本文整理汇总了Python中calibre.gui2.tweak_book.check.Check类的典型用法代码示例。如果您正苦于以下问题:Python Check类的具体用法?Python Check怎么用?Python Check使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Check类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, opts, notify=None):
MainWindow.__init__(self, opts, disable_automatic_gc=True)
self.setWindowTitle(self.APP_NAME)
self.boss = Boss(self, notify=notify)
self.setWindowIcon(QIcon(I('tweak.png')))
self.opts = opts
self.path_to_ebook = None
self.container = None
self.current_metadata = None
self.blocking_job = BlockingJob(self)
self.keyboard = KeyboardManager(self, config_name='shortcuts/tweak_book')
self.central = Central(self)
self.setCentralWidget(self.central)
self.check_book = Check(self)
self.spell_check = SpellCheck(parent=self)
self.toc_view = TOCViewer(self)
self.text_search = TextSearch(self)
self.saved_searches = SavedSearches(self)
self.image_browser = InsertImage(self, for_browsing=True)
self.reports = Reports(self)
self.check_external_links = CheckExternalLinks(self)
self.insert_char = CharSelect(self)
self.manage_fonts = ManageFonts(self)
self.sr_debug_output = DebugOutput(self)
self.create_actions()
self.create_toolbars()
self.create_docks()
self.create_menubar()
self.status_bar = self.statusBar()
self.status_bar.addPermanentWidget(self.boss.save_manager.status_widget)
self.cursor_position_widget = CursorPositionWidget(self)
self.status_bar.addPermanentWidget(self.cursor_position_widget)
self.status_bar_default_msg = la = QLabel(' ' + _('{0} {1} created by {2}').format(__appname__, get_version(), 'Kovid Goyal'))
la.base_template = unicode(la.text())
self.status_bar.addWidget(la)
f = self.status_bar.font()
f.setBold(True)
self.status_bar.setFont(f)
self.boss(self)
g = QApplication.instance().desktop().availableGeometry(self)
self.resize(g.width()-50, g.height()-50)
self.restore_state()
self.apply_settings()
示例2: __init__
def __init__(self, opts, notify=None):
MainWindow.__init__(self, opts, disable_automatic_gc=True)
self.boss = Boss(self, notify=notify)
self.setWindowTitle(self.APP_NAME)
self.setWindowIcon(QIcon(I('tweak.png')))
self.opts = opts
self.path_to_ebook = None
self.container = None
self.current_metadata = None
self.blocking_job = BlockingJob(self)
self.keyboard = KeyboardManager(self, config_name='shortcuts/tweak_book')
self.central = Central(self)
self.setCentralWidget(self.central)
self.check_book = Check(self)
self.toc_view = TOCViewer(self)
self.image_browser = InsertImage(self, for_browsing=True)
self.insert_char = CharSelect(self)
self.create_actions()
self.create_toolbars()
self.create_docks()
self.create_menubar()
self.status_bar = self.statusBar()
self.status_bar.addPermanentWidget(self.boss.save_manager.status_widget)
self.cursor_position_widget = CursorPositionWidget(self)
self.status_bar.addPermanentWidget(self.cursor_position_widget)
self.status_bar.addWidget(QLabel(_('{0} {1} created by {2}').format(__appname__, get_version(), 'Kovid Goyal')))
f = self.status_bar.font()
f.setBold(True)
self.status_bar.setFont(f)
self.boss(self)
g = QApplication.instance().desktop().availableGeometry(self)
self.resize(g.width()-50, g.height()-50)
self.restore_state()
self.apply_settings()
示例3: Main
class Main(MainWindow):
APP_NAME = _('Edit Book')
STATE_VERSION = 0
def __init__(self, opts, notify=None):
MainWindow.__init__(self, opts, disable_automatic_gc=True)
self.setWindowTitle(self.APP_NAME)
self.boss = Boss(self, notify=notify)
self.setWindowIcon(QIcon(I('tweak.png')))
self.opts = opts
self.path_to_ebook = None
self.container = None
self.current_metadata = None
self.blocking_job = BlockingJob(self)
self.keyboard = KeyboardManager(self, config_name='shortcuts/tweak_book')
self.central = Central(self)
self.setCentralWidget(self.central)
self.check_book = Check(self)
self.spell_check = SpellCheck(parent=self)
self.toc_view = TOCViewer(self)
self.saved_searches = SavedSearches(self)
self.image_browser = InsertImage(self, for_browsing=True)
self.reports = Reports(self)
self.check_external_links = CheckExternalLinks(self)
self.insert_char = CharSelect(self)
self.manage_fonts = ManageFonts(self)
self.sr_debug_output = DebugOutput(self)
self.create_actions()
self.create_toolbars()
self.create_docks()
self.create_menubar()
self.status_bar = self.statusBar()
self.status_bar.addPermanentWidget(self.boss.save_manager.status_widget)
self.cursor_position_widget = CursorPositionWidget(self)
self.status_bar.addPermanentWidget(self.cursor_position_widget)
self.status_bar_default_msg = la = QLabel(_('{0} {1} created by {2}').format(__appname__, get_version(), 'Kovid Goyal'))
la.base_template = unicode(la.text())
self.status_bar.addWidget(la)
f = self.status_bar.font()
f.setBold(True)
self.status_bar.setFont(f)
self.boss(self)
g = QApplication.instance().desktop().availableGeometry(self)
self.resize(g.width()-50, g.height()-50)
self.restore_state()
self.apply_settings()
def apply_settings(self):
self.keyboard.finalize()
self.setDockNestingEnabled(tprefs['nestable_dock_widgets'])
for v, h in product(('top', 'bottom'), ('left', 'right')):
p = 'dock_%s_%s' % (v, h)
pref = tprefs[p] or tprefs.defaults[p]
area = getattr(Qt, '%sDockWidgetArea' % capitalize({'vertical':h, 'horizontal':v}[pref]))
self.setCorner(getattr(Qt, '%s%sCorner' % tuple(map(capitalize, (v, h)))), area)
self.preview.apply_settings()
self.live_css.apply_theme()
for bar in (self.global_bar, self.tools_bar, self.plugins_bar):
bar.setIconSize(QSize(tprefs['toolbar_icon_size'], tprefs['toolbar_icon_size']))
def show_status_message(self, msg, timeout=5):
self.status_bar.showMessage(msg, int(timeout*1000))
def elided_text(self, text, width=300):
return elided_text(text, font=self.font(), width=width)
@property
def editor_tabs(self):
return self.central.editor_tabs
def create_actions(self):
group = _('Global Actions')
def reg(icon, text, target, sid, keys, description, toolbar_allowed=False):
if not isinstance(icon, QIcon):
icon = QIcon(I(icon))
ac = actions[sid] = QAction(icon, text, self) if icon else QAction(text, self)
ac.setObjectName('action-' + sid)
if toolbar_allowed:
toolbar_actions[sid] = ac
if target is not None:
ac.triggered.connect(target)
if isinstance(keys, type('')):
keys = (keys,)
self.keyboard.register_shortcut(
sid, unicode(ac.text()).replace('&', ''), default_keys=keys, description=description, action=ac, group=group)
self.addAction(ac)
return ac
def treg(icon, text, target, sid, keys, description):
return reg(icon, text, target, sid, keys, description, toolbar_allowed=icon is not None)
self.action_new_file = treg('document-new.png', _('&New file (images/fonts/HTML/etc.)'), self.boss.add_file,
'new-file', (), _('Create a new file in the current book'))
self.action_import_files = treg('document-import.png', _('&Import files into book'), self.boss.add_files, 'new-files', (), _('Import files into book'))
#.........这里部分代码省略.........
示例4: Main
class Main(MainWindow):
APP_NAME = _('Edit Book')
STATE_VERSION = 0
def __init__(self, opts, notify=None):
MainWindow.__init__(self, opts, disable_automatic_gc=True)
self.boss = Boss(self, notify=notify)
self.setWindowTitle(self.APP_NAME)
self.setWindowIcon(QIcon(I('tweak.png')))
self.opts = opts
self.path_to_ebook = None
self.container = None
self.current_metadata = None
self.blocking_job = BlockingJob(self)
self.keyboard = KeyboardManager(self, config_name='shortcuts/tweak_book')
self.central = Central(self)
self.setCentralWidget(self.central)
self.check_book = Check(self)
self.toc_view = TOCViewer(self)
self.image_browser = InsertImage(self, for_browsing=True)
self.insert_char = CharSelect(self)
self.create_actions()
self.create_toolbars()
self.create_docks()
self.create_menubar()
self.status_bar = self.statusBar()
self.status_bar.addPermanentWidget(self.boss.save_manager.status_widget)
self.cursor_position_widget = CursorPositionWidget(self)
self.status_bar.addPermanentWidget(self.cursor_position_widget)
self.status_bar.addWidget(QLabel(_('{0} {1} created by {2}').format(__appname__, get_version(), 'Kovid Goyal')))
f = self.status_bar.font()
f.setBold(True)
self.status_bar.setFont(f)
self.boss(self)
g = QApplication.instance().desktop().availableGeometry(self)
self.resize(g.width()-50, g.height()-50)
self.restore_state()
self.apply_settings()
def apply_settings(self):
self.keyboard.finalize()
self.setDockNestingEnabled(tprefs['nestable_dock_widgets'])
for v, h in product(('top', 'bottom'), ('left', 'right')):
p = 'dock_%s_%s' % (v, h)
pref = tprefs[p] or tprefs.defaults[p]
area = getattr(Qt, '%sDockWidgetArea' % capitalize({'vertical':h, 'horizontal':v}[pref]))
self.setCorner(getattr(Qt, '%s%sCorner' % tuple(map(capitalize, (v, h)))), area)
self.preview.apply_settings()
def show_status_message(self, msg, timeout=5):
self.status_bar.showMessage(msg, int(timeout*1000))
def elided_text(self, text, width=300):
return elided_text(text, font=self.font(), width=width)
@property
def editor_tabs(self):
return self.central.editor_tabs
def create_actions(self):
group = _('Global Actions')
def reg(icon, text, target, sid, keys, description):
ac = actions[sid] = QAction(QIcon(I(icon)), text, self) if icon else QAction(text, self)
ac.setObjectName('action-' + sid)
if target is not None:
ac.triggered.connect(target)
if isinstance(keys, type('')):
keys = (keys,)
self.keyboard.register_shortcut(
sid, unicode(ac.text()).replace('&', ''), default_keys=keys, description=description, action=ac, group=group)
self.addAction(ac)
return ac
self.action_new_file = reg('document-new.png', _('&New file (images/fonts/HTML/etc.)'), self.boss.add_file,
'new-file', (), _('Create a new file in the current book'))
self.action_import_files = reg(None, _('&Import files into book'), self.boss.add_files, 'new-files', (), _('Import files into book'))
self.action_open_book = reg('document_open.png', _('Open &book'), self.boss.open_book, 'open-book', 'Ctrl+O', _('Open a new book'))
self.action_global_undo = reg('back.png', _('&Revert to before'), self.boss.do_global_undo, 'global-undo', 'Ctrl+Left',
_('Revert book to before the last action (Undo)'))
self.action_global_redo = reg('forward.png', _('&Revert to after'), self.boss.do_global_redo, 'global-redo', 'Ctrl+Right',
_('Revert book state to after the next action (Redo)'))
self.action_save = reg('save.png', _('&Save'), self.boss.save_book, 'save-book', 'Ctrl+S', _('Save book'))
self.action_save.setEnabled(False)
self.action_save_copy = reg('save.png', _('Save a ©'), self.boss.save_copy, 'save-copy', 'Ctrl+Alt+S', _('Save a copy of the book'))
self.action_quit = reg('quit.png', _('&Quit'), self.boss.quit, 'quit', 'Ctrl+Q', _('Quit'))
self.action_preferences = reg('config.png', _('&Preferences'), self.boss.preferences, 'preferences', 'Ctrl+P', _('Preferences'))
self.action_new_book = reg('book.png', _('Create &new, empty book'), self.boss.new_book, 'new-book', (), _('Create a new, empty book'))
# Editor actions
group = _('Editor actions')
self.action_editor_undo = reg('edit-undo.png', _('&Undo'), self.boss.do_editor_undo, 'editor-undo', 'Ctrl+Z',
_('Undo typing'))
self.action_editor_redo = reg('edit-redo.png', _('&Redo'), self.boss.do_editor_redo, 'editor-redo', 'Ctrl+Y',
#.........这里部分代码省略.........
示例5: Main
class Main(MainWindow):
APP_NAME = _("Edit Book")
STATE_VERSION = 0
def __init__(self, opts, notify=None):
MainWindow.__init__(self, opts, disable_automatic_gc=True)
self.boss = Boss(self, notify=notify)
self.setWindowTitle(self.APP_NAME)
self.setWindowIcon(QIcon(I("tweak.png")))
self.opts = opts
self.path_to_ebook = None
self.container = None
self.current_metadata = None
self.blocking_job = BlockingJob(self)
self.keyboard = KeyboardManager(self, config_name="shortcuts/tweak_book")
self.central = Central(self)
self.setCentralWidget(self.central)
self.check_book = Check(self)
self.spell_check = SpellCheck(parent=self)
self.toc_view = TOCViewer(self)
self.saved_searches = SavedSearches(self)
self.image_browser = InsertImage(self, for_browsing=True)
self.insert_char = CharSelect(self)
self.manage_fonts = ManageFonts(self)
self.create_actions()
self.create_toolbars()
self.create_docks()
self.create_menubar()
self.status_bar = self.statusBar()
self.status_bar.addPermanentWidget(self.boss.save_manager.status_widget)
self.cursor_position_widget = CursorPositionWidget(self)
self.status_bar.addPermanentWidget(self.cursor_position_widget)
self.status_bar_default_msg = la = QLabel(
_("{0} {1} created by {2}").format(__appname__, get_version(), "Kovid Goyal")
)
la.base_template = unicode(la.text())
self.status_bar.addWidget(la)
f = self.status_bar.font()
f.setBold(True)
self.status_bar.setFont(f)
self.boss(self)
g = QApplication.instance().desktop().availableGeometry(self)
self.resize(g.width() - 50, g.height() - 50)
self.restore_state()
self.apply_settings()
def apply_settings(self):
self.keyboard.finalize()
self.setDockNestingEnabled(tprefs["nestable_dock_widgets"])
for v, h in product(("top", "bottom"), ("left", "right")):
p = "dock_%s_%s" % (v, h)
pref = tprefs[p] or tprefs.defaults[p]
area = getattr(Qt, "%sDockWidgetArea" % capitalize({"vertical": h, "horizontal": v}[pref]))
self.setCorner(getattr(Qt, "%s%sCorner" % tuple(map(capitalize, (v, h)))), area)
self.preview.apply_settings()
self.live_css.apply_theme()
def show_status_message(self, msg, timeout=5):
self.status_bar.showMessage(msg, int(timeout * 1000))
def elided_text(self, text, width=300):
return elided_text(text, font=self.font(), width=width)
@property
def editor_tabs(self):
return self.central.editor_tabs
def create_actions(self):
group = _("Global Actions")
def reg(icon, text, target, sid, keys, description, toolbar_allowed=False):
if not isinstance(icon, QIcon):
icon = QIcon(I(icon))
ac = actions[sid] = QAction(icon, text, self) if icon else QAction(text, self)
ac.setObjectName("action-" + sid)
if toolbar_allowed:
toolbar_actions[sid] = ac
if target is not None:
ac.triggered.connect(target)
if isinstance(keys, type("")):
keys = (keys,)
self.keyboard.register_shortcut(
sid,
unicode(ac.text()).replace("&", ""),
default_keys=keys,
description=description,
action=ac,
group=group,
)
self.addAction(ac)
return ac
def treg(icon, text, target, sid, keys, description):
return reg(icon, text, target, sid, keys, description, toolbar_allowed=icon is not None)
#.........这里部分代码省略.........