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