mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
commit
258f39af7c
@ -94,6 +94,9 @@ class DeviceConfig(object):
|
|||||||
if isinstance(cls.EXTRA_CUSTOMIZATION_MESSAGE, list):
|
if isinstance(cls.EXTRA_CUSTOMIZATION_MESSAGE, list):
|
||||||
ec = []
|
ec = []
|
||||||
for i in range(0, len(cls.EXTRA_CUSTOMIZATION_MESSAGE)):
|
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'):
|
if hasattr(config_widget.opt_extra_customization[i], 'isChecked'):
|
||||||
ec.append(config_widget.opt_extra_customization[i].isChecked())
|
ec.append(config_widget.opt_extra_customization[i].isChecked())
|
||||||
else:
|
else:
|
||||||
|
@ -15,7 +15,7 @@ class USER_DEFINED(USBMS):
|
|||||||
supported_platforms = ['windows', 'osx', 'linux']
|
supported_platforms = ['windows', 'osx', 'linux']
|
||||||
|
|
||||||
# Ordered list of supported formats
|
# Ordered list of supported formats
|
||||||
FORMATS = BOOK_EXTENSIONS
|
FORMATS = ['epub', 'mobi', 'pdf']
|
||||||
|
|
||||||
VENDOR_ID = 0xFFFF
|
VENDOR_ID = 0xFFFF
|
||||||
PRODUCT_ID = 0xFFFF
|
PRODUCT_ID = 0xFFFF
|
||||||
@ -35,42 +35,44 @@ class USER_DEFINED(USBMS):
|
|||||||
SUPPORTS_SUB_DIRS = True
|
SUPPORTS_SUB_DIRS = True
|
||||||
|
|
||||||
EXTRA_CUSTOMIZATION_MESSAGE = [
|
EXTRA_CUSTOMIZATION_MESSAGE = [
|
||||||
_('USB Vendor ID (in hex)') + ':::' +
|
_('USB Vendor ID (in hex)') + ':::<p>' +
|
||||||
_('Get this ID using Preferences -> Misc -> Get information to '
|
_('Get this ID using Preferences -> Misc -> Get information to '
|
||||||
'set up the user-defined device'),
|
'set up the user-defined device') + '</p>',
|
||||||
_('USB Product ID (in hex)')+ ':::' +
|
_('USB Product ID (in hex)')+ ':::<p>' +
|
||||||
_('Get this ID using Preferences -> Misc -> Get information to '
|
_('Get this ID using Preferences -> Misc -> Get information to '
|
||||||
'set up the user-defined device'),
|
'set up the user-defined device') + '</p>',
|
||||||
_('USB Revision ID (in hex)')+ ':::' +
|
_('USB Revision ID (in hex)')+ ':::<p>' +
|
||||||
_('Get this ID using Preferences -> Misc -> Get information to '
|
_('Get this ID using Preferences -> Misc -> Get information to '
|
||||||
'set up the user-defined device'),
|
'set up the user-defined device') + '</p>',
|
||||||
_('Windows main memory vendor string') + ':::' +
|
'',
|
||||||
|
_('Windows main memory vendor string') + ':::<p>' +
|
||||||
_('This field is used only on windows. '
|
_('This field is used only on windows. '
|
||||||
'Get this ID using Preferences -> Misc -> Get information to '
|
'Get this ID using Preferences -> Misc -> Get information to '
|
||||||
'set up the user-defined device'),
|
'set up the user-defined device') + '</p>',
|
||||||
_('Windows main memory ID string') + ':::' +
|
_('Windows main memory ID string') + ':::<p>' +
|
||||||
_('This field is used only on windows. '
|
_('This field is used only on windows. '
|
||||||
'Get this ID using Preferences -> Misc -> Get information to '
|
'Get this ID using Preferences -> Misc -> Get information to '
|
||||||
'set up the user-defined device'),
|
'set up the user-defined device') + '</p>',
|
||||||
_('Windows card A vendor string') + ':::' +
|
_('Windows card A vendor string') + ':::<p>' +
|
||||||
_('This field is used only on windows. '
|
_('This field is used only on windows. '
|
||||||
'Get this ID using Preferences -> Misc -> Get information to '
|
'Get this ID using Preferences -> Misc -> Get information to '
|
||||||
'set up the user-defined device'),
|
'set up the user-defined device') + '</p>',
|
||||||
_('Windows card A ID string') + ':::' +
|
_('Windows card A ID string') + ':::<p>' +
|
||||||
_('This field is used only on windows. '
|
_('This field is used only on windows. '
|
||||||
'Get this ID using Preferences -> Misc -> Get information to '
|
'Get this ID using Preferences -> Misc -> Get information to '
|
||||||
'set up the user-defined device'),
|
'set up the user-defined device') + '</p>',
|
||||||
_('Main memory folder') + ':::' +
|
_('Main memory folder') + ':::<p>' +
|
||||||
_('Enter the folder where the books are to be stored. This 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') + '</p>',
|
||||||
_('Card A folder') + ':::' +
|
_('Card A folder') + ':::<p>' +
|
||||||
_('Enter the folder where the books are to be stored. This 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') + '</p>',
|
||||||
]
|
]
|
||||||
EXTRA_CUSTOMIZATION_DEFAULT = [
|
EXTRA_CUSTOMIZATION_DEFAULT = [
|
||||||
'0x0000',
|
'0x0000',
|
||||||
'0x0000',
|
'0x0000',
|
||||||
'0x0000',
|
'0x0000',
|
||||||
|
None,
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
'',
|
'',
|
||||||
@ -81,12 +83,12 @@ class USER_DEFINED(USBMS):
|
|||||||
OPT_USB_VENDOR_ID = 0
|
OPT_USB_VENDOR_ID = 0
|
||||||
OPT_USB_PRODUCT_ID = 1
|
OPT_USB_PRODUCT_ID = 1
|
||||||
OPT_USB_REVISION_ID = 2
|
OPT_USB_REVISION_ID = 2
|
||||||
OPT_USB_WINDOWS_MM_VEN_ID = 3
|
OPT_USB_WINDOWS_MM_VEN_ID = 4
|
||||||
OPT_USB_WINDOWS_MM_ID = 4
|
OPT_USB_WINDOWS_MM_ID = 5
|
||||||
OPT_USB_WINDOWS_CA_VEN_ID = 5
|
OPT_USB_WINDOWS_CA_VEN_ID = 6
|
||||||
OPT_USB_WINDOWS_CA_ID = 6
|
OPT_USB_WINDOWS_CA_ID = 7
|
||||||
OPT_MAIN_MEM_FOLDER = 7
|
OPT_MAIN_MEM_FOLDER = 8
|
||||||
OPT_CARD_A_FOLDER = 8
|
OPT_CARD_A_FOLDER = 9
|
||||||
|
|
||||||
def initialize(self):
|
def initialize(self):
|
||||||
try:
|
try:
|
||||||
|
@ -62,8 +62,18 @@ class ConfigWidget(QWidget, Ui_ConfigWidget):
|
|||||||
|
|
||||||
if isinstance(extra_customization_message, list):
|
if isinstance(extra_customization_message, list):
|
||||||
self.opt_extra_customization = []
|
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):
|
for i, m in enumerate(extra_customization_message):
|
||||||
label_text, tt = parse_msg(m)
|
label_text, tt = parse_msg(m)
|
||||||
|
if not label_text:
|
||||||
|
self.opt_extra_customization.append(None)
|
||||||
|
continue
|
||||||
if isinstance(settings.extra_customization[i], bool):
|
if isinstance(settings.extra_customization[i], bool):
|
||||||
self.opt_extra_customization.append(QCheckBox(label_text))
|
self.opt_extra_customization.append(QCheckBox(label_text))
|
||||||
self.opt_extra_customization[-1].setToolTip(tt)
|
self.opt_extra_customization[-1].setToolTip(tt)
|
||||||
@ -75,8 +85,9 @@ class ConfigWidget(QWidget, Ui_ConfigWidget):
|
|||||||
l.setBuddy(self.opt_extra_customization[i])
|
l.setBuddy(self.opt_extra_customization[i])
|
||||||
l.setWordWrap(True)
|
l.setWordWrap(True)
|
||||||
self.opt_extra_customization[i].setText(settings.extra_customization[i])
|
self.opt_extra_customization[i].setText(settings.extra_customization[i])
|
||||||
self.extra_layout.addWidget(l)
|
self.extra_layout.addWidget(l, row_func(i, 0), col_func(i))
|
||||||
self.extra_layout.addWidget(self.opt_extra_customization[i])
|
self.extra_layout.addWidget(self.opt_extra_customization[i],
|
||||||
|
row_func(i, 1), col_func(i))
|
||||||
else:
|
else:
|
||||||
self.opt_extra_customization = QLineEdit()
|
self.opt_extra_customization = QLineEdit()
|
||||||
label_text, tt = parse_msg(extra_customization_message)
|
label_text, tt = parse_msg(extra_customization_message)
|
||||||
@ -86,8 +97,8 @@ class ConfigWidget(QWidget, Ui_ConfigWidget):
|
|||||||
l.setWordWrap(True)
|
l.setWordWrap(True)
|
||||||
if settings.extra_customization:
|
if settings.extra_customization:
|
||||||
self.opt_extra_customization.setText(settings.extra_customization)
|
self.opt_extra_customization.setText(settings.extra_customization)
|
||||||
self.extra_layout.addWidget(l)
|
self.extra_layout.addWidget(l, 0, 0)
|
||||||
self.extra_layout.addWidget(self.opt_extra_customization)
|
self.extra_layout.addWidget(self.opt_extra_customization, 1, 0)
|
||||||
self.opt_save_template.setText(settings.save_template)
|
self.opt_save_template.setText(settings.save_template)
|
||||||
|
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<layout class="QVBoxLayout" name="extra_layout"/>
|
<layout class="QGridLayout" name="extra_layout"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user