Esempio n. 1
0
    def OnItemEdit(self, evt):
        """ Edition menu has been invoked.
		"""

        item = self.GetSelection()
        path = self.GetItemPyData(item)

        ### virtual DEVS component just for edition
        devscomp = DEVSComponent()

        ### path depends on the nature of droped component
        ### if pure python path
        if path.endswith('.py'):
            devscomp.setDEVSPythonPath(path)
        ### if devsimpy model
        elif zipfile.is_zipfile(path):
            #zf = Zip(path)
            devscomp.setDEVSPythonPath(
                os.path.join(path, getPythonModelFileName(path)))
            devscomp.model_path = path
        else:
            sys.stdout.write(
                _('The code of this type of model is not editable.'))
            return

        ### call frame editor
        DEVSComponent.OnEditor(devscomp, evt)