This commit is contained in:
Kovid Goyal 2011-05-02 11:19:33 -06:00
commit 258f39af7c
4 changed files with 46 additions and 30 deletions

View File

@ -94,6 +94,9 @@ class DeviceConfig(object):
if isinstance(cls.EXTRA_CUSTOMIZATION_MESSAGE, list):
ec = []
for i in range(0, len(cls.EXTRA_CUSTOMIZATION_MESSAGE)):
if config_widget.opt_extra_customization[i] is None:
ec.append(None)
continue
if hasattr(config_widget.opt_extra_customization[i], 'isChecked'):
ec.append(config_widget.opt_extra_customization[i].isChecked())
else:

View File

@ -15,7 +15,7 @@ class USER_DEFINED(USBMS):
supported_platforms = ['windows', 'osx', 'linux']
# Ordered list of supported formats
FORMATS = BOOK_EXTENSIONS
FORMATS = ['epub', 'mobi', 'pdf']
VENDOR_ID = 0xFFFF
PRODUCT_ID = 0xFFFF
@ -35,42 +35,44 @@ class USER_DEFINED(USBMS):
SUPPORTS_SUB_DIRS = True
EXTRA_CUSTOMIZATION_MESSAGE = [
_('USB Vendor ID (in hex)') + ':::' +
_('USB Vendor ID (in hex)') + ':::<p>' +
_('Get this ID using Preferences -> Misc -> Get information to '
'set up the user-defined device'),
_('USB Product ID (in hex)')+ ':::' +
'set up the user-defined device') + '</p>',
_('USB Product ID (in hex)')+ ':::<p>' +
_('Get this ID using Preferences -> Misc -> Get information to '
'set up the user-defined device'),
_('USB Revision ID (in hex)')+ ':::' +
'set up the user-defined device') + '</p>',
_('USB Revision ID (in hex)')+ ':::<p>' +
_('Get this ID using Preferences -> Misc -> Get information to '
'set up the user-defined device'),
_('Windows main memory vendor string') + ':::' +
'set up the user-defined device') + '</p>',
'',
_('Windows main memory vendor string') + ':::<p>' +
_('This field is used only on windows. '
'Get this ID using Preferences -> Misc -> Get information to '
'set up the user-defined device'),
_('Windows main memory ID string') + ':::' +
'set up the user-defined device') + '</p>',
_('Windows main memory ID string') + ':::<p>' +
_('This field is used only on windows. '
'Get this ID using Preferences -> Misc -> Get information to '
'set up the user-defined device'),
_('Windows card A vendor string') + ':::' +
'set up the user-defined device') + '</p>',
_('Windows card A vendor string') + ':::<p>' +
_('This field is used only on windows. '
'Get this ID using Preferences -> Misc -> Get information to '
'set up the user-defined device'),
_('Windows card A ID string') + ':::' +
'set up the user-defined device') + '</p>',
_('Windows card A ID string') + ':::<p>' +
_('This field is used only on windows. '
'Get this ID using Preferences -> Misc -> Get information to '
'set up the user-defined device'),
_('Main memory folder') + ':::' +
'set up the user-defined device') + '</p>',
_('Main memory folder') + ':::<p>' +
_('Enter the folder where the books are to be stored. This folder '
'is prepended to any send_to_device template'),
_('Card A folder') + ':::' +
'is prepended to any send_to_device template') + '</p>',
_('Card A folder') + ':::<p>' +
_('Enter the folder where the books are to be stored. This folder '
'is prepended to any send_to_device template'),
'is prepended to any send_to_device template') + '</p>',
]
EXTRA_CUSTOMIZATION_DEFAULT = [
'0x0000',
'0x0000',
'0x0000',
None,
'',
'',
'',
@ -81,12 +83,12 @@ class USER_DEFINED(USBMS):
OPT_USB_VENDOR_ID = 0
OPT_USB_PRODUCT_ID = 1
OPT_USB_REVISION_ID = 2
OPT_USB_WINDOWS_MM_VEN_ID = 3
OPT_USB_WINDOWS_MM_ID = 4
OPT_USB_WINDOWS_CA_VEN_ID = 5
OPT_USB_WINDOWS_CA_ID = 6
OPT_MAIN_MEM_FOLDER = 7
OPT_CARD_A_FOLDER = 8
OPT_USB_WINDOWS_MM_VEN_ID = 4
OPT_USB_WINDOWS_MM_ID = 5
OPT_USB_WINDOWS_CA_VEN_ID = 6
OPT_USB_WINDOWS_CA_ID = 7
OPT_MAIN_MEM_FOLDER = 8
OPT_CARD_A_FOLDER = 9
def initialize(self):
try:

View File

@ -62,8 +62,18 @@ class ConfigWidget(QWidget, Ui_ConfigWidget):
if isinstance(extra_customization_message, list):
self.opt_extra_customization = []
if len(extra_customization_message) > 6:
row_func = lambda x, y: ((x/2) * 2) + y
col_func = lambda x: x%2
else:
row_func = lambda x, y: x*2 + y
col_func = lambda x: 0
for i, m in enumerate(extra_customization_message):
label_text, tt = parse_msg(m)
if not label_text:
self.opt_extra_customization.append(None)
continue
if isinstance(settings.extra_customization[i], bool):
self.opt_extra_customization.append(QCheckBox(label_text))
self.opt_extra_customization[-1].setToolTip(tt)
@ -75,8 +85,9 @@ class ConfigWidget(QWidget, Ui_ConfigWidget):
l.setBuddy(self.opt_extra_customization[i])
l.setWordWrap(True)
self.opt_extra_customization[i].setText(settings.extra_customization[i])
self.extra_layout.addWidget(l)
self.extra_layout.addWidget(self.opt_extra_customization[i])
self.extra_layout.addWidget(l, row_func(i, 0), col_func(i))
self.extra_layout.addWidget(self.opt_extra_customization[i],
row_func(i, 1), col_func(i))
else:
self.opt_extra_customization = QLineEdit()
label_text, tt = parse_msg(extra_customization_message)
@ -86,8 +97,8 @@ class ConfigWidget(QWidget, Ui_ConfigWidget):
l.setWordWrap(True)
if settings.extra_customization:
self.opt_extra_customization.setText(settings.extra_customization)
self.extra_layout.addWidget(l)
self.extra_layout.addWidget(self.opt_extra_customization)
self.extra_layout.addWidget(l, 0, 0)
self.extra_layout.addWidget(self.opt_extra_customization, 1, 0)
self.opt_save_template.setText(settings.save_template)

View File

@ -101,7 +101,7 @@
</widget>
</item>
<item row="6" column="0">
<layout class="QVBoxLayout" name="extra_layout"/>
<layout class="QGridLayout" name="extra_layout"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">