mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
16472e86b1
@ -1,6 +1,4 @@
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import Tag
|
||||
import re
|
||||
|
||||
class NatureNews(BasicNewsRecipe):
|
||||
title = u'Nature News'
|
||||
|
@ -15,6 +15,7 @@ from calibre.utils.terminfo import TerminalController
|
||||
from calibre.devices.errors import ArgumentError, DeviceError, DeviceLocked
|
||||
from calibre.customize.ui import device_plugins
|
||||
from calibre.devices.scanner import DeviceScanner
|
||||
from calibre.utils.config import device_prefs
|
||||
|
||||
MINIMUM_COL_WIDTH = 12 #: Minimum width of columns in ls output
|
||||
|
||||
@ -228,6 +229,7 @@ def main():
|
||||
continue
|
||||
else:
|
||||
dev = d
|
||||
d.specialize_global_preferences(device_prefs)
|
||||
break
|
||||
|
||||
|
||||
|
@ -5,7 +5,6 @@ from collections import namedtuple
|
||||
|
||||
from calibre.customize import Plugin
|
||||
from calibre.constants import iswindows
|
||||
from calibre.utils.config import prefs
|
||||
|
||||
class DevicePlugin(Plugin):
|
||||
"""
|
||||
@ -627,19 +626,17 @@ class DevicePlugin(Plugin):
|
||||
'''
|
||||
pass
|
||||
|
||||
def specialize_global_preferences(self, device_prefs, add_specializations):
|
||||
def specialize_global_preferences(self, device_prefs):
|
||||
'''
|
||||
Implement this method if your device wants to override a particular
|
||||
preference. You must ensure that all call sites that want a preference
|
||||
that can be overridden use device_prefs['something'] instead
|
||||
of prefs['something']. If add_specializations is True, then your
|
||||
of prefs['something']. Your
|
||||
method should call device_prefs.set_overrides(pref=val, pref=val, ...).
|
||||
If add_specializations is False, then your method should call
|
||||
device_prefs.set_overrides() to remove any previous specialization.
|
||||
Currently used for:
|
||||
metadata management (prefs['manage_device_metadata'])
|
||||
'''
|
||||
pass
|
||||
device_prefs.set_overrides()
|
||||
|
||||
|
||||
# Dynamic control interface.
|
||||
|
@ -34,7 +34,7 @@ from calibre.library import current_library_name
|
||||
from calibre.library.server import server_config as content_server_config
|
||||
from calibre.ptempfile import PersistentTemporaryFile
|
||||
from calibre.utils.ipc import eintr_retry_call
|
||||
from calibre.utils.config import from_json, tweaks, prefs
|
||||
from calibre.utils.config import from_json, tweaks
|
||||
from calibre.utils.date import isoformat, now
|
||||
from calibre.utils.filenames import ascii_filename as sanitize, shorten_components_to
|
||||
from calibre.utils.mdns import (publish as publish_zeroconf, unpublish as
|
||||
@ -1198,12 +1198,8 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
|
||||
self.plugboard_func = pb_func
|
||||
|
||||
@synchronous('sync_lock')
|
||||
def specialize_global_preferences(self, device_prefs, add_specializations):
|
||||
self._debug('add', add_specializations)
|
||||
if add_specializations:
|
||||
device_prefs.set_overrides(manage_device_metadata='on_connect')
|
||||
else:
|
||||
device_prefs.set_overrides()
|
||||
def specialize_global_preferences(self, device_prefs):
|
||||
device_prefs.set_overrides(manage_device_metadata='on_connect')
|
||||
|
||||
@synchronous('sync_lock')
|
||||
def startup(self):
|
||||
|
@ -210,8 +210,7 @@ class DeviceManager(Thread): # {{{
|
||||
return
|
||||
|
||||
self.connected_device = dev
|
||||
self.connected_device.specialize_global_preferences(device_prefs,
|
||||
add_specializations=True)
|
||||
self.connected_device.specialize_global_preferences(device_prefs)
|
||||
self.connected_device_kind = device_kind
|
||||
self.connected_slot(True, device_kind)
|
||||
|
||||
@ -237,8 +236,7 @@ class DeviceManager(Thread): # {{{
|
||||
# is being shut down.
|
||||
self.connected_device.shutdown()
|
||||
self.call_shutdown_on_disconnect = False
|
||||
self.connected_device.specialize_global_preferences(device_prefs,
|
||||
add_specializations=False)
|
||||
device_prefs.set_overrides()
|
||||
self.connected_device = None
|
||||
self._device_information = None
|
||||
|
||||
|
@ -5,11 +5,10 @@ from __future__ import (unicode_literals, division, absolute_import,
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from PyQt4.Qt import (QDialog, QLineEdit, Qt, QPushButton, QDialogButtonBox)
|
||||
from PyQt4.Qt import (QDialog, QLineEdit, Qt)
|
||||
|
||||
from calibre.gui2 import error_dialog
|
||||
from calibre.gui2.dialogs.smartdevice_ui import Ui_Dialog
|
||||
from calibre.utils.config import prefs
|
||||
from calibre.utils.mdns import get_all_ips
|
||||
|
||||
def _cmp_ipaddr(l, r):
|
||||
|
@ -16,7 +16,7 @@ from calibre.utils.pyparsing import ParseException
|
||||
from calibre.ebooks.metadata import fmt_sidx, authors_to_string, string_to_authors
|
||||
from calibre.ebooks.metadata.book.base import SafeFormat
|
||||
from calibre.ptempfile import PersistentTemporaryFile
|
||||
from calibre.utils.config import tweaks, prefs, device_prefs
|
||||
from calibre.utils.config import tweaks, device_prefs
|
||||
from calibre.utils.date import dt_factory, qt_to_dt, as_local_time
|
||||
from calibre.utils.icu import sort_key
|
||||
from calibre.utils.search_query_parser import SearchQueryParser
|
||||
|
@ -648,6 +648,7 @@ class CatalogBuilder(object):
|
||||
# Hackhackhackhackhack
|
||||
# icu returns bogus results with curly apostrophes, maybe others under OS X 10.6.x
|
||||
# When we see the magic combo of 0/-1 for ordnum/ordlen, special case the logic
|
||||
last_c = u''
|
||||
if ordnum == 0 and ordlen == -1:
|
||||
if icu_upper(c[0]) != last_c:
|
||||
last_c = icu_upper(c[0])
|
||||
|
Loading…
x
Reference in New Issue
Block a user