def onChangeContext(event): """called to handle 'change context' request""" frame = util.getMainFrame() preferences = preference.Preferences() newContext = frame.chooseDirectory("Select a directory", preferences.getRecentContexts()[0]) if newContext is not None: pvscomm.PVSCommandManager().changeContext(newContext)
def pvsContextUpdated(self): newContext = preference.Preferences().getRecentContexts()[0] item = self.tree.GetFirstChild(self.tree.GetRootItem())[0] while item.IsOk(): data = self.tree.GetItemPyData(item) if LCONTEXT in data: contextName = data[LCONTEXT] newImage = self.imageIndices[ LCONTEXT] if newContext == contextName else self.imageIndices[ LINACTIVECONTEXT] self.tree.SetItemImage(item, newImage) item = self.tree.GetNextSibling(item)
def processResponse(self, evt): pvsMode = evt.pvsmode context = evt.context result = evt.result resultfn = evt.resultfn if pvsMode != self.pvsMode: self.pvsMode = pvsMode pub.sendMessage(constants.PUB_UPDATEPVSMODE, pvsMode=pvsMode) if context != self.pvsContext: self.pvsContext = context import preference preference.Preferences().setRecentContext(context) logging.debug("New Context is: %s", context) pub.sendMessage(constants.PUB_UPDATEPVSCONTEXT) if resultfn is not None: resultfn(result) PVSCommunicator()._validateJSON(result)
def initializePlugins(self, pluginsDefinitions): import preference preference = preference.Preferences() self.pluginsDefinitions = pluginsDefinitions for pluginDefinitions in pluginsDefinitions: self.create(pluginDefinitions)
def closeFile(fullname): preference.Preferences().setRecentFile(fullname) pub.sendMessage(constants.PUB_CLOSEFILE, fullname=fullname) pub.sendMessage(constants.PUB_PREPARERECENTFILESMENU) pub.sendMessage(constants.PUB_NUMBEROFOPENFILESCHANGED)
def openFile(fullname): pub.sendMessage(constants.PUB_ADDFILE, fullname=fullname) preference.Preferences().removeFromRecentFiles(fullname) pub.sendMessage(constants.PUB_PREPARERECENTFILESMENU) pub.sendMessage(constants.PUB_NUMBEROFOPENFILESCHANGED)