mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Copy to clipboard button on message dialogs.
This commit is contained in:
parent
3b23ff4518
commit
a25d93dff2
@ -154,7 +154,6 @@ class FB2MLizer(object):
|
||||
self.image_hrefs[page.abshref(elem.attrib['src'])] = '%s.jpg' % len(self.image_hrefs.keys())
|
||||
fb2_text += '<image xlink:href="#%s" />' % self.image_hrefs[page.abshref(elem.attrib['src'])]
|
||||
|
||||
|
||||
fb2_tag = TAG_MAP.get(tag, None)
|
||||
if fb2_tag and fb2_tag not in tag_stack:
|
||||
tag_count += 1
|
||||
|
@ -5,7 +5,7 @@ import os
|
||||
from PyQt4.QtCore import QVariant, QFileInfo, QObject, SIGNAL, QBuffer, Qt, QSize, \
|
||||
QByteArray, QUrl, QTranslator, QCoreApplication, QThread
|
||||
from PyQt4.QtGui import QFileDialog, QMessageBox, QPixmap, QFileIconProvider, \
|
||||
QIcon, QTableView, QApplication, QDialog
|
||||
QIcon, QTableView, QApplication, QDialog, QPushButton
|
||||
|
||||
ORG_NAME = 'KovidsBrain'
|
||||
APP_UID = 'libprs500'
|
||||
@ -108,7 +108,11 @@ def warning_dialog(parent, title, msg, det_msg='', show=False):
|
||||
parent)
|
||||
d.setDetailedText(det_msg)
|
||||
d.setIconPixmap(QPixmap(':/images/dialog_warning.svg'))
|
||||
clipboard_button = QPushButton(_('Copy to Clipboard'))
|
||||
d.layout().addWidget(clipboard_button)
|
||||
def copy_to_clipboard():
|
||||
QApplication.clipboard().setText('%s - %s: %s' % (title, msg, det_msg))
|
||||
d.connect(clipboard_button, SIGNAL('clicked()'), copy_to_clipboard)
|
||||
if show:
|
||||
return d.exec_()
|
||||
return d
|
||||
@ -118,7 +122,11 @@ def error_dialog(parent, title, msg, det_msg='', show=False):
|
||||
parent)
|
||||
d.setDetailedText(det_msg)
|
||||
d.setIconPixmap(QPixmap(':/images/dialog_error.svg'))
|
||||
clipboard_button = QPushButton(_('Copy to Clipboard'))
|
||||
d.layout().addWidget(clipboard_button)
|
||||
def copy_to_clipboard():
|
||||
QApplication.clipboard().setText('%s - %s: %s' % (title, msg, det_msg))
|
||||
d.connect(clipboard_button, SIGNAL('clicked()'), copy_to_clipboard)
|
||||
if show:
|
||||
return d.exec_()
|
||||
return d
|
||||
@ -128,7 +136,11 @@ def question_dialog(parent, title, msg, det_msg=''):
|
||||
parent)
|
||||
d.setDetailedText(det_msg)
|
||||
d.setIconPixmap(QPixmap(':/images/dialog_information.svg'))
|
||||
clipboard_button = QPushButton(_('Copy to Clipboard'))
|
||||
d.layout().addWidget(clipboard_button)
|
||||
def copy_to_clipboard():
|
||||
QApplication.clipboard().setText('%s - %s: %s' % (title, msg, det_msg))
|
||||
d.connect(clipboard_button, SIGNAL('clicked()'), copy_to_clipboard)
|
||||
return d.exec_() == QMessageBox.Yes
|
||||
|
||||
def info_dialog(parent, title, msg, det_msg='', show=False):
|
||||
@ -136,7 +148,11 @@ def info_dialog(parent, title, msg, det_msg='', show=False):
|
||||
parent)
|
||||
d.setDetailedText(det_msg)
|
||||
d.setIconPixmap(QPixmap(':/images/dialog_information.svg'))
|
||||
clipboard_button = QPushButton(_('Copy to Clipboard'))
|
||||
d.layout().addWidget(clipboard_button)
|
||||
def copy_to_clipboard():
|
||||
QApplication.clipboard().setText('%s - %s: %s' % (title, msg, det_msg))
|
||||
d.connect(clipboard_button, SIGNAL('clicked()'), copy_to_clipboard)
|
||||
if show:
|
||||
return d.exec_()
|
||||
return d
|
||||
|
Loading…
x
Reference in New Issue
Block a user