当前位置: 首页>>代码示例>>Python>>正文


Python keyboard.ShortcutConfig类代码示例

本文整理汇总了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)
开发者ID:AEliu,项目名称:calibre,代码行数:27,代码来源:keyboard.py

示例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)
开发者ID:AEliu,项目名称:calibre,代码行数:7,代码来源:keyboard.py

示例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)
开发者ID:kutanari,项目名称:calibre,代码行数:60,代码来源:preferences.py

示例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()
开发者ID:john-peterson,项目名称:count_pages,代码行数:31,代码来源:common_utils.py

示例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()
开发者ID:john-peterson,项目名称:count_pages,代码行数:19,代码来源:common_utils.py

示例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)
开发者ID:kovidgoyal,项目名称:calibre,代码行数:70,代码来源:preferences.py


注:本文中的calibre.gui2.keyboard.ShortcutConfig类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。