mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix configuration handling
Removed some experimental stuff that I had forgotten about.
This commit is contained in:
parent
b468713b5c
commit
77f6664a4f
@ -148,44 +148,6 @@ class KOBO(USBMS):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
USBMS.__init__(self, *args, **kwargs)
|
USBMS.__init__(self, *args, **kwargs)
|
||||||
self.plugboards = self.plugboard_func = None
|
self.plugboards = self.plugboard_func = None
|
||||||
self._prefs = None
|
|
||||||
# self.device_defaults = DeviceDefaults()
|
|
||||||
self.current_device_defaults = {}
|
|
||||||
self.device_defaults_key = self.name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def prefs(self):
|
|
||||||
from calibre.utils.config import JSONConfig
|
|
||||||
# debug_print("KOBO:prefs - start")
|
|
||||||
if self._prefs is None:
|
|
||||||
self._prefs = p = JSONConfig(self.device_defaults_key + '_devices')
|
|
||||||
# debug_print("KOBO:prefs - self._prefs=", self._prefs)
|
|
||||||
if p == {}:
|
|
||||||
old_settings = super(KOBO, self).settings()
|
|
||||||
p[self.device_defaults_key] = self.migrate_old_settings(old_settings)
|
|
||||||
# debug_print("KOBO:prefs - Old settings self._prefs=", self._prefs)
|
|
||||||
p.defaults['format_map'] = self.FORMATS
|
|
||||||
p.defaults['save_template'] = KOBO._default_save_template()
|
|
||||||
p.defaults['use_subdirs'] = True
|
|
||||||
p.defaults['read_metadata'] = True
|
|
||||||
p.defaults['use_author_sort'] = False
|
|
||||||
|
|
||||||
p.defaults['collections_columns'] = ''
|
|
||||||
p.defaults['create_collections'] = False
|
|
||||||
p.defaults['delete_empty_collections'] = False
|
|
||||||
|
|
||||||
p.defaults['upload_covers'] = False
|
|
||||||
p.defaults['upload_grayscale'] = False
|
|
||||||
|
|
||||||
p.defaults['show_expired_books'] = False
|
|
||||||
p.defaults['show_previews'] = False
|
|
||||||
p.defaults['show_recommendations'] = False
|
|
||||||
p.defaults['support_newer_firmware'] = False
|
|
||||||
|
|
||||||
p.defaults['extra_customization'] = self.EXTRA_CUSTOMIZATION_DEFAULT
|
|
||||||
debug_print("KOBO:prefs - finish self._prefs=", self._prefs)
|
|
||||||
|
|
||||||
return self._prefs
|
|
||||||
|
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
@ -1111,7 +1073,6 @@ class KOBO(USBMS):
|
|||||||
OPT_SHOW_RECOMMENDATIONS = 5
|
OPT_SHOW_RECOMMENDATIONS = 5
|
||||||
OPT_SUPPORT_NEWER_FIRMWARE = 6
|
OPT_SUPPORT_NEWER_FIRMWARE = 6
|
||||||
|
|
||||||
|
|
||||||
p = {}
|
p = {}
|
||||||
p['format_map'] = old_settings.format_map
|
p['format_map'] = old_settings.format_map
|
||||||
p['save_template'] = old_settings.save_template
|
p['save_template'] = old_settings.save_template
|
||||||
@ -1434,11 +1395,6 @@ class KOBOTOUCH(KOBO):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
KOBO.__init__(self, *args, **kwargs)
|
KOBO.__init__(self, *args, **kwargs)
|
||||||
self.plugboards = self.plugboard_func = None
|
self.plugboards = self.plugboard_func = None
|
||||||
self._prefs = None
|
|
||||||
# self.device_defaults = DeviceDefaults()
|
|
||||||
self.current_device_defaults = {}
|
|
||||||
self.device_defaults_key = self.name
|
|
||||||
|
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
super(KOBOTOUCH, self).initialize()
|
super(KOBOTOUCH, self).initialize()
|
||||||
|
@ -46,8 +46,6 @@ class KOBOTOUCHConfig(TabbedDeviceConfig):
|
|||||||
self.extra_customization_message = extra_customization_message
|
self.extra_customization_message = extra_customization_message
|
||||||
self.extra_customization_choices = extra_customization_choices
|
self.extra_customization_choices = extra_customization_choices
|
||||||
|
|
||||||
self.current_device_key = device.device_defaults_key
|
|
||||||
|
|
||||||
self.tab1 = Tab1Config(self, self.device)
|
self.tab1 = Tab1Config(self, self.device)
|
||||||
self.tab2 = Tab2Config(self, self.device)
|
self.tab2 = Tab2Config(self, self.device)
|
||||||
|
|
||||||
@ -117,8 +115,6 @@ class KOBOTOUCHConfig(TabbedDeviceConfig):
|
|||||||
p['support_newer_firmware'] = self.support_newer_firmware
|
p['support_newer_firmware'] = self.support_newer_firmware
|
||||||
p['debugging_title'] = self.debugging_title
|
p['debugging_title'] = self.debugging_title
|
||||||
|
|
||||||
p['extra_customization'] = self.extra_tab.extra_customization()
|
|
||||||
|
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
|
||||||
@ -228,8 +224,8 @@ class CollectionsGroupBox(DeviceOptionsGroupBox):
|
|||||||
self.options_layout.addWidget(self.collections_columns_label, 1, 0, 1, 1)
|
self.options_layout.addWidget(self.collections_columns_label, 1, 0, 1, 1)
|
||||||
self.options_layout.addWidget(self.collections_columns_edit, 1, 1, 1, 1)
|
self.options_layout.addWidget(self.collections_columns_edit, 1, 1, 1, 1)
|
||||||
self.options_layout.addWidget(self.create_collections_checkbox, 2, 0, 1, 2)
|
self.options_layout.addWidget(self.create_collections_checkbox, 2, 0, 1, 2)
|
||||||
self.options_layout.addWidget(self.delete_empty_collections_checkbox, 3, 0)#, 1, 2)
|
self.options_layout.addWidget(self.delete_empty_collections_checkbox, 3, 0, 1, 2)
|
||||||
self.options_layout.setRowStretch(5, 1)
|
self.options_layout.setRowStretch(4, 1)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
@ -275,9 +271,9 @@ class CoversGroupBox(DeviceOptionsGroupBox):
|
|||||||
' This is for firmware versions 2.3.1 and later.'),
|
' This is for firmware versions 2.3.1 and later.'),
|
||||||
device.get_pref('keep_cover_aspect'))
|
device.get_pref('keep_cover_aspect'))
|
||||||
|
|
||||||
self.options_layout.addWidget(self.keep_cover_aspect_checkbox, 1, 0, 1, 1)
|
self.options_layout.addWidget(self.keep_cover_aspect_checkbox, 0, 0, 1, 1)
|
||||||
self.options_layout.addWidget(self.upload_grayscale_checkbox, 2, 0, 1, 1)
|
self.options_layout.addWidget(self.upload_grayscale_checkbox, 1, 0, 1, 1)
|
||||||
self.options_layout.setRowStretch(3, 1)
|
self.options_layout.setRowStretch(2, 1)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def upload_covers(self):
|
def upload_covers(self):
|
||||||
|
@ -164,14 +164,6 @@ class TabbedDeviceConfig(QTabWidget):
|
|||||||
pass
|
pass
|
||||||
raise ae
|
raise ae
|
||||||
|
|
||||||
def get_pref(self, key):
|
|
||||||
debug_print("get_pref - self.device.prefs", self.device.prefs)
|
|
||||||
p = self.device.prefs.get(self.current_device_key, {})
|
|
||||||
if not p:
|
|
||||||
self.device.prefs[self.current_device_key] = p
|
|
||||||
debug_print("get_pref - self.device.get_pref(key)", self.device.get_pref(key))
|
|
||||||
return self.device.get_pref(key)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def device(self):
|
def device(self):
|
||||||
return self._device()
|
return self._device()
|
||||||
@ -217,26 +209,11 @@ class TabbedDeviceConfig(QTabWidget):
|
|||||||
def commit(self):
|
def commit(self):
|
||||||
debug_print("TabbedDeviceConfig::commit: start")
|
debug_print("TabbedDeviceConfig::commit: start")
|
||||||
p = self.device._configProxy()
|
p = self.device._configProxy()
|
||||||
debug_print("commit: starting setting=%s" % (p, ))
|
|
||||||
|
|
||||||
f = self.formats.format_map
|
|
||||||
debug_print("commit: self.formats.format_map=", self.formats.format_map)
|
|
||||||
debug_print("commit: self.device.prefs['format_map']=", self.device.prefs['format_map'])
|
|
||||||
if f and f != self.device.prefs['format_map']:
|
|
||||||
p['format_map'] = f
|
|
||||||
|
|
||||||
f = self.use_subdirs()
|
|
||||||
if f != self.get_pref('use_subdirs'):
|
|
||||||
p['use_subdirs'] = f
|
|
||||||
|
|
||||||
f = self.read_metadata()
|
|
||||||
if f != self.get_pref('read_metadata'):
|
|
||||||
p['read_metadata'] = f
|
|
||||||
|
|
||||||
t = self.template.template
|
|
||||||
if t and t != self.device.prefs['save_template']:
|
|
||||||
p['save_template'] = t
|
|
||||||
|
|
||||||
|
p['format_map'] = self.formats.format_map
|
||||||
|
p['use_subdirs'] = self.use_subdirs()
|
||||||
|
p['read_metadata'] = self.read_metadata()
|
||||||
|
p['save_template'] = self.template.template
|
||||||
p['extra_customization'] = self.extra_tab.extra_customization()
|
p['extra_customization'] = self.extra_tab.extra_customization()
|
||||||
|
|
||||||
return p
|
return p
|
||||||
|
Loading…
x
Reference in New Issue
Block a user