コード例 #1
0
 def saveURI(self, uri, txt=None):
     if not uri in self._module_list.keys():
         # create module...
         mod_name = getModuleName(uri)+".xml"
         mod_path = os.path.join(self._base_path, mod_name)
         if os.path.isfile(mod_path): raise Exception("File %s allready exists!"%mod_path)
         f = open(mod_path,"w")
         f.write(txt)
         f.close()
         mod = eDevModelModule(mod_path)
         self._module_list[uri] = mod
         return
     # save module
     mod = self._module_list[uri]
     mod.setText(txt)
コード例 #2
0
 def OnSaveAs(self, evt=None):
     selected = False
     while not selected:
         dlg = Dialogs.eDevSaveModuleAsDialog(self, -1)
         if dlg.ShowModal() != wx.ID_OK:
             return
         uri = "mod://%s"%dlg.getSelection()
         dlg.Destroy()
         if self._model.checkURI(uri):
             # FIXME Override?
             continue
         selected = True
     
     if not self._model.checkURI(uri):
         self._controller.DocumentSave(uri, self._toXML())
         self._moduletree.addURI(uri)
     else:
         self._controller.DocumentSave(uri, self._toXML())
     self.setURI(uri)
     self.setTitle( getModuleName(uri) )
コード例 #3
0
    def __init__(self, parent, ID, uri):
        ScrolledPanel.__init__(self, parent, ID)
        eDevEditorInterface.__init__(self, parent, False, uri)

        self._controller = Controller()
        self._model      = Model()
        self._mainframe  = self._controller.getMainFrame()
        self._component_manager = ComponentManager()
        self._moduletree = self._component_manager.getComponent("modeditor").getModuleTree()
        self._notebook   = self._controller.getNotebook()


        if uri == "mod://":
            txt = '<?xml version="1.0"?><Module version="1.0"/>'
            title = "unsaved"
        else:
            txt = self._model.openURI(uri)
            title = getModuleName(uri)
        self.setTitle(title)
        
        self._d_doc = xml.dom.minidom.parseString(txt)

        vert_box = wx.BoxSizer(wx.VERTICAL)
        self._d_basic_data = eDevModuleEditorBasic(self, -1, self._d_doc)
        self._d_require = eDevModuleEditorRequire(self, -1, self._d_doc)
        self._d_provide = eDevModuleEditorProvide(self, -1, self._d_doc)

        self.Bind(Events.EVT_MODIFIED, self.OnModified, self._d_basic_data)
        self.Bind(Events.EVT_MODIFIED, self.OnModified, self._d_require)
        self.Bind(Events.EVT_MODIFIED, self.OnModified, self._d_provide)

        vert_box.Add(self._d_basic_data, 0, wx.EXPAND|wx.ALL, 15)
        vert_box.Add(self._d_require, 0, wx.EXPAND|wx.ALL, 15)
        vert_box.Add(self._d_provide, 0, wx.EXPAND|wx.ALL, 15)

        self.SetSizer(vert_box)
        self.SetAutoLayout(1)
        self.SetupScrolling()