def loadModule(self, uri, x, y, params=None): self._logger.debug("load module %s @ (%s %s) with %s"%(uri, x,y, params)) (proto, path) = Tools.splitURI(uri) name = ".".join(path.split("/")) self._logger.debug("Get prameter for module %s"%name) try: (path, meta) = self._importer.getModuleMeta(name) except: showExceptionDialog(self, -1, "Unable to load module %s"%name) return if len(meta.getParameters()) > 0 and params==None: param_dialog = ParameterDialog(self, -1, name) if not wx.ID_OK == param_dialog.ShowModal(): self._logger.info("Module load aborted!") param_dialog.Destroy() return params = param_dialog.parameters param_dialog.Destroy() elif params==None: params = dict() self._logger.debug("Instance and place module with params: %s"%params) try: mod = self._importer.loadGrafical(self, (x,y), name, params) except Exception, e: showExceptionDialog(self, -1, "Unable to load/import module \"%s\""%name)
def saveURI(self, uri, data): if uri == "circ://": raise Exception("Invaid uri %s"%uri) if not uri in self._circuits.keys(): (proto, path) = Tools.splitURI(uri) path = ".".join(path.split("/"))+".xml" path = os.path.join(self._base_path, path) circ = CircuitModel(path) self._circuits[uri] = circ self._circuits[uri].setText(data)
def addURI(self, uri): if self.hasURI(uri,self._d_root): return (proto, path) = Tools.splitURI(uri) if not proto == "mod": return self.popClasses([uri])