コード例 #1
0
ファイル: vocabularypage.py プロジェクト: cburgmer/eclectus
    def setupActions(self):
        self._editAction = QAction(KIcon('document-properties'),
            i18n('&Edit Translation'), self)
        self._editAction.setShortcut(Qt.Key_Return)
        self._editAction.setShortcutContext(Qt.WidgetShortcut)
        self.connect(self._editAction, SIGNAL("triggered(bool)"),
            lambda: self.vocabularyListView.edit(
                self.vocabularyListView.currentIndex()))
        self.connect(self.vocabularyListView, SIGNAL("returnPressed()"),
            self._editAction.trigger) # TODO

        self._selectAllAction = KStandardAction.selectAll(
            self.vocabularyListView.selectAll, self)

        self._removeAction = QAction(KIcon('list-remove'),
            i18n('&Remove Selected'), self)
        #c = QShortcut(self)
        #c.setKey(Qt.Key_Delete)
        #c.setContext(Qt.WidgetShortcut)
        #self.connect(c, SIGNAL("activated()"), self._removeAction.trigger)
        self._removeAction.setShortcut(Qt.Key_Delete)
        self._removeAction.setShortcutContext(Qt.WidgetShortcut)
        self.connect(self.vocabularyListView, SIGNAL("deletePressed()"),
            self._removeAction.trigger) # TODO
        self.connect(self.vocabularyListView.selectionModel(),
            SIGNAL("selectionChanged(const QItemSelection &, const QItemSelection &)"),
            lambda: self._removeAction.setEnabled(
                self.vocabularyListView.selectionModel().hasSelection()))
        self.connect(self._removeAction, SIGNAL("triggered(bool)"),
            lambda: self.vocabularyModel.remove(
                self.vocabularyListView.selectedIndexes()))
コード例 #2
0
ファイル: MainControl.py プロジェクト: Ebolon/pynal
 def createActions(self):
     actionCollection = self.window.actionCollection()
     # File Menu
     KStandardAction.openNew(self.new_file, actionCollection)
     KStandardAction.open(self.open_file, actionCollection)
     KStandardAction.openRecent(self.open_file_recent, actionCollection)   
     KStandardAction.save(self.save_file, actionCollection)
     KStandardAction.quit(self.quit, actionCollection)
     
     # Edit Menu
     KStandardAction.undo(self.undo, actionCollection)
     KStandardAction.redo(self.redo, actionCollection)
     KStandardAction.copy(self.copy, actionCollection)
     KStandardAction.paste(self.paste, actionCollection)
     KStandardAction.cut(self.cut, actionCollection)
     
     # View Menu
     KStandardAction.zoomIn(self.zoom_in, actionCollection)
     KStandardAction.zoomOut(self.zoom_out, actionCollection)
     
     # Settings Menu
     KStandardAction.selectAll(self.select_all, actionCollection)