Add a restart calibre button to the warning dialog that pops up after changing some preference that requires a restart

This commit is contained in:
Kovid Goyal 2012-01-20 16:02:51 +05:30
parent b1ca9f1c0d
commit d9e89b3ca3

View File

@ -325,6 +325,7 @@ class Preferences(QMainWindow):
return
rc = self.showing_widget.restart_critical
self.committed = True
do_restart = False
if must_restart:
self.must_restart = True
msg = _('Some of the changes you made require a restart.'
@ -335,12 +336,24 @@ class Preferences(QMainWindow):
'set any more preferences, until you restart.')
warning_dialog(self, _('Restart needed'), msg, show=True,
d = warning_dialog(self, _('Restart needed'), msg,
show_copy_button=False)
b = d.bb.addButton(_('Restart calibre'), d.bb.AcceptRole)
b.setIcon(QIcon(I('lt.png')))
d.do_restart = False
def rf():
d.do_restart = True
b.clicked.connect(rf)
d.set_details('')
d.exec_()
b.clicked.disconnect()
do_restart = d.do_restart
self.showing_widget.refresh_gui(self.gui)
self.hide_plugin()
if self.close_after_initial or (must_restart and rc):
if self.close_after_initial or (must_restart and rc) or do_restart:
self.close()
if do_restart:
self.gui.quit(restart=True)
def cancel(self, *args):