From 669d6e313e5e3c77aad43a32f18aa062eb16a4cf Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 28 Aug 2009 14:22:37 -0600 Subject: [PATCH] Support for the SONY Reader Touch Edition --- src/calibre/customize/builtins.py | 3 +-- src/calibre/devices/kindle/driver.py | 1 + src/calibre/devices/prs500/driver.py | 4 ++++ src/calibre/devices/prs505/driver.py | 16 ++++++++-------- src/calibre/devices/prs700/driver.py | 21 +++++++-------------- src/calibre/devices/usbms/device.py | 8 ++++++++ src/calibre/gui2/main.py | 2 +- src/calibre/gui2/wizard/__init__.py | 2 +- upload.py | 10 ++++------ 9 files changed, 35 insertions(+), 32 deletions(-) diff --git a/src/calibre/customize/builtins.py b/src/calibre/customize/builtins.py index a8f68e3073..9e924f15d6 100644 --- a/src/calibre/customize/builtins.py +++ b/src/calibre/customize/builtins.py @@ -365,7 +365,7 @@ from calibre.devices.jetbook.driver import JETBOOK from calibre.devices.kindle.driver import KINDLE, KINDLE2, KINDLE_DX from calibre.devices.prs500.driver import PRS500 from calibre.devices.prs505.driver import PRS505 -from calibre.devices.prs700.driver import PRS700, PRS600 +from calibre.devices.prs700.driver import PRS700 from calibre.devices.android.driver import ANDROID plugins = [HTML2ZIP] @@ -414,7 +414,6 @@ plugins += [ PRS500, PRS505, PRS700, - PRS600, ANDROID, CYBOOK_OPUS, COOL_ER diff --git a/src/calibre/devices/kindle/driver.py b/src/calibre/devices/kindle/driver.py index f947d33773..83f8d064fe 100644 --- a/src/calibre/devices/kindle/driver.py +++ b/src/calibre/devices/kindle/driver.py @@ -17,6 +17,7 @@ from calibre.devices.usbms.driver import USBMS class KINDLE(USBMS): name = 'Kindle Device Interface' + gui_name = 'Amazon Kindle' description = _('Communicate with the Kindle eBook reader.') author = _('John Schember') supported_platforms = ['windows', 'osx', 'linux'] diff --git a/src/calibre/devices/prs500/driver.py b/src/calibre/devices/prs500/driver.py index 4273101273..7c506c6bf0 100644 --- a/src/calibre/devices/prs500/driver.py +++ b/src/calibre/devices/prs500/driver.py @@ -112,6 +112,10 @@ 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}. diff --git a/src/calibre/devices/prs505/driver.py b/src/calibre/devices/prs505/driver.py index d1e1535e36..9983b45105 100644 --- a/src/calibre/devices/prs505/driver.py +++ b/src/calibre/devices/prs505/driver.py @@ -22,6 +22,7 @@ from calibre import __appname__ class PRS505(CLI, Device): name = 'PRS-505 Device Interface' + gui_name = 'SONY Pocket Edition' description = _('Communicate with the Sony PRS-505 eBook reader.') author = _('Kovid Goyal and John Schember') supported_platforms = ['windows', 'osx', 'linux'] @@ -30,16 +31,16 @@ class PRS505(CLI, Device): VENDOR_ID = [0x054c] #: SONY Vendor Id PRODUCT_ID = [0x031e] #: Product Id for the PRS-505 - BCD = [0x229, 0x1000] #: Needed to disambiguate 505 and 700 on linux + BCD = [0x229, 0x1000] VENDOR_NAME = 'SONY' - WINDOWS_MAIN_MEM = 'PRS-505' - WINDOWS_CARD_A_MEM = re.compile(r'PRS-505/\S+:MS') - WINDOWS_CARD_B_MEM = re.compile(r'PRS-505/\S+:SD') + WINDOWS_MAIN_MEM = re.compile('PRS-(505|300)') + WINDOWS_CARD_A_MEM = re.compile(r'PRS-(505|300)/\S+:MS') + WINDOWS_CARD_B_MEM = re.compile(r'PRS-(505|300)/\S+:SD') - OSX_MAIN_MEM = re.compile(r'Sony PRS-505/[^:]+ Media') - OSX_CARD_A_MEM = re.compile(r'Sony PRS-505/[^:]+:MS Media') - OSX_CARD_B_MEM = re.compile(r'Sony PRS-505/[^:]+:SD Media') + OSX_MAIN_MEM = re.compile(r'Sony PRS-(505|300)/[^:]+ Media') + OSX_CARD_A_MEM = re.compile(r'Sony PRS-(505|300)/[^:]+:MS Media') + OSX_CARD_B_MEM = re.compile(r'Sony PRS-(505|300)/[^:]+:SD Media') MAIN_MEMORY_VOLUME_LABEL = 'Sony Reader Main Memory' STORAGE_CARD_VOLUME_LABEL = 'Sony Reader Storage Card' @@ -84,7 +85,6 @@ class PRS505(CLI, Device): self._card_b_prefix = None def get_device_information(self, end_session=True): - #self.report_progress(1.0, _('Get device information...')) return (self.__class__.__name__, '', '', '') def books(self, oncard=None, end_session=True): diff --git a/src/calibre/devices/prs700/driver.py b/src/calibre/devices/prs700/driver.py index aa6e2cf83e..4c4231821e 100644 --- a/src/calibre/devices/prs700/driver.py +++ b/src/calibre/devices/prs700/driver.py @@ -16,24 +16,17 @@ class PRS700(PRS505): name = 'PRS-700 Device Interface' description = _('Communicate with the Sony PRS-700 eBook reader.') author = _('Kovid Goyal and John Schember') + gui_name = 'SONY Touch edition' supported_platforms = ['windows', 'osx', 'linux'] BCD = [0x31a] - WINDOWS_MAIN_MEM = 'PRS-700' - WINDOWS_CARD_A_MEM = re.compile(r'PRS-700/\S+:MS') - WINDOWS_CARD_B_MEM = re.compile(r'PRS-700/\S+:SD') + WINDOWS_MAIN_MEM = re.compile('PRS-[67]00') + WINDOWS_CARD_A_MEM = re.compile(r'PRS-[67]00/\S+:MS') + WINDOWS_CARD_B_MEM = re.compile(r'PRS-[67]00/\S+:SD') - OSX_MAIN_MEM = re.compile(r'Sony PRS-700/[^:]+ Media') - OSX_CARD_A_MEM = re.compile(r'Sony PRS-700/[^:]+:MS Media') - OSX_CARD_B_MEM = re.compile(r'Sony PRS-700/[^:]+:SD Media') + OSX_MAIN_MEM = re.compile(r'Sony PRS-[67]00/[^:]+ Media') + OSX_CARD_A_MEM = re.compile(r'Sony PRS-[67]00/[^:]+:MS Media') + OSX_CARD_B_MEM = re.compile(r'Sony PRS-[67]00/[^:]+:SD Media') -class PRS600(PRS700): - - name = 'PRS-600 Device Interface' - description = PRS700.description.replace('700', '600') - - WINDOWS_MAIN_MEM = 'PRS-600' - WINDOWS_CARD_A_MEM = re.compile(r'PRS-700/\S+:MS') - WINDOWS_CARD_B_MEM = re.compile(r'PRS-700/\S+:SD') diff --git a/src/calibre/devices/usbms/device.py b/src/calibre/devices/usbms/device.py index 007d058941..c92c2258e9 100644 --- a/src/calibre/devices/usbms/device.py +++ b/src/calibre/devices/usbms/device.py @@ -111,6 +111,14 @@ class Device(DeviceConfig, DevicePlugin): def reset(self, key='-1', log_packets=False, report_progress=None) : self._main_prefix = self._card_a_prefix = self._card_b_prefix = None + @classmethod + def get_gui_name(cls): + x = getattr(cls, 'gui_name', None) + if x is None: + x = cls.__name__ + return x + + @classmethod def get_fdi(cls): fdi = '' diff --git a/src/calibre/gui2/main.py b/src/calibre/gui2/main.py index 8d2abd77d7..a4cb5777b4 100644 --- a/src/calibre/gui2/main.py +++ b/src/calibre/gui2/main.py @@ -722,7 +722,7 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): self.set_default_thumbnail(\ self.device_manager.device.THUMBNAIL_HEIGHT) self.status_bar.showMessage(_('Device: ')+\ - self.device_manager.device.__class__.__name__+\ + self.device_manager.device.__class__.get_gui_name()+\ _(' detected.'), 3000) self.device_connected = True self._sync_menu.enable_device_actions(True, self.device_manager.device.card_prefix()) diff --git a/src/calibre/gui2/wizard/__init__.py b/src/calibre/gui2/wizard/__init__.py index d00417205d..f4aea4268f 100644 --- a/src/calibre/gui2/wizard/__init__.py +++ b/src/calibre/gui2/wizard/__init__.py @@ -90,7 +90,7 @@ class Sony500(Device): class Sony505(Sony500): output_format = 'EPUB' - name = 'SONY PRS 505/700' + name = 'SONY Reader Pocket/Touch Edition' id = 'prs505' class CybookG3(Device): diff --git a/upload.py b/upload.py index 29d277191f..fcf8fd9911 100644 --- a/upload.py +++ b/upload.py @@ -633,7 +633,7 @@ class build_windows(VMInstaller): class build_osx(VMInstaller): description = 'Build OS X app bundle' - VM = '/vmware/calibre_os_x/Mac OSX.vmx' + VM = '/vmware/bin/tiger_build' def get_build_script(self, subs): return (self.BUILD_SCRIPT%subs).replace('rm ', 'sudo rm ') @@ -642,15 +642,13 @@ class build_osx(VMInstaller): installer = installer_name('dmg') python = '/Library/Frameworks/Python.framework/Versions/Current/bin/python' self.start_vmware() - self.start_vm('osx_build', ('sudo %s setup.py develop'%python, python, + self.start_vm('tiger_build', ('sudo %s setup.py develop'%python, python, 'installer/osx/freeze.py')) - check_call(('scp', 'osx_build:build/calibre/dist/*.dmg', 'dist')) + check_call(('scp', 'tiger_build:build/calibre/dist/*.dmg', 'dist')) if not os.path.exists(installer): raise Exception('Failed to build installer '+installer) if not self.dont_shutdown: - Popen(('ssh', 'osx_build', 'sudo', '/sbin/shutdown', '-h', 'now')) - time.sleep(20) - self.stop_vmware() + Popen(('ssh', 'tiger_build', 'sudo', '/sbin/shutdown', '-h', 'now')) return os.path.basename(installer) class upload_installers(OptionlessCommand):