def __init__(self, parent=None): QTabWidget.__init__(self, parent) self._layerTab = GEditorLayerTab(self) self._modelTab = GEditorModelTab(self) self.addTab(self._layerTab, "Layer") self.addTab(self._modelTab, "Model")
def __init__(self, filesystem_cache, show_files=True): QTabWidget.__init__(self) self.fs = filesystem_cache for storage in self.fs.entries: w = Storage(storage, show_files) self.addTab(w, w.name) w.doubleClicked.connect(self.selected) self.setCurrentIndex(0)
def __init__(self, device, parent=None, highlight_ignored_folders=False): QTabWidget.__init__(self, parent) self._device = weakref.ref(device) cd = msg = None if device.current_friendly_name is not None: if device.current_serial_num is None: msg = "<p>" + ( _("The <b>%s</b> device has no serial number, " "it cannot be configured") % device.current_friendly_name ) else: cd = "device-" + device.current_serial_num else: msg = "<p>" + _( "<b>No MTP device connected.</b><p>" " You can only configure the MTP device plugin when a device" " is connected." ) self.current_device_key = cd if msg: msg += "<p>" + _( "If you want to un-ignore a previously" ' ignored MTP device, use the "Ignored devices" tab.' ) l = QLabel(msg) l.setWordWrap(True) l.setStyleSheet("QLabel { margin-left: 2em }") l.setMinimumWidth(500) l.setMinimumHeight(400) self.insertTab(0, l, _("Cannot configure")) else: self.base = QWidget(self) self.insertTab(0, self.base, _("Configure %s") % self.device.current_friendly_name) l = self.base.l = QGridLayout(self.base) self.base.setLayout(l) self.rules = r = FormatRules(self.device, self.get_pref("rules")) self.formats = FormatsConfig(set(BOOK_EXTENSIONS), self.get_pref("format_map")) self.send_to = SendToConfig(self.get_pref("send_to"), self.device) self.template = TemplateConfig(self.get_pref("send_template")) self.base.la = la = QLabel(_("Choose the formats to send to the %s") % self.device.current_friendly_name) la.setWordWrap(True) self.base.b = b = QPushButton( QIcon(I("list_remove.png")), _("&Ignore the %s in calibre") % device.current_friendly_name, self.base ) b.clicked.connect(self.ignore_device) self.config_ign_folders_button = cif = QPushButton(QIcon(I("tb_folder.png")), _("Change scanned &folders")) cif.setStyleSheet("QPushButton { font-weight: bold; }") if highlight_ignored_folders: cif.setIconSize(QSize(64, 64)) self.show_debug_button = bd = QPushButton(QIcon(I("debug.png")), _("Show device information")) bd.clicked.connect(self.show_debug_info) cif.clicked.connect(self.change_ignored_folders) l.addWidget(b, 0, 0, 1, 2) l.addWidget(la, 1, 0, 1, 1) l.addWidget(self.formats, 2, 0, 5, 1) l.addWidget(cif, 2, 1, 1, 1) l.addWidget(self.template, 3, 1, 1, 1) l.addWidget(self.send_to, 4, 1, 1, 1) l.addWidget(self.show_debug_button, 5, 1, 1, 1) l.setRowStretch(6, 10) l.addWidget(r, 7, 0, 1, 2) l.setRowStretch(7, 100) self.igntab = IgnoredDevices(self.device.prefs["history"], self.device.prefs["blacklist"]) self.addTab(self.igntab, _("Ignored devices")) self.current_ignored_folders = self.get_pref("ignored_folders") self.initial_ignored_folders = self.current_ignored_folders self.setCurrentIndex(1 if msg else 0)
def __init__(self, device, parent=None, highlight_ignored_folders=False): QTabWidget.__init__(self, parent) self._device = weakref.ref(device) cd = msg = None if device.current_friendly_name is not None: if device.current_serial_num is None: msg = '<p>' + (_('The <b>%s</b> device has no serial number, ' 'it cannot be configured') % device.current_friendly_name) else: cd = 'device-' + device.current_serial_num else: msg = '<p>' + _( '<b>No MTP device connected.</b><p>' ' You can only configure the MTP device plugin when a device' ' is connected.') self.current_device_key = cd if msg: msg += '<p>' + _( 'If you want to un-ignore a previously' ' ignored MTP device, use the "Ignored devices" tab.') l = QLabel(msg) l.setWordWrap(True) l.setStyleSheet('QLabel { margin-left: 2em }') l.setMinimumWidth(500) l.setMinimumHeight(400) self.insertTab(0, l, _('Cannot configure')) else: self.base = QWidget(self) self.insertTab( 0, self.base, _('Configure %s') % self.device.current_friendly_name) l = self.base.l = QGridLayout(self.base) self.base.setLayout(l) self.rules = r = FormatRules(self.device, self.get_pref('rules')) self.formats = FormatsConfig(set(BOOK_EXTENSIONS), self.get_pref('format_map')) self.send_to = SendToConfig(self.get_pref('send_to'), self.device) self.template = TemplateConfig(self.get_pref('send_template')) self.base.la = la = QLabel( _('Choose the formats to send to the %s') % self.device.current_friendly_name) la.setWordWrap(True) self.base.b = b = QPushButton( QIcon(I('list_remove.png')), _('&Ignore the %s in calibre') % device.current_friendly_name, self.base) b.clicked.connect(self.ignore_device) self.config_ign_folders_button = cif = QPushButton( QIcon(I('tb_folder.png')), _('Change scanned &folders')) cif.setStyleSheet('QPushButton { font-weight: bold; }') if highlight_ignored_folders: cif.setIconSize(QSize(64, 64)) self.show_debug_button = bd = QPushButton( QIcon(I('debug.png')), _('Show device information')) bd.clicked.connect(self.show_debug_info) cif.clicked.connect(self.change_ignored_folders) l.addWidget(b, 0, 0, 1, 2) l.addWidget(la, 1, 0, 1, 1) l.addWidget(self.formats, 2, 0, 5, 1) l.addWidget(cif, 2, 1, 1, 1) l.addWidget(self.template, 3, 1, 1, 1) l.addWidget(self.send_to, 4, 1, 1, 1) l.addWidget(self.show_debug_button, 5, 1, 1, 1) l.setRowStretch(6, 10) l.addWidget(r, 7, 0, 1, 2) l.setRowStretch(7, 100) self.igntab = IgnoredDevices(self.device.prefs['history'], self.device.prefs['blacklist']) self.addTab(self.igntab, _('Ignored devices')) self.current_ignored_folders = self.get_pref('ignored_folders') self.initial_ignored_folders = self.current_ignored_folders self.setCurrentIndex(1 if msg else 0)
def __init__(self, device, parent=None): QTabWidget.__init__(self, parent) self._device = weakref.ref(device) cd = msg = None if device.current_friendly_name is not None: if device.current_serial_num is None: msg = '<p>' + (_('The <b>%s</b> device has no serial number, ' 'it cannot be configured')%device.current_friendly_name) else: cd = 'device-'+device.current_serial_num else: msg = '<p>' + _('<b>No MTP device connected.</b><p>' ' You can only configure the MTP device plugin when a device' ' is connected.') self.current_device_key = cd if msg: msg += '<p>' + _('If you want to un-ignore a previously' ' ignored MTP device, use the "Ignored devices" tab.') l = QLabel(msg) l.setWordWrap(True) l.setStyleSheet('QLabel { margin-left: 2em }') l.setMinimumWidth(500) l.setMinimumHeight(400) self.insertTab(0, l, _('Cannot configure')) else: self.base = QWidget(self) self.insertTab(0, self.base, _('Configure %s')%self.device.current_friendly_name) l = self.base.l = QGridLayout(self.base) self.base.setLayout(l) self.rules = r = FormatRules(self.device, self.get_pref('rules')) self.formats = FormatsConfig(set(BOOK_EXTENSIONS), self.get_pref('format_map')) self.send_to = SendToConfig(self.get_pref('send_to'), self.device) self.template = TemplateConfig(self.get_pref('send_template')) self.base.la = la = QLabel(_( 'Choose the formats to send to the %s')%self.device.current_friendly_name) la.setWordWrap(True) self.base.b = b = QPushButton(QIcon(I('list_remove.png')), _('&Ignore the %s in calibre')%device.current_friendly_name, self.base) b.clicked.connect(self.ignore_device) self.show_debug_button = bd = QPushButton(QIcon(I('debug.png')), _('Show device information')) bd.clicked.connect(self.show_debug_info) l.addWidget(b, 0, 0, 1, 2) l.addWidget(la, 1, 0, 1, 1) l.addWidget(self.formats, 2, 0, 4, 1) l.addWidget(self.send_to, 2, 1, 1, 1) l.addWidget(self.template, 3, 1, 1, 1) l.addWidget(self.show_debug_button, 4, 1, 1, 1) l.setRowStretch(5, 10) l.addWidget(r, 6, 0, 1, 2) l.setRowStretch(6, 100) self.igntab = IgnoredDevices(self.device.prefs['history'], self.device.prefs['blacklist']) self.addTab(self.igntab, _('Ignored devices')) self.setCurrentIndex(1 if msg else 0)