本文整理汇总了Python中calibre.gui2.ResizableDialog.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python ResizableDialog.__init__方法的具体用法?Python ResizableDialog.__init__怎么用?Python ResizableDialog.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calibre.gui2.ResizableDialog
的用法示例。
在下文中一共展示了ResizableDialog.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from calibre.gui2 import ResizableDialog [as 别名]
# 或者: from calibre.gui2.ResizableDialog import __init__ [as 别名]
def __init__(self, parent, db, preferred_output_format=None,
has_saved_settings=True):
ResizableDialog.__init__(self, parent)
self.setup_output_formats(db, preferred_output_format)
self.db = db
self.setup_pipeline()
self.input_label.hide()
self.input_formats.hide()
self.opt_individual_saved_settings.setVisible(True)
self.opt_individual_saved_settings.setChecked(True)
self.opt_individual_saved_settings.setToolTip(_('For '
'settings that cannot be specified in this dialog, use the '
'values saved in a previous conversion (if they exist) instead '
'of using the defaults specified in the Preferences'))
self.output_formats.currentIndexChanged[str].connect(self.setup_pipeline)
self.groups.activated[(QModelIndex)].connect(self.show_pane)
self.groups.clicked[(QModelIndex)].connect(self.show_pane)
self.groups.entered[(QModelIndex)].connect(self.show_group_help)
rb = self.buttonBox.button(self.buttonBox.RestoreDefaults)
rb.setVisible(False)
self.groups.setMouseTracking(True)
if not has_saved_settings:
o = self.opt_individual_saved_settings
o.setEnabled(False)
o.setToolTip(_('None of the selected books have saved conversion '
'settings.'))
o.setChecked(False)
geom = gprefs.get('convert_bulk_dialog_geom', None)
if geom:
self.restoreGeometry(geom)
示例2: __init__
# 需要导入模块: from calibre.gui2 import ResizableDialog [as 别名]
# 或者: from calibre.gui2.ResizableDialog import __init__ [as 别名]
def __init__(self, parent, recipe_model):
ResizableDialog.__init__(self, parent)
self._model = self.model = CustomRecipeModel(recipe_model)
self.available_profiles.setModel(self._model)
self.available_profiles.currentChanged = self.current_changed
f = QFont()
f.setStyleHint(f.Monospace)
self.source_code.setFont(f)
self.remove_feed_button.clicked[(bool)].connect(self.added_feeds.remove_selected_items)
self.remove_profile_button.clicked[(bool)].connect(self.remove_selected_items)
self.add_feed_button.clicked[(bool)].connect(self.add_feed)
self.load_button.clicked.connect(self.load)
self.opml_button.clicked.connect(self.opml_import)
self.builtin_recipe_button.clicked.connect(self.add_builtin_recipe)
self.share_button.clicked.connect(self.share)
self.show_recipe_files_button.clicked.connect(self.show_recipe_files)
self.down_button.clicked.connect(self.down)
self.up_button.clicked.connect(self.up)
self.add_profile_button.clicked[(bool)].connect(self.add_profile)
self.feed_url.returnPressed[()].connect(self.add_feed)
self.feed_title.returnPressed[()].connect(self.add_feed)
self.toggle_mode_button.clicked[(bool)].connect(self.toggle_mode)
self.clear()
示例3: __init__
# 需要导入模块: from calibre.gui2 import ResizableDialog [as 别名]
# 或者: from calibre.gui2.ResizableDialog import __init__ [as 别名]
def __init__(self, parent, db, book_id,
preferred_input_format=None, preferred_output_format=None):
ResizableDialog.__init__(self, parent)
self.opt_individual_saved_settings.setVisible(False)
self.db, self.book_id = db, book_id
self.setup_input_output_formats(self.db, self.book_id, preferred_input_format,
preferred_output_format)
self.setup_pipeline()
self.connect(self.input_formats, SIGNAL('currentIndexChanged(QString)'),
self.setup_pipeline)
self.connect(self.output_formats, SIGNAL('currentIndexChanged(QString)'),
self.setup_pipeline)
self.connect(self.groups, SIGNAL('activated(QModelIndex)'),
self.show_pane)
self.connect(self.groups, SIGNAL('clicked(QModelIndex)'),
self.show_pane)
self.connect(self.groups, SIGNAL('entered(QModelIndex)'),
self.show_group_help)
rb = self.buttonBox.button(self.buttonBox.RestoreDefaults)
self.connect(rb, SIGNAL('clicked()'), self.restore_defaults)
self.groups.setMouseTracking(True)
geom = gprefs.get('convert_single_dialog_geom', None)
if geom:
self.restoreGeometry(geom)
示例4: __init__
# 需要导入模块: from calibre.gui2 import ResizableDialog [as 别名]
# 或者: from calibre.gui2.ResizableDialog import __init__ [as 别名]
def __init__(self, db, parent=None):
self.db = db
self.changed = set()
self.books_to_refresh = set()
self.rows_to_refresh = set()
self.metadata_before_fetch = None
ResizableDialog.__init__(self, parent)
示例5: __init__
# 需要导入模块: from calibre.gui2 import ResizableDialog [as 别名]
# 或者: from calibre.gui2.ResizableDialog import __init__ [as 别名]
def __init__(self, db, parent=None, editing_multiple=False):
self.db = db
self.changed = set()
self.books_to_refresh = set()
self.rows_to_refresh = set()
self.metadata_before_fetch = None
self.editing_multiple = editing_multiple
ResizableDialog.__init__(self, parent)
示例6: __init__
# 需要导入模块: from calibre.gui2 import ResizableDialog [as 别名]
# 或者: from calibre.gui2.ResizableDialog import __init__ [as 别名]
def __init__(self, window, rows, model, tab, refresh_books):
ResizableDialog.__init__(self, window)
Ui_MetadataBulkDialog.__init__(self)
self.model = model
self.db = model.db
self.refresh_book_list.setChecked(gprefs['refresh_book_list_on_bulk_edit'])
self.refresh_book_list.toggled.connect(self.save_refresh_booklist)
self.ids = [self.db.id(r) for r in rows]
self.first_title = self.db.title(self.ids[0], index_is_id=True)
self.cover_clone.setToolTip(unicode(self.cover_clone.toolTip()) + ' (%s)' % self.first_title)
self.box_title.setText('<p>' +
_('Editing meta information for <b>%d books</b>') %
len(rows))
self.write_series = False
self.changed = False
self.refresh_books = refresh_books
self.comments = null
self.comments_button.clicked.connect(self.set_comments)
all_tags = self.db.all_tags()
self.tags.update_items_cache(all_tags)
self.remove_tags.update_items_cache(all_tags)
self.initialize_combos()
for f in sorted(self.db.all_formats()):
self.remove_format.addItem(f)
self.remove_format.setCurrentIndex(-1)
self.series.currentIndexChanged[int].connect(self.series_changed)
self.series.editTextChanged.connect(self.series_changed)
self.tag_editor_button.clicked.connect(self.tag_editor)
self.autonumber_series.stateChanged[int].connect(self.auto_number_changed)
self.pubdate.setMinimumDateTime(UNDEFINED_QDATETIME)
self.pubdate_cw = CalendarWidget(self.pubdate)
self.pubdate.setCalendarWidget(self.pubdate_cw)
pubdate_format = tweaks['gui_pubdate_display_format']
if pubdate_format is not None:
self.pubdate.setDisplayFormat(pubdate_format)
self.pubdate.setSpecialValueText(_('Undefined'))
self.clear_pubdate_button.clicked.connect(self.clear_pubdate)
self.pubdate.dateTimeChanged.connect(self.do_apply_pubdate)
self.adddate.setDateTime(QDateTime.currentDateTime())
self.adddate.setMinimumDateTime(UNDEFINED_QDATETIME)
adddate_format = tweaks['gui_timestamp_display_format']
if adddate_format is not None:
self.adddate.setDisplayFormat(adddate_format)
self.adddate.setSpecialValueText(_('Undefined'))
self.clear_adddate_button.clicked.connect(self.clear_adddate)
self.adddate.dateTimeChanged.connect(self.do_apply_adddate)
if len(self.db.custom_field_keys(include_composites=False)) == 0:
self.central_widget.removeTab(1)
else:
self.create_custom_column_editors()
self.prepare_search_and_replace()
self.button_box.clicked.connect(self.button_clicked)
self.button_box.button(QDialogButtonBox.Apply).setToolTip(_(
'Immediately make all changes without closing the dialog. '
'This operation cannot be canceled or undone'))
self.do_again = False
self.central_widget.setCurrentIndex(tab)
geom = gprefs.get('bulk_metadata_window_geometry', None)
if geom is not None:
self.restoreGeometry(bytes(geom))
ct = gprefs.get('bulk_metadata_window_tab', 0)
self.central_widget.setCurrentIndex(ct)
self.languages.init_langs(self.db)
self.languages.setEditText('')
self.authors.setFocus(Qt.OtherFocusReason)
self.exec_()
示例7: __init__
# 需要导入模块: from calibre.gui2 import ResizableDialog [as 别名]
# 或者: from calibre.gui2.ResizableDialog import __init__ [as 别名]
def __init__(self, db, parent=None):
self.db = db
self.changed = set()
self.books_to_refresh = set()
self.rows_to_refresh = set()
ResizableDialog.__init__(self, parent)
示例8: __init__
# 需要导入模块: from calibre.gui2 import ResizableDialog [as 别名]
# 或者: from calibre.gui2.ResizableDialog import __init__ [as 别名]
def __init__(self, parent, dbspec, ids, db):
import re, cStringIO
from calibre import prints as info
from PyQt5.uic import compileUi
ResizableDialog.__init__(self, parent)
self.dbspec, self.ids = dbspec, ids
# Display the number of books we've been passed
self.count.setText(unicode(self.count.text()).format(len(ids)))
# Display the last-used title
self.title.setText(dynamic.get("catalog_last_used_title", _("My Books")))
self.fmts, self.widgets = [], []
for plugin in catalog_plugins():
if plugin.name in config["disabled_plugins"]:
continue
name = plugin.name.lower().replace(" ", "_")
if getattr(plugin, "plugin_path", None) is None:
try:
catalog_widget = importlib.import_module("calibre.gui2.catalog." + name)
pw = catalog_widget.PluginWidget()
pw.initialize(name, db)
pw.ICON = I("forward.png")
self.widgets.append(pw)
[self.fmts.append([file_type.upper(), pw.sync_enabled, pw]) for file_type in plugin.file_types]
except ImportError:
info("ImportError initializing %s" % name)
continue
else:
# Load dynamic tab
form = os.path.join(plugin.resources_path, "%s.ui" % name)
klass = os.path.join(plugin.resources_path, "%s.py" % name)
compiled_form = os.path.join(plugin.resources_path, "%s_ui.py" % name)
if os.path.exists(form) and os.path.exists(klass):
# info("Adding widget for user-installed Catalog plugin %s" % plugin.name)
# Compile the .ui form provided in plugin.zip
if not os.path.exists(compiled_form):
# info('\tCompiling form', form)
buf = cStringIO.StringIO()
compileUi(form, buf)
dat = buf.getvalue()
dat = re.compile(r'QtGui.QApplication.translate\(.+?,\s+"(.+?)(?<!\\)",.+?\)', re.DOTALL).sub(
r'_("\1")', dat
)
open(compiled_form, "wb").write(dat)
# Import the dynamic PluginWidget() from .py file provided in plugin.zip
try:
sys.path.insert(0, plugin.resources_path)
catalog_widget = importlib.import_module(name)
pw = catalog_widget.PluginWidget()
pw.initialize(name)
pw.ICON = I("forward.png")
self.widgets.append(pw)
[self.fmts.append([file_type.upper(), pw.sync_enabled, pw]) for file_type in plugin.file_types]
except ImportError:
info("ImportError with %s" % name)
continue
finally:
sys.path.remove(plugin.resources_path)
else:
info("No dynamic tab resources found for %s" % name)
self.widgets = sorted(self.widgets, cmp=lambda x, y: cmp(x.TITLE, y.TITLE))
# Generate a sorted list of installed catalog formats/sync_enabled pairs
fmts = sorted([x[0] for x in self.fmts])
self.sync_enabled_formats = []
for fmt in self.fmts:
if fmt[1]:
self.sync_enabled_formats.append(fmt[0])
# Callbacks when format, title changes
self.format.currentIndexChanged.connect(self.format_changed)
self.format.currentIndexChanged.connect(self.settings_changed)
self.title.editingFinished.connect(self.settings_changed)
# Add the installed catalog format list to the format QComboBox
self.format.blockSignals(True)
self.format.addItems(fmts)
pref = dynamic.get("catalog_preferred_format", "CSV")
idx = self.format.findText(pref)
if idx > -1:
self.format.setCurrentIndex(idx)
self.format.blockSignals(False)
if self.sync.isEnabled():
self.sync.setChecked(dynamic.get("catalog_sync_to_device", True))
self.format.currentIndexChanged.connect(self.show_plugin_tab)
self.buttonBox.button(self.buttonBox.Apply).clicked.connect(self.apply)
#.........这里部分代码省略.........