Adding file with generated master in build folder and a button for editing it with objdictedit
--- a/plugger.py Sun Dec 09 19:01:21 2007 +0100
+++ b/plugger.py Mon Dec 10 11:04:52 2007 +0100
@@ -464,7 +464,10 @@
if getattr(PlugClass, "__init__", None):
PlugClass.__init__(_self)
_self.PlugRequestSave()
-
+
+ def _getBuildPath(_self):
+ return self._getBuildPath()
+
# Create the object out of the resulting class
newPluginOpj = FinalPlugClass()
# Store it in PluggedChils
--- a/plugins/canfestival/canfestival.py Sun Dec 09 19:01:21 2007 +0100
+++ b/plugins/canfestival/canfestival.py Mon Dec 10 11:04:52 2007 +0100
@@ -7,8 +7,13 @@
from nodemanager import NodeManager
import config_utils, gen_cfile
from networkedit import networkedit
+from objdictedit import objdictedit
import canfestival_config
+from gnosis.xml.pickle import *
+from gnosis.xml.pickle.util import setParanoia
+setParanoia(0)
+
class _NetworkEdit(networkedit):
" Overload some of CanFestival Network Editor methods "
def OnCloseFrame(self, event):
@@ -50,11 +55,29 @@
self._View._onsave = _onsave
self._View.Show()
+ def _ShowMasterGenerated(self, logger):
+ buildpath = self._getBuildPath()
+ # Eventually create build dir
+ if not os.path.exists(buildpath):
+ logger.write_error("Error: No PLC built\n")
+ return
+
+ masterpath = os.path.join(buildpath, "MasterGenerated.od")
+ if not os.path.exists(masterpath):
+ logger.write_error("Error: No Master generated\n")
+ return
+
+ new_dialog = objdictedit(None, [masterpath])
+ new_dialog.Show()
+
PluginMethods = [
{"bitmap" : os.path.join("images", "NetworkEdit.png"),
"name" : "Edit network",
"tooltip" : "Edit CanOpen Network with NetworkEdit",
- "method" : _OpenView}
+ "method" : _OpenView},
+ {"name" : "Show Master",
+ "tooltip" : "Show Master generated by config_utils",
+ "method" : _ShowMasterGenerated}
]
def OnPlugClose(self):
@@ -92,6 +115,10 @@
if res :
raise Exception, res
+ file = open(os.path.join(buildpath, "MasterGenerated.od"), "w")
+ dump(master, file)
+ file.close()
+
return [(Gen_OD_path,canfestival_config.getCFLAGS(CanFestivalPath))],"",False
class RootClass: