Fix more storage card related bugs

This commit is contained in:
Kovid Goyal 2009-06-06 16:39:23 -07:00
parent c33a1bda71
commit 8e5cb5e1cd
4 changed files with 14 additions and 20 deletions

View File

@ -22,7 +22,7 @@ class BEBOOK(USBMS):
VENDOR_NAME = 'LINUX' VENDOR_NAME = 'LINUX'
WINDOWS_MAIN_MEM = 'FILE-STOR_GADGET' WINDOWS_MAIN_MEM = 'FILE-STOR_GADGET'
WINDOWS_CARD_MEM = 'FILE-STOR_GADGET' WINDOWS_CARD_A_MEM = 'FILE-STOR_GADGET'
OSX_MAIN_MEM = 'BeBook Internal Memory' OSX_MAIN_MEM = 'BeBook Internal Memory'
OSX_CARD_A_MEM = 'BeBook Storage Card' OSX_CARD_A_MEM = 'BeBook Storage Card'

View File

@ -216,13 +216,12 @@ class Device(DeviceConfig, DevicePlugin):
wmi = __import__('wmi', globals(), locals(), [], -1) wmi = __import__('wmi', globals(), locals(), [], -1)
c = wmi.WMI(find_classes=False) c = wmi.WMI(find_classes=False)
for drive in c.Win32_DiskDrive(): for drive in c.Win32_DiskDrive():
if self.windows_match_device(str(drive.PNPDeviceID), self.WINDOWS_MAIN_MEM): if self.windows_match_device(str(drive.PNPDeviceID), self.WINDOWS_CARD_A_MEM):
drives['main'] = self.windows_get_drive_prefix(drive)
elif self.windows_match_device(str(drive.PNPDeviceID), self.WINDOWS_CARD_A_MEM):
drives['carda'] = self.windows_get_drive_prefix(drive) drives['carda'] = self.windows_get_drive_prefix(drive)
elif self.windows_match_device(str(drive.PNPDeviceID), self.WINDOWS_CARD_B_MEM): elif self.windows_match_device(str(drive.PNPDeviceID), self.WINDOWS_CARD_B_MEM):
drives['cardb'] = self.windows_get_drive_prefix(drive) drives['cardb'] = self.windows_get_drive_prefix(drive)
elif self.windows_match_device(str(drive.PNPDeviceID), self.WINDOWS_MAIN_MEM):
drives['main'] = self.windows_get_drive_prefix(drive)
if 'main' in drives.keys() and 'carda' in drives.keys() and 'cardb' in drives.keys(): if 'main' in drives.keys() and 'carda' in drives.keys() and 'cardb' in drives.keys():
break break

View File

@ -28,11 +28,6 @@
<layout class="QGridLayout" name="gridLayout" > <layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" > <item row="0" column="0" >
<widget class="QWebView" name="view" > <widget class="QWebView" name="view" >
<property name="url" >
<url>
<string>about:blank</string>
</url>
</property>
</widget> </widget>
</item> </item>
<item row="0" column="1" > <item row="0" column="1" >

View File

@ -171,10 +171,10 @@ class LocationModel(QAbstractListModel):
self.count = 0 self.count = 0
self.highlight_row = 0 self.highlight_row = 0
self.tooltips = [ self.tooltips = [
_('Click to see the list of books available on your computer'), _('Click to see the books available on your computer'),
_('Click to see the list of books in the main memory of your reader'), _('Click to see the books in the main memory of your reader'),
_('Click to see the list of books on storage card A in your reader'), _('Click to see the books on storage card A in your reader'),
_('Click to see the list of books on storage card B in your reader') _('Click to see the books on storage card B in your reader')
] ]
def rowCount(self, *args): def rowCount(self, *args):
@ -209,15 +209,15 @@ class LocationModel(QAbstractListModel):
def headerData(self, section, orientation, role): def headerData(self, section, orientation, role):
return NONE return NONE
def update_devices(self, cp=None, fs=[-1, -1, -1]): def update_devices(self, cp=(None, None), fs=[-1, -1, -1]):
self.free[0] = fs[0] self.free[0] = fs[0]
self.free[1] = fs[1] self.free[1] = fs[1]
self.free[2] = fs[2] self.free[2] = fs[2]
if cp != None: cpa, cpb = cp
self.free[1] = fs[1] if fs[1] else -1 self.free[1] = fs[1] if fs[1] is not None and cpa is not None else -1
self.free[2] = fs[2] if fs[2] else -1 self.free[2] = fs[2] if fs[2] is not None and cpb is not None else -1
else: if self.free[1] < 0 and self.free[2] >= 0:
self.free[1] = -1 self.free[1] = self.free[2]
self.free[2] = -1 self.free[2] = -1
self.reset() self.reset()