mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
Add a copy to clipboard button to the job log viewer dialog
This commit is contained in:
parent
01a9fb6687
commit
86671138dc
@ -443,6 +443,15 @@ class DetailView(Dialog): # {{{
|
|||||||
def sizeHint(self):
|
def sizeHint(self):
|
||||||
return QSize(700, 500)
|
return QSize(700, 500)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def plain_text(self):
|
||||||
|
if self.html_view:
|
||||||
|
return self.tb.toPlainText()
|
||||||
|
return self.log.toPlainText()
|
||||||
|
|
||||||
|
def copy_to_clipboard(self):
|
||||||
|
QApplication.instance().clipboard().setText(self.plain_text)
|
||||||
|
|
||||||
def setup_ui(self):
|
def setup_ui(self):
|
||||||
self.l = l = QVBoxLayout(self)
|
self.l = l = QVBoxLayout(self)
|
||||||
if self.html_view:
|
if self.html_view:
|
||||||
@ -453,6 +462,9 @@ class DetailView(Dialog): # {{{
|
|||||||
l.addWidget(w)
|
l.addWidget(w)
|
||||||
l.addWidget(self.bb)
|
l.addWidget(self.bb)
|
||||||
self.bb.clear(), self.bb.setStandardButtons(self.bb.Close)
|
self.bb.clear(), self.bb.setStandardButtons(self.bb.Close)
|
||||||
|
self.copy_button = b = self.bb.addButton(_('&Copy to clipboard'), self.bb.ActionRole)
|
||||||
|
b.setIcon(QIcon(I('edit-copy.png')))
|
||||||
|
b.clicked.connect(self.copy_to_clipboard)
|
||||||
self.next_pos = 0
|
self.next_pos = 0
|
||||||
self.update()
|
self.update()
|
||||||
self.timer = QTimer(self)
|
self.timer = QTimer(self)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user