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


Python hotkeyparser.HotKeyParser类代码示例

本文整理汇总了Python中outwiker.gui.hotkeyparser.HotKeyParser的典型用法代码示例。如果您正苦于以下问题:Python HotKeyParser类的具体用法?Python HotKeyParser怎么用?Python HotKeyParser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了HotKeyParser类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testToString

    def testToString(self):
        self.assertEqual(HotKeyParser.toString(HotKey("A")), "A")
        self.assertEqual(HotKeyParser.toString(HotKey("F1")), "F1")

        self.assertEqual(HotKeyParser.toString(HotKey("A", ctrl=True)),
                         "Ctrl+A")

        self.assertEqual(HotKeyParser.toString(HotKey("A", shift=True)),
                         "Shift+A")

        self.assertEqual(HotKeyParser.toString(HotKey("A", alt=True)),
                         "Alt+A")

        self.assertEqual(HotKeyParser.toString(
            HotKey("A", ctrl=True, alt=True)),
            "Ctrl+Alt+A")

        self.assertEqual(HotKeyParser.toString(
            HotKey("A", ctrl=True, shift=True)),
            "Ctrl+Shift+A")

        self.assertEqual(HotKeyParser.toString(
            HotKey("A", alt=True, shift=True)),
            "Shift+Alt+A")

        self.assertEqual(HotKeyParser.toString(
            HotKey("A", ctrl=True, alt=True, shift=True)),
            "Ctrl+Shift+Alt+A")
开发者ID:Jenyay,项目名称:outwiker,代码行数:28,代码来源:test_hotkeyparser.py

示例2: testParse7

    def testParse7 (self):
        hotkey = HotKeyParser.fromString (u"+")

        self.assertEqual (hotkey.key, u"+")
        self.assertFalse (hotkey.ctrl)
        self.assertFalse (hotkey.shift)
        self.assertFalse (hotkey.alt)
开发者ID:LihMeh,项目名称:outwiker,代码行数:7,代码来源:hotkeyparser.py

示例3: testParse5

    def testParse5 (self):
        hotkey = HotKeyParser.fromString (u"Shift+Alt+Ctrl+F1")

        self.assertEqual (hotkey.key, "F1")
        self.assertTrue (hotkey.ctrl)
        self.assertTrue (hotkey.shift)
        self.assertTrue (hotkey.alt)
开发者ID:LihMeh,项目名称:outwiker,代码行数:7,代码来源:hotkeyparser.py

示例4: testParse4

    def testParse4 (self):
        hotkey = HotKeyParser.fromString (u"Alt+A")

        self.assertEqual (hotkey.key, "A")
        self.assertFalse (hotkey.ctrl)
        self.assertFalse (hotkey.shift)
        self.assertTrue (hotkey.alt)
开发者ID:LihMeh,项目名称:outwiker,代码行数:7,代码来源:hotkeyparser.py

示例5: testParse13

    def testParse13 (self):
        hotkey = HotKeyParser.fromString (u" Ctrl + F1 ")

        self.assertEqual (hotkey.key, u"F1")
        self.assertTrue (hotkey.ctrl)
        self.assertFalse (hotkey.shift)
        self.assertFalse (hotkey.alt)
开发者ID:LihMeh,项目名称:outwiker,代码行数:7,代码来源:hotkeyparser.py

示例6: testParse9

    def testParse9 (self):
        hotkey = HotKeyParser.fromString (u"ShIfT+ALT+ctrl+F1")

        self.assertEqual (hotkey.key, "F1")
        self.assertTrue (hotkey.ctrl)
        self.assertTrue (hotkey.shift)
        self.assertTrue (hotkey.alt)
开发者ID:LihMeh,项目名称:outwiker,代码行数:7,代码来源:hotkeyparser.py

示例7: testParse8

    def testParse8(self):
        hotkey = HotKeyParser.fromString("Ctrl++")

        self.assertEqual(hotkey.key, "+")
        self.assertTrue(hotkey.ctrl)
        self.assertFalse(hotkey.shift)
        self.assertFalse(hotkey.alt)
开发者ID:Jenyay,项目名称:outwiker,代码行数:7,代码来源:test_hotkeyparser.py

示例8: _getToolbarItemTitle

    def _getToolbarItemTitle (self, strid):
        hotkey = self.getHotKey (strid)
        title = self.getTitle (strid)

        if hotkey == None:
            return title

        return u"{0} ({1})".format (title, HotKeyParser.toString (hotkey))
开发者ID:smogendrr,项目名称:outwiker,代码行数:8,代码来源:wxactioncontroller.py

示例9: _getMenuItemTitle

    def _getMenuItemTitle (self, strid):
        hotkey = self.getHotKey (strid)
        title = self.getTitle (strid)

        if hotkey is None:
            return title

        return u"{0}\t{1}".format (title, HotKeyParser.toString (hotkey))
开发者ID:theoden-dd,项目名称:outwiker,代码行数:8,代码来源:actioncontroller.py

示例10: _assertMenuItemExists

    def _assertMenuItemExists (self, menu, title, hotkey):
        """
        Проверить, что в меню есть элемент с заголовком (title + '\t' + hotkey)
        """
        menuItemId = menu.FindItem (title)
        self.assertNotEqual (menuItemId, wx.NOT_FOUND)

        menuItem = menu.FindItemById (menuItemId)
        
        if hotkey != None:
            self.assertEqual (menuItem.GetItemLabel(), title + "\t" + HotKeyParser.toString (hotkey))
        else:
            self.assertEqual (menuItem.GetItemLabel(), title)
开发者ID:qyqx,项目名称:outwiker,代码行数:13,代码来源:actioncontroller.py

示例11: testHotKeysDefaultToolBar

    def testHotKeysDefaultToolBar (self):
        action = TestAction()
        hotkey = HotKey ("T", ctrl=True)
        toolbar = self.wnd.toolbars[self.wnd.PLUGINS_TOOLBAR_STR]
        image = "../test/images/save.png"

        self.actionController.register (action, hotkey=hotkey)
        self.assertEqual (self.actionController.getHotKey (action.stringId), hotkey)

        self.actionController.appendToolbarButton (action.stringId, 
                toolbar,
                image)

        self.assertEqual (self._getToolItemLabel (toolbar, action.stringId), 
                u"{0} ({1})".format (action.title, HotKeyParser.toString (hotkey) ) )
开发者ID:qyqx,项目名称:outwiker,代码行数:15,代码来源:actioncontroller.py

示例12: _prepareToWrite

 def _prepareToWrite (self, value):
     return u"" if value == None else HotKeyParser.toString (value)
开发者ID:qyqx,项目名称:outwiker,代码行数:2,代码来源:hotkeyoption.py

示例13: _loadValue

 def _loadValue (self):
     """
     Получить значение. В производных классах этот метод переопределяется
     """
     return HotKeyParser.fromString (self.config.get (self.section, self.param))
开发者ID:qyqx,项目名称:outwiker,代码行数:5,代码来源:hotkeyoption.py


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