diff --git a/src/calibre/devices/usbms/deviceconfig.py b/src/calibre/devices/usbms/deviceconfig.py index 3c79652463..3f669f1e24 100644 --- a/src/calibre/devices/usbms/deviceconfig.py +++ b/src/calibre/devices/usbms/deviceconfig.py @@ -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: diff --git a/src/calibre/devices/user_defined/driver.py b/src/calibre/devices/user_defined/driver.py index 3211bd19ef..f57f61fe7c 100644 --- a/src/calibre/devices/user_defined/driver.py +++ b/src/calibre/devices/user_defined/driver.py @@ -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)') + ':::

' + _('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') + '

', + _('USB Product ID (in hex)')+ ':::

' + _('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') + '

', + _('USB Revision ID (in hex)')+ ':::

' + _('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') + '

', + '', + _('Windows main memory vendor string') + ':::

' + _('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') + '

', + _('Windows main memory ID string') + ':::

' + _('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') + '

', + _('Windows card A vendor string') + ':::

' + _('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') + '

', + _('Windows card A ID string') + ':::

' + _('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') + '

', + _('Main memory folder') + ':::

' + _('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') + '

', + _('Card A folder') + ':::

' + _('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') + '

', ] 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: diff --git a/src/calibre/gui2/device_drivers/configwidget.py b/src/calibre/gui2/device_drivers/configwidget.py index fc7e16e639..e55a0c6dda 100644 --- a/src/calibre/gui2/device_drivers/configwidget.py +++ b/src/calibre/gui2/device_drivers/configwidget.py @@ -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) diff --git a/src/calibre/gui2/device_drivers/configwidget.ui b/src/calibre/gui2/device_drivers/configwidget.ui index 619d7052e8..92324fd1a7 100644 --- a/src/calibre/gui2/device_drivers/configwidget.ui +++ b/src/calibre/gui2/device_drivers/configwidget.ui @@ -101,7 +101,7 @@ - +