--- a/Beremiz.py Fri Sep 07 10:19:04 2007 +0200
+++ b/Beremiz.py Mon Sep 10 14:10:03 2007 +0200
@@ -578,15 +578,15 @@
pos=wx.Point(0, 0), size=wx.Size(100, 17), style=0)
boxsizer.AddWindow(statictext, 0, border=0, flag=wx.TOP|wx.LEFT|wx.BOTTOM)
if "min" in element_infos["type"]:
- min = element_infos["type"]["min"]
+ scmin = element_infos["type"]["min"] if "max" in element_infos["type"]:
- max = element_infos["type"]["max"]
+ scmax = element_infos["type"]["max"] spinctrl = wx.SpinCtrl(id=id, name=element_infos["name"], parent=self.ParamsPanel,
- pos=wx.Point(0, 0), size=wx.Size(150, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT,
+ pos=wx.Point(0, 0), size=wx.Size(150, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT) + spinctrl.SetRange(scmin,scmax) boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, element_path), id=id)
spinctrl.SetValue(element_infos["value"])
@@ -618,8 +618,14 @@
checkbox.Bind(wx.EVT_CHECKBOX, self.GetCheckBoxCallBackFunction(checkbox, element_path), id=id)
checkbox.SetValue(element_infos["value"])
elif element_infos["type"] in ["unsignedLong", "long","integer"]:
+ if element_infos["type"].startswith("unsigned"): spinctrl = wx.SpinCtrl(id=id, name=element_infos["name"], parent=self.ParamsPanel,
pos=wx.Point(0, 0), size=wx.Size(150, 25), style=wx.SP_ARROW_KEYS|wx.ALIGN_RIGHT)
+ spinctrl.SetRange(scmin, scmax) boxsizer.AddWindow(spinctrl, 0, border=0, flag=0)
spinctrl.Bind(wx.EVT_SPINCTRL, self.GetTextCtrlCallBackFunction(spinctrl, element_path), id=id)
spinctrl.SetValue(element_infos["value"])
--- a/plugger.py Fri Sep 07 10:19:04 2007 +0200
+++ b/plugger.py Mon Sep 10 14:10:03 2007 +0200
@@ -154,7 +154,11 @@
# recurse through all childs, and stack their results
for PlugChild in self.IterChilds():
# Compute child's IEC location
- new_location = current_location + (self.BaseParams.getIEC_Channel())
+ new_location = current_location + (self.BaseParams.getIEC_Channel()) # Get childs [(Cfiles, CFLAGS)], LDFLAGS
CFilesAndCFLAGS, LDFLAGS = \
@@ -203,6 +207,12 @@
def GetChildByIECLocation(self, Location):
return self._GetChildBySomething('_',"IEC_Channel", Name)
+ def GetCurrentLocation(self): + return self.PlugParent.GetCurrentLocation() + (self.BaseParams.getIEC_Channel(),) + return self.PlugParent.GetPlugRoot() for child in self.IterChilds():
@@ -352,10 +362,10 @@
for PlugDir in os.listdir(self.PlugPath()):
if os.path.isdir(os.path.join(self.PlugPath(), PlugDir)) and \
PlugDir.count(NameTypeSeparator) == 1:
- self.PlugAddChild(*PlugDir.split(NameTypeSeparator))
+ self.PlugAddChild(*PlugDir.split(NameTypeSeparator)) def _GetClassFunction(name):
@@ -464,7 +474,7 @@
# Keep track of the plugin type name
self.PlugType = "Beremiz"
@@ -479,6 +489,12 @@
Return if a project is actually opened
return self.ProjectPath != None
+ def GetCurrentLocation(self): def GetProjectPath(self):
@@ -609,7 +625,7 @@
C_files.remove("LOCATED_VARIABLES.h")
# transform those base names to full names with path
- C_files = map(lambda filename:os.path.join(self.TargetDir, filename), C_files)
+ C_files = map(lambda filename:os.path.join(buildpath, filename), C_files) logger.write("Extracting Located Variables...\n")
# IEC2CC compiler generate a list of located variables : LOCATED_VARIABLES.h
location_file = open(os.path.join(buildpath,"LOCATED_VARIABLES.h"))
@@ -657,16 +673,16 @@
logger.write("SoftPLC code generation successfull\n")
# Generate C code and compilation params from plugin hierarchy
- CFilesAndCFLAGS, LDFLAGS = self._Generate_C(
- self.PLCGeneratedLocatedVars,
- logger.write_error("Plugins code generation Failed !\n")
- logger.write_error(str(msg))
+ CFilesAndCFLAGS, LDFLAGS = self._Generate_C( + None, #root has no location + self.PLCGeneratedLocatedVars, + #except Exception, msg: + # logger.write_error("Plugins code generation Failed !\n") + # logger.write_error(str(msg)) logger.write("Plugins code generation successfull\n")
--- a/plugins/canfestival/canfestival.py Fri Sep 07 10:19:04 2007 +0200
+++ b/plugins/canfestival/canfestival.py Mon Sep 10 14:10:03 2007 +0200
@@ -27,7 +27,8 @@
- NodeList.__init__(self, manager)
+ # TODO change netname when name change + NodeList.__init__(self, manager, self.BaseParams.getName()) self.LoadProject(self.PlugPath())
@@ -35,9 +36,12 @@
- self._View = _NetworkEdit()
+ self._View = _NetworkEdit(self.GetPlugRoot().AppFrame, self) + # TODO redefine BusId when IEC channel change + self._View.SetBusId(self.GetCurrentLocation()) self._View._onclose = _onclose
PluginMethods = [("NetworkEdit",_OpenView)]
@@ -88,7 +92,7 @@
PlugChildsTypes = [("CanOpenNode",_NodeListPlug)]
- def PlugGenerate_C(self, buildpath, current_location, locations):
+ def PlugGenerate_C(self, buildpath, current_location, locations, logger):