Tolino driver: Add an option to swap the main memory and card in calibre

Fixes #1240504 [Tolino Shine: Please change (again, sorry) device order](https://bugs.launchpad.net/calibre/+bug/1240504)
This commit is contained in:
Kovid Goyal 2013-10-17 16:29:17 +05:30
parent abcaae49e2
commit bbac6e953d

View File

@ -59,10 +59,24 @@ class TOLINO(EB600):
VENDOR_NAME = ['DEUTSCHE'] VENDOR_NAME = ['DEUTSCHE']
WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = ['_TELEKOMTOLINO'] WINDOWS_MAIN_MEM = WINDOWS_CARD_A_MEM = ['_TELEKOMTOLINO']
EXTRA_CUSTOMIZATION_MESSAGE = [
_('Swap main and card A') +
':::' +
_('Check this box if the device\'s main memory is being seen as card a and the card '
'is being seen as main memory. Some Tolino devices may need this option.'),
]
EXTRA_CUSTOMIZATION_DEFAULT = [
True,
]
OPT_SWAP_MEMORY = 0
# There are apparently two versions of this device, one with swapped # There are apparently two versions of this device, one with swapped
# drives and one without, see https://bugs.launchpad.net/bugs/1240504 # drives and one without, see https://bugs.launchpad.net/bugs/1240504
def linux_swap_drives(self, drives): def linux_swap_drives(self, drives):
if len(drives) < 2 or not drives[0] or not drives[1]: e = self.settings().extra_customization
if len(drives) < 2 or not drives[0] or not drives[1] or not e[self.OPT_SWAP_MEMORY]:
return drives return drives
drives = list(drives) drives = list(drives)
t = drives[0] t = drives[0]
@ -71,7 +85,8 @@ class TOLINO(EB600):
return tuple(drives) return tuple(drives)
def windows_sort_drives(self, drives): def windows_sort_drives(self, drives):
if len(drives) < 2: e = self.settings().extra_customization
if len(drives) < 2 or not e[self.OPT_SWAP_MEMORY]:
return drives return drives
main = drives.get('main', None) main = drives.get('main', None)
carda = drives.get('carda', None) carda = drives.get('carda', None)