mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-26 21:05:37 +02:00
...
This commit is contained in:
commit
78d492b554
4 changed files with 18 additions and 18 deletions
|
|
@ -61,6 +61,9 @@ def osx_version():
|
|||
if m:
|
||||
return int(m.group(1)), int(m.group(2)), int(m.group(3))
|
||||
|
||||
def confirm_config_name(name):
|
||||
return name + '_again'
|
||||
|
||||
_filename_sanitize = re.compile(r'[\xae\0\\|\?\*<":>\+/]')
|
||||
_filename_sanitize_unicode = frozenset([u'\\', u'|', u'?', u'*', u'<',
|
||||
u'"', u':', u'>', u'+', u'/'] + list(map(unichr, xrange(32))))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import cStringIO, ctypes, datetime, os, re, shutil, subprocess, sys, tempfile, time
|
||||
from calibre.constants import __appname__, __version__, DEBUG
|
||||
from calibre import fit_image
|
||||
from calibre import fit_image, confirm_config_name
|
||||
from calibre.constants import isosx, iswindows
|
||||
from calibre.devices.errors import OpenFeedback, UserFeedback
|
||||
from calibre.devices.usbms.deviceconfig import DeviceConfig
|
||||
|
|
@ -37,9 +37,9 @@ def custom_dialog(self, parent):
|
|||
|
||||
class Dialog(QDialog):
|
||||
|
||||
def __init__(self, p, pixmap='dialog_information.png'):
|
||||
def __init__(self, p, cd, pixmap='dialog_information.png'):
|
||||
QDialog.__init__(self, p)
|
||||
|
||||
self.cd = cd
|
||||
self.setWindowTitle("Apple iDevice detected")
|
||||
self.l = l = QVBoxLayout()
|
||||
self.setLayout(l)
|
||||
|
|
@ -79,15 +79,14 @@ def __init__(self, p, pixmap='dialog_information.png'):
|
|||
|
||||
def do_it(self, return_code):
|
||||
if return_code == self.Accepted:
|
||||
from calibre.gui2.dialogs.confirm_delete import config_name
|
||||
self.log.info(" Apple driver ENABLED")
|
||||
dynamic[config_name(self.plugin.DISPLAY_DISABLE_DIALOG)] = False
|
||||
self.cd.log.info(" Apple driver ENABLED")
|
||||
dynamic[confirm_config_name(self.cd.plugin.DISPLAY_DISABLE_DIALOG)] = False
|
||||
else:
|
||||
from calibre.customize.ui import disable_plugin
|
||||
self.log.info(" Apple driver DISABLED")
|
||||
disable_plugin(self.plugin)
|
||||
self.cd.log.info(" Apple driver DISABLED")
|
||||
disable_plugin(self.cd.plugin)
|
||||
|
||||
return Dialog(parent)
|
||||
return Dialog(parent, self)
|
||||
|
||||
|
||||
from PIL import Image as PILImage
|
||||
|
|
@ -808,8 +807,7 @@ def open(self, library_uuid):
|
|||
|
||||
# Display a dialog recommending using 'Connect to iTunes' if user hasn't
|
||||
# previously disabled the dialog
|
||||
from calibre.gui2.dialogs.confirm_delete import config_name
|
||||
if dynamic.get(config_name(self.DISPLAY_DISABLE_DIALOG),True):
|
||||
if dynamic.get(confirm_config_name(self.DISPLAY_DISABLE_DIALOG),True):
|
||||
raise AppleOpenFeedback(self)
|
||||
else:
|
||||
if DEBUG:
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ def __init__(self, msg):
|
|||
|
||||
def custom_dialog(self, parent):
|
||||
'''
|
||||
If you need to show the user a custom dialog, instead if just
|
||||
If you need to show the user a custom dialog, instead of just
|
||||
displaying the feedback_msg, create and return it here.
|
||||
'''
|
||||
raise NotImplementedError
|
||||
|
|
|
|||
|
|
@ -3,12 +3,11 @@
|
|||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from calibre.gui2 import dynamic
|
||||
from calibre.gui2.dialogs.confirm_delete_ui import Ui_Dialog
|
||||
from PyQt4.Qt import QDialog, Qt, QPixmap, QIcon
|
||||
|
||||
def config_name(name):
|
||||
return name + '_again'
|
||||
from calibre import confirm_config_name
|
||||
from calibre.gui2 import dynamic
|
||||
from calibre.gui2.dialogs.confirm_delete_ui import Ui_Dialog
|
||||
|
||||
class Dialog(QDialog, Ui_Dialog):
|
||||
|
||||
|
|
@ -22,11 +21,11 @@ def __init__(self, msg, name, parent):
|
|||
self.buttonBox.setFocus(Qt.OtherFocusReason)
|
||||
|
||||
def toggle(self, *args):
|
||||
dynamic[config_name(self.name)] = self.again.isChecked()
|
||||
dynamic[confirm_config_name(self.name)] = self.again.isChecked()
|
||||
|
||||
|
||||
def confirm(msg, name, parent=None, pixmap='dialog_warning.png'):
|
||||
if not dynamic.get(config_name(name), True):
|
||||
if not dynamic.get(confirm_config_name(name), True):
|
||||
return True
|
||||
d = Dialog(msg, name, parent)
|
||||
d.label.setPixmap(QPixmap(I(pixmap)))
|
||||
|
|
|
|||
Loading…
Reference in a new issue