diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index c8e2c77769..20bb70ad58 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -76,10 +76,13 @@ class DummyCSSPreProcessor: return data +GENERIC_GUI_NAME = 'Kobo eReader' + + class KOBO(USBMS): name = 'Kobo Reader Device Interface' - gui_name = 'Kobo Reader' + gui_name = GENERIC_GUI_NAME description = _('Communicate with the original Kobo Reader and the Kobo WiFi.') author = 'Timothy Legge and David Forrester' version = (2, 6, 0) @@ -1380,7 +1383,7 @@ class KOBO(USBMS): class KOBOTOUCH(KOBO): name = 'KoboTouch' - gui_name = 'Kobo eReader' + gui_name = GENERIC_GUI_NAME author = 'David Forrester' description = _( 'Communicate with the Kobo Touch, Glo, Mini, Aura HD,' @@ -1613,6 +1616,9 @@ class KOBOTOUCH(KOBO): self.db_manager = Database(self.device_database_path) self.dbversion = self.db_manager.dbversion + def on_device_close(self): + self.__class__.gui_name = GENERIC_GUI_NAME + def database_transaction(self, use_row_factory=False): self.db_manager.use_row_factory = use_row_factory return self.db_manager diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index da255521d5..357f8fe9bb 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -908,6 +908,9 @@ class Device(DeviceConfig, DevicePlugin): print('Udisks eject call for:', d, 'failed:') print('\t', e) + def on_device_close(self): + pass + def unmount_device(self): if self.connected_folder_path: self.eject_connected_folder = True @@ -934,6 +937,7 @@ class Device(DeviceConfig, DevicePlugin): except: pass self._main_prefix = self._card_a_prefix = self._card_b_prefix = None + self.on_device_close() def linux_post_yank(self): self._linux_mount_map = {} @@ -946,6 +950,7 @@ class Device(DeviceConfig, DevicePlugin): import traceback traceback.print_exc() self._main_prefix = self._card_a_prefix = self._card_b_prefix = None + self.on_device_close() def get_main_ebook_dir(self, for_upload=False): return self.EBOOK_DIR_MAIN