mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
KG updates
This commit is contained in:
commit
c31150d37a
@ -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 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
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
|
||||
@ -17,7 +17,6 @@ from calibre.ebooks.metadata import authors_to_string, MetaInformation, \
|
||||
title_sort
|
||||
from calibre.ebooks.metadata.book.base import Metadata
|
||||
from calibre.ebooks.metadata.epub import set_metadata
|
||||
from calibre.gui2.dialogs.confirm_delete import config_name
|
||||
from calibre.library.server.utils import strftime
|
||||
from calibre.utils.config import config_dir, dynamic, prefs
|
||||
from calibre.utils.date import now, parse_date
|
||||
@ -81,7 +80,7 @@ class AppleOpenFeedback(OpenFeedback):
|
||||
def do_it(self, return_code):
|
||||
if return_code == self.Accepted:
|
||||
self.cd.log.info(" Apple driver ENABLED")
|
||||
dynamic[config_name(self.cd.plugin.DISPLAY_DISABLE_DIALOG)] = False
|
||||
dynamic[confirm_config_name(self.cd.plugin.DISPLAY_DISABLE_DIALOG)] = False
|
||||
else:
|
||||
from calibre.customize.ui import disable_plugin
|
||||
self.cd.log.info(" Apple driver DISABLED")
|
||||
@ -808,7 +807,7 @@ class ITUNES(DriverBase):
|
||||
|
||||
# Display a dialog recommending using 'Connect to iTunes' if user hasn't
|
||||
# previously disabled the dialog
|
||||
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:
|
||||
|
@ -3,12 +3,11 @@ __license__ = 'GPL v3'
|
||||
__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 @@ class Dialog(QDialog, Ui_Dialog):
|
||||
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…
x
Reference in New Issue
Block a user