def testInstance(self): """ test retrieving global instance """ self.assertTrue(QgsGui.shortcutsManager()) # register an action to the singleton action = QAction('test', None) QgsGui.shortcutsManager().registerAction(action) # check that the same instance is returned self.assertEqual(QgsGui.shortcutsManager().listActions(), [action]) s2 = QgsShortcutsManager() self.assertEqual(s2.listActions(), [])
def allQgisActions(self): """ Reads all registered actions on QGIS GUI. :return: (dict) a map from action name to its action object. """ sm = QgsGui.shortcutsManager() actions = dict() for item in sm.listAll(): if isinstance(item, QAction): # remove the mnemonic shortcuts added by Qt (which might remove # actual characters) actions[item.text().replace("&", "")] = item return actions
def __init__(self, abstractDb, returnDict = False, parent = None): """ Constructor """ super(self.__class__, self).__init__(parent) self.abstractDb = abstractDb self.edgvVersion = self.abstractDb.getDatabaseVersion() if self.abstractDb.db.driverName() == 'QPSQL': self.geomTypeDict = self.abstractDb.getGeomTypeDict() self.geomDict = self.abstractDb.getGeomDict(self.geomTypeDict) self.domainDict = self.abstractDb.getDbDomainDict(self.geomDict) self.geomStructDict = self.abstractDb.getGeomStructDict() self.returnDict = returnDict self.setupUi(self) self.tableComboBox.setCurrentIndex(-1) self.populateClassList() self.treeWidget.setContextMenuPolicy(Qt.CustomContextMenu) self.treeWidget.customContextMenuRequested.connect(self.createMenu) self.folder = os.path.join(os.path.dirname(__file__), 'FieldSetupConfigs') #re-do this self.optionalDict = {self.tr('Yes'):'1', self.tr('No'):'0'} self.buttonPropDict = dict() self.shortcutsManager = QgsGui.shortcutsManager() self.qgisShortcutList = self.getQGISShortcutList()
def __init__(self): self.sManager = QgsGui.shortcutsManager() self.objList = [ ] # lista di coppie (shortcut KeySequence) o (action KeySequence)