Esempio n. 1
0
    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)
Esempio n. 2
0
 def connect(self, frm, to, auto_redraw=False):
     if self.isConnection(frm, to): return
     
     try:
         con = emConnection(frm,to)
     except Exception, e:
         showExceptionDialog(self, -1, "Unable to connect %s with %s"%(frm.getName(),to.getName()))
Esempio n. 3
0
    def OnSaveAs(self, evt):
        dlg = SaveAsDialog(self, -1)
        if dlg.ShowModal()==wx.ID_CANCEL:
            dlg.Destroy()
            return
        uri = dlg.getSelection()
        dlg.Destroy()

        try:
            txt = self._to_xml().toprettyxml("  ")
            self._model.saveURI(uri, txt)
        except:
            showExceptionDialog(self, -1, "Unable to save file to %s"%uri)

        self.setURI(uri)
        self.setTitle(uri)
        self._circtree.addURI(uri)
        self.setModified(False)
        self._updateMainFrame()