From d9e89b3ca3b215b52fe09cb6d3725618674523ef Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 20 Jan 2012 16:02:51 +0530 Subject: [PATCH] Add a restart calibre button to the warning dialog that pops up after changing some preference that requires a restart --- src/calibre/gui2/preferences/main.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/preferences/main.py b/src/calibre/gui2/preferences/main.py index 774b7f8958..65566c1107 100644 --- a/src/calibre/gui2/preferences/main.py +++ b/src/calibre/gui2/preferences/main.py @@ -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):