diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 82bf8ff0c5..806820ff7c 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -148,44 +148,6 @@ class KOBO(USBMS): def __init__(self, *args, **kwargs): USBMS.__init__(self, *args, **kwargs) 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): @@ -1111,7 +1073,6 @@ class KOBO(USBMS): OPT_SHOW_RECOMMENDATIONS = 5 OPT_SUPPORT_NEWER_FIRMWARE = 6 - p = {} p['format_map'] = old_settings.format_map p['save_template'] = old_settings.save_template @@ -1434,11 +1395,6 @@ class KOBOTOUCH(KOBO): def __init__(self, *args, **kwargs): KOBO.__init__(self, *args, **kwargs) 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): super(KOBOTOUCH, self).initialize() diff --git a/src/calibre/devices/kobo/kobotouch_config.py b/src/calibre/devices/kobo/kobotouch_config.py index 1b9df07608..68887ccec7 100644 --- a/src/calibre/devices/kobo/kobotouch_config.py +++ b/src/calibre/devices/kobo/kobotouch_config.py @@ -46,8 +46,6 @@ class KOBOTOUCHConfig(TabbedDeviceConfig): self.extra_customization_message = extra_customization_message self.extra_customization_choices = extra_customization_choices - self.current_device_key = device.device_defaults_key - self.tab1 = Tab1Config(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['debugging_title'] = self.debugging_title - p['extra_customization'] = self.extra_tab.extra_customization() - 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_edit, 1, 1, 1, 1) 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.setRowStretch(5, 1) + self.options_layout.addWidget(self.delete_empty_collections_checkbox, 3, 0, 1, 2) + self.options_layout.setRowStretch(4, 1) @property @@ -275,9 +271,9 @@ class CoversGroupBox(DeviceOptionsGroupBox): ' This is for firmware versions 2.3.1 and later.'), device.get_pref('keep_cover_aspect')) - self.options_layout.addWidget(self.keep_cover_aspect_checkbox, 1, 0, 1, 1) - self.options_layout.addWidget(self.upload_grayscale_checkbox, 2, 0, 1, 1) - self.options_layout.setRowStretch(3, 1) + self.options_layout.addWidget(self.keep_cover_aspect_checkbox, 0, 0, 1, 1) + self.options_layout.addWidget(self.upload_grayscale_checkbox, 1, 0, 1, 1) + self.options_layout.setRowStretch(2, 1) @property def upload_covers(self): diff --git a/src/calibre/gui2/device_drivers/tabbed_device_config.py b/src/calibre/gui2/device_drivers/tabbed_device_config.py index e8b0c8d016..74d378da45 100644 --- a/src/calibre/gui2/device_drivers/tabbed_device_config.py +++ b/src/calibre/gui2/device_drivers/tabbed_device_config.py @@ -164,14 +164,6 @@ class TabbedDeviceConfig(QTabWidget): pass 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 def device(self): return self._device() @@ -217,26 +209,11 @@ class TabbedDeviceConfig(QTabWidget): def commit(self): debug_print("TabbedDeviceConfig::commit: start") 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() return p