Kobo driver: Forget device specific GUI name on close

Fixes #2105703 [Kobo device vs Kobo forma](https://bugs.launchpad.net/calibre/+bug/2105703)
This commit is contained in:
Kovid Goyal 2025-04-01 09:19:43 +05:30
parent 2d85dc02d7
commit 90abfc5a37
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 13 additions and 2 deletions

View File

@ -76,10 +76,13 @@ class DummyCSSPreProcessor:
return data return data
GENERIC_GUI_NAME = 'Kobo eReader'
class KOBO(USBMS): class KOBO(USBMS):
name = 'Kobo Reader Device Interface' 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.') description = _('Communicate with the original Kobo Reader and the Kobo WiFi.')
author = 'Timothy Legge and David Forrester' author = 'Timothy Legge and David Forrester'
version = (2, 6, 0) version = (2, 6, 0)
@ -1380,7 +1383,7 @@ class KOBO(USBMS):
class KOBOTOUCH(KOBO): class KOBOTOUCH(KOBO):
name = 'KoboTouch' name = 'KoboTouch'
gui_name = 'Kobo eReader' gui_name = GENERIC_GUI_NAME
author = 'David Forrester' author = 'David Forrester'
description = _( description = _(
'Communicate with the Kobo Touch, Glo, Mini, Aura HD,' '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.db_manager = Database(self.device_database_path)
self.dbversion = self.db_manager.dbversion 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): def database_transaction(self, use_row_factory=False):
self.db_manager.use_row_factory = use_row_factory self.db_manager.use_row_factory = use_row_factory
return self.db_manager return self.db_manager

View File

@ -908,6 +908,9 @@ class Device(DeviceConfig, DevicePlugin):
print('Udisks eject call for:', d, 'failed:') print('Udisks eject call for:', d, 'failed:')
print('\t', e) print('\t', e)
def on_device_close(self):
pass
def unmount_device(self): def unmount_device(self):
if self.connected_folder_path: if self.connected_folder_path:
self.eject_connected_folder = True self.eject_connected_folder = True
@ -934,6 +937,7 @@ class Device(DeviceConfig, DevicePlugin):
except: except:
pass pass
self._main_prefix = self._card_a_prefix = self._card_b_prefix = None self._main_prefix = self._card_a_prefix = self._card_b_prefix = None
self.on_device_close()
def linux_post_yank(self): def linux_post_yank(self):
self._linux_mount_map = {} self._linux_mount_map = {}
@ -946,6 +950,7 @@ class Device(DeviceConfig, DevicePlugin):
import traceback import traceback
traceback.print_exc() traceback.print_exc()
self._main_prefix = self._card_a_prefix = self._card_b_prefix = None 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): def get_main_ebook_dir(self, for_upload=False):
return self.EBOOK_DIR_MAIN return self.EBOOK_DIR_MAIN