mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Use GUI name when show connected device in GUI (I'm fed up with all the posts about calibre detecting x SONY reader as y SONY reader)
This commit is contained in:
parent
9e30796443
commit
59c4b241f4
@ -43,6 +43,15 @@ class DevicePlugin(Plugin):
|
||||
#: Icon for this device
|
||||
icon = I('reader.svg')
|
||||
|
||||
@classmethod
|
||||
def get_gui_name(cls):
|
||||
if hasattr(cls, 'gui_name'):
|
||||
return cls.gui_name
|
||||
if hasattr(cls, '__name__'):
|
||||
return cls.__name__
|
||||
return cls.name
|
||||
|
||||
|
||||
def test_bcd_windows(self, device_id, bcd):
|
||||
if bcd is None or len(bcd) == 0:
|
||||
return True
|
||||
|
@ -95,6 +95,7 @@ class PRS500(DeviceConfig, DevicePlugin):
|
||||
PRODUCT_ID = 0x029b #: Product Id for the PRS-500
|
||||
BCD = [0x100]
|
||||
PRODUCT_NAME = 'PRS-500'
|
||||
gui_name = PRODUCT_NAME
|
||||
VENDOR_NAME = 'SONY'
|
||||
INTERFACE_ID = 0 #: The interface we use to talk to the device
|
||||
BULK_IN_EP = 0x81 #: Endpoint for Bulk reads
|
||||
@ -114,10 +115,6 @@ class PRS500(DeviceConfig, DevicePlugin):
|
||||
SUPPORTS_SUB_DIRS = False
|
||||
MUST_READ_METADATA = True
|
||||
|
||||
@classmethod
|
||||
def get_gui_name(cls):
|
||||
return 'PRS-500'
|
||||
|
||||
def log_packet(self, packet, header, stream=sys.stderr):
|
||||
"""
|
||||
Log C{packet} to stream C{stream}.
|
||||
|
@ -22,7 +22,7 @@ from calibre import __appname__
|
||||
class PRS505(CLI, Device):
|
||||
|
||||
name = 'PRS-300/505 Device Interface'
|
||||
gui_name = 'SONY Pocket Edition'
|
||||
gui_name = 'SONY Reader'
|
||||
description = _('Communicate with the Sony PRS-300/505/500 eBook reader.')
|
||||
author = 'Kovid Goyal and John Schember'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
@ -95,7 +95,7 @@ class PRS505(CLI, Device):
|
||||
self._card_b_prefix = None
|
||||
|
||||
def get_device_information(self, end_session=True):
|
||||
return (self.__class__.__name__, '', '', '')
|
||||
return (self.gui_name, '', '', '')
|
||||
|
||||
def books(self, oncard=None, end_session=True):
|
||||
if oncard == 'carda' and not self._card_a_prefix:
|
||||
@ -214,7 +214,7 @@ class PRS700(PRS505):
|
||||
name = 'PRS-600/700/900 Device Interface'
|
||||
description = _('Communicate with the Sony PRS-600/700/900 eBook reader.')
|
||||
author = 'Kovid Goyal and John Schember'
|
||||
gui_name = 'SONY Touch/Daily edition'
|
||||
gui_name = 'SONY Reader'
|
||||
supported_platforms = ['windows', 'osx', 'linux']
|
||||
|
||||
BCD = [0x31a]
|
||||
|
@ -98,13 +98,6 @@ class Device(DeviceConfig, DevicePlugin):
|
||||
self.detected_device = None
|
||||
self.set_progress_reporter(report_progress)
|
||||
|
||||
@classmethod
|
||||
def get_gui_name(cls):
|
||||
x = getattr(cls, 'gui_name', None)
|
||||
if x is None:
|
||||
x = cls.__name__
|
||||
return x
|
||||
|
||||
def set_progress_reporter(self, report_progress):
|
||||
self.report_progress = report_progress
|
||||
self.report_progress = report_progress
|
||||
|
@ -35,7 +35,7 @@ class USBMS(CLI, Device):
|
||||
|
||||
def get_device_information(self, end_session=True):
|
||||
self.report_progress(1.0, _('Get device information...'))
|
||||
return (self.__class__.__name__, '', '', '')
|
||||
return (self.get_gui_name(), '', '', '')
|
||||
|
||||
def books(self, oncard=None, end_session=True):
|
||||
from calibre.ebooks.metadata.meta import path_to_ext
|
||||
|
Loading…
x
Reference in New Issue
Block a user