Ejemplo n.º 1
0
    def _createActions(self):
        makeFirst = QAction('Set item first', self)
        makeFirst.setShortcut(Qt.Key_1)
        makeFirst.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        makeFirst.triggered.connect(self._makeSelectedFirst)
        self.addAction(makeFirst)

        add = QAction('Add item', self)
        add.setShortcut(Qt.Key_A)
        add.setShortcutContext(Qt.WidgetWithChildrenShortcut)
        add.triggered.connect(self._addNewItem)
        self.addAction(add)
Ejemplo n.º 2
0
def add_menu_actions(menu, menu_options):
    for mp in menu_options:

        k = mp[0]
        t = mp[1]
        cb = mp[2]

        hk = 0
        if k:
            hk = get_config_value(k)

        act = QAction(t, menu)
        if hk:
            act.setShortcut(QKeySequence(hk))
            act.setShortcutContext(Qt.ApplicationShortcut)

        if len(mp) > 3:
            icon = mp[3]
            icon = QIcon(utility.misc.get_web_folder_path() + "icons/" + icon)
            act.setIcon(icon)

        act.triggered.connect(cb)
        menu.addAction(act)