mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 10:44:09 -04:00
Fix device job error dialog not showing actual error
This commit is contained in:
parent
1cec2afd12
commit
af6ce250b3
@ -687,7 +687,7 @@ class DeviceMixin(object): # {{{
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
if not self.device_error_dialog.isVisible():
|
if not self.device_error_dialog.isVisible():
|
||||||
self.device_error_dialog.setDetailedText(job.details)
|
self.device_error_dialog.set_details(job.details)
|
||||||
self.device_error_dialog.show()
|
self.device_error_dialog.show()
|
||||||
|
|
||||||
# Device connected {{{
|
# Device connected {{{
|
||||||
|
@ -45,7 +45,6 @@ class MessageBox(QDialog, Ui_Dialog):
|
|||||||
self.ctc_button.clicked.connect(self.copy_to_clipboard)
|
self.ctc_button.clicked.connect(self.copy_to_clipboard)
|
||||||
|
|
||||||
|
|
||||||
if det_msg:
|
|
||||||
self.show_det_msg = _('Show &details')
|
self.show_det_msg = _('Show &details')
|
||||||
self.hide_det_msg = _('Hide &details')
|
self.hide_det_msg = _('Hide &details')
|
||||||
self.det_msg_toggle = self.bb.addButton(self.show_det_msg, self.bb.ActionRole)
|
self.det_msg_toggle = self.bb.addButton(self.show_det_msg, self.bb.ActionRole)
|
||||||
@ -53,7 +52,6 @@ class MessageBox(QDialog, Ui_Dialog):
|
|||||||
self.det_msg_toggle.setToolTip(
|
self.det_msg_toggle.setToolTip(
|
||||||
_('Show detailed information about this error'))
|
_('Show detailed information about this error'))
|
||||||
|
|
||||||
|
|
||||||
self.copy_action = QAction(self)
|
self.copy_action = QAction(self)
|
||||||
self.addAction(self.copy_action)
|
self.addAction(self.copy_action)
|
||||||
self.copy_action.setShortcuts(QKeySequence.Copy)
|
self.copy_action.setShortcuts(QKeySequence.Copy)
|
||||||
@ -66,10 +64,14 @@ class MessageBox(QDialog, Ui_Dialog):
|
|||||||
else:
|
else:
|
||||||
self.bb.button(self.bb.Ok).setDefault(True)
|
self.bb.button(self.bb.Ok).setDefault(True)
|
||||||
|
|
||||||
|
if not det_msg:
|
||||||
|
self.det_msg_toggle.setVisible(False)
|
||||||
|
|
||||||
self.do_resize()
|
self.do_resize()
|
||||||
|
|
||||||
|
|
||||||
def toggle_det_msg(self, *args):
|
def toggle_det_msg(self, *args):
|
||||||
vis = self.det_msg.isVisible()
|
vis = unicode(self.det_msg_toggle.text()) == self.hide_det_msg
|
||||||
self.det_msg_toggle.setText(self.show_det_msg if vis else
|
self.det_msg_toggle.setText(self.show_det_msg if vis else
|
||||||
self.hide_det_msg)
|
self.hide_det_msg)
|
||||||
self.det_msg.setVisible(not vis)
|
self.det_msg.setVisible(not vis)
|
||||||
@ -100,6 +102,15 @@ class MessageBox(QDialog, Ui_Dialog):
|
|||||||
self.bb.button(self.bb.Ok).setFocus(Qt.OtherFocusReason)
|
self.bb.button(self.bb.Ok).setFocus(Qt.OtherFocusReason)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
def set_details(self, msg):
|
||||||
|
if not msg:
|
||||||
|
msg = ''
|
||||||
|
self.det_msg.setPlainText(msg)
|
||||||
|
self.det_msg_toggle.setText(self.show_det_msg)
|
||||||
|
self.det_msg_toggle.setVisible(bool(msg))
|
||||||
|
self.det_msg.setVisible(False)
|
||||||
|
self.do_resize()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
from calibre.gui2 import question_dialog
|
from calibre.gui2 import question_dialog
|
||||||
|
Loading…
x
Reference in New Issue
Block a user