本文整理汇总了Python中calibre.gui2.keyboard.ShortcutConfig类的典型用法代码示例。如果您正苦于以下问题:Python ShortcutConfig类的具体用法?Python ShortcutConfig怎么用?Python ShortcutConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ShortcutConfig类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ConfigWidget
class ConfigWidget(ConfigWidgetBase):
def genesis(self, gui):
self.gui = gui
self.conf_widget = ShortcutConfig(self)
self.conf_widget.changed_signal.connect(self.changed_signal)
self._layout = l = QVBoxLayout()
self.setLayout(l)
l.addWidget(self.conf_widget)
def initialize(self):
ConfigWidgetBase.initialize(self)
self.conf_widget.initialize(self.gui.keyboard)
def restore_defaults(self):
ConfigWidgetBase.restore_defaults(self)
self.conf_widget.restore_defaults()
def commit(self):
self.conf_widget.commit()
return ConfigWidgetBase.commit(self)
def refresh_gui(self, gui):
gui.keyboard.finalize()
def highlight_group(self, group_name):
self.conf_widget.highlight_group(group_name)
示例2: genesis
def genesis(self, gui):
self.gui = gui
self.conf_widget = ShortcutConfig(self)
self.conf_widget.changed_signal.connect(self.changed_signal)
self._layout = l = QVBoxLayout()
self.setLayout(l)
l.addWidget(self.conf_widget)
示例3: __init__
def __init__(self, gui, initial_panel=None):
QDialog.__init__(self, gui)
self.l = l = QGridLayout(self)
self.setLayout(l)
self.setWindowTitle(_('Preferences for Tweak Book'))
self.setWindowIcon(QIcon(I('config.png')))
self.stacks = QStackedWidget(self)
l.addWidget(self.stacks, 0, 1, 1, 1)
self.categories_list = cl = QListWidget(self)
cl.currentRowChanged.connect(self.stacks.setCurrentIndex)
cl.clearPropertyFlags()
cl.setViewMode(cl.IconMode)
cl.setFlow(cl.TopToBottom)
cl.setMovement(cl.Static)
cl.setWrapping(False)
cl.setSpacing(15)
cl.setWordWrap(True)
l.addWidget(cl, 0, 0, 1, 1)
self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
self.rdb = b = bb.addButton(_('Restore all defaults'), bb.ResetRole)
b.setToolTip(_('Restore defaults for all preferences'))
b.clicked.connect(self.restore_all_defaults)
self.rcdb = b = bb.addButton(_('Restore current defaults'), bb.ResetRole)
b.setToolTip(_('Restore defaults for currently displayed preferences'))
b.clicked.connect(self.restore_current_defaults)
l.addWidget(bb, 1, 0, 1, 2)
self.resize(800, 600)
geom = tprefs.get('preferences_geom', None)
if geom is not None:
self.restoreGeometry(geom)
self.keyboard_panel = ShortcutConfig(self)
self.keyboard_panel.initialize(gui.keyboard)
self.editor_panel = EditorSettings(self)
self.integration_panel = IntegrationSettings(self)
for name, icon, panel in [
(_('Editor settings'), 'modified.png', 'editor'),
(_('Keyboard shortcuts'), 'keyboard-prefs.png', 'keyboard'),
(_('Integration with calibre'), 'lt.png', 'integration'),
]:
i = QListWidgetItem(QIcon(I(icon)), name, cl)
cl.addItem(i)
self.stacks.addWidget(getattr(self, panel + '_panel'))
cl.setCurrentRow(0)
cl.item(0).setSelected(True)
w, h = cl.sizeHintForColumn(0), 0
for i in xrange(cl.count()):
h = max(h, cl.sizeHintForRow(i))
cl.item(i).setSizeHint(QSize(w, h))
cl.setMaximumWidth(cl.sizeHintForColumn(0) + 35)
cl.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
示例4: KeyboardConfigDialog
class KeyboardConfigDialog(SizePersistedDialog):
'''
This dialog is used to allow editing of keyboard shortcuts.
'''
def __init__(self, gui, group_name):
SizePersistedDialog.__init__(self, gui, 'Keyboard shortcut dialog')
self.gui = gui
self.setWindowTitle('Keyboard shortcuts')
layout = QVBoxLayout(self)
self.setLayout(layout)
self.keyboard_widget = ShortcutConfig(self)
layout.addWidget(self.keyboard_widget)
self.group_name = group_name
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
button_box.accepted.connect(self.commit)
button_box.rejected.connect(self.reject)
layout.addWidget(button_box)
# Cause our dialog size to be restored from prefs or created on first usage
self.resize_dialog()
self.initialize()
def initialize(self):
self.keyboard_widget.initialize(self.gui.keyboard)
self.keyboard_widget.highlight_group(self.group_name)
def commit(self):
self.keyboard_widget.commit()
self.accept()
示例5: __init__
def __init__(self, gui, group_name):
SizePersistedDialog.__init__(self, gui, 'Keyboard shortcut dialog')
self.gui = gui
self.setWindowTitle('Keyboard shortcuts')
layout = QVBoxLayout(self)
self.setLayout(layout)
self.keyboard_widget = ShortcutConfig(self)
layout.addWidget(self.keyboard_widget)
self.group_name = group_name
button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
button_box.accepted.connect(self.commit)
button_box.rejected.connect(self.reject)
layout.addWidget(button_box)
# Cause our dialog size to be restored from prefs or created on first usage
self.resize_dialog()
self.initialize()
示例6: __init__
def __init__(self, gui, initial_panel=None):
QDialog.__init__(self, gui)
self.l = l = QGridLayout(self)
self.setLayout(l)
self.setWindowTitle(_("Preferences for Edit Book"))
self.setWindowIcon(QIcon(I("config.png")))
self.stacks = QStackedWidget(self)
l.addWidget(self.stacks, 0, 1, 1, 1)
self.categories_list = cl = QListWidget(self)
cl.currentRowChanged.connect(self.stacks.setCurrentIndex)
cl.clearPropertyFlags()
cl.setViewMode(cl.IconMode)
cl.setFlow(cl.TopToBottom)
cl.setMovement(cl.Static)
cl.setWrapping(False)
cl.setSpacing(15)
cl.setWordWrap(True)
l.addWidget(cl, 0, 0, 1, 1)
self.bb = bb = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
self.rdb = b = bb.addButton(_("Restore all defaults"), bb.ResetRole)
b.setToolTip(_("Restore defaults for all preferences"))
b.clicked.connect(self.restore_all_defaults)
self.rcdb = b = bb.addButton(_("Restore current defaults"), bb.ResetRole)
b.setToolTip(_("Restore defaults for currently displayed preferences"))
b.clicked.connect(self.restore_current_defaults)
self.rconfs = b = bb.addButton(_("Restore confirmations"), bb.ResetRole)
b.setToolTip(_("Restore all disabled confirmation prompts"))
b.clicked.connect(self.restore_confirmations)
l.addWidget(bb, 1, 0, 1, 2)
self.resize(800, 600)
geom = tprefs.get("preferences_geom", None)
if geom is not None:
self.restoreGeometry(geom)
self.keyboard_panel = ShortcutConfig(self)
self.keyboard_panel.initialize(gui.keyboard)
self.editor_panel = EditorSettings(self)
self.integration_panel = IntegrationSettings(self)
self.main_window_panel = MainWindowSettings(self)
self.preview_panel = PreviewSettings(self)
self.toolbars_panel = ToolbarSettings(self)
for name, icon, panel in [
(_("Main window"), "page.png", "main_window"),
(_("Editor settings"), "modified.png", "editor"),
(_("Preview settings"), "viewer.png", "preview"),
(_("Keyboard shortcuts"), "keyboard-prefs.png", "keyboard"),
(_("Toolbars"), "wizard.png", "toolbars"),
(_("Integration with calibre"), "lt.png", "integration"),
]:
i = QListWidgetItem(QIcon(I(icon)), name, cl)
cl.addItem(i)
self.stacks.addWidget(getattr(self, panel + "_panel"))
cl.setCurrentRow(0)
cl.item(0).setSelected(True)
w, h = cl.sizeHintForColumn(0), 0
for i in xrange(cl.count()):
h = max(h, cl.sizeHintForRow(i))
cl.item(i).setSizeHint(QSize(w, h))
cl.setMaximumWidth(cl.sizeHintForColumn(0) + 35)
cl.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)