def _load_shortcuts(self): for action in resources.CUSTOM_SHORTCUTS: shortcut_action = resources.get_shortcut(action) #populate the tree widget tree_data = [ self.shortcuts_text[action], shortcut_action.toString(QKeySequence.NativeText), action ] item = QTreeWidgetItem(self.result_widget, tree_data) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
def _load_defaults_shortcuts(self): #clean custom shortcuts and UI widget resources.clean_custom_shortcuts() self.result_widget.clear() for name, action in list(resources.SHORTCUTS.items()): shortcut_action = action #populate the tree widget tree_data = [ self.shortcuts_text[name], shortcut_action.toString(QKeySequence.NativeText), name ] item = QTreeWidgetItem(self.result_widget, tree_data) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
def __init__(self,parent=None): QDialog.__init__(self,parent) self.setupUi(self) #center this window screen = QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2) for item in PluginAdapter().new().readInfos(): itree = QTreeWidgetItem() for i in range(6): itree.setText(i,str(item[i])) self.pluginList.addTopLevelItem(itree) QObject.connect(self.pluginList, SIGNAL("customContextMenuRequested (const QPoint&)"),self.__evt_contextmenu)
def __downloadFileDone(self, error): """ Private method called, after the file has been downloaded from the internet. @param error flag indicating an error condition (boolean) """ if self.__downloadFile.exists(): filename = self.__downloadFile.fileName() #Notice must flush it first self.__downloadFile.flush() if not zipfile.is_zipfile(filename): plugins_info = open(filename).readlines() self.pluginList.clear() for plugin_info in plugins_info: try: plugin_name = plugin_info.split('|')[0] plugin_version = plugin_info.split('|')[1] plugin_instruction = plugin_info.split('|')[2] plugin_author = plugin_info.split('|')[3] itree = QTreeWidgetItem() itree.setText(0, plugin_name) itree.setText(1, plugin_author) itree.setText(2, plugin_version) itree.setText(3, plugin_instruction) self.pluginList.addTopLevelItem(itree) except Exception as e: raise e else: pluginDir = getPrccisePath( "pluginsDir", "", "extdir") if sys.platform.startswith( "win") else getPrccisePath("pluginsDir", "", "userdir") tmpZip = zipfile.ZipFile(filename) for file in tmpZip.namelist(): tmpZip.extract(file, pluginDir) tmpZip.close() self.result_label.setText("Success install the plugin ")
def __init__(self, parent=None): QDialog.__init__(self, parent) self.setupUi(self) #center this window screen = QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2) for item in PluginAdapter().new().readInfos(): itree = QTreeWidgetItem() for i in range(6): itree.setText(i, str(item[i])) self.pluginList.addTopLevelItem(itree) QObject.connect(self.pluginList, SIGNAL("customContextMenuRequested (const QPoint&)"), self.__evt_contextmenu)
def __downloadFileDone(self, error): """ Private method called, after the file has been downloaded from the internet. @param error flag indicating an error condition (boolean) """ if self.__downloadFile.exists(): filename = self.__downloadFile.fileName() #Notice must flush it first self.__downloadFile.flush() if not zipfile.is_zipfile(filename): plugins_info = open(filename).readlines() self.pluginList.clear() for plugin_info in plugins_info: try: plugin_name = plugin_info.split('|')[0] plugin_version = plugin_info.split('|')[1] plugin_instruction = plugin_info.split('|')[2] plugin_author = plugin_info.split('|')[3] itree = QTreeWidgetItem() itree.setText(0,plugin_name) itree.setText(1,plugin_author) itree.setText(2,plugin_version) itree.setText(3,plugin_instruction) self.pluginList.addTopLevelItem(itree) except Exception as e: raise e else: pluginDir = getPrccisePath("pluginsDir", "", "extdir") if sys.platform.startswith("win") else getPrccisePath("pluginsDir", "", "userdir") tmpZip = zipfile.ZipFile(filename) for file in tmpZip.namelist(): tmpZip.extract(file,pluginDir) tmpZip.close() self.result_label.setText("Success install the plugin ")
def __setupActions(self, namespace, actions): """ get the global shortcuts config and values """ top = QTreeWidgetItem() top.setText(0, namespace) for key in actions.keys(): action = actions.get(key) item = ShortcutQTreeWidgetItem() item.setShorcutMark(key) item.setText(0, action.text()) item.setIcon(0, action.icon()) skey = Prefs.new().getShortcut(key) if skey is None or skey == "": skey = action.shortcut().toString() item.setText(1, skey) top.addChild(item) self.shortcutsList.addTopLevelItem(top) top.setExpanded(True)
def __setupActions(self,namespace,actions): """ get the global shortcuts config and values """ top = QTreeWidgetItem() top.setText(0,namespace) for key in actions.keys(): action = actions.get(key) item = ShortcutQTreeWidgetItem() item.setShorcutMark(key) item.setText(0,action.text()) item.setIcon(0,action.icon()) skey = Prefs.new().getShortcut(key) if skey is None or skey == "": skey = action.shortcut().toString() item.setText(1,skey) top.addChild(item) self.shortcutsList.addTopLevelItem(top) top.setExpanded(True)
def __init__(self): QTreeWidgetItem.__init__(self) self.__shortcutmark = ""
def __init__(self,modName): QTreeWidgetItem.__init__(self) self.__pageName = modName