diff --git a/src/calibre/ebooks/metadata/book/base.py b/src/calibre/ebooks/metadata/book/base.py index 1eae2e5326..cd2f2a3165 100644 --- a/src/calibre/ebooks/metadata/book/base.py +++ b/src/calibre/ebooks/metadata/book/base.py @@ -390,6 +390,9 @@ class Metadata(object): return (None, None, None, None) orig_res = res cmeta = self.get_user_metadata(key, make_copy=False) + if res is None or res == '': + return (None, None, None, None) + orig_res = res name = unicode(cmeta['name']) datatype = cmeta['datatype'] if datatype == 'text' and cmeta['is_multiple']: diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index b20cd7594f..ae3141db56 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -707,6 +707,10 @@ class DeviceMixin(object): # {{{ ''' Called when a device is connected to the computer. ''' + # This can happen as this function is called in a queued connection and + # the user could have yanked the device in the meantime + if connected and not self.device_manager.is_device_connected: + connected = False self.set_device_menu_items_state(connected) if connected: self.device_manager.get_device_information(\ diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index f40eed1fcd..f8d50d1cd2 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -38,6 +38,7 @@ from calibre.gui2.init import LibraryViewMixin, LayoutMixin from calibre.gui2.search_box import SearchBoxMixin, SavedSearchBoxMixin from calibre.gui2.search_restriction_mixin import SearchRestrictionMixin from calibre.gui2.tag_view import TagBrowserMixin +from calibre.utils.ordered_dict import OrderedDict class Listener(Thread): # {{{ @@ -97,7 +98,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, # {{{ MainWindow.__init__(self, opts, parent) self.opts = opts self.device_connected = None - acmap = {} + acmap = OrderedDict() for action in interface_actions(): mod, cls = action.actual_plugin.split(':') ac = getattr(__import__(mod, fromlist=['1'], level=0), cls)(self, diff --git a/src/calibre/library/server/opds.py b/src/calibre/library/server/opds.py index 0eb7379ac5..d495f58fa1 100644 --- a/src/calibre/library/server/opds.py +++ b/src/calibre/library/server/opds.py @@ -20,7 +20,6 @@ from calibre.library.comments import comments_to_html from calibre.library.server.utils import format_tag_string from calibre import guess_type from calibre.utils.ordered_dict import OrderedDict -from calibre.utils.date import format_date BASE_HREFS = { 0 : '/stanza',