diff -r c81397b665b6 -r daa6941fe21a canfestival/canfestival.py --- a/canfestival/canfestival.py Mon Jun 18 02:35:21 2012 +0200 +++ b/canfestival/canfestival.py Mon Jun 18 19:34:41 2012 +0200 @@ -13,7 +13,7 @@ from commondialogs import CreateNodeDialog import wx -from SlaveEditor import SlaveEditor +from SlaveEditor import SlaveEditor, MasterViewer from NetworkEditor import NetworkEditor from gnosis.xml.pickle import * @@ -113,14 +113,22 @@ if self._View is not None: self._View.SetBusId(self.GetCurrentLocation()) return self._View - + + def _ExportSlave(self): + dialog = wx.FileDialog(self.GetCTRoot().AppFrame, _("Choose a file"), os.getcwd(), "", _("EDS files (*.eds)|*.eds|All files|*.*"), wx.SAVE|wx.OVERWRITE_PROMPT) + if dialog.ShowModal() == wx.ID_OK: + result = eds_utils.GenerateEDSFile(dialog.GetPath(), self.GetCurrentNodeCopy()) + if result: + self.GetCTRoot().logger.write_error(_("Error: Export slave failed\n")) + dialog.Destroy() + ConfNodeMethods = [ - {"bitmap" : "NetworkEdit", - "name" : "Edit slave", - "tooltip" : "Edit CanOpen slave with ObjdictEdit", - "method" : "_OpenView"}, + {"bitmap" : "ExportSlave", + "name" : _("Export slave"), + "tooltip" : _("Export CanOpen slave to EDS file"), + "method" : "_ExportSlave"}, ] - + def CTNTestModified(self): return self.ChangesToSave or self.OneFileHasChanged() @@ -188,16 +196,22 @@ self.Parent = parent self.Fullname = fullname - + + def GetIconPath(self): + return None + def OnCloseEditor(self, view): self.Parent.OnCloseEditor(view) def CTNFullName(self): return self.Fullname + def CTNTestModified(self): + return False + def GetBufferState(self): return self.GetCurrentBufferState() - + ConfNodeMethods = [] class _NodeListCTN(NodeList): @@ -258,7 +272,7 @@ app_frame = self.GetCTRoot().AppFrame manager = MiniNodeManager(self, masterpath, self.CTNFullName() + ".generated_master") - self._GeneratedMasterView = SlaveEditor(app_frame.TabsOpened, manager, app_frame, False) + self._GeneratedMasterView = MasterViewer(app_frame.TabsOpened, manager, app_frame) app_frame.EditProjectElement(self._GeneratedMasterView, name) @@ -270,10 +284,6 @@ return self._View ConfNodeMethods = [ - {"bitmap" : "NetworkEdit", - "name" : _("Edit network"), - "tooltip" : _("Edit CanOpen Network with NetworkEdit"), - "method" : "_OpenView"}, {"bitmap" : "ShowMaster", "name" : _("Show Master"), "tooltip" : _("Show Master generated by config_utils"),