mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Change post configure this device action warning to restart calibre warning
This commit is contained in:
parent
a30bb5ded4
commit
5113981c95
@ -328,6 +328,19 @@ def info_dialog(parent, title, msg, det_msg='', show=False,
|
||||
return d.exec_()
|
||||
return d
|
||||
|
||||
def show_restart_warning(msg, parent=None):
|
||||
d = warning_dialog(parent, _('Restart needed'), msg,
|
||||
show_copy_button=False)
|
||||
b = d.bb.addButton(_('Restart calibre now'), 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()
|
||||
return d.do_restart
|
||||
|
||||
|
||||
class Dispatcher(QObject):
|
||||
|
@ -19,7 +19,8 @@ from calibre.gui2.dialogs.choose_format_device import ChooseFormatDeviceDialog
|
||||
from calibre.utils.ipc.job import BaseJob
|
||||
from calibre.devices.scanner import DeviceScanner
|
||||
from calibre.gui2 import (config, error_dialog, Dispatcher, dynamic,
|
||||
warning_dialog, info_dialog, choose_dir, FunctionDispatcher)
|
||||
warning_dialog, info_dialog, choose_dir, FunctionDispatcher,
|
||||
show_restart_warning)
|
||||
from calibre.ebooks.metadata import authors_to_string
|
||||
from calibre import preferred_encoding, prints, force_unicode, as_unicode
|
||||
from calibre.utils.filenames import ascii_filename
|
||||
@ -895,10 +896,10 @@ class DeviceMixin(object): # {{{
|
||||
d.accept = validate
|
||||
if d.exec_() == d.Accepted:
|
||||
dev.save_settings(cw)
|
||||
warning_dialog(self, _('Disconnect device'),
|
||||
_('Disconnect and re-connect the %s for your changes to'
|
||||
' be applied.')%dev.get_gui_name(), show=True,
|
||||
show_copy_button=False)
|
||||
do_restart = show_restart_warning(_('Restart calibre for the changes to %s'
|
||||
' to be applied.')%dev.get_gui_name(), parent=self)
|
||||
if do_restart:
|
||||
self.quit(restart=True)
|
||||
|
||||
def _sync_action_triggered(self, *args):
|
||||
m = getattr(self, '_sync_menu', None)
|
||||
|
@ -9,14 +9,14 @@ import textwrap
|
||||
from functools import partial
|
||||
from collections import OrderedDict
|
||||
|
||||
from PyQt4.Qt import QMainWindow, Qt, QIcon, QStatusBar, QFont, QWidget, \
|
||||
QScrollArea, QStackedWidget, QVBoxLayout, QLabel, QFrame, QKeySequence, \
|
||||
QToolBar, QSize, pyqtSignal, QPixmap, QToolButton, QAction, \
|
||||
QDialogButtonBox, QHBoxLayout
|
||||
from PyQt4.Qt import (QMainWindow, Qt, QIcon, QStatusBar, QFont, QWidget,
|
||||
QScrollArea, QStackedWidget, QVBoxLayout, QLabel, QFrame, QKeySequence,
|
||||
QToolBar, QSize, pyqtSignal, QPixmap, QToolButton, QAction,
|
||||
QDialogButtonBox, QHBoxLayout)
|
||||
|
||||
from calibre.constants import __appname__, __version__, islinux
|
||||
from calibre.gui2 import gprefs, min_available_height, available_width, \
|
||||
warning_dialog
|
||||
from calibre.gui2 import (gprefs, min_available_height, available_width,
|
||||
show_restart_warning)
|
||||
from calibre.gui2.preferences import init_gui, AbortCommit, get_plugin
|
||||
from calibre.customize.ui import preferences_plugins
|
||||
|
||||
@ -346,19 +346,8 @@ class Preferences(QMainWindow):
|
||||
'restarted immediately. You will not be allowed to '
|
||||
'set any more preferences, until you restart.')
|
||||
|
||||
do_restart = show_restart_warning(msg, parent=self)
|
||||
|
||||
d = warning_dialog(self, _('Restart needed'), msg,
|
||||
show_copy_button=False)
|
||||
b = d.bb.addButton(_('Restart calibre now'), 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) or do_restart:
|
||||
|
Loading…
x
Reference in New Issue
Block a user