# HG changeset patch # User Edouard Tisserant # Date 1337533629 -7200 # Node ID 5c42cafaee15f475c3ab38fc8298657a95c7d74d # Parent 915be999f3f0d40662f6ba7b198f3b0f0908a734 Moved LPC sources to a separate project diff -r 915be999f3f0 -r 5c42cafaee15 .hgignore --- a/.hgignore Sat May 19 19:00:55 2012 +0200 +++ b/.hgignore Sun May 20 19:07:09 2012 +0200 @@ -12,5 +12,3 @@ ^tests/wxGlade/build$ syntax: regexp ^.*\.pyc$ -syntax: regexp -^\.settings/org.eclipse.core.resources.prefs$ diff -r 915be999f3f0 -r 5c42cafaee15 Beremiz.py --- a/Beremiz.py Sat May 19 19:00:55 2012 +0200 +++ b/Beremiz.py Sun May 20 19:07:09 2012 +0200 @@ -970,7 +970,7 @@ id = wx.NewId() label = confnode_method["name"] button = GenBitmapTextButton(id=id, parent=parent, - bitmap=wx.Bitmap(Bpath( "%s.png"%confnode_method.get("bitmap", os.path.join("images", "Unknown")))), label=label, + bitmap=wx.Bitmap(Bpath("images", "%s.png"%confnode_method.get("bitmap", "Unknown"))), label=label, name=label, pos=wx.DefaultPosition, style=wx.NO_BORDER) button.SetFont(normal_bt_font) button.SetToolTipString(confnode_method["tooltip"]) @@ -1829,12 +1829,12 @@ def Display_Exception_Dialog(e_type, e_value, e_tb, bug_report_path): trcbck_lst = [] for i,line in enumerate(traceback.extract_tb(e_tb)): - trcbck = " " + str(i+1) + _(". ") + trcbck = " " + str(i+1) + ". " if line[0].find(os.getcwd()) == -1: - trcbck += _("file : ") + str(line[0]) + _(", ") - else: - trcbck += _("file : ") + str(line[0][len(os.getcwd()):]) + _(", ") - trcbck += _("line : ") + str(line[1]) + _(", ") + _("function : ") + str(line[2]) + trcbck += "file : " + str(line[0]) + ", " + else: + trcbck += "file : " + str(line[0][len(os.getcwd()):]) + ", " + trcbck += "line : " + str(line[1]) + ", " + "function : " + str(line[2]) trcbck_lst.append(trcbck) # Allow clicking.... @@ -1848,7 +1848,7 @@ (%s) Please be kind enough to send this file to: -dev@automforge.net +beremiz-devel@lists.sourceforge.net You should now restart Beremiz. diff -r 915be999f3f0 -r 5c42cafaee15 ConfigTreeNode.py --- a/ConfigTreeNode.py Sat May 19 19:00:55 2012 +0200 +++ b/ConfigTreeNode.py Sun May 20 19:07:09 2012 +0200 @@ -89,8 +89,8 @@ return parent + "." + self.CTNName() return self.BaseParams.getName() - def GetIconPath(self, name): - return opjimg(name) + def GetIconPath(self): + return None def CTNTestModified(self): return self.ChangesToSave diff -r 915be999f3f0 -r 5c42cafaee15 LPCBeremiz.py --- a/LPCBeremiz.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1765 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -import shutil -import socket - -__version__ = "$Revision$" - -import os, sys, getopt, wx, tempfile -import __builtin__ -from types import TupleType, StringType, UnicodeType - -CWD = os.path.split(os.path.realpath(__file__))[0] - -def Bpath(*args): - return os.path.join(CWD,*args) - -if __name__ == '__main__': - def usage(): - print "\nUsage of LPCBeremiz.py :" - print "\n %s Projectpath Buildpath port\n"%sys.argv[0] - - try: - opts, args = getopt.getopt(sys.argv[1:], "h", ["help"]) - except getopt.GetoptError: - # print help information and exit: - usage() - sys.exit(2) - - for o, a in opts: - if o in ("-h", "--help"): - usage() - sys.exit() - - if len(args) != 3: - usage() - sys.exit() - else: - projectOpen = args[0] - buildpath = args[1] - try: - port = int(args[2]) - except: - usage() - sys.exit() - - if os.path.exists("LPC_DEBUG"): - __builtin__.__dict__["BMZ_DBG"] = True - else : - __builtin__.__dict__["BMZ_DBG"] = False - -app = wx.PySimpleApp(redirect=BMZ_DBG) -app.SetAppName('beremiz') -wx.InitAllImageHandlers() - -# Import module for internationalization -import gettext - -if __name__ == '__main__': - __builtin__.__dict__['_'] = wx.GetTranslation#unicode_translation - -from Beremiz import * -from ProjectController import ProjectController -from ConfigTreeNode import ConfigTreeNode -import connectors -from util import opjimg -from plcopen.structures import LOCATIONDATATYPES -from PLCControler import LOCATION_CONFNODE, LOCATION_MODULE, LOCATION_GROUP,\ - LOCATION_VAR_INPUT, LOCATION_VAR_OUTPUT, LOCATION_VAR_MEMORY -from PLCOpenEditor import IDEFrame, ProjectDialog - -havecanfestival = False -try: - from canfestival import RootClass as CanOpenRootClass - from canfestival.canfestival import _SlaveCTN, _NodeListCTN, NodeManager - havecanfestival = True -except: - havecanfestival = False - - -#------------------------------------------------------------------------------- -# CANFESTIVAL CONFNODE HACK -#------------------------------------------------------------------------------- -# from canfestival import canfestival -# class LPC_canfestival_config: -# def getCFLAGS(self, *args): -# return "" -# -# def getLDFLAGS(self, *args): -# return "" -# -# canfestival.local_canfestival_config = LPC_canfestival_config() -#------------------------------------------------------------------------------- -# LPCModule Class -#------------------------------------------------------------------------------- - -LOCATION_TYPES = {"I": LOCATION_VAR_INPUT, - "Q": LOCATION_VAR_OUTPUT, - "M": LOCATION_VAR_MEMORY} - -LOCATION_DIRS = dict([(dir, size) for size, dir in LOCATION_TYPES.iteritems()]) - -LOCATION_SIZES = {} -for size, types in LOCATIONDATATYPES.iteritems(): - for type in types: - LOCATION_SIZES[type] = size - -def _GetModuleChildren(module): - children = [] - for child in module["children"]: - if child["type"] == LOCATION_GROUP: - children.extend(child["children"]) - else: - children.append(child) - return children - -def _GetVariables(module): - variables = [] - for child in module["children"]: - if child["type"] in [LOCATION_GROUP, LOCATION_MODULE]: - variables.extend(_GetVariables(child)) - else: - variables.append(child) - return variables - -def _GetLastModuleGroup(module): - group = module - for child in module["children"]: - if child["type"] == LOCATION_GROUP: - group = child - return group["children"] - -def _GetModuleBySomething(module, something, toks): - for child in _GetModuleChildren(module): - if child.get(something) == toks[0]: - if len(toks) > 1: - return _GetModuleBySomething(child, something, toks[1:]) - return child - return None - -def _GetModuleVariable(module, location, direction): - for child in _GetModuleChildren(module): - if child["location"] == location and child["type"] == LOCATION_TYPES[direction]: - return child - return None - -def _RemoveModuleChild(module, child): - if child in module["children"]: - module["children"].remove(child) - else: - for group in module["children"]: - if group["type"] == LOCATION_GROUP and child in group["children"]: - group["children"].remove(child) - -BUS_TEXT = """/* Code generated by LPCBus confnode */ - -/* LPCBus confnode includes */ -#include "app_glue.h" -#ifdef _WINDOWS_H - #include "iec_types.h" -#else - #include "iec_std_lib.h" -#endif - -%(declare_code)s - -/* LPCBus confnode user variables definition */ -%(var_decl)s - -/* LPCBus confnode functions */ -int __init_%(location_str)s(int argc,char **argv) -{ -%(init_code)s - return 0; -} - -void __cleanup_%(location_str)s(void) -{ -} - -void __retrieve_%(location_str)s(void) -{ -%(retrieve_code)s -} - -void __publish_%(location_str)s(void) -{ -%(publish_code)s -} -""" - -class LPCBus(object): - - def __init__(self): - self.VariableLocationTree = [] - self.ResetUsedLocations() - self.Icon = None - - def __getitem__(self, key): - if key == "children": - return self.VariableLocationTree - raise KeyError, "Only 'children' key is available" - - def CTNEnabled(self): - return None - - def SetIcon(self, icon): - self.Icon = icon - - def _GetChildBySomething(self, something, toks): - return _GetModuleBySomething({"children" : self.VariableLocationTree}, something, toks) - - def GetBaseTypes(self): - return self.GetCTRoot().GetBaseTypes() - - def GetSizeOfType(self, type): - return LOCATION_SIZES[self.GetCTRoot().GetBaseType(type)] - - def _GetVariableLocationTree(self, current_location, infos): - if infos["type"] == LOCATION_MODULE: - location = current_location + (infos["IEC_Channel"],) - return {"name": infos["name"], - "type": infos["type"], - "location": ".".join(map(str, location + ("x",))), - "icon": infos["icon"], - "children": [self._GetVariableLocationTree(location, child) for child in infos["children"]]} - elif infos["type"] == LOCATION_GROUP: - return {"name": infos["name"], - "type": infos["type"], - "location": "", - "icon": infos["icon"], - "children": [self._GetVariableLocationTree(current_location, child) for child in infos["children"]]} - else: - size = self.GetSizeOfType(infos["IEC_type"]) - location = "%" + LOCATION_DIRS[infos["type"]] + size + ".".join(map(str, current_location + infos["location"])) - return {"name": infos["name"], - "type": infos["type"], - "size": size, - "IEC_type": infos["IEC_type"], - "var_name": infos["name"], - "location": location, - "description": infos["description"], - "children": []} - - def GetVariableLocationTree(self): - return {"name": self.BaseParams.getName(), - "type": LOCATION_CONFNODE, - "location": self.GetFullIEC_Channel(), - "icon": self.Icon, - "children": [self._GetVariableLocationTree(self.GetCurrentLocation(), child) - for child in self.VariableLocationTree]} - - def CTNTestModified(self): - return False - - def CTNMakeDir(self): - pass - - def CTNRequestSave(self): - return None - - def ResetUsedLocations(self): - self.UsedLocations = {} - - def _AddUsedLocation(self, parent, location): - num = location.pop(0) - if not parent.has_key(num): - parent[num] = {"used": False, "children": {}} - if len(location) > 0: - self._AddUsedLocation(parent[num]["children"], location) - else: - parent[num]["used"] = True - - def AddUsedLocation(self, location): - if len(location) > 0: - self._AddUsedLocation(self.UsedLocations, list(location)) - - def _CheckLocationConflicts(self, parent, location): - num = location.pop(0) - if not parent.has_key(num): - return False - if len(location) > 0: - if parent[num]["used"]: - return True - return self._CheckLocationConflicts(parent[num]["children"], location) - elif len(parent[num]["children"]) > 0: - return True - return False - - def CheckLocationConflicts(self, location): - if len(location) > 0: - return self._CheckLocationConflicts(self.UsedLocations, list(location)) - return False - - def CTNGenerate_C(self, buildpath, locations): - """ - Generate C code - @param current_location: Tupple containing confnode IEC location : %I0.0.4.5 => (0,0,4,5) - @param locations: List of complete variables locations \ - [{"IEC_TYPE" : the IEC type (i.e. "INT", "STRING", ...) - "NAME" : name of the variable (generally "__IW0_1_2" style) - "DIR" : direction "Q","I" or "M" - "SIZE" : size "X", "B", "W", "D", "L" - "LOC" : tuple of interger for IEC location (0,1,2,...) - }, ...] - @return: [(C_file_name, CFLAGS),...] , LDFLAGS_TO_APPEND - """ - current_location = self.GetCurrentLocation() - # define a unique name for the generated C file - location_str = "_".join(map(str, current_location)) - - code_str = {"location_str": location_str, - "var_decl": "", - "declare_code": "", - "init_code": "", - "retrieve_code": "", - "publish_code": "", - } - - for module in _GetModuleChildren(self): - if module["init"] != "": - code_str["init_code"] += " %s\n" % module["init"] - - # Adding variables - vars = [] - self.ResetUsedLocations() - for location in locations: - loc = location["LOC"][len(current_location):] - group = next = self - i = 0 - while next is not None and i < len(loc): - next = self._GetChildBySomething("IEC_Channel", loc[:i + 1]) - if next is not None: - i += 1 - group = next - var_loc = loc[i:] - for variable in _GetModuleChildren(group): - if variable["location"] == var_loc and location["DIR"] == LOCATION_DIRS[variable["type"]]: -# if location["DIR"] != LOCATION_DIRS[variable["type"]]: -# raise Exception, "Direction conflict in variable definition" -# if location["IEC_TYPE"] != variable["IEC_type"]: -# raise Exception, "Type conflict in variable definition" - if location["DIR"] == "Q": - if self.CheckLocationConflicts(location["LOC"]): - raise Exception, "BYTE and BIT from the same BYTE can't be used together" - self.AddUsedLocation(location["LOC"]) - vars.append({"location": location["NAME"], - "Type": variable["IEC_type"], - "Retrieve": variable["retrieve"], - "Publish": variable["publish"], - }) - break - base_types = self.GetCTRoot().GetBaseTypes() - for var in vars: - prefix = "" - if var["Type"] in base_types: - prefix = "IEC_" - code_str["var_decl"] += "%s%s beremiz%s;\n"%(prefix, var["Type"], var["location"]) - code_str["var_decl"] += "%s%s *%s = &beremiz%s;\n"%(prefix, var["Type"], var["location"], var["location"]) - if var["Retrieve"] != "": - code_str["retrieve_code"] += " " + var["Retrieve"] % ("*" + var["location"]) + "\n" - if var["Publish"] != "": - code_str["publish_code"] += " " + var["Publish"] % ("*" + var["location"]) + "\n" - - Gen_Module_path = os.path.join(buildpath, "Bus_%s.c"%location_str) - module = open(Gen_Module_path,'w') - module.write(BUS_TEXT % code_str) - module.close() - - matiec_flags = '"-I%s"'%os.path.abspath(self.GetCTRoot().GetIECLibPath()) - return [(Gen_Module_path, matiec_flags)],"",True - -#------------------------------------------------------------------------------- -# LPC CanFestival ConfNode Class -#------------------------------------------------------------------------------- - -if havecanfestival: - - DEFAULT_SETTINGS = { - "CAN_Baudrate": "125K", - "Slave_NodeId": 2, - "Master_NodeId": 1, - } - - class LPCCanOpenSlave(_SlaveCTN): - XSD = """ - - - - - - - - - - - - - - - - - - """ % DEFAULT_SETTINGS - - def __init__(self): - # TODO change netname when name change - NodeManager.__init__(self) - odfilepath = self.GetSlaveODPath() - if(os.path.isfile(odfilepath)): - self.OpenFileInCurrent(odfilepath) - else: - self.CreateNewNode("SlaveNode", # Name - will be changed at build time - 0x00, # NodeID - will be changed at build time - "slave", # Type - "", # description - "None", # profile - "", # prfile filepath - "heartbeat", # NMT - []) # options - self.OnCTNSave() - - def GetCanDevice(self): - return str(self.BaseParams.getIEC_Channel()) - - class LPCCanOpenMaster(_NodeListCTN): - XSD = """ - - - - - - - - - - """ % DEFAULT_SETTINGS - - def GetCanDevice(self): - return str(self.BaseParams.getIEC_Channel()) - - class LPCCanOpen(CanOpenRootClass): - XSD = None - CTNChildrenTypes = [("CanOpenNode",LPCCanOpenMaster, "CanOpen Master"), - ("CanOpenSlave",LPCCanOpenSlave, "CanOpen Slave")] - - def GetCanDriver(self): - return "" - - def LoadChildren(self): - ConfigTreeNode.LoadChildren(self) - - if self.GetChildByName("Master") is None: - master = self.CTNAddChild("Master", "CanOpenNode", 0) - master.BaseParams.setEnabled(False) - - if self.GetChildByName("Slave") is None: - slave = self.CTNAddChild("Slave", "CanOpenSlave", 1) - slave.BaseParams.setEnabled(False) - - -#------------------------------------------------------------------------------- -# LPCProjectController Class -#------------------------------------------------------------------------------- - -def mycopytree(src, dst): - """ - Copy content of a directory to an other, omit hidden files - @param src: source directory - @param dst: destination directory - """ - for i in os.listdir(src): - if not i.startswith('.') and i != "pous.xml": - srcpath = os.path.join(src,i) - dstpath = os.path.join(dst,i) - if os.path.isdir(srcpath): - if os.path.exists(dstpath): - shutil.rmtree(dstpath) - os.makedirs(dstpath) - mycopytree(srcpath, dstpath) - elif os.path.isfile(srcpath): - shutil.copy2(srcpath, dstpath) - -[SIMULATION_MODE, TRANSFER_MODE] = range(2) - -class LPCProjectController(ProjectController): - - ConfNodeMethods = [ - {"bitmap" : opjimg("Debug"), - "name" : _("Simulate"), - "tooltip" : _("Simulate PLC"), - "method" : "_Simulate"}, - {"bitmap" : opjimg("Run"), - "name" : _("Run"), - "shown" : False, - "tooltip" : _("Start PLC"), - "method" : "_Run"}, - {"bitmap" : opjimg("Stop"), - "name" : _("Stop"), - "shown" : False, - "tooltip" : _("Stop Running PLC"), - "method" : "_Stop"}, - {"bitmap" : opjimg("Build"), - "name" : _("Build"), - "tooltip" : _("Build project into build folder"), - "method" : "_Build"}, - {"bitmap" : opjimg("Transfer"), - "name" : _("Transfer"), - "shown" : False, - "tooltip" : _("Transfer PLC"), - "method" : "_Transfer"}, - ] - - def __init__(self, frame, logger, buildpath): - self.OrigBuildPath = buildpath - - ProjectController.__init__(self, frame, logger) - - if havecanfestival: - self.CTNChildrenTypes += [("LPCBus", LPCBus, "LPC bus"), ("CanOpen", LPCCanOpen, "CanOpen bus")] - else: - self.CTNChildrenTypes += [("LPCBus", LPCBus, "LPC bus")] - self.CTNType = "LPC" - - self.OnlineMode = "OFF" - self.LPCConnector = None - - self.CurrentMode = None - self.previous_mode = None - - self.SimulationBuildPath = None - - self.AbortTransferTimer = None - - def ConfNodeLibraryFilePath(self): - if self.OrigBuildPath is not None: - return os.path.join(self.OrigBuildPath, "pous.xml") - else: - return ProjectController.ConfNodeLibraryFilePath(self) - - def GetProjectName(self): - return self.Project.getname() - - def GetDefaultTargetName(self): - if self.CurrentMode == SIMULATION_MODE: - return ProjectController.GetDefaultTargetName(self) - else: - return "LPC" - - def GetTarget(self): - target = ProjectController.GetTarget(self) - if self.CurrentMode != SIMULATION_MODE: - target.getcontent()["value"].setBuildPath(self.BuildPath) - return target - - def _getBuildPath(self): - if self.CurrentMode == SIMULATION_MODE: - if self.SimulationBuildPath is None: - self.SimulationBuildPath = os.path.join(tempfile.mkdtemp(), os.path.basename(self.ProjectPath), "build") - return self.SimulationBuildPath - else: - return ProjectController._getBuildPath(self) - - def _Build(self): - save = self.ProjectTestModified() - if save: - self.SaveProject() - self.AppFrame._Refresh(TITLE, FILEMENU) - if self.BuildPath is not None: - mycopytree(self.OrigBuildPath, self.BuildPath) - ProjectController._Build(self) - if save: - wx.CallAfter(self.AppFrame.RefreshAll) - - def SetProjectName(self, name): - return self.Project.setname(name) - - def SetOnlineMode(self, mode, path=None): - if self.OnlineMode != mode.upper(): - self.OnlineMode = mode.upper() - - if self.OnlineMode != "OFF": - uri = "LPC://%s/%s" % (self.OnlineMode,path) - try: - self.LPCConnector = connectors.ConnectorFactory(uri, self) - except Exception, msg: - self.logger.write_error(_("Exception while connecting %s!\n")%uri) - self.logger.write_error(traceback.format_exc()) - - # Did connection success ? - if self.LPCConnector is None: - # Oups. - self.logger.write_error(_("Connection failed to %s!\n")%uri) - - else: - self.LPCConnector = None - - self.ApplyOnlineMode() - - def ApplyOnlineMode(self): - if self.CurrentMode != SIMULATION_MODE: - self.KillDebugThread() - - self._connector = self.LPCConnector - - # Init with actual PLC status and print it - self.UpdateMethodsFromPLCStatus() - - if self.LPCConnector is not None and self.OnlineMode == "APPLICATION": - - self.CompareLocalAndRemotePLC() - - if self.previous_plcstate is not None: - status = _(self.previous_plcstate) - else: - status = "" - self.logger.write(_("PLC is %s\n")%status) - - #if self.StatusTimer and not self.StatusTimer.IsRunning(): - # # Start the status Timer - # self.StatusTimer.Start(milliseconds=2000, oneShot=False) - - if self.previous_plcstate=="Started": - if self.DebugAvailable() and self.GetIECProgramsAndVariables(): - self.logger.write(_("Debug connect matching running PLC\n")) - self._connect_debug() - else: - self.logger.write_warning(_("Debug do not match PLC - stop/transfert/start to re-enable\n")) - - elif self.StatusTimer and self.StatusTimer.IsRunning(): - self.StatusTimer.Stop() - - if self.CurrentMode == TRANSFER_MODE: - - if self.OnlineMode == "BOOTLOADER": - self.BeginTransfer() - - elif self.OnlineMode == "APPLICATION": - self.CurrentMode = None - self.AbortTransferTimer.Stop() - self.AbortTransferTimer = None - - self.logger.write(_("PLC transferred successfully\n")) - - # Update a PLCOpenEditor Pou variable name - def UpdateProjectVariableName(self, old_name, new_name): - self.Project.updateElementName(old_name, new_name) - self.BufferProject() - - def RemoveProjectVariableByAddress(self, address): - self.Project.removeVariableByAddress(address) - self.BufferProject() - - def RemoveProjectVariableByFilter(self, leading): - self.Project.removeVariableByFilter(leading) - self.BufferProject() - - def LoadProject(self, ProjectPath, BuildPath=None): - """ - Load a project contained in a folder - @param ProjectPath: path of the project folder - """ - if os.path.basename(ProjectPath) == "": - ProjectPath = os.path.dirname(ProjectPath) - - # Verify that project contains a PLCOpen program - plc_file = os.path.join(ProjectPath, "plc.xml") - if os.path.isfile(plc_file): - # Load PLCOpen file - result = self.OpenXMLFile(plc_file) - if result: - return result - else: - self.CreateNewProject({"companyName": "", - "productName": "", - "productVersion": "", - "projectName": "", - "pageSize": (0, 0), - "scaling": {}}) - - # Change XSD into class members - self._AddParamsMembers() - self.Children = {} - - # Keep track of the root confnode (i.e. project path) - self.ProjectPath = ProjectPath - - self.BuildPath = self._getBuildPath() - if self.OrigBuildPath is not None: - mycopytree(self.OrigBuildPath, self.BuildPath) - - # If dir have already be made, and file exist - if os.path.isdir(self.CTNPath()) and os.path.isfile(self.ConfNodeXmlFilePath()): - #Load the confnode.xml file into parameters members - result = self.LoadXMLParams() - if result: - return result - #Load and init all the children - self.LoadChildren() - - if havecanfestival and self.GetChildByName("CanOpen") is None: - canopen = self.CTNAddChild("CanOpen", "CanOpen", 0) - canopen.BaseParams.setEnabled(False) - canopen.LoadChildren() - - if self.CTNTestModified(): - self.SaveProject() - - if wx.GetApp() is None: - self.RefreshConfNodesBlockLists() - else: - wx.CallAfter(self.RefreshConfNodesBlockLists) - - return None - - ############# Real PLC object access ############# - def UpdateMethodsFromPLCStatus(self): - # Get PLC state : Running or Stopped - # TODO : use explicit status instead of boolean - if self.OnlineMode == "OFF": - status = "Disconnected" - elif self.OnlineMode == "BOOTLOADER": - status = "Connected" - else: - if self._connector is not None: - status = self._connector.GetPLCstatus() - else: - status = "Disconnected" - if self.previous_plcstate != status or self.previous_mode != self.CurrentMode: - simulating = self.CurrentMode == SIMULATION_MODE - for args in { - "Started" : [("_Simulate", False), - ("_Run", False), - ("_Stop", True), - ("_Build", True), - ("_Transfer", True)], - "Stopped" : [("_Simulate", False), - ("_Run", True), - ("_Stop", False), - ("_Build", True), - ("_Transfer", True)], - "Connected" : [("_Simulate", not simulating), - ("_Run", True), - ("_Stop", simulating), - ("_Build", True), - ("_Transfer", True)], - "Disconnected" :[("_Simulate", not simulating), - ("_Run", False), - ("_Stop", simulating), - ("_Build", True), - ("_Transfer", False)], - }.get(status,[]): - self.ShowMethod(*args) - self.previous_plcstate = status - self.previous_mode = self.CurrentMode - return True - return False - - def Generate_plc_declare_locations(self): - """ - Declare used locations in order to simulatePLC in a black box - """ - return """#include "iec_types_all.h" - -#define __LOCATED_VAR(type, name, ...) \ -type beremiz_##name;\ -type *name = &beremiz_##name; - -#include "LOCATED_VARIABLES.h" - -#undef __LOCATED_VAR - -""" - - def Generate_lpc_retain_array_sim(self): - """ - Support for retain array in Simulation - """ - return """/* Support for retain array */ -#define USER_RETAIN_ARRAY_SIZE 2000 -#define NUM_OF_COLS 3 -unsigned char readOK = 0; -unsigned int foundIndex = USER_RETAIN_ARRAY_SIZE; -unsigned int retainArray[USER_RETAIN_ARRAY_SIZE][NUM_OF_COLS]; - -unsigned int __GetRetainData(unsigned char READ, unsigned int INDEX, unsigned int COLUMN) -{ - if(READ == 1) - { - if((0<=INDEX) && (INDEX return index that is out of array bounds */ - return 0; -} - -/* Since Beremiz debugger doesn't like pointer-by-reference stuff or global varibles, separate function is a must */ -unsigned char __GetReadStatus(unsigned char dummy) -{ - return readOK; -} - -unsigned int __GetFoundIndex(unsigned char dummy) -{ - return foundIndex; -} -""" - - def _Simulate(self): - """ - Method called by user to Simulate PLC - """ - self.CurrentMode = SIMULATION_MODE - - uri = "LOCAL://" - try: - self._connector = connectors.ConnectorFactory(uri, self) - except Exception, msg: - self.logger.write_error(_("Exception while connecting %s!\n")%uri) - self.logger.write_error(traceback.format_exc()) - - # Did connection success ? - if self._connector is None: - # Oups. - self.logger.write_error(_("Connection failed to %s!\n")%uri) - self.StopSimulation() - return False - - buildpath = self._getBuildPath() - - # Eventually create build dir - if not os.path.exists(buildpath): - os.makedirs(buildpath) - - # Generate SoftPLC IEC code - IECGenRes = self._Generate_SoftPLC() - - # If IEC code gen fail, bail out. - if not IECGenRes: - self.logger.write_error(_("IEC-61131-3 code generation failed !\n")) - self.StopSimulation() - return False - - # Reset variable and program list that are parsed from - # CSV file generated by IEC2C compiler. - self.ResetIECProgramsAndVariables() - - gen_result = self.CTNGenerate_C(buildpath, self.PLCGeneratedLocatedVars) - CTNCFilesAndCFLAGS, CTNLDFLAGS, DoCalls = gen_result[:3] - # if some files have been generated put them in the list with their location - if CTNCFilesAndCFLAGS: - self.LocationCFilesAndCFLAGS = [(self.GetCurrentLocation(), CTNCFilesAndCFLAGS, DoCalls)] - else: - self.LocationCFilesAndCFLAGS = [] - - # confnode asks for some LDFLAGS - if CTNLDFLAGS: - # LDFLAGS can be either string - if type(CTNLDFLAGS)==type(str()): - self.LDFLAGS=[CTNLDFLAGS] - #or list of strings - elif type(CTNLDFLAGS)==type(list()): - self.LDFLAGS=CTNLDFLAGS[:] - else: - self.LDFLAGS=[] - - # Template based part of C code generation - # files are stacked at the beginning, as files of confnode tree root - for generator, filename, name in [ - # debugger code - (self.Generate_plc_debugger, "plc_debugger.c", "Debugger"), - # init/cleanup/retrieve/publish, run and align code - (self.Generate_plc_common_main,"plc_common_main.c","Common runtime"), - # declare located variables for simulate in a black box - (self.Generate_plc_declare_locations,"plc_declare_locations.c","Declare Locations"), - # declare located variables for simulate in a black box - (self.Generate_lpc_retain_array_sim,"lpc_retain_array_sim.c","Retain Array for Simulation")]: - try: - # Do generate - code = generator() - if code is None: - raise - code_path = os.path.join(buildpath,filename) - open(code_path, "w").write(code) - # Insert this file as first file to be compiled at root confnode - self.LocationCFilesAndCFLAGS[0][1].insert(0,(code_path, self.plcCFLAGS)) - except Exception, exc: - self.logger.write_error(name+_(" generation failed !\n")) - self.logger.write_error(traceback.format_exc()) - self.StopSimulation() - return False - - # Get simulation builder - builder = self.GetBuilder() - if builder is None: - self.logger.write_error(_("Fatal : cannot get builder.\n")) - self.StopSimulation() - return False - - # Build - try: - if not builder.build() : - self.logger.write_error(_("C Build failed.\n")) - self.StopSimulation() - return False - except Exception, exc: - self.logger.write_error(_("C Build crashed !\n")) - self.logger.write_error(traceback.format_exc()) - self.StopSimulation() - return False - - data = builder.GetBinaryCode() - if data is not None : - if self._connector.NewPLC(builder.GetBinaryCodeMD5(), data, []): - self.UnsubscribeAllDebugIECVariable() - self.ProgramTransferred() - if self.AppFrame is not None: - self.AppFrame.CloseObsoleteDebugTabs() - self.logger.write(_("Transfer completed successfully.\n")) - else: - self.logger.write_error(_("Transfer failed\n")) - self.StopSimulation() - return False - - self._Run() - - if not self.StatusTimer.IsRunning(): - # Start the status Timer - self.StatusTimer.Start(milliseconds=500, oneShot=False) - - def StopSimulation(self): - self.CurrentMode = None - self.ApplyOnlineMode() - - def _Stop(self): - ProjectController._Stop(self) - - if self.CurrentMode == SIMULATION_MODE: - self.StopSimulation() - - def CompareLocalAndRemotePLC(self): - if self.LPCConnector is None: - return - # We are now connected. Update button status - MD5 = self.GetLastBuildMD5() - # Check remote target PLC correspondance to that md5 - if MD5 is not None and self.LPCConnector.MatchMD5(MD5): - # warns controller that program match - self.ProgramTransferred() - - def ResetBuildMD5(self): - builder=self.GetBuilder() - if builder is not None: - builder.ResetBinaryCodeMD5(self.OnlineMode) - - def GetLastBuildMD5(self): - builder=self.GetBuilder() - if builder is not None: - return builder.GetBinaryCodeMD5(self.OnlineMode) - else: - return None - - def _Transfer(self): - if self.CurrentMode is None and self.OnlineMode != "OFF": - self.CurrentMode = TRANSFER_MODE - - if ProjectController._Build(self): - - ID_ABORTTRANSFERTIMER = wx.NewId() - self.AbortTransferTimer = wx.Timer(self.AppFrame, ID_ABORTTRANSFERTIMER) - self.AppFrame.Bind(wx.EVT_TIMER, self.AbortTransfer, self.AbortTransferTimer) - - if self.OnlineMode == "BOOTLOADER": - self.BeginTransfer() - - else: - self.logger.write(_("Resetting PLC\n")) - #self.StatusTimer.Stop() - self.LPCConnector.ResetPLC() - self.AbortTransferTimer.Start(milliseconds=5000, oneShot=True) - - else: - self.CurrentMode = None - - def BeginTransfer(self): - self.logger.write(_("Start PLC transfer\n")) - - self.AbortTransferTimer.Stop() - ProjectController._Transfer(self) - self.AbortTransferTimer.Start(milliseconds=5000, oneShot=True) - - def AbortTransfer(self, event): - self.logger.write_warning(_("Timeout waiting PLC to recover\n")) - - self.CurrentMode = None - self.AbortTransferTimer.Stop() - self.AbortTransferTimer = None - event.Skip() - - def _Run(self): - """ - Start PLC - """ - if self.GetIECProgramsAndVariables(): - self._connector.StartPLC() - self.logger.write(_("Starting PLC\n")) - self._connect_debug() - else: - self.logger.write_error(_("Couldn't start PLC !\n")) - self.UpdateMethodsFromPLCStatus() - -#------------------------------------------------------------------------------- -# LPCBeremiz Class -#------------------------------------------------------------------------------- -lpcberemiz_cmd=None - -class LPCBeremiz(Beremiz): - - def _init_coll_FileMenu_Items(self, parent): - AppendMenu(parent, help='', id=wx.ID_SAVE, - kind=wx.ITEM_NORMAL, text=_(u'Save\tCTRL+S')) - AppendMenu(parent, help='', id=wx.ID_CLOSE, - kind=wx.ITEM_NORMAL, text=_(u'Close Tab\tCTRL+W')) - parent.AppendSeparator() - AppendMenu(parent, help='', id=wx.ID_PAGE_SETUP, - kind=wx.ITEM_NORMAL, text=_(u'Page Setup')) - AppendMenu(parent, help='', id=wx.ID_PREVIEW, - kind=wx.ITEM_NORMAL, text=_(u'Preview')) - AppendMenu(parent, help='', id=wx.ID_PRINT, - kind=wx.ITEM_NORMAL, text=_(u'Print')) - parent.AppendSeparator() - AppendMenu(parent, help='', id=wx.ID_PROPERTIES, - kind=wx.ITEM_NORMAL, text=_(u'Properties')) - parent.AppendSeparator() - AppendMenu(parent, help='', id=wx.ID_EXIT, - kind=wx.ITEM_NORMAL, text=_(u'Quit\tCTRL+Q')) - - self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE) - self.Bind(wx.EVT_MENU, self.OnCloseTabMenu, id=wx.ID_CLOSE) - self.Bind(wx.EVT_MENU, self.OnPageSetupMenu, id=wx.ID_PAGE_SETUP) - self.Bind(wx.EVT_MENU, self.OnPreviewMenu, id=wx.ID_PREVIEW) - self.Bind(wx.EVT_MENU, self.OnPrintMenu, id=wx.ID_PRINT) - self.Bind(wx.EVT_MENU, self.OnPropertiesMenu, id=wx.ID_PROPERTIES) - self.Bind(wx.EVT_MENU, self.OnQuitMenu, id=wx.ID_EXIT) - - self.AddToMenuToolBar([(wx.ID_SAVE, "save.png", _(u'Save'), None), - (wx.ID_PRINT, "print.png", _(u'Print'), None)]) - - def _init_ctrls(self, prnt): - IDEFrame._init_ctrls(self, prnt) - - self.Bind(wx.EVT_MENU, self.OnOpenWidgetInspector, id=ID_BEREMIZINSPECTOR) - accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL|wx.ACCEL_ALT, ord('I'), ID_BEREMIZINSPECTOR)]) - self.SetAcceleratorTable(accel) - - self.PLCConfig = wx.ScrolledWindow(id=ID_BEREMIZPLCCONFIG, - name='PLCConfig', parent=self.LeftNoteBook, pos=wx.Point(0, 0), - size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER|wx.HSCROLL|wx.VSCROLL) - self.PLCConfig.SetBackgroundColour(wx.WHITE) - self.PLCConfig.Bind(wx.EVT_LEFT_DOWN, self.OnPanelLeftDown) - self.PLCConfig.Bind(wx.EVT_SIZE, self.OnMoveWindow) - self.LeftNoteBook.InsertPage(0, self.PLCConfig, _("Topology"), True) - - self.LogConsole = wx.TextCtrl(id=ID_BEREMIZLOGCONSOLE, value='', - name='LogConsole', parent=self.BottomNoteBook, pos=wx.Point(0, 0), - size=wx.Size(0, 0), style=wx.TE_MULTILINE|wx.TE_RICH2) - self.LogConsole.Bind(wx.EVT_LEFT_DCLICK, self.OnLogConsoleDClick) - self.BottomNoteBook.AddPage(self.LogConsole, _("Log Console")) - - self._init_beremiz_sizers() - - def OnCloseFrame(self, event): - global frame - - if self.CheckSaveBeforeClosing(_("Close Application")): - - frame.Hide() - - self.CTR.ResetAppFrame(lpcberemiz_cmd.Log) - if self.CTR.OnlineMode == 0: - self.CTR._connector = None - - self.CTR.KillDebugThread() - self.KillLocalRuntime() - - self.SaveLastState() - - lpcberemiz_cmd.Log.write("Closed\n") - - event.Veto() - - def ShowProperties(self): - old_values = self.Controler.GetProjectProperties() - dialog = ProjectDialog(self ,False) - dialog.SetValues(old_values) - if dialog.ShowModal() == wx.ID_OK: - new_values = dialog.GetValues() - new_values["creationDateTime"] = old_values["creationDateTime"] - if new_values != old_values: - self.Controler.SetProjectProperties(None, new_values) - self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU, - PROJECTTREE, POUINSTANCEVARIABLESPANEL, SCALING) - dialog.Destroy() - - def RefreshFileMenu(self): - MenuToolBar = self.Panes["MenuToolBar"] - if self.CTR is not None: - selected = self.TabsOpened.GetSelection() - if selected >= 0: - graphic_viewer = isinstance(self.TabsOpened.GetPage(selected), Viewer) - else: - graphic_viewer = False - if self.TabsOpened.GetPageCount() > 0: - self.FileMenu.Enable(wx.ID_CLOSE, True) - if graphic_viewer: - self.FileMenu.Enable(wx.ID_PREVIEW, True) - self.FileMenu.Enable(wx.ID_PRINT, True) - MenuToolBar.EnableTool(wx.ID_PRINT, True) - else: - self.FileMenu.Enable(wx.ID_PREVIEW, False) - self.FileMenu.Enable(wx.ID_PRINT, False) - MenuToolBar.EnableTool(wx.ID_PRINT, False) - else: - self.FileMenu.Enable(wx.ID_CLOSE, False) - self.FileMenu.Enable(wx.ID_PREVIEW, False) - self.FileMenu.Enable(wx.ID_PRINT, False) - MenuToolBar.EnableTool(wx.ID_PRINT, False) - self.FileMenu.Enable(wx.ID_PAGE_SETUP, True) - project_modified = self.CTR.ProjectTestModified() - self.FileMenu.Enable(wx.ID_SAVE, project_modified) - MenuToolBar.EnableTool(wx.ID_SAVE, project_modified) - self.FileMenu.Enable(wx.ID_PROPERTIES, True) - else: - self.FileMenu.Enable(wx.ID_CLOSE, False) - self.FileMenu.Enable(wx.ID_PAGE_SETUP, False) - self.FileMenu.Enable(wx.ID_PREVIEW, False) - self.FileMenu.Enable(wx.ID_PRINT, False) - MenuToolBar.EnableTool(wx.ID_PRINT, False) - self.FileMenu.Enable(wx.ID_SAVE, False) - MenuToolBar.EnableTool(wx.ID_SAVE, False) - self.FileMenu.Enable(wx.ID_PROPERTIES, False) - - def RefreshPLCParams(self): - self.Freeze() - self.ClearSizer(self.PLCParamsSizer) - - if self.CTR is not None: - plcwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1)) - if self.CTR.CTNTestModified(): - bkgdclr = CHANGED_TITLE_COLOUR - else: - bkgdclr = TITLE_COLOUR - - if self.CTR not in self.ConfNodeInfos: - self.ConfNodeInfos[self.CTR] = {"right_visible" : False} - - plcwindow.SetBackgroundColour(TITLE_COLOUR) - plcwindow.Bind(wx.EVT_LEFT_DOWN, self.OnPanelLeftDown) - self.PLCParamsSizer.AddWindow(plcwindow, 0, border=0, flag=wx.GROW) - - plcwindowsizer = wx.BoxSizer(wx.HORIZONTAL) - plcwindow.SetSizer(plcwindowsizer) - - st = wx.StaticText(plcwindow, -1) - st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"])) - st.SetLabel(self.CTR.GetProjectName()) - plcwindowsizer.AddWindow(st, 0, border=5, flag=wx.ALL|wx.ALIGN_CENTER) - - plcwindowmainsizer = wx.BoxSizer(wx.VERTICAL) - plcwindowsizer.AddSizer(plcwindowmainsizer, 0, border=5, flag=wx.ALL) - - plcwindowbuttonsizer = wx.BoxSizer(wx.HORIZONTAL) - plcwindowmainsizer.AddSizer(plcwindowbuttonsizer, 0, border=0, flag=wx.ALIGN_CENTER) - - msizer = self.GenerateMethodButtonSizer(self.CTR, plcwindow, not self.ConfNodeInfos[self.CTR]["right_visible"]) - plcwindowbuttonsizer.AddSizer(msizer, 0, border=0, flag=wx.GROW) - - self.PLCConfigMainSizer.Layout() - self.RefreshScrollBars() - self.Thaw() - - def GenerateTreeBranch(self, confnode): - leftwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1)) - if confnode.CTNTestModified(): - bkgdclr=CHANGED_WINDOW_COLOUR - else: - bkgdclr=WINDOW_COLOUR - - leftwindow.SetBackgroundColour(bkgdclr) - - if confnode not in self.ConfNodeInfos: - self.ConfNodeInfos[confnode] = {"expanded" : False, "left_visible" : False, "right_visible" : False} - - self.ConfNodeInfos[confnode]["children"] = confnode.IECSortedChildren() - confnode_infos = confnode.GetVariableLocationTree() - confnode_locations = [] - if len(self.ConfNodeInfos[confnode]["children"]) == 0: - confnode_locations = confnode_infos["children"] - if not self.ConfNodeInfos[confnode].has_key("locations_infos"): - self.ConfNodeInfos[confnode]["locations_infos"] = {"root": {"expanded" : False}} - - self.ConfNodeInfos[confnode]["locations_infos"]["root"]["left"] = None - self.ConfNodeInfos[confnode]["locations_infos"]["root"]["right"] = None - self.ConfNodeInfos[confnode]["locations_infos"]["root"]["children"] = [] - - self.ConfNodeTreeSizer.AddWindow(leftwindow, 0, border=0, flag=wx.GROW) - - leftwindowvsizer = wx.BoxSizer(wx.VERTICAL) - leftwindow.SetSizer(leftwindowvsizer) - - leftwindowsizer = wx.BoxSizer(wx.HORIZONTAL) - leftwindowvsizer.AddSizer(leftwindowsizer, 0, border=0, flag=0) - - self.GenerateEnableButton(leftwindow, leftwindowsizer, confnode) - - st = wx.StaticText(leftwindow, -1) - st.SetFont(wx.Font(faces["size"], wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"])) - st.SetLabel(confnode.GetFullIEC_Channel()) - leftwindowsizer.AddWindow(st, 0, border=5, flag=wx.RIGHT) - - expandbutton_id = wx.NewId() - expandbutton = wx.lib.buttons.GenBitmapToggleButton(id=expandbutton_id, bitmap=wx.Bitmap(Bpath( 'images', 'plus.png')), - name='ExpandButton', parent=leftwindow, pos=wx.Point(0, 0), - size=wx.Size(13, 13), style=wx.NO_BORDER) - expandbutton.labelDelta = 0 - expandbutton.SetBezelWidth(0) - expandbutton.SetUseFocusIndicator(False) - expandbutton.SetBitmapSelected(wx.Bitmap(Bpath( 'images', 'minus.png'))) - - if len(self.ConfNodeInfos[confnode]["children"]) > 0: - expandbutton.SetToggle(self.ConfNodeInfos[confnode]["expanded"]) - def togglebutton(event): - if expandbutton.GetToggle(): - self.ExpandConfNode(confnode) - else: - self.CollapseConfNode(confnode) - self.ConfNodeInfos[confnode]["expanded"] = expandbutton.GetToggle() - self.PLCConfigMainSizer.Layout() - self.RefreshScrollBars() - event.Skip() - expandbutton.Bind(wx.EVT_BUTTON, togglebutton, id=expandbutton_id) - elif len(confnode_locations) > 0: - locations_infos = self.ConfNodeInfos[confnode]["locations_infos"] - expandbutton.SetToggle(locations_infos["root"]["expanded"]) - def togglebutton(event): - if expandbutton.GetToggle(): - self.ExpandLocation(locations_infos, "root") - else: - self.CollapseLocation(locations_infos, "root") - self.ConfNodeInfos[confnode]["expanded"] = expandbutton.GetToggle() - locations_infos["root"]["expanded"] = expandbutton.GetToggle() - self.PLCConfigMainSizer.Layout() - self.RefreshScrollBars() - event.Skip() - expandbutton.Bind(wx.EVT_BUTTON, togglebutton, id=expandbutton_id) - else: - expandbutton.Enable(False) - leftwindowsizer.AddWindow(expandbutton, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL) - - sb = wx.StaticBitmap(leftwindow, -1) - icon = confnode_infos.get("icon", None) - if icon is None: - icon_bitmap = self.LocationImageList.GetBitmap(self.LocationImageDict[confnode_infos["type"]]) - else: - icon_bitmap = wx.Bitmap(icon) - sb.SetBitmap(icon_bitmap) - leftwindowsizer.AddWindow(sb, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL) - - st_id = wx.NewId() - st = wx.StaticText(leftwindow, st_id, size=wx.DefaultSize, style=wx.NO_BORDER) - st.SetFont(wx.Font(faces["size"] * 0.75, wx.DEFAULT, wx.NORMAL, wx.BOLD, faceName = faces["helv"])) - st.SetLabel(confnode.MandatoryParams[1].getName()) - leftwindowsizer.AddWindow(st, 0, border=5, flag=wx.RIGHT|wx.ALIGN_CENTER_VERTICAL) - - rightwindow = self.GenerateParamsPanel(confnode, bkgdclr) - self.ConfNodeTreeSizer.AddWindow(rightwindow, 0, border=0, flag=wx.GROW) - - self.ConfNodeInfos[confnode]["left"] = leftwindow - self.ConfNodeInfos[confnode]["right"] = rightwindow - for child in self.ConfNodeInfos[confnode]["children"]: - self.GenerateTreeBranch(child) - if not self.ConfNodeInfos[child]["expanded"]: - self.CollapseConfNode(child) - - if len(confnode_locations) > 0: - locations_infos = self.ConfNodeInfos[confnode]["locations_infos"] - treectrl = wx.TreeCtrl(self.PLCConfig, -1, size=wx.DefaultSize, - style=wx.TR_HAS_BUTTONS|wx.TR_SINGLE|wx.NO_BORDER|wx.TR_HIDE_ROOT|wx.TR_NO_LINES|wx.TR_LINES_AT_ROOT) - treectrl.SetImageList(self.LocationImageList) - treectrl.Bind(wx.EVT_TREE_BEGIN_DRAG, self.GenerateLocationBeginDragFunction(locations_infos)) - treectrl.Bind(wx.EVT_TREE_ITEM_EXPANDED, self.GenerateLocationExpandCollapseFunction(locations_infos, True)) - treectrl.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.GenerateLocationExpandCollapseFunction(locations_infos, False)) - - treectrl.AddRoot("") - self.ConfNodeTreeSizer.AddWindow(treectrl, 0, border=0, flag=0) - - rightwindow = wx.Panel(self.PLCConfig, -1, size=wx.Size(-1, -1)) - rightwindow.SetBackgroundColour(wx.WHITE) - self.ConfNodeTreeSizer.AddWindow(rightwindow, 0, border=0, flag=wx.GROW) - - locations_infos["root"]["left"] = treectrl - locations_infos["root"]["right"] = rightwindow - for location in confnode_locations: - locations_infos["root"]["children"].append("root.%s" % location["name"]) - self.GenerateLocationTreeBranch(treectrl, treectrl.GetRootItem(), locations_infos, "root", location) - if locations_infos["root"]["expanded"]: - self.ExpandLocation(locations_infos, "root") - -class StdoutPseudoFile: - - def __init__(self, port): - self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - self.socket.connect(('localhost', port)) - self.Buffer = "" - - def __del__(self): - self.socket.close() - - def readline(self): - idx = self.Buffer.find("\n") - if idx == -1: - self.Buffer += self.socket.recv(2048) - idx = self.Buffer.find("\n") - if idx != -1: - line = self.Buffer[:idx+1] - self.Buffer = self.Buffer[idx+1:] - if BMZ_DBG: - print "command >"+line - return line - return "" - - """ Base class for file like objects to facilitate StdOut for the Shell.""" - def write(self, s, style = None): - if s != '': - self.socket.send(s.encode('utf8')) - - def writeyield(self, s): - self.write(s) - - def write_warning(self, s): - self.write(s) - - def write_error(self, s): - self.write(s) - - def flush(self): - pass - - def isatty(self): - return False - -if __name__ == '__main__': - - from threading import Thread, Timer, Semaphore - import cmd - - wx_eval_lock = Semaphore(0) - eval_res = None - def wx_evaluator(callable, *args, **kwargs): - global eval_res - eval_res = None - try: - eval_res=callable(*args,**kwargs) - finally: - wx_eval_lock.release() - - def evaluator(callable, *args, **kwargs): - global eval_res - wx.CallAfter(wx_evaluator,callable,*args,**kwargs) - wx_eval_lock.acquire() - return eval_res - - # Command log for debug, for viewing from wxInspector - if BMZ_DBG: - __builtins__.cmdlog = [] - - class LPCBeremiz_Cmd(cmd.Cmd): - - prompt = "" - RefreshTimer = None - - def __init__(self, CTR, Log): - cmd.Cmd.__init__(self, stdin=Log, stdout=Log) - self.use_rawinput = False - self.Log = Log - self.CTR = CTR - - def RestartTimer(self): - if self.RefreshTimer is not None: - self.RefreshTimer.cancel() - self.RefreshTimer = Timer(0.1, wx.CallAfter, args = [self.Refresh]) - self.RefreshTimer.start() - - def Exit(self): - global frame, app - self.Close() - app.ExitMainLoop() - return True - - def do_EOF(self, line): - return self.Exit() - - def Show(self): - global frame - if frame is not None: - self.CTR.SetAppFrame(frame, frame.Log) - frame.Show() - frame.Raise() - - def Refresh(self): - global frame - if frame is not None: - frame._Refresh(TITLE, POUINSTANCEVARIABLESPANEL, FILEMENU, EDITMENU) - frame.RefreshEditor() - frame.RefreshAll() - - def Close(self): - global frame - - self.CTR.ResetAppFrame(self.Log) - if frame is not None: - frame.Hide() - - def Compile(self): - self.CTR._Build() - - def SetProjectProperties(self, projectname, productname, productversion, companyname): - properties = self.CTR.GetProjectProperties() - new_properties = properties.copy() - new_properties["projectName"] = projectname - new_properties["productName"] = productname - new_properties["productVersion"] = productversion - new_properties["companyName"] = companyname - if new_properties != properties: - self.CTR.SetProjectProperties(properties=new_properties, buffer=False) - self.RestartTimer() - - def SetOnlineMode(self, mode, path=None): - self.CTR.SetOnlineMode(mode, path) - self.RestartTimer() - - def AddBus(self, iec_channel, name, icon=None): - for child in self.CTR.IterChildren(): - if child.BaseParams.getName() == name: - return "Error: A bus named %s already exists\n" % name - elif child.BaseParams.getIEC_Channel() == iec_channel: - return "Error: A bus with IEC_channel %d already exists\n" % iec_channel - bus = self.CTR.CTNAddChild(name, "LPCBus", iec_channel) - if bus is None: - return "Error: Unable to create bus\n" - bus.SetIcon(icon) - self.RestartTimer() - - def RenameBus(self, iec_channel, name): - bus = self.CTR.GetChildByIECLocation((iec_channel,)) - if bus is None: - return "Error: No bus found\n" - for child in self.CTR.IterChildren(): - if child != bus and child.BaseParams.getName() == name: - return "Error: A bus named %s already exists\n" % name - bus.BaseParams.setName(name) - self.RestartTimer() - - def ChangeBusIECChannel(self, old_iec_channel, new_iec_channel): - bus = self.CTR.GetChildByIECLocation((old_iec_channel,)) - if bus is None: - return "Error: No bus found\n" - for child in self.CTR.IterChildren(): - if child != bus and child.BaseParams.getIEC_Channel() == new_iec_channel: - return "Error: A bus with IEC_channel %d already exists\n" % new_iec_channel - if wx.GetApp() is None: - self.CTR.UpdateProjectVariableLocation(str(old_iec_channel), - str(new_iec_channel)) - else: - self.CTR.UpdateProjectVariableLocation( - str(old_iec_channel), - str(new_iec_channel)) - bus.BaseParams.setIEC_Channel(new_iec_channel) - self.RestartTimer() - - def RemoveBus(self, iec_channel): - bus = self.CTR.GetChildByIECLocation((iec_channel,)) - if bus is None: - return "Error: No bus found\n" - self.CTR.RemoveProjectVariableByFilter(str(iec_channel)) - self.CTR.Children["LPCBus"].remove(bus) - self.RestartTimer() - - def AddModule(self, parent, iec_channel, name, icode, icon=None): - module = self.CTR.GetChildByIECLocation(parent) - if module is None: - return "Error: No parent found\n" - for child in _GetModuleChildren(module): - if child["name"] == name: - return "Error: A module named %s already exists\n" % name - elif child["IEC_Channel"] == iec_channel: - return "Error: A module with IEC_channel %d already exists\n" % iec_channel - _GetLastModuleGroup(module).append({"name": name, - "type": LOCATION_MODULE, - "IEC_Channel": iec_channel, - "icon": icon, - "init": icode, - "children": []}) - self.RestartTimer() - - def RenameModule(self, iec_location, name): - module = self.CTR.GetChildByIECLocation(iec_location) - if module is None: - return "Error: No module found\n" - parent = self.CTR.GetChildByIECLocation(iec_location[:-1]) - if parent is self.CTR: - return "Error: No module found\n" - if module["name"] != name: - for child in _GetModuleChildren(parent): - if child["name"] == name: - return "Error: A module named %s already exists\n" % name - module["name"] = name - self.RestartTimer() - - def ChangeModuleIECChannel(self, old_iec_location, new_iec_channel): - module = self.CTR.GetChildByIECLocation(old_iec_location) - if module is None: - return "Error: No module found\n" - parent = self.CTR.GetChildByIECLocation(old_iec_location[:-1]) - if parent is self.CTR: - return "Error: No module found\n" - if module["IEC_Channel"] != new_iec_channel: - for child in _GetModuleChildren(parent): - if child["IEC_Channel"] == new_iec_channel: - return "Error: A module with IEC_channel %d already exists\n" % new_iec_channel - self.CTR.UpdateProjectVariableLocation(".".join(map(str, old_iec_location)), ".".join(map(str, old_iec_location[:1] + (new_iec_channel,)))) - module["IEC_Channel"] = new_iec_channel - self.RestartTimer() - - def ChangeModuleInitCode(self, iec_location, icode): - module = self.CTR.GetChildByIECLocation(iec_location) - if module is None: - return "Error: No module found\n" - module["init"] = icode - - def RemoveModule(self, parent, iec_channel): - module = self.CTR.GetChildByIECLocation(parent) - if module is None: - return "Error: No parent found\n" - child = _GetModuleBySomething(module, "IEC_Channel", (iec_channel,)) - if child is None: - return "Error: No module found\n" - self.CTR.RemoveProjectVariableByFilter(".".join(map(str, parent + (iec_channel,)))) - _RemoveModuleChild(module, child) - self.RestartTimer() - - def StartGroup(self, parent, name, icon=None): - module = self.CTR.GetChildByIECLocation(parent) - if module is None: - return "Error: No parent found\n" - for child in module["children"]: - if child["type"] == LOCATION_GROUP and child["name"] == name: - return "Error: A group named %s already exists\n" % name - module["children"].append({"name": name, - "type": LOCATION_GROUP, - "icon": icon, - "children": []}) - self.RestartTimer() - - def AddVariable(self, parent, location, name, direction, type, rcode, pcode, description=""): - module = self.CTR.GetChildByIECLocation(parent) - if module is None: - return "Error: No parent found\n" - for child in _GetModuleChildren(module): - if child["name"] == name: - return "Error: A variable named %s already exists\n" % name - if child["location"] == location and child["type"] == LOCATION_TYPES[direction]: - return "Error: A variable with location %s already exists\n" % ".".join(map(str, location)) - _GetLastModuleGroup(module).append({"name": name, - "location": location, - "type": LOCATION_TYPES[direction], - "IEC_type": type, - "description": description, - "retrieve": rcode, - "publish": pcode}) - self.RestartTimer() - - def ChangeVariableParams(self, parent, location, new_name, new_direction, new_type, new_rcode, new_pcode, new_description=None): - module = self.CTR.GetChildByIECLocation(parent) - if module is None: - return "Error: No parent found\n" - variable = None - for child in _GetModuleChildren(module): - if child["location"] == location and child["type"] == LOCATION_TYPES[new_direction]: - variable = child - elif child["name"] == new_name: - return "Error: A variable named %s already exists\n" % new_name - if variable is None: - return "Error: No variable found\n" - if variable["name"] != new_name: - self.CTR.UpdateProjectVariableName(variable["name"], new_name) - variable["name"] = new_name - variable["type"] = LOCATION_TYPES[new_direction] - variable["IEC_type"] = new_type - variable["retrieve"] = new_rcode - variable["publish"] = new_pcode - if new_description is not None: - variable["description"] = new_description - self.RestartTimer() - - def RemoveVariable(self, parent, location, direction): - module = self.CTR.GetChildByIECLocation(parent) - if module is None: - return "Error: No parent found\n" - child = _GetModuleVariable(module, location, direction) - if child is None: - return "Error: No variable found\n" - size = LOCATION_SIZES[self.CTR.GetBaseType(child["IEC_type"])] - address = "%" + LOCATION_DIRS[child["type"]] + size + ".".join(map(str, parent + location)) - self.CTR.RemoveProjectVariableByAddress(address) - _RemoveModuleChild(module, child) - self.RestartTimer() - - def location(loc): - return tuple(map(int, loc.split("."))) - - def GetCmdFunction(function, arg_types, opt=0): - arg_number = len(arg_types) - def CmdFunction(self, line): - args_toks = line.split('"') - if len(args_toks) % 2 == 0: - self.Log.write("Error: Invalid command\n") - sys.stdout.flush() - return - args = [] - for num, arg in enumerate(args_toks): - if num % 2 == 0: - stripped = arg.strip() - if stripped: - args.extend(stripped.split(" ")) - else: - args.append(arg) - number = None - extra = "" - if opt == 0 and len(args) != arg_number: - number = arg_number - elif len(args) > arg_number: - number = arg_number - extra = " at most" - elif len(args) < arg_number - opt: - number = arg_number - opt - extra = " at least" - if number is not None: - if number == 0: - self.Log.write("Error: No argument%s expected\n" % extra) - elif number == 1: - self.Log.write("Error: 1 argument%s expected\n" % extra) - else: - self.Log.write("Error: %d arguments%s expected\n" % (number, extra)) - sys.stdout.flush() - return - for num, arg in enumerate(args): - try: - args[num] = arg_types[num](arg) - except: - self.Log.write("Error: Invalid value for argument %d\n" % (num + 1)) - sys.stdout.flush() - return - - func = getattr(self, function) - res = evaluator(func,*args) - - if BMZ_DBG: - cmdlog.append((function,line,res)) - if len(cmdlog) > 100: #prevent debug log to grow too much - cmdlog.pop(0) - - if isinstance(res, (StringType, UnicodeType)): - self.Log.write(res) - return False - else: - return res - return CmdFunction - - def CmdThreadProc(CTR, Log): - global lpcberemiz_cmd - for function, (arg_types, opt) in {"Exit": ([], 0), - "Show": ([], 0), - "Refresh": ([], 0), - "Close": ([], 0), - "Compile": ([], 0), - "SetProjectProperties": ([str, str, str, str], 0), - "SetOnlineMode": ([str, str], 1), - "AddBus": ([int, str, str], 1), - "RenameBus": ([int, str], 0), - "ChangeBusIECChannel": ([int, int], 0), - "RemoveBus": ([int], 0), - "AddModule": ([location, int, str, str, str], 1), - "RenameModule": ([location, str], 0), - "ChangeModuleIECChannel": ([location, int], 0), - "ChangeModuleInitCode": ([location, str], 0), - "RemoveModule": ([location, int], 0), - "StartGroup": ([location, str, str], 1), - "AddVariable": ([location, location, str, str, str, str, str, str], 1), - "ChangeVariableParams": ([location, location, str, str, str, str, str, str], 1), - "RemoveVariable": ([location, location], 0)}.iteritems(): - - setattr(LPCBeremiz_Cmd, "do_%s" % function, GetCmdFunction(function, arg_types, opt)) - lpcberemiz_cmd = LPCBeremiz_Cmd(CTR, Log) - lpcberemiz_cmd.cmdloop() - - Log = StdoutPseudoFile(port) - - CTR = LPCProjectController(None, Log, buildpath) - if projectOpen is not None and os.path.isdir(projectOpen): - result = CTR.LoadProject(projectOpen) - if result: - Log.write("Error: Invalid project directory", result) - else: - Log.write("Error: No such file or directory") - - cmd_thread=Thread(target=CmdThreadProc, args=[CTR, Log]) - cmd_thread.start() - - # Install a exception handle for bug reports - AddExceptHook(os.getcwd(),__version__) - - frame = LPCBeremiz(None, ctr=CTR, debug=True) - - app.MainLoop() - diff -r 915be999f3f0 -r 5c42cafaee15 ProjectController.py --- a/ProjectController.py Sat May 19 19:00:55 2012 +0200 +++ b/ProjectController.py Sun May 20 19:07:09 2012 +0200 @@ -61,9 +61,9 @@ - """+"\n".join(['' + """+"\n".join(['' for libname,lib in features.libraries])+""" @@ -1341,45 +1341,45 @@ wx.CallAfter(self.UpdateMethodsFromPLCStatus) ConfNodeMethods = [ - {"bitmap" : opjimg("Build"), + {"bitmap" : "Build", "name" : _("Build"), "tooltip" : _("Build project into build folder"), "method" : "_Build"}, - {"bitmap" : opjimg("Clean"), + {"bitmap" : "Clean", "name" : _("Clean"), "enabled" : False, "tooltip" : _("Clean project build folder"), "method" : "_Clean"}, - {"bitmap" : opjimg("Run"), + {"bitmap" : "Run", "name" : _("Run"), "shown" : False, "tooltip" : _("Start PLC"), "method" : "_Run"}, - {"bitmap" : opjimg("Stop"), + {"bitmap" : "Stop", "name" : _("Stop"), "shown" : False, "tooltip" : _("Stop Running PLC"), "method" : "_Stop"}, - {"bitmap" : opjimg("Connect"), + {"bitmap" : "Connect", "name" : _("Connect"), "tooltip" : _("Connect to the target PLC"), "method" : "_Connect"}, - {"bitmap" : opjimg("Transfer"), + {"bitmap" : "Transfer", "name" : _("Transfer"), "shown" : False, "tooltip" : _("Transfer PLC"), "method" : "_Transfer"}, - {"bitmap" : opjimg("Disconnect"), + {"bitmap" : "Disconnect", "name" : _("Disconnect"), "shown" : False, "tooltip" : _("Disconnect from PLC"), "method" : "_Disconnect"}, - {"bitmap" : opjimg("ShowIECcode"), + {"bitmap" : "ShowIECcode", "name" : _("Show code"), "shown" : False, "tooltip" : _("Show IEC code generated by PLCGenerator"), "method" : "_showIECcode"}, - {"bitmap" : opjimg("editIECrawcode"), + {"bitmap" : "editIECrawcode", "name" : _("Raw IEC code"), "tooltip" : _("Edit raw IEC code added to code generated by PLCGenerator"), "method" : "_editIECrawcode"}, diff -r 915be999f3f0 -r 5c42cafaee15 c_ext/CFileEditor.py --- a/c_ext/CFileEditor.py Sat May 19 19:00:55 2012 +0200 +++ b/c_ext/CFileEditor.py Sun May 20 19:07:09 2012 +0200 @@ -4,6 +4,7 @@ import wx.grid import wx.stc as stc import wx.lib.buttons +from util import opjimg from controls import CustomGrid, CustomTable, EditorPanel @@ -718,72 +719,6 @@ ("Publish", CppEditor), ] -#---------------------------------------------------------------------- -# different icons for the collapsed/expanded states. -# Taken from standard Windows XP collapsed/expanded states. -#---------------------------------------------------------------------- - -def GetCollapsedIconData(): - return \ -'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\ -\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\ -\x00\x01\x8eIDAT8\x8d\xa5\x93-n\xe4@\x10\x85?g\x03\n6lh)\xc4\xd2\x12\xc3\x81\ -\xd6\xa2I\x90\x154\xb9\x81\x8f1G\xc8\x11\x16\x86\xcd\xa0\x99F\xb3A\x91\xa1\ -\xc9J&\x96L"5lX\xcc\x0bl\xf7v\xb2\x7fZ\xa5\x98\xebU\xbdz\xf5\\\x9deW\x9f\xf8\ -H\\\xbfO|{y\x9dT\x15P\x04\x01\x01UPUD\x84\xdb/7YZ\x9f\xa5\n\xce\x97aRU\x8a\ -\xdc`\xacA\x00\x04P\xf0!0\xf6\x81\xa0\xf0p\xff9\xfb\x85\xe0|\x19&T)K\x8b\x18\ -\xf9\xa3\xe4\xbe\xf3\x8c^#\xc9\xd5\n\xa8*\xc5?\x9a\x01\x8a\xd2b\r\x1cN\xc3\ -\x14\t\xce\x97a\xb2F0Ks\xd58\xaa\xc6\xc5\xa6\xf7\xdfya\xe7\xbdR\x13M2\xf9\ -\xf9qKQ\x1fi\xf6-\x00~T\xfac\x1dq#\x82,\xe5q\x05\x91D\xba@\xefj\xba1\xf0\xdc\ -zzW\xcff&\xb8,\x89\xa8@Q\xd6\xaaf\xdfRm,\xee\xb1BDxr#\xae\xf5|\xddo\xd6\xe2H\ -\x18\x15\x84\xa0q@]\xe54\x8d\xa3\xedf\x05M\xe3\xd8Uy\xc4\x15\x8d\xf5\xd7\x8b\ -~\x82\x0fh\x0e"\xb0\xad,\xee\xb8c\xbb\x18\xe7\x8e;6\xa5\x89\x04\xde\xff\x1c\ -\x16\xef\xe0p\xfa>\x19\x11\xca\x8d\x8d\xe0\x93\x1b\x01\xd8m\xf3(;x\xa5\xef=\ -\xb7w\xf3\x1d$\x7f\xc1\xe0\xbd\xa7\xeb\xa0(,"Kc\x12\xc1+\xfd\xe8\tI\xee\xed)\ -\xbf\xbcN\xc1{D\x04k\x05#\x12\xfd\xf2a\xde[\x81\x87\xbb\xdf\x9cr\x1a\x87\xd3\ -0)\xba>\x83\xd5\xb97o\xe0\xaf\x04\xff\x13?\x00\xd2\xfb\xa9`z\xac\x80w\x00\ -\x00\x00\x00IEND\xaeB`\x82' - -def GetCollapsedIconBitmap(): - return wx.BitmapFromImage(GetCollapsedIconImage()) - -def GetCollapsedIconImage(): - import cStringIO - stream = cStringIO.StringIO(GetCollapsedIconData()) - return wx.ImageFromStream(stream) - -#---------------------------------------------------------------------- -def GetExpandedIconData(): - return \ -'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\ -\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\ -\x00\x01\x9fIDAT8\x8d\x95\x93\xa1\x8e\xdc0\x14EO\xb2\xc4\xd0\xd2\x12\xb7(mI\ -\xa4%V\xd1lQT4[4-\x9a\xfe\xc1\xc2|\xc6\xc2~BY\x83:A3E\xd3\xa0*\xa4\xd2\x90H!\ -\x95\x0c\r\r\x1fK\x81g\xb2\x99\x84\xb4\x0fY\xd6\xbb\xc7\xf7>=\'Iz\xc3\xbcv\ -\xfbn\xb8\x9c\x15 \xe7\xf3\xc7\x0fw\xc9\xbc7\x99\x03\x0e\xfbn0\x99F+\x85R\ -\x80RH\x10\x82\x08\xde\x05\x1ef\x90+\xc0\xe1\xd8\ryn\xd0Z-\\A\xb4\xd2\xf7\ -\x9e\xfbwoF\xc8\x088\x1c\xbbae\xb3\xe8y&\x9a\xdf\xf5\xbd\xe7\xfem\x84\xa4\ -\x97\xccYf\x16\x8d\xdb\xb2a]\xfeX\x18\xc9s\xc3\xe1\x18\xe7\x94\x12cb\xcc\xb5\ -\xfa\xb1l8\xf5\x01\xe7\x84\xc7\xb2Y@\xb2\xcc0\x02\xb4\x9a\x88%\xbe\xdc\xb4\ -\x9e\xb6Zs\xaa74\xadg[6\x88<\xb7]\xc6\x14\x1dL\x86\xe6\x83\xa0\x81\xba\xda\ -\x10\x02x/\xd4\xd5\x06\r\x840!\x9c\x1fM\x92\xf4\x86\x9f\xbf\xfe\x0c\xd6\x9ae\ -\xd6u\x8d \xf4\xf5\x165\x9b\x8f\x04\xe1\xc5\xcb\xdb$\x05\x90\xa97@\x04lQas\ -\xcd*7\x14\xdb\x9aY\xcb\xb8\\\xe9E\x10|\xbc\xf2^\xb0E\x85\xc95_\x9f\n\xaa/\ -\x05\x10\x81\xce\xc9\xa8\xf6>\x13\xc0n\xff{PJ\xc5\xfdP\x11""<\xbc\ -\xff\x87\xdf\xf8\xbf\xf5\x17FF\xaf\x8f\x8b\xd3\xe6K\x00\x00\x00\x00IEND\xaeB\ -`\x82' - -def GetExpandedIconBitmap(): - return wx.BitmapFromImage(GetExpandedIconImage()) - -def GetExpandedIconImage(): - import cStringIO - stream = cStringIO.StringIO(GetExpandedIconData()) - return wx.ImageFromStream(stream) - class FoldPanelCaption(wx.lib.buttons.GenBitmapTextToggleButton): def GetBackgroundBrush(self, dc): @@ -854,9 +789,10 @@ for idx, (name, panel_class) in enumerate(CFILE_PARTS): button_id = wx.NewId() button = FoldPanelCaption(id=button_id, name='FoldPanelCaption_%s' % name, - label=name, bitmap=GetCollapsedIconBitmap(), parent=self.Editor, pos=wx.Point(0, 0), + label=name, bitmap=wx.Bitmap(opjimg("CollapsedIconData")), + parent=self.Editor, pos=wx.Point(0, 0), size=wx.Size(0, 20), style=wx.NO_BORDER|wx.ALIGN_LEFT) - button.SetBitmapSelected(GetExpandedIconBitmap()) + button.SetBitmapSelected(wx.Bitmap(opjimg("ExpandedIconData"))) button.Bind(wx.EVT_BUTTON, self.GenPanelButtonCallback(name), id=button_id) self.MainSizer.AddWindow(button, 0, border=0, flag=wx.TOP|wx.GROW) @@ -879,9 +815,7 @@ def __init__(self, parent, controler, window): EditorPanel.__init__(self, parent, "", window, controler) - - img = wx.Bitmap(self.Controler.GetIconPath("Cfile.png"), wx.BITMAP_TYPE_PNG).ConvertToImage() - self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16))) + self.SetIcon(wx.Bitmap(opjimg("Cfile"))) def __del__(self): self.Controler.OnCloseEditor(self) diff -r 915be999f3f0 -r 5c42cafaee15 c_ext/c_ext.py --- a/c_ext/c_ext.py Sat May 19 19:00:55 2012 +0200 +++ b/c_ext/c_ext.py Sun May 20 19:07:09 2012 +0200 @@ -139,7 +139,7 @@ return "" ConfNodeMethods = [ - {"bitmap" : os.path.join("images", "EditCfile"), + {"bitmap" : "EditCfile", "name" : _("Edit C File"), "tooltip" : _("Edit C File"), "method" : "_OpenView"}, diff -r 915be999f3f0 -r 5c42cafaee15 canfestival/canfestival.py --- a/canfestival/canfestival.py Sat May 19 19:00:55 2012 +0200 +++ b/canfestival/canfestival.py Sun May 20 19:07:09 2012 +0200 @@ -113,7 +113,7 @@ self._View.SetBusId(self.GetCurrentLocation()) ConfNodeMethods = [ - {"bitmap" : os.path.join("images", "NetworkEdit"), + {"bitmap" : "NetworkEdit", "name" : "Edit slave", "tooltip" : "Edit CanOpen slave with ObjdictEdit", "method" : "_OpenView"}, diff -r 915be999f3f0 -r 5c42cafaee15 connectors/LPC/LPCAppObject.py --- a/connectors/LPC/LPCAppObject.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -#This file is part of Beremiz, a Integrated Development Environment for -#programming IEC 61131-3 automates supporting plcopen standard and CanFestival. -# -#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD -# -#See COPYING file for copyrights details. -# -#This library is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public -#License as published by the Free Software Foundation; either -#version 2.1 of the License, or (at your option) any later version. -# -#This library is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -#General Public License for more details. -# -#You should have received a copy of the GNU General Public -#License along with this library; if not, write to the Free Software -#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -import ctypes -from LPCAppProto import * -from LPCObject import * -from targets.typemapping import SameEndianessTypeTranslator as TypeTranslator - -class LPCAppObject(LPCObject): - def connect(self,comport): - self.SerialConnection = LPCAppProto(comport,#number - 115200, #speed - 2) #timeout - - def StartPLC(self, debug=False): - self.HandleSerialTransaction(STARTTransaction()) - - def StopPLC(self): - self.HandleSerialTransaction(STOPTransaction()) - return True - - def ResetPLC(self): - self.HandleSerialTransaction(RESETTransaction()) - return self.PLCStatus - - def GetPLCstatus(self): - self.HandleSerialTransaction(GET_PLCIDTransaction()) - return self.PLCStatus - - def MatchMD5(self, MD5): - data = self.HandleSerialTransaction(GET_PLCIDTransaction()) - if data is not None: - return data[:32] == MD5[:32] - return False - - def SetTraceVariablesList(self, idxs): - """ - Call ctype imported function to append - these indexes to registred variables in PLC debugger - """ - if idxs: - buff = "" - # keep a copy of requested idx - self._Idxs = idxs[:] - for idx,iectype,force in idxs: - idxstr = ctypes.string_at( - ctypes.pointer( - ctypes.c_uint32(idx)),4) - if force !=None: - c_type,unpack_func, pack_func = TypeTranslator.get(iectype, (None,None,None)) - forced_type_size = ctypes.sizeof(c_type) - forced_type_size_str = chr(forced_type_size) - forcestr = ctypes.string_at( - ctypes.pointer( - pack_func(c_type,force)), - forced_type_size) - buff += idxstr + forced_type_size_str + forcestr - else: - buff += idxstr + chr(0) - else: - buff = "" - self._Idxs = [] - - self.HandleSerialTransaction(SET_TRACE_VARIABLETransaction(buff)) - - def GetTraceVariables(self): - """ - Return a list of variables, corresponding to the list of required idx - """ - offset = 0 - strbuf = self.HandleSerialTransaction( - GET_TRACE_VARIABLETransaction()) - if strbuf is not None and len(strbuf) > 4 and self.PLCStatus == "Started": - res=[] - size = len(strbuf) - 4 - tick = ctypes.cast( - ctypes.c_char_p(strbuf[:4]), - ctypes.POINTER(ctypes.c_int)).contents - buff = ctypes.cast( - ctypes.c_char_p(strbuf[4:]), - ctypes.c_void_p) - for idx, iectype, forced in self._Idxs: - cursor = ctypes.c_void_p(buff.value + offset) - c_type,unpack_func, pack_func = TypeTranslator.get(iectype, (None,None,None)) - if c_type is not None and offset < size: - res.append(unpack_func(ctypes.cast(cursor, - ctypes.POINTER(c_type)).contents)) - offset += ctypes.sizeof(c_type) - else: - #if c_type is None: - #PLCprint("Debug error - " + iectype + " not supported !") - #if offset >= size: - #PLCprint("Debug error - buffer too small !") - break - if offset and offset == size: - return self.PLCStatus, tick.value, res - #PLCprint("Debug error - wrong buffer unpack !") - return self.PLCStatus, None, [] - diff -r 915be999f3f0 -r 5c42cafaee15 connectors/LPC/LPCAppProto.py --- a/connectors/LPC/LPCAppProto.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,121 +0,0 @@ -import ctypes -from LPCProto import * - -LPC_STATUS={0xaa : "Started", - 0x55 : "Stopped"} - -class LPCAppProto(LPCProto): - def HandleTransaction(self, transaction): - self.TransactionLock.acquire() - try: - transaction.SetPseudoFile(self.serialPort) - # send command, wait ack (timeout) - transaction.SendCommand() - current_plc_status = transaction.GetCommandAck() - if current_plc_status is not None: - res = transaction.ExchangeData() - else: - raise LPCProtoError("controller did not answer as expected") - except Exception, e: - raise LPCProtoError("application mode transaction error : "+str(e)) - finally: - self.TransactionLock.release() - return LPC_STATUS.get(current_plc_status,"Broken"), res - -class LPCAppTransaction: - def __init__(self, command, optdata = ""): - self.Command = command - self.OptData = optdata - self.pseudofile = None - - def SetPseudoFile(self, pseudofile): - self.pseudofile = pseudofile - - def SendCommand(self): - # send command thread - self.pseudofile.write(chr(self.Command)) - - def GetCommandAck(self): - res = self.pseudofile.read(2) - if len(res) == 2: - comm_status, current_plc_status = map(ord, res) - else: - raise LPCProtoError("LPC transaction error - controller did not ack order") - # LPC returns command itself as an ack for command - if(comm_status == self.Command): - return current_plc_status - return None - - def SendData(self): - length = len(self.OptData) - # transform length into a byte string - # we presuppose endianess of LPC same as PC - lengthstr = ctypes.string_at(ctypes.pointer(ctypes.c_int(length)),4) - buffer = lengthstr + self.OptData - return self.pseudofile.write(buffer) - - def GetData(self): - lengthstr = self.pseudofile.read(4) - # transform a byte string into length - length = ctypes.cast(ctypes.c_char_p(lengthstr), ctypes.POINTER(ctypes.c_int)).contents.value - return self.pseudofile.read(length) - - def ExchangeData(self): - pass - -class IDLETransaction(LPCAppTransaction): - def __init__(self): - LPCAppTransaction.__init__(self, 0x07) - ExchangeData = LPCAppTransaction.GetData - -class STARTTransaction(LPCAppTransaction): - def __init__(self): - LPCAppTransaction.__init__(self, 0x01) - -class STOPTransaction(LPCAppTransaction): - def __init__(self): - LPCAppTransaction.__init__(self, 0x02) - -class RESETTransaction(LPCAppTransaction): - def __init__(self): - LPCAppTransaction.__init__(self, 0x03) - -class SET_TRACE_VARIABLETransaction(LPCAppTransaction): - def __init__(self, data): - LPCAppTransaction.__init__(self, 0x04, data) - ExchangeData = LPCAppTransaction.SendData - -class GET_TRACE_VARIABLETransaction(LPCAppTransaction): - def __init__(self): - LPCAppTransaction.__init__(self, 0x05) - ExchangeData = LPCAppTransaction.GetData - -class GET_PLCIDTransaction(LPCAppTransaction): - def __init__(self): - LPCAppTransaction.__init__(self, 0x07) - ExchangeData = LPCAppTransaction.GetData - -if __name__ == "__main__": - __builtins__.BMZ_DBG = True - TestConnection = LPCAppProto(6,115200,2) -# TestConnection.HandleTransaction(GET_PLCIDTransaction()) - TestConnection.HandleTransaction(STARTTransaction()) -# TestConnection.HandleTransaction(SET_TRACE_VARIABLETransaction( -# "\x03\x00\x00\x00"*200)) -# TestConnection.HandleTransaction(STARTTransaction()) - while True: - TestConnection.HandleTransaction(SET_TRACE_VARIABLETransaction( - "\x01\x00\x00\x00"+ - "\x04"+ - "\x01\x02\x02\x04"+ - "\x01\x00\x00\x00"+ - "\x08"+ - "\x01\x02\x02\x04"+ - "\x01\x02\x02\x04"+ - "\x01\x00\x00\x00"+ - "\x04"+ - "\x01\x02\x02\x04")) - #status,res = TestConnection.HandleTransaction(GET_TRACE_VARIABLETransaction()) - #print len(res) - #print "GOT : ", map(hex, map(ord, res)) - #TestConnection.HandleTransaction(STOPTransaction()) diff -r 915be999f3f0 -r 5c42cafaee15 connectors/LPC/LPCBootObject.py --- a/connectors/LPC/LPCBootObject.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -#This file is part of Beremiz, a Integrated Development Environment for -#programming IEC 61131-3 automates supporting plcopen standard and CanFestival. -# -#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD -# -#See COPYING file for copyrights details. -# -#This library is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public -#License as published by the Free Software Foundation; either -#version 2.1 of the License, or (at your option) any later version. -# -#This library is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -#General Public License for more details. -# -#You should have received a copy of the GNU General Public -#License along with this library; if not, write to the Free Software -#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from LPCBootProto import * -from LPCObject import * - -class LPCBootObject(LPCObject): - def __init__(self, confnodesroot, comportstr): - LPCObject.__init__(self, confnodesroot, comportstr) - self.successfully_transfered = False - - def connect(self,comport): - self.SerialConnection = LPCBootProto(comport,#number - 115200, #speed - 120) #timeout - self.HandleSerialTransaction(KEEPBOOTINGTransaction()) - self.PLCStatus = "Stopped" - - def StartPLC(self, debug=False): - self.HandleSerialTransaction(STARTTransaction()) - - def NewPLC(self, md5sum, data, extrafiles): - self.successfully_transfered = self.HandleSerialTransaction(LOADTransaction(data, self.PLCprint)) - return self.successfully_transfered - - def MatchMD5(self, MD5): - res = self.HandleSerialTransaction(CHECKMD5Transaction(MD5)) - if res : - return "".join(res).find('FAILED') == -1 - return False - - - def SetTraceVariablesList(self, idxs): - pass - - def GetTraceVariables(self): - return self.PLCStatus, None, None - diff -r 915be999f3f0 -r 5c42cafaee15 connectors/LPC/LPCBootProto.py --- a/connectors/LPC/LPCBootProto.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -from LPCProto import * - -class LPCBootProto(LPCProto): - def HandleTransaction(self, transaction): - self.TransactionLock.acquire() - try: - transaction.SetPseudoFile(self.serialPort) - res = transaction.ExchangeData() - finally: - self.TransactionLock.release() - return "Stopped", res - -class LPCBootTransaction: - def __init__(self, optdata = ""): - self.OptData = optdata - self.pseudofile = None - - def SetPseudoFile(self, pseudofile): - self.pseudofile = pseudofile - - def ExchangeData(self): - self.pseudofile.write(self.OptData) - return map(lambda x:self.pseudofile.readline(), xrange(self.expectedlines)) - -class KEEPBOOTINGTransaction(LPCBootTransaction): - def __init__(self): - self.expectedlines = 2 - LPCBootTransaction.__init__(self, "md5\n") - -class STARTTransaction(LPCBootTransaction): - def __init__(self): - self.expectedlines = 0 - LPCBootTransaction.__init__(self, "go\n") - -class CHECKMD5Transaction(LPCBootTransaction): - def __init__(self, md5ref): - self.expectedlines = 5 - LPCBootTransaction.__init__(self, md5ref+"md5\n") - -class LOADTransaction(LPCBootTransaction): - def __init__(self, data, PLCprint): - self.PLCprint = PLCprint - LPCBootTransaction.__init__(self, data) - - def ExchangeData(self): - #file("fw.bin","w").write(self.OptData) - data = self.OptData - loptdata = len(self.OptData) - count=0 - #self.PLCprint("%dkB:" % (loptdata/1024)) - while len(data)>0: - res = self.pseudofile.write(data[:loptdata/100]) - data = data[res:] - count += 1 - if count % 10 == 0 : - self.PLCprint("%d%%" % count) - else : - self.PLCprint(".") - self.PLCprint("\n") - return True - -if __name__ == "__main__": - __builtins__.BMZ_DBG = True - TestConnection = LPCBootProto(2,115200,1200) - mystr=file("fw.bin").read() - def mylog(blah): - print blah, - - TestConnection.HandleTransaction(LOADTransaction(mystr, mylog)) diff -r 915be999f3f0 -r 5c42cafaee15 connectors/LPC/LPCObject.py --- a/connectors/LPC/LPCObject.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- - -#This file is part of Beremiz, a Integrated Development Environment for -#programming IEC 61131-3 automates supporting plcopen standard and CanFestival. -# -#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD -# -#See COPYING file for copyrights details. -# -#This library is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public -#License as published by the Free Software Foundation; either -#version 2.1 of the License, or (at your option) any later version. -# -#This library is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -#General Public License for more details. -# -#You should have received a copy of the GNU General Public -#License along with this library; if not, write to the Free Software -#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from LPCProto import * - - - -class LPCObject(): - def __init__(self, confnodesroot, comportstr): - self.PLCStatus = "Disconnected" - self.confnodesroot = confnodesroot - self.PLCprint = confnodesroot.logger.writeyield - self._Idxs = [] - comport = int(comportstr[3:]) - 1 - try: - self.connect(comportstr) - except Exception,e: - self.confnodesroot.logger.write_error(str(e)+"\n") - self.SerialConnection = None - self.PLCStatus = "Disconnected" - - def HandleSerialTransaction(self, transaction): - if self.SerialConnection is not None: - try: - self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction) - return res - except LPCProtoError,e: - self.confnodesroot.logger.write(_("PLC disconnected\n")) - if self.SerialConnection is not None: - self.SerialConnection.close() - self.SerialConnection = None - self.PLCStatus = "Disconnected" - return None - except Exception,e: - self.confnodesroot.logger.write_warning(str(e)+"\n") - - def StartPLC(self, debug=False): - raise LPCProtoError("Not implemented") - - def StopPLC(self): - raise LPCProtoError("Not implemented") - - def GetPLCstatus(self): - raise LPCProtoError("Not implemented") - - def NewPLC(self, md5sum, data, extrafiles): - raise LPCProtoError("Not implemented") - - def MatchMD5(self, MD5): - raise LPCProtoError("Not implemented") - - def SetTraceVariablesList(self, idxs): - raise LPCProtoError("Not implemented") - - def GetTraceVariables(self): - raise LPCProtoError("Not implemented") - diff -r 915be999f3f0 -r 5c42cafaee15 connectors/LPC/LPCProto.py --- a/connectors/LPC/LPCProto.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -import serial -import exceptions -from threading import Lock -import time - -class LPCProtoError(exceptions.Exception): - """Exception class""" - def __init__(self, msg): - self.msg = msg - - def __str__(self): - return "Exception in PLC protocol : " + str(self.msg) - -class LPCProto: - def __init__(self, port, rate, timeout): - # serialize access lock - self.TransactionLock = Lock() - if BMZ_DBG: - # Debugging serial stuff - self._serialPort = serial.Serial( port, rate, timeout = timeout, writeTimeout = timeout ) - class myser: - def readline(self_): - res = self._serialPort.readline() - print 'Recv :"', res, '"' - return res - - def read(self_,cnt): - res = self._serialPort.read(cnt) - if len(res) > 16: - print "Recv :", map(hex,map(ord,res[:16])), "[...]" - else: - print "Recv :", map(hex,map(ord,res)) - - return res - def write(self_, string): - lstr=len(string) - if lstr > 16: - print "Send :", map(hex,map(ord,string[:16])), "[...]" - else: - print "Send :", map(hex,map(ord,string)) - return self._serialPort.write(string) - # while len(string)>0: - # i = self._serialPort.write(string[:4096]) - # print ".", - # string = string[i:] - # print - #return lstr - def flush(self_): - return self._serialPort.flush() - def close(self_): - self._serialPort.close() - self.serialPort = myser() - else: - # open serial port - self.serialPort = serial.Serial( port, rate, timeout = timeout ) - # start with empty buffer - self.serialPort.flush() - - def __del__(self): - if self.serialPort: - self.serialPort.close() - - def close(self): - self.serialPort.close() - self.serialPort = None diff -r 915be999f3f0 -r 5c42cafaee15 connectors/LPC/__init__.py --- a/connectors/LPC/__init__.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD -# -#See COPYING file for copyrights details. -# -#This library is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public -#License as published by the Free Software Foundation; either -#version 2.1 of the License, or (at your option) any later version. -# -#This library is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -#General Public License for more details. -# -#You should have received a copy of the GNU General Public -#License along with this library; if not, write to the Free Software -#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -def LPC_connector_factory(uri, confnodesroot): - """ - This returns the connector to LPC style PLCobject - """ - servicetype, location = uri.split("://") - mode,comportstr = location.split('/') - if mode=="APPLICATION": - from LPCAppObject import LPCAppObject - return LPCAppObject(confnodesroot,comportstr) - elif mode=="BOOTLOADER": - from LPCBootObject import LPCBootObject - return LPCBootObject(confnodesroot,comportstr) - - diff -r 915be999f3f0 -r 5c42cafaee15 connectors/USB/__init__.py --- a/connectors/USB/__init__.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# -#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD -# -#See COPYING file for copyrights details. -# -#This library is free software; you can redistribute it and/or -#modify it under the terms of the GNU General Public -#License as published by the Free Software Foundation; either -#version 2.1 of the License, or (at your option) any later version. -# -#This library is distributed in the hope that it will be useful, -#but WITHOUT ANY WARRANTY; without even the implied warranty of -#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -#General Public License for more details. -# -#You should have received a copy of the GNU General Public -#License along with this library; if not, write to the Free Software -#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -from USB_connector import * \ No newline at end of file diff -r 915be999f3f0 -r 5c42cafaee15 features.py --- a/features.py Sat May 19 19:00:55 2012 +0200 +++ b/features.py Sun May 20 19:07:09 2012 +0200 @@ -3,7 +3,7 @@ catalog = [ ('canfestival', _('CANopen support'), _('Map located variables over CANopen'), 'canfestival.canfestival.RootClass'), - ('c_ext', _('C extention'), _('Add C code accessing located variables synchronously'), 'c_ext.CFile'), + ('c_ext', _('C extension'), _('Add C code accessing located variables synchronously'), 'c_ext.CFile'), ('py_ext', _('Python file'), _('Add Python code executed asynchronously'), 'py_ext.PythonFile'), ('wxglade_hmi', _('WxGlade GUI'), _('Add a simple WxGlade based GUI.'), 'wxglade_hmi.WxGladeHMI'), ('svgui', _('SVGUI'), _('Experimental web based HMI'), 'svgui.SVGUI')] diff -r 915be999f3f0 -r 5c42cafaee15 i18n/Beremiz_fr_FR.po --- a/i18n/Beremiz_fr_FR.po Sat May 19 19:00:55 2012 +0200 +++ b/i18n/Beremiz_fr_FR.po Sun May 20 19:07:09 2012 +0200 @@ -7,15 +7,16 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-12-16 12:32+0100\n" -"PO-Revision-Date: 2009-12-16 13:34+0100\n" +"POT-Creation-Date: 2012-05-20 18:25+0200\n" +"PO-Revision-Date: 2012-05-20 18:38+0100\n" "Last-Translator: \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../Beremiz.py:1487 +#: ../Beremiz.py:1846 #, python-format msgid "" "\n" @@ -23,7 +24,7 @@ "(%s)\n" "\n" "Please be kind enough to send this file to:\n" -"edouard.tisserant@gmail.com\n" +"beremiz-devel@lists.sourceforge.net\n" "\n" "You should now restart Beremiz.\n" "\n" @@ -34,377 +35,436 @@ "(%s)\n" "\n" "Envoyez ce fichier à l'adresse :\n" -"edouard.tisserant@gmail.com\n" +"beremiz-devel@lists.sourceforge.net\n" "\n" "Vous devriez redémarrer Beremiz.\n" "\n" -"Origine :\n" - -#: ../LPCBeremiz.py:695 -#: ../plugger.py:1473 +"Trace d'exécution:\n" + +#: ../ProjectController.py:845 msgid " generation failed !\n" -msgstr ": la construction a échouée !\n" - -#: ../Beremiz.py:1385 +msgstr "la construction a échouée !\n" + +#: ../Beremiz.py:1739 #, python-format msgid "\"%s\" folder is not a valid Beremiz project\n" msgstr "Le dossier \"%s\" ne contient pas de projet Beremiz valide\n" -#: ../plugins/python/PythonEditor.py:500 -msgid "&Edit" -msgstr "&Editer" - -#: ../Beremiz.py:1475 -#: ../Beremiz.py:1477 -#: ../Beremiz.py:1478 +#: ../canfestival/NetworkEditor.py:78 +#: ../canfestival/SlaveEditor.py:48 +#, python-format +msgid "%s Profile" +msgstr "" + +#: ../Beremiz.py:394 +msgid "&ConfNode" +msgstr "" + +#: ../Beremiz.py:426 +msgid "&Properties" +msgstr "&Propriétés" + +#: ../Beremiz.py:407 +msgid "&Recent Projects" +msgstr "Projets &récent" + +#: ../Beremiz.py:1834 +#: ../Beremiz.py:1836 +#: ../Beremiz.py:1837 msgid ", " msgstr ", " -#: ../Beremiz.py:1473 +#: ../Beremiz.py:1832 msgid ". " msgstr ". " -#: ../plugger.py:447 +#: ../ProjectController.py:1146 +msgid "... debugger recovered\n" +msgstr "... déboggueur operationel\n" + +#: ../ConfigTreeNode.py:369 #, python-format msgid "A child names \"%s\" already exist -> \"%s\"\n" msgstr "" -#: ../plugger.py:479 -#, python-format -msgid "A child with IEC channel %d already exist -> %d\n" -msgstr "" - -#: ../Beremiz.py:340 +#: ../Beremiz.py:451 msgid "About" msgstr "A propos" -#: ../Beremiz.py:1420 +#: ../Beremiz.py:1771 msgid "About Beremiz" msgstr "A propos de Beremiz" -#: ../Beremiz.py:1443 -msgid "Add Plugin" -msgstr "Ajouter un plugin" - -#: ../Beremiz.py:618 -#: ../Beremiz.py:883 -msgid "Add a sub plugin" -msgstr "Ajouter un sous plugin" - -#: ../plugger.py:1822 +#: ../canfestival/NetworkEditor.py:90 +#: ../canfestival/SlaveEditor.py:60 +msgid "Add" +msgstr "" + +#: ../features.py:6 +msgid "Add C code accessing located variables synchronously" +msgstr "" + +#: ../Beremiz.py:1802 +msgid "Add ConfNode" +msgstr "" + +#: ../features.py:7 +msgid "Add Python code executed asynchronously" +msgstr "" + +#: ../features.py:8 +msgid "Add a simple WxGlade based GUI." +msgstr "" + +#: ../Beremiz.py:886 +#: ../Beremiz.py:1231 +msgid "Add a sub confnode" +msgstr "Add a sub confnode" + +#: ../canfestival/NetworkEditor.py:92 +msgid "Add slave" +msgstr "" + +#: ../ProjectController.py:1213 msgid "Already connected. Please disconnect\n" msgstr "Déjà connecté. Veuillez déconnecter\n" -#: ../Beremiz.py:1131 +#: ../Beremiz.py:1428 msgid "Append " msgstr "Ajouter " -#: ../plugins/canfestival/config_utils.py:341 -#: ../plugins/canfestival/config_utils.py:623 +#: ../util/Zeroconf.py:599 +msgid "Bad domain name (circular) at " +msgstr "" + +#: ../util/Zeroconf.py:602 +msgid "Bad domain name at " +msgstr "" + +#: ../canfestival/config_utils.py:341 +#: ../canfestival/config_utils.py:623 #, python-format msgid "Bad location size : %s" msgstr "Mauvaise taille d'adresse : %s" -#: ../Beremiz.py:439 +#: ../Beremiz.py:592 msgid "Beremiz" msgstr "Beremiz" -#: ../Beremiz.py:338 -msgid "Beremiz\tF1" -msgstr "Beremiz\tF1" - -#: ../LPCBeremiz.py:388 -#: ../plugger.py:1955 +#: ../util/BrowseValuesLibraryDialog.py:37 +#, python-format +msgid "Browse %s library" +msgstr "" + +#: ../ProjectController.py:1345 msgid "Build" msgstr "Compiler" -#: ../plugger.py:1537 +#: ../ProjectController.py:929 msgid "Build directory already clean\n" msgstr "Le répertoire de compilation est déjà nettoyé\n" -#: ../LPCBeremiz.py:389 -#: ../plugger.py:1956 +#: ../ProjectController.py:1346 msgid "Build project into build folder" msgstr "Compiler le projet dans le répertoire ce compilation" -#: ../LPCBeremiz.py:714 -#: ../plugger.py:1491 +#: ../ProjectController.py:865 msgid "C Build crashed !\n" msgstr "La compilation du C a mal fonctionné !\n" -#: ../LPCBeremiz.py:710 -#: ../plugger.py:1488 +#: ../ProjectController.py:862 msgid "C Build failed.\n" msgstr "La compilation du C a échouée !\n" -#: ../plugger.py:1477 +#: ../ProjectController.py:850 msgid "C code generated successfully.\n" msgstr "Code C généré avec succès.\n" -#: ../targets/toolchain_gcc.py:123 +#: ../targets/toolchain_gcc.py:132 #, python-format msgid "C compilation of %s failed.\n" msgstr "La compilation C de %s a échouée.\n" -#: ../plugger.py:1214 -#, python-format -msgid "Can't find module for target %s!\n" -msgstr "Impossible de trouver le module correspondant à la cible %s !\n" - -#: ../plugger.py:1904 -msgid "Cannot compare latest build to target. Please build.\n" -msgstr "Impossible de comparer la cible avec la dernière compilation. Veuillez compiler le projet.\n" - -#: ../plugger.py:517 +#: ../features.py:6 +msgid "C extension" +msgstr "Extension C" + +#: ../features.py:5 +msgid "CANopen support" +msgstr "" + +#: ../ConfigTreeNode.py:460 #, python-format msgid "Cannot create child %s of type %s " msgstr "Impossible d'ajouter un élément \"%s\" de type \"%s\"" -#: ../plugger.py:472 +#: ../ConfigTreeNode.py:398 #, python-format msgid "Cannot find lower free IEC channel than %d\n" msgstr "Impossible de trouver un numéro IEC inférieur à %d libre\n" -#: ../connectors/PYRO/__init__.py:76 +#: ../connectors/PYRO/__init__.py:75 msgid "Cannot get PLC status - connection failed.\n" msgstr "Impossible d'obtenir le statut de l'automate - la connexion a échoué.\n" -#: ../plugger.py:1312 +#: ../ProjectController.py:671 msgid "Cannot open/parse VARIABLES.csv!\n" msgstr "Impossible d'ouvrir ou d'analyser le fichier VARIABLES.csv !\n" -#: ../plugins/canfestival/config_utils.py:371 +#: ../canfestival/config_utils.py:371 #, python-format msgid "Cannot set bit offset for non bool '%s' variable (ID:%d,Idx:%x,sIdx:%x))" msgstr "" -#: ../Beremiz_service.py:320 +#: ../Beremiz_service.py:322 msgid "Change IP of interface to bind" msgstr "Changer l'adresse IP de l'interface à lier" -#: ../Beremiz_service.py:319 +#: ../Beremiz_service.py:321 msgid "Change Name" msgstr "Changer le nom" -#: ../Beremiz_service.py:323 +#: ../Beremiz_service.py:325 msgid "Change Port Number" msgstr "Changer le numéro de port" -#: ../Beremiz_service.py:325 +#: ../Beremiz_service.py:327 msgid "Change working directory" msgstr "Changer le dossier de travail" -#: ../plugins/python/modules/svgui/svgui.py:90 +#: ../util/BrowseValuesLibraryDialog.py:42 +#, python-format +msgid "Choose a %s:" +msgstr "Choisissez un %s:" + +#: ../svgui/svgui.py:92 msgid "Choose a SVG file" msgstr "Choisissez un fichier SVG" -#: ../plugger.py:975 +#: ../ProjectController.py:311 msgid "Choose a directory to save project" msgstr "Choisissez un dossier où enregistrer le projet" -#: ../Beremiz.py:1337 -#: ../Beremiz.py:1366 +#: ../Beremiz.py:1680 +#: ../Beremiz.py:1713 msgid "Choose a project" msgstr "Choisissez un projet" -#: ../Beremiz_service.py:371 +#: ../Beremiz_service.py:373 msgid "Choose a working directory " msgstr "Choisissez un dossier de travail" -#: ../plugger.py:933 +#: ../ProjectController.py:265 msgid "Chosen folder doesn't contain a program. It's not a valid project!" msgstr "Le répertoire ne contient pas de programme. Ce n'est pas un projet valide !" -#: ../plugger.py:898 +#: ../ProjectController.py:230 msgid "Chosen folder isn't empty. You can't use it for a new project!" msgstr "Le répertoire n'est pas vide. Vous ne pouvez pas l'utiliser pour créer un nouveau projet !" -#: ../plugger.py:1959 +#: ../ProjectController.py:1349 msgid "Clean" msgstr "Nettoyer" -#: ../plugger.py:1961 +#: ../ProjectController.py:1351 msgid "Clean project build folder" msgstr "Nettoyer le répertoire de compilation" -#: ../plugger.py:1534 +#: ../ProjectController.py:926 msgid "Cleaning the build directory\n" msgstr "Répertoire de compilation en cours de nettoyage\n" -#: ../Beremiz.py:517 +#: ../Beremiz.py:698 msgid "Close Application" msgstr "Fermer l'application" -#: ../Beremiz.py:309 -#: ../Beremiz.py:502 +#: ../Beremiz.py:658 msgid "Close Project" msgstr "Fermer le projet" -#: ../Beremiz.py:307 -#: ../LPCBeremiz.py:750 +#: ../Beremiz.py:416 +msgid "Close Project\tCTRL+SHIFT+W" +msgstr "Fermer le project\tCTRL+SHIFT+W" + +#: ../Beremiz.py:414 msgid "Close Tab\tCTRL+W" msgstr "Fermer l'onglet\tCTRL+W" -#: ../plugger.py:1139 +#: ../ProjectController.py:494 msgid "Compiling IEC Program into C code...\n" msgstr "Compilation du program en IEC vers du code C en cours...\n" -#: ../plugger.py:1974 +#: ../ProjectController.py:1364 msgid "Connect" msgstr "Connecter" -#: ../plugger.py:1975 +#: ../ProjectController.py:1365 msgid "Connect to the target PLC" msgstr "Connecter à l'automate cible" -#: ../connectors/PYRO/__init__.py:39 +#: ../connectors/PYRO/__init__.py:38 #, python-format msgid "Connecting to URI : %s\n" msgstr "Connection à l'URI %s en cours...\n" -#: ../plugger.py:1841 +#: ../ProjectController.py:1232 msgid "Connection canceled!\n" msgstr "La connection a été abandonnée !\n" -#: ../LPCBeremiz.py:459 -#: ../LPCBeremiz.py:632 -#: ../plugger.py:1858 +#: ../ProjectController.py:1249 #, python-format msgid "Connection failed to %s!\n" msgstr "La connection à \"%s\" a échouée !\n" -#: ../plugger.py:638 +#: ../ConfigTreeNode.py:572 #, python-format msgid "" "Could not add child \"%s\", type %s :\n" "%s\n" msgstr "" -#: ../plugger.py:615 +#: ../ConfigTreeNode.py:549 #, python-format msgid "" -"Couldn't load plugin base parameters %s :\n" +"Couldn't load confnode base parameters %s :\n" " %s" msgstr "" "Impossible de charger les paramètres de base du plugin %s :\n" " %s" -#: ../plugger.py:626 +#: ../ConfigTreeNode.py:560 #, python-format msgid "" -"Couldn't load plugin parameters %s :\n" +"Couldn't load confnode parameters %s :\n" " %s" msgstr "" "Impossible de charger les paramètres du plugin %s :\n" " %s" -#: ../plugger.py:1785 +#: ../ProjectController.py:1195 msgid "Couldn't start PLC !\n" msgstr "Impossible de démarrer l'automate !\n" -#: ../plugger.py:1811 +#: ../ProjectController.py:1203 msgid "Couldn't stop PLC !\n" msgstr "Impossible d'arrêter l'automate !\n" -#: ../plugins/python/modules/svgui/svgui.py:20 +#: ../ProjectController.py:1173 +msgid "Couldn't stop debugger.\n" +msgstr "Impossible d'arrêter le débogage de l'automate !\n" + +#: ../svgui/svgui.py:22 msgid "Create HMI" msgstr "Créer une IHM" -#: ../plugger.py:1605 +#: ../canfestival/NetworkEditor.py:86 +#: ../canfestival/SlaveEditor.py:56 +msgid "DS-301 Profile" +msgstr "" + +#: ../canfestival/NetworkEditor.py:87 +#: ../canfestival/SlaveEditor.py:57 +msgid "DS-302 Profile" +msgstr "" + +#: ../ProjectController.py:1000 #, python-format msgid "Debug : Unknown variable %s\n" msgstr "Débogage : variable \"%s\" inconnue\n" -#: ../plugger.py:1766 -msgid "Debug Thread couldn't be killed" -msgstr "Le thread de débogage n'a pu être détruit" - -#: ../LPCBeremiz.py:479 -#: ../plugger.py:1879 +#: ../ProjectController.py:998 +#, python-format +msgid "Debug : Unsuppoted type to debug %s\n" +msgstr "" + +#: ../ProjectController.py:1270 msgid "Debug connect matching running PLC\n" msgstr "L'automate connecté correspond au project ouvert.\n" -#: ../plugger.py:1745 -#, python-format -msgid "Debug data do not match requested variable count %d != %d\n" -msgstr "Les données de débogage ne sont pas cohérentes %d != %d\n" - -#: ../LPCBeremiz.py:482 -#: ../plugger.py:1882 +#: ../ProjectController.py:1273 msgid "Debug do not match PLC - stop/transfert/start to re-enable\n" msgstr "L'automate connecté ne correspond pas au project ouvert - Arrêter/transférez/démarrer pour pouvoir débogguer.\n" -#: ../plugger.py:1757 +#: ../ProjectController.py:1163 msgid "Debugger disabled\n" msgstr "Débogueur désactivé\n" -#: ../Beremiz.py:874 -msgid "Delete this plugin" +#: ../ProjectController.py:1175 +msgid "Debugger stopped.\n" +msgstr "Débogueur désactivé\n" + +#: ../Beremiz.py:1222 +msgid "Delete this confnode" msgstr "Supprimer ce plugin" -#: ../plugger.py:1983 +#: ../ProjectController.py:1373 msgid "Disconnect" msgstr "Déconnecter" -#: ../plugger.py:1985 +#: ../ProjectController.py:1375 msgid "Disconnect from PLC" msgstr "Déconnecter l'automate" -#: ../plugins/c_ext/c_ext.py:250 -#: ../plugins/c_ext/c_ext.py:251 +#: ../c_ext/c_ext.py:143 +#: ../c_ext/c_ext.py:144 msgid "Edit C File" msgstr "Editer le fichier C" -#: ../plugins/canfestival/canfestival.py:246 +#: ../canfestival/canfestival.py:274 msgid "Edit CanOpen Network with NetworkEdit" msgstr "Editer le réseau CANOpen à l'aide de NetworkEdit" -#: ../plugins/python/modules/wxglade_hmi/wxglade_hmi.py:13 +#: ../py_ext/PythonFileCTNMixin.py:19 +#: ../py_ext/PythonFileCTNMixin.py:20 +msgid "Edit Python File" +msgstr "Editer le fichier Python" + +#: ../wxglade_hmi/wxglade_hmi.py:12 msgid "Edit a WxWidgets GUI with WXGlade" msgstr "Editer une IHM WxWidgets à l'aide de WXGlade" -#: ../plugins/canfestival/canfestival.py:245 +#: ../canfestival/canfestival.py:273 msgid "Edit network" msgstr "Editer le réseau" -#: ../plugger.py:1994 +#: ../ProjectController.py:1384 msgid "Edit raw IEC code added to code generated by PLCGenerator" msgstr "Editer le code IEC ajouté au code généré par PLCGenerator" -#: ../Beremiz.py:824 -msgid "Enable/Disable this plugin" +#: ../Beremiz.py:948 +msgid "Enable/Disable this confnode" msgstr "Activer/Désactiver le plugin" -#: ../Beremiz_service.py:378 +#: ../Beremiz_service.py:380 msgid "Enter a name " msgstr "Saisissez un nom" -#: ../Beremiz_service.py:363 +#: ../Beremiz_service.py:365 msgid "Enter a port number " msgstr "Saisissez un numéro de port" -#: ../Beremiz_service.py:353 +#: ../Beremiz_service.py:355 msgid "Enter the IP of the interface to bind" msgstr "Saisissez l'adresse IP de l'interface à lier" -#: ../Beremiz.py:1499 -#: ../Beremiz.py:1509 -#: ../plugger.py:879 -#: ../Beremiz_service.py:268 -#: ../Beremiz_service.py:392 +#: ../util/BrowseValuesLibraryDialog.py:83 +#: ../Beremiz.py:1858 +#: ../ProjectController.py:210 +#: ../Beremiz_service.py:270 +#: ../Beremiz_service.py:394 msgid "Error" msgstr "Erreur" -#: ../plugger.py:1187 +#: ../ProjectController.py:543 msgid "Error : At least one configuration and one resource must be declared in PLC !\n" msgstr "Erreur : Au moins une configuration ou une ressource doit être déclarée dans l'automate !\n" -#: ../plugger.py:1179 +#: ../ProjectController.py:535 #, python-format msgid "Error : IEC to C compiler returned %d\n" msgstr "Erreur : Le compilateur d'IEC en C a retourné %d\n" -#: ../plugger.py:1121 +#: ../ProjectController.py:476 #, python-format msgid "" "Error in ST/IL/SFC code generator :\n" @@ -413,434 +473,443 @@ "Erreur dans le générateur de code ST/IL/SFC :\n" "%s\n" -#: ../plugger.py:222 +#: ../ConfigTreeNode.py:180 #, python-format msgid "Error while saving \"%s\"\n" msgstr "Erreur lors de l'enregistrement de \"%s\"\n" -#: ../plugins/canfestival/canfestival.py:237 +#: ../canfestival/canfestival.py:255 msgid "Error: No Master generated\n" msgstr "Erreur : Aucun maître généré\n" -#: ../plugins/canfestival/canfestival.py:232 +#: ../canfestival/canfestival.py:250 msgid "Error: No PLC built\n" msgstr "Erreur : Aucun automate compilé\n" -#: ../LPCBeremiz.py:453 -#: ../LPCBeremiz.py:626 -#: ../plugger.py:1852 +#: ../ProjectController.py:1243 #, python-format msgid "Exception while connecting %s!\n" msgstr "Une exception est apparu au cours de la connexion %s !\n" -#: ../plugger.py:1191 +#: ../features.py:9 +msgid "Experimental web based HMI" +msgstr "" + +#: ../ProjectController.py:547 msgid "Extracting Located Variables...\n" msgstr "Extraction des variables adressées en cours...\n" -#: ../plugger.py:1919 +#: ../ProjectController.py:1310 msgid "Failed : Must build before transfer.\n" msgstr "Echec : Le projet doit être compilé avant d'être transféré.\n" -#: ../LPCBeremiz.py:703 -#: ../plugger.py:1482 +#: ../ProjectController.py:855 msgid "Fatal : cannot get builder.\n" msgstr "Erreur fatale : impossible de trouver un compilateur.\n" -#: ../connectors/PYRO/__init__.py:109 +#: ../connectors/PYRO/__init__.py:108 msgid "Force runtime reload\n" msgstr "Redémarrage du runtime forcé\n" -#: ../plugger.py:1111 +#: ../ProjectController.py:466 msgid "Generating SoftPLC IEC-61131 ST/IL/SFC code...\n" msgstr "Création du code ST/IL/SFC de l'automate IEC-61131 en cours...\n" -#: ../plugger.py:1432 -msgid "Generating plugins C code\n" -msgstr "Création du code C des plugins en cours\n" - -#: ../LPCBeremiz.py:649 -#: ../plugger.py:1424 +#: ../ProjectController.py:782 msgid "IEC-61131-3 code generation failed !\n" msgstr "La création du code IEC-61131-3 a échouée !\n" -#: ../Beremiz_service.py:354 -#: ../Beremiz_service.py:355 +#: ../Beremiz_service.py:356 +#: ../Beremiz_service.py:357 msgid "IP is not valid!" msgstr "l'IP est invalide !" -#: ../plugins/python/modules/svgui/svgui.py:15 -#: ../plugins/python/modules/svgui/svgui.py:16 +#: ../svgui/svgui.py:17 +#: ../svgui/svgui.py:18 msgid "Import SVG" msgstr "Importer un SVG" -#: ../plugins/python/modules/svgui/svgui.py:19 +#: ../svgui/svgui.py:21 msgid "Inkscape" msgstr "Inkscape" -#: ../plugins/canfestival/config_utils.py:376 -#: ../plugins/canfestival/config_utils.py:637 +#: ../canfestival/config_utils.py:376 +#: ../canfestival/config_utils.py:637 #, python-format msgid "Invalid type \"%s\"-> %d != %d for location\"%s\"" msgstr "Type invalide \"%s\"-> %d != %d pour cette adresse \"%s\"" -#: ../plugger.py:1925 +#: ../ProjectController.py:1316 msgid "Latest build already matches current target. Transfering anyway...\n" msgstr "La dernière compilation correspond à la cible actuelle...\n" -#: ../plugger.py:1893 -msgid "Latest build does not match with target, please transfer.\n" -msgstr "La dernière compilation ne correspond pas a la cible actuelle, veuillez transférer le programme.\n" - -#: ../plugger.py:1897 -msgid "Latest build matches target, no transfer needed.\n" -msgstr "La dernière compilation correspond à la cible actuelle. il n'est pas nécessaire de transférer le programme.\n" - -#: ../Beremiz_service.py:322 +#: ../Beremiz_service.py:324 msgid "Launch WX GUI inspector" msgstr "Lancer un inspecteur d'IHM WX" -#: ../Beremiz_service.py:321 +#: ../Beremiz_service.py:323 msgid "Launch a live Python shell" msgstr "Lancer une console Python" -#: ../targets/toolchain_gcc.py:131 +#: ../targets/toolchain_gcc.py:142 msgid "Linking :\n" msgstr "Linkage :\n" -#: ../discovery.py:107 +#: ../util/discovery.py:107 msgid "Local" msgstr "Local" -#: ../Beremiz.py:388 -#: ../LPCBeremiz.py:792 +#: ../Beremiz.py:514 msgid "Log Console" msgstr "Console de log" -#: ../plugger.py:527 -#, python-format -msgid "Max count (%d) reached for this plugin of type %s " +#: ../canfestival/NetworkEditor.py:73 +#: ../canfestival/SlaveEditor.py:43 +msgid "Map Variable" +msgstr "" + +#: ../features.py:5 +msgid "Map located variables over CANopen" +msgstr "" + +#: ../canfestival/NetworkEditor.py:95 +msgid "Master" +msgstr "Maître" + +#: ../ConfigTreeNode.py:470 +#, python-format +msgid "Max count (%d) reached for this confnode of type %s " msgstr "Nombre limite(%d) atteint pour les plugin de type %s" -#: ../Beremiz_service.py:379 +#: ../Beremiz_service.py:381 msgid "Name must not be null!" msgstr "Le nom ne doit pas être vide !" -#: ../Beremiz.py:299 +#: ../Beremiz.py:443 +msgid "New" +msgstr "" + +#: ../Beremiz.py:404 msgid "New\tCTRL+N" msgstr "Nouveau\tCTRL+N" -#: ../plugger.py:1949 +#: ../ProjectController.py:1339 msgid "No PLC to transfer (did build succeed ?)\n" msgstr "Aucun automate à transférer (la compilation a-t-elle réussi ?)\n" -#: ../Beremiz_service.py:392 +#: ../Beremiz_service.py:394 msgid "No running PLC" msgstr "Aucun automate en cours d'exécution" -#: ../plugins/python/modules/svgui/svgui.py:96 +#: ../svgui/svgui.py:98 #, python-format msgid "No such SVG file: %s\n" msgstr "Fichier SVG inconnu : %s\n" -#: ../plugins/canfestival/config_utils.py:632 +#: ../canfestival/config_utils.py:632 #, python-format msgid "No such index/subindex (%x,%x) (variable %s)" msgstr "indice et sous-indice inconnu (%x,%x) (variable %s)" -#: ../plugins/canfestival/config_utils.py:361 +#: ../canfestival/config_utils.py:361 #, python-format msgid "No such index/subindex (%x,%x) in ID : %d (variable %s)" msgstr "indice et sous-indice inconnu (%x,%x) pour l'ID : %d (variable %s)" -#: ../plugins/canfestival/config_utils.py:354 +#: ../util/BrowseValuesLibraryDialog.py:83 +msgid "No valid value selected!" +msgstr "" + +#: ../canfestival/NetworkEditor.py:85 +#: ../canfestival/SlaveEditor.py:55 +msgid "Node infos" +msgstr "" + +#: ../canfestival/config_utils.py:354 #, python-format msgid "Non existing node ID : %d (variable %s)" msgstr "Le node ID n'existe pas : %d (variable %s)" -#: ../plugins/canfestival/config_utils.py:383 +#: ../canfestival/config_utils.py:383 #, python-format msgid "Not PDO mappable variable : '%s' (ID:%d,Idx:%x,sIdx:%x))" msgstr "Variable non mappable dans un PDO : '%s' (ID:%d,Idx:%x,sIdx:%x))" -#: ../Beremiz.py:301 +#: ../Beremiz.py:444 +msgid "Open" +msgstr "" + +#: ../Beremiz.py:406 msgid "Open\tCTRL+O" msgstr "Ouvrir\tCTRL+O" -#: ../plugins/c_ext/c_ext.py:230 -msgid "Open CFileEditor" -msgstr "Ouverture de CFileEditor" - -#: ../plugins/python/modules/svgui/svgui.py:105 +#: ../svgui/svgui.py:107 msgid "Open Inkscape" msgstr "Ouverture de Inkscape" -#: ../plugins/canfestival/canfestival.py:208 -msgid "Open NetworkEdit" -msgstr "Ouverture de NetworkEdit" - -#: ../plugins/canfestival/canfestival.py:108 -msgid "Open ObjDictEdit" -msgstr "Ouverture de ObjdictEdit" - -#: ../plugins/python/modules/wxglade_hmi/wxglade_hmi.py:107 +#: ../wxglade_hmi/wxglade_hmi.py:109 msgid "Open wxGlade" msgstr "Ouverture de wxGlade" -#: ../targets/toolchain_gcc.py:99 +#: ../canfestival/NetworkEditor.py:83 +#: ../canfestival/SlaveEditor.py:53 +msgid "Other Profile" +msgstr "" + +#: ../canfestival/NetworkEditor.py:72 +#: ../canfestival/SlaveEditor.py:42 +msgid "PDO Receive" +msgstr "" + +#: ../canfestival/NetworkEditor.py:71 +#: ../canfestival/SlaveEditor.py:41 +msgid "PDO Transmit" +msgstr "" + +#: ../targets/toolchain_gcc.py:107 msgid "PLC :\n" msgstr "Automate :\n" -#: ../LPCBeremiz.py:472 -#: ../plugger.py:1582 -#: ../plugger.py:1872 +#: ../ProjectController.py:974 +#: ../ProjectController.py:1263 #, python-format msgid "PLC is %s\n" msgstr "L'automate est dans l'état %s\n" -#: ../Beremiz.py:312 -#: ../LPCBeremiz.py:753 -msgid "Page Setup" -msgstr "Mise en page..." - -#: ../Beremiz.py:1443 -msgid "Please enter a name for plugin:" +#: ../Beremiz.py:419 +msgid "Page Setup\tCTRL+ALT+P" +msgstr "Mise en page\tCTRL+ALT+P" + +#: ../Beremiz.py:1802 +msgid "Please enter a name for confnode:" msgstr "Saisissez un nom pour le plugin :" -#: ../targets/toolchain_gcc.py:97 -msgid "Plugin : " -msgstr "Plugin :" - -#: ../plugger.py:1438 -msgid "Plugins code generation failed !\n" -msgstr "La création du code des plugins a échoué !\n" - -#: ../Beremiz_service.py:364 +#: ../Beremiz_service.py:366 msgid "Port number must be 0 <= port <= 65535!" msgstr "Le numéro de port doit être compris entre 0 et 65535 !" -#: ../Beremiz_service.py:364 +#: ../Beremiz_service.py:366 msgid "Port number must be an integer!" msgstr "Le numéro de port doit être un entier !" -#: ../Beremiz.py:314 -#: ../LPCBeremiz.py:755 -msgid "Preview" -msgstr "Aperçu avant impression" - -#: ../Beremiz.py:316 -#: ../LPCBeremiz.py:757 +#: ../Beremiz.py:421 +msgid "Preview\tCTRL+SHIFT+P" +msgstr "Preview\tCTRL+SHIFT+P" + +#: ../Beremiz.py:447 msgid "Print" msgstr "Imprimer" -#: ../plugger.py:907 +#: ../Beremiz.py:423 +msgid "Print\tCTRL+P" +msgstr "Imprimer\tCTRL+P" + +#: ../ProjectController.py:239 msgid "Project not created" msgstr "Le projet n'a pu être créé" -#: ../plugger.py:553 -#, python-format -msgid "Project tree layout do not match plugin.xml %s!=%s " +#: ../ConfigTreeNode.py:496 +#, python-format +msgid "Project tree layout do not match confnode.xml %s!=%s " msgstr "L'organisation du projet ne correspond pas à plugin.xml %s!=%s" -#: ../Beremiz.py:319 -#: ../LPCBeremiz.py:760 -msgid "Properties" -msgstr "Propriétés" - -#: ../plugins/python/PythonEditor.py:513 -#: ../plugins/python/PythonEditor.py:565 -msgid "PythonEditor" -msgstr "PythonEditor" - -#: ../Beremiz_service.py:326 +#: ../features.py:7 +msgid "Python file" +msgstr "Fichier Python" + +#: ../Beremiz_service.py:328 msgid "Quit" msgstr "Quitter" -#: ../Beremiz.py:322 -#: ../LPCBeremiz.py:763 +#: ../Beremiz.py:429 msgid "Quit\tCTRL+Q" msgstr "Quitter\tCTRL+Q" -#: ../plugger.py:1993 +#: ../ProjectController.py:1383 msgid "Raw IEC code" msgstr "Ajout code IEC" -#: ../Beremiz.py:1454 -msgid "Really delete plugin ?" +#: ../Beremiz.py:1813 +msgid "Really delete confnode ?" msgstr "Voulez-vous réellement supprimer le plugin ?" -#: ../plugins/python/PythonEditor.py:494 -msgid "Redo\tCTRL+Y" -msgstr "Refaire\tCTRL+Y" - -#: ../discovery.py:102 +#: ../util/discovery.py:102 msgid "Refresh" msgstr "Actualiser" -#: ../plugins/python/PythonEditor.py:490 -msgid "Refresh\tCTRL+R" -msgstr "Actualiser\tCTRL+R" - -#: ../Beremiz.py:1454 -msgid "Remove plugin" -msgstr "Enlever le plugin" - -#: ../LPCBeremiz.py:378 -#: ../plugger.py:1964 +#: ../Beremiz.py:1813 +msgid "Remove confnode" +msgstr "" + +#: ../canfestival/NetworkEditor.py:93 +msgid "Remove slave" +msgstr "Enlever l'esclave" + +#: ../ProjectController.py:1354 msgid "Run" msgstr "Exécuter" -#: ../plugins/python/modules/svgui/svgui.py:90 +#: ../ProjectController.py:796 +#: ../ProjectController.py:805 +msgid "Runtime extensions C code generation failed !\n" +msgstr "La génération du code des plugins a échoué !\n" + +#: ../canfestival/NetworkEditor.py:70 +#: ../canfestival/SlaveEditor.py:40 +msgid "SDO Client" +msgstr "" + +#: ../canfestival/NetworkEditor.py:69 +#: ../canfestival/SlaveEditor.py:39 +msgid "SDO Server" +msgstr "" + +#: ../svgui/svgui.py:92 msgid "SVG files (*.svg)|*.svg|All files|*.*" msgstr "Fichiers SVG (*.svg)|*.svg|Tous les fichiers|*.*" -#: ../Beremiz.py:303 -#: ../LPCBeremiz.py:748 +#: ../features.py:9 +msgid "SVGUI" +msgstr "" + +#: ../Beremiz.py:445 +msgid "Save" +msgstr "Enregistrer" + +#: ../Beremiz.py:410 msgid "Save\tCTRL+S" msgstr "Enregistrer\tCTRL+S" -#: ../Beremiz.py:305 +#: ../Beremiz.py:446 +msgid "Save As..." +msgstr "" + +#: ../Beremiz.py:412 msgid "Save as\tCTRL+SHIFT+S" msgstr "Enregistrer sous...\tCTRL+SHIFT+S" -#: ../discovery.py:81 +#: ../util/discovery.py:81 msgid "Services available:" msgstr "Services disponibles:" -#: ../plugger.py:1990 +#: ../ProjectController.py:1380 msgid "Show IEC code generated by PLCGenerator" msgstr "Afficher le code IEC généré par PLCGenerator" -#: ../plugins/canfestival/canfestival.py:249 +#: ../canfestival/canfestival.py:277 msgid "Show Master" msgstr "Afficher le maître" -#: ../plugins/canfestival/canfestival.py:250 +#: ../canfestival/canfestival.py:278 msgid "Show Master generated by config_utils" msgstr "Afficher le maître généré par config_utils" -#: ../plugger.py:1988 +#: ../ProjectController.py:1378 msgid "Show code" msgstr "Afficher le code" -#: ../LPCBeremiz.py:374 -msgid "Simulate" -msgstr "Simuler" - -#: ../LPCBeremiz.py:375 -msgid "Simulate PLC" -msgstr "Simuler l'automate" - -#: ../LPCBeremiz.py:380 -#: ../plugger.py:1966 -#: ../Beremiz_service.py:317 +#: ../ProjectController.py:1356 +#: ../Beremiz_service.py:319 msgid "Start PLC" msgstr "Démarrer l'automate" -#: ../plugger.py:1416 +#: ../ProjectController.py:774 #, python-format msgid "Start build in %s\n" msgstr "Début de la compilation dans %s\n" -#: ../plugger.py:1782 +#: ../ProjectController.py:1192 msgid "Starting PLC\n" msgstr "Démarrer l'automate\n" -#: ../LPCBeremiz.py:383 -#: ../plugger.py:1969 +#: ../ProjectController.py:1359 msgid "Stop" msgstr "Arrêter" -#: ../Beremiz_service.py:318 +#: ../Beremiz_service.py:320 msgid "Stop PLC" msgstr "Arrêter l'automate" -#: ../LPCBeremiz.py:385 -#: ../plugger.py:1971 +#: ../ProjectController.py:1361 msgid "Stop Running PLC" msgstr "Arrêter l'automate en cours d'exécution" -#: ../plugger.py:1814 -msgid "Stopping debug\n" +#: ../ProjectController.py:1170 +msgid "Stopping debugger...\n" msgstr "Arrêt du débogage en cours\n" -#: ../Beremiz.py:505 +#: ../ProjectController.py:870 +msgid "Successfully built.\n" +msgstr "" + +#: ../Beremiz.py:661 msgid "There are changes, do you want to save?" msgstr "Le projet a été modifié, voulez-vous l'enregistrer ?" -#: ../Beremiz.py:382 -#: ../LPCBeremiz.py:786 +#: ../Beremiz.py:507 +#: ../Beremiz.py:508 msgid "Topology" msgstr "Topologie" -#: ../LPCBeremiz.py:392 -#: ../plugger.py:1978 +#: ../ProjectController.py:1368 msgid "Transfer" msgstr "Transférer" -#: ../LPCBeremiz.py:394 -#: ../plugger.py:1980 +#: ../ProjectController.py:1370 msgid "Transfer PLC" msgstr "Transférer l'automate" -#: ../LPCBeremiz.py:727 -#: ../plugger.py:1945 +#: ../ProjectController.py:1335 msgid "Transfer completed successfully.\n" msgstr "Transfert effectué avec succès.\n" -#: ../LPCBeremiz.py:729 -#: ../plugger.py:1947 +#: ../ProjectController.py:1337 msgid "Transfer failed\n" msgstr "Le transfert a échoué\n" -#: ../plugins/canfestival/config_utils.py:335 -#: ../plugins/canfestival/config_utils.py:617 +#: ../canfestival/config_utils.py:335 +#: ../canfestival/config_utils.py:617 #, python-format msgid "Type conflict for location \"%s\"" msgstr "Conflit entre types pour l'adresse \"%s\"" -#: ../plugins/canfestival/config_utils.py:455 -#: ../plugins/canfestival/config_utils.py:469 +#: ../canfestival/config_utils.py:455 +#: ../canfestival/config_utils.py:469 #, python-format msgid "Unable to define PDO mapping for node %02x" msgstr "Impossible de définir le mappage des PDO pour le noeud %02x" -#: ../targets/Xenomai/__init__.py:27 -msgid "Unable to get Xenomai's CFLAGS\n" -msgstr "Impossible d'obtenir les CFLAGS de Xenomai\n" - -#: ../targets/Xenomai/__init__.py:16 -msgid "Unable to get Xenomai's LDFLAGS\n" -msgstr "Impossible d'obtenir les LDFLAGS de Xenomai\n" - -#: ../plugins/python/PythonEditor.py:492 -msgid "Undo\tCTRL+Z" -msgstr "Défaire\tCTRL+Z" - -#: ../plugins/python/modules/wxglade_hmi/wxglade_hmi.py:12 +#: ../targets/Xenomai/__init__.py:14 +#, python-format +msgid "Unable to get Xenomai's %s \n" +msgstr "Unable to get Xenomai's %s \n" + +#: ../canfestival/NetworkEditor.py:74 +#: ../canfestival/SlaveEditor.py:44 +msgid "User Type" +msgstr "" + +#: ../wxglade_hmi/wxglade_hmi.py:11 msgid "WXGLADE GUI" msgstr "IHM WXGlade" -#: ../plugger.py:1752 +#: ../ProjectController.py:1154 msgid "Waiting debugger to recover...\n" msgstr "En attente de la mise en route du déboggueur...\n" -#: ../plugger.py:1116 +#: ../ProjectController.py:471 msgid "Warnings in ST/IL/SFC code generator :\n" msgstr "Mises en garde du generateur de code ST/IL/SFC :\n" -#: ../connectors/PYRO/__init__.py:47 +#: ../connectors/PYRO/__init__.py:46 msgid "Wrong URI, please check it !\n" msgstr "URI inconnue, veuillez vérifier l'adresse !\n" -#: ../plugins/c_ext/c_ext.py:229 -msgid "" -"You don't have write permissions.\n" -"Open CFileEditor anyway ?" -msgstr "" -"Vous n'avez pas les permissions d'écriture.\n" -"Ouvrir CFileEditor tout de même ?" - -#: ../plugins/python/modules/svgui/svgui.py:104 +#: ../features.py:8 +msgid "WxGlade GUI" +msgstr "" + +#: ../svgui/svgui.py:106 msgid "" "You don't have write permissions.\n" "Open Inkscape anyway ?" @@ -848,23 +917,7 @@ "Vous n'avez pas les permissions d'écriture.\n" "Ouvrir Inkscape tout de même ?" -#: ../plugins/canfestival/canfestival.py:207 -msgid "" -"You don't have write permissions.\n" -"Open NetworkEdit anyway ?" -msgstr "" -"Vous n'avez pas les permissions d'écriture.\n" -"Ouvrir NetworkEdit tout de même ?" - -#: ../plugins/canfestival/canfestival.py:107 -msgid "" -"You don't have write permissions.\n" -"Open ObjDictEdit anyway ?" -msgstr "" -"Vous n'avez pas les permissions d'écriture.\n" -"Ouvrir ObjdictEdit tout de même ?" - -#: ../plugins/python/modules/wxglade_hmi/wxglade_hmi.py:106 +#: ../wxglade_hmi/wxglade_hmi.py:108 msgid "" "You don't have write permissions.\n" "Open wxGlade anyway ?" @@ -872,7 +925,7 @@ "Vous n'avez pas les permissions d'écriture.\n" "Ouvrir wxGlade tout de même ?" -#: ../plugger.py:878 +#: ../ProjectController.py:209 msgid "" "You must have permission to work on the project\n" "Work on a project copy ?" @@ -880,25 +933,34 @@ "Vous n'avez pas la permission de travailler sur le projet.\n" "Travailler sur une copie du projet ?" -#: ../wxPopen.py:145 +#: ../util/ProcessLogger.py:158 #, python-format msgid "exited with status %s (pid %s)\n" msgstr "a quitté avec le status %s (pid %s)\n" -#: ../Beremiz.py:1475 -#: ../Beremiz.py:1477 +#: ../Beremiz.py:1834 +#: ../Beremiz.py:1836 msgid "file : " msgstr "fichier :" -#: ../Beremiz.py:1478 +#: ../Beremiz.py:1837 msgid "function : " msgstr "fonction :" -#: ../Beremiz.py:1478 +#: ../Beremiz.py:1837 msgid "line : " msgstr "ligne :" #: Extra XSD strings +msgid "CExtension" +msgstr "Extension C" + +msgid "CFLAGS" +msgstr "CFLAGS" + +msgid "LDFLAGS" +msgstr "LDFLAGS" + msgid "BaseParams" msgstr "Paramètres de base" @@ -911,163 +973,69 @@ msgid "Enabled" msgstr "Actif" +msgid "Xenomai" +msgstr "Xenomai" + +msgid "XenoConfig" +msgstr "Config Xenomai" + +msgid "Win32" +msgstr "Win32" + +msgid "Linux" +msgstr "Linux" + +msgid "Compiler" +msgstr "Compileur" + +msgid "Linker" +msgstr "Linkeur" + +msgid "CanFestivalSlaveNode" +msgstr "Noeud esclave CanFestival" + +msgid "CAN_Device" +msgstr "Port CAN" + +msgid "CAN_Baudrate" +msgstr "Vitesse CAN" + +msgid "NodeId" +msgstr "NodeId" + +msgid "Sync_Align" +msgstr "Aligner sur synchro" + +msgid "Sync_Align_Ratio" +msgstr "Rapport d'alignement" + +msgid "CanFestivalNode" +msgstr "Noeud CanFestival" + +msgid "Sync_TPDOs" +msgstr "TPDOs sur synchro" + +msgid "CanFestivalInstance" +msgstr "Instance CanFestival" + +msgid "CAN_Driver" +msgstr "Driver CAN" + +msgid "Debug_mode" +msgstr "Mode de débogage" + msgid "BeremizRoot" msgstr "Racine de Beremiz" msgid "TargetType" msgstr "Type de cible" +msgid "Libraries" +msgstr "" + msgid "URI_location" msgstr "Adresse URI" -msgid "Enable_Plugins" -msgstr "Plugins actifs" - -msgid "CExtension" -msgstr "Extension C" - -msgid "CFLAGS" -msgstr "CFLAGS" - -msgid "LDFLAGS" -msgstr "LDFLAGS" - -msgid "CanFestivalSlaveNode" -msgstr "Noeud esclave CanFestival" - -msgid "CAN_Device" -msgstr "Port CAN" - -msgid "CAN_Baudrate" -msgstr "Vitesse CAN" - -msgid "NodeId" -msgstr "NodeId" - -msgid "Sync_Align" -msgstr "Aligner sur synchro" - -msgid "Sync_Align_Ratio" -msgstr "Rapport d'alignement" - -msgid "CanFestivalNode" -msgstr "Noeud CanFestival" - -msgid "Sync_TPDOs" -msgstr "TPDOs sur synchro" - -msgid "CanFestivalInstance" -msgstr "Instance CanFestival" - -msgid "CAN_Driver" -msgstr "Driver CAN" - -msgid "Debug_mode" -msgstr "Mode de débogage" - -msgid "Compiler" -msgstr "Compileur" - -msgid "Linker" -msgstr "Linkeur" - -msgid "Linux" -msgstr "Linux" - -msgid "Rtai" -msgstr "Rtai" - -msgid "rtai_config" -msgstr "Config Rtai" - -msgid "Win32" -msgstr "Win32" - -msgid "Xenomai" -msgstr "Xenomai" - -msgid "XenoConfig" -msgstr "Config Xenomai" - -#~ msgid "Broken" -#~ msgstr "Cassé" -#~ msgid "Couldn't start PLC debug !\n" -#~ msgstr "Impossible d'arrêter le débogage de l'automate !\n" -#~ msgid "Debug" -#~ msgstr "Déboguer" -#~ msgid "Dirty" -#~ msgstr "Corrompu" -#~ msgid "Disconnected" -#~ msgstr "Déconnecté" -#~ msgid "Empty" -#~ msgstr "Vide" -#~ msgid "Start PLC (debug mode)" -#~ msgstr "Démarrer l'automate (en mode debug)" -#~ msgid "Started" -#~ msgstr "Démarré" -#~ msgid "Starting" -#~ msgstr "Démarrage" -#~ msgid "Starting PLC (debug mode)\n" -#~ msgstr "Démarrage de l'automate (en mode debug) en cours\n" -#~ msgid "Stopped" -#~ msgstr "Arrêté" -#~ msgid "Save changes ?" -#~ msgstr "Enregistrer les changements ?" - -#, fuzzy -#~ msgid "Conflict type for location \"%s\"" -#~ msgstr "Conflit entre types pour l'adresse \"%s\"" -#~ msgid "#EXCEPTION : " -#~ msgstr "#EXCEPTION : " -#~ msgid "Build\tCTRL+R" -#~ msgstr "Compiler\tCTRL+R" -#~ msgid "Cancel" -#~ msgstr "Annuler" -#~ msgid "Delete Plugin" -#~ msgstr "Supprimer un plugin" -#~ msgid "Do you want to continue?" -#~ msgstr "Voulez-vous continuer ?" -#~ msgid "ERROR" -#~ msgstr "ERREUR" -#~ msgid "Edit PLC\tCTRL+R" -#~ msgstr "Editer l'automate\tCTRL+R" -#~ msgid "Edit PLC program with PLCOpenEditor" -#~ msgstr "Editer le programme à l'aide de PLCOpenEditor" -#~ msgid "File" -#~ msgstr "Fichier" -#~ msgid "Help" -#~ msgstr "Aide" -#~ msgid "My IP is :" -#~ msgstr "Mon IP est :" -#~ msgid "NewPLC (%s)" -#~ msgstr "Nouvel automate (%s)" -#~ msgid "OK" -#~ msgstr "Valider" -#~ msgid "Please stop PLC to close" -#~ msgstr "Veuillez arrêter l'automate pour quitter" -#~ msgid "Problem %s PLC" -#~ msgstr "Problème lors du %s de l'automate" -#~ msgid "Publish service on local network" -#~ msgstr "Le service est publié sur le réseau local" -#~ msgid "PythonThreadProc interrupted" -#~ msgstr "PythonThreadProc a été interrompu" -#~ msgid "Question" -#~ msgstr "Question" -#~ msgid "Save Log" -#~ msgstr "Enregistrer le log" -#~ msgid "Service Discovery" -#~ msgstr "Découverte de service" -#~ msgid "The daemon runs on port :" -#~ msgstr "Le service est disponible sur le port :" -#~ msgid "The object's uri is :" -#~ msgstr "L' URI de l'objet est :" -#~ msgid "The working directory :" -#~ msgstr "Le répertoire de travail :" -#~ msgid "Write Python runtime code, for use with python_eval FBs" -#~ msgstr "" -#~ "Ecrivez le code Python du runtime, à utiliser avec les blocs python_eval" -#~ msgid "You are about to overwrite that file\n" -#~ msgstr "Vous allez écraser ce fichier\n" -#~ msgid "loading" -#~ msgstr "chargement" - +msgid "Disable_Extensions" +msgstr "Disable_Extensions" + diff -r 915be999f3f0 -r 5c42cafaee15 i18n/README --- a/i18n/README Sat May 19 19:00:55 2012 +0200 +++ b/i18n/README Sun May 20 19:07:09 2012 +0200 @@ -5,4 +5,8 @@ To generate .mo files for all languages: python mki18n.py -m --moTarget=../locale --domain=Beremiz - \ No newline at end of file + + +To generate app.fil: + + find .. -name "*.py" -exec grep -q '_(' {} ';' -print -o -name "*XSD*" -print | grep -v '/build/' | grep -v '/pyjs/' > app.fil diff -r 915be999f3f0 -r 5c42cafaee15 i18n/app.fil --- a/i18n/app.fil Sat May 19 19:00:55 2012 +0200 +++ b/i18n/app.fil Sun May 20 19:07:09 2012 +0200 @@ -1,22 +1,36 @@ -../Beremiz.py -../LPCBeremiz.py -../plugger.py -../Beremiz_service.py -../discovery.py -../wxPopen.py -../connectors/PYRO/__init__.py -../plugins/c_ext/c_ext.py -../plugins/canfestival/canfestival.py -../plugins/canfestival/config_utils.py -../plugins/python/PythonEditor.py -../plugins/python/modules/svgui/svgui.py -../plugins/python/modules/wxglade_hmi/wxglade_hmi.py ../runtime/PLCObject.py ../runtime/ServicePublisher.py +../c_ext/CFileEditor.py +../c_ext/c_ext.py +../features.py +../svgui/svgui.py +../svgui/svgui_server.py +../svgui/svguilib.py +../util/BrowseValuesLibraryDialog.py +../util/TextCtrlAutoComplete.py +../util/MiniTextControler.py +../util/Zeroconf.py +../util/discovery.py +../util/misc.py +../util/ProcessLogger.py +../ConfigTreeNode.py ../targets/toolchain_gcc.py +../targets/__init__.py +../targets/Xenomai/__init__.py +../targets/Xenomai/XSD +../targets/Win32/XSD +../targets/Linux/XSD ../targets/XSD_toolchain_gcc -../targets/Linux/XSD -../targets/Rtai/XSD -../targets/Win32/XSD -../targets/Xenomai/__init__.py -../targets/Xenomai/XSD \ No newline at end of file +../canfestival/config_utils.py +../canfestival/NetworkEditor.py +../canfestival/canfestival.py +../canfestival/SlaveEditor.py +../py_ext/PythonFileCTNMixin.py +../py_ext/PythonEditor.py +../Beremiz.py +../wxglade_hmi/wxglade_hmi.py +../ProjectController.py +../POULibrary.py +../connectors/PYRO/__init__.py +../connectors/__init__.py +../Beremiz_service.py diff -r 915be999f3f0 -r 5c42cafaee15 i18n/messages.pot --- a/i18n/messages.pot Sat May 19 19:00:55 2012 +0200 +++ b/i18n/messages.pot Sun May 20 19:07:09 2012 +0200 @@ -8,15 +8,16 @@ msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2009-12-16 12:32+0100\n" +"POT-Creation-Date: 2012-05-20 18:25+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../Beremiz.py:1487 +#: ../Beremiz.py:1846 #, python-format msgid "" "\n" @@ -24,810 +25,891 @@ "(%s)\n" "\n" "Please be kind enough to send this file to:\n" -"edouard.tisserant@gmail.com\n" +"beremiz-devel@lists.sourceforge.net\n" "\n" "You should now restart Beremiz.\n" "\n" "Traceback:\n" msgstr "" -#: ../LPCBeremiz.py:695 ../plugger.py:1473 +#: ../ProjectController.py:845 msgid " generation failed !\n" msgstr "" -#: ../Beremiz.py:1385 +#: ../Beremiz.py:1739 #, python-format msgid "\"%s\" folder is not a valid Beremiz project\n" msgstr "" -#: ../plugins/python/PythonEditor.py:500 -msgid "&Edit" -msgstr "" - -#: ../Beremiz.py:1475 ../Beremiz.py:1477 ../Beremiz.py:1478 +#: ../canfestival/NetworkEditor.py:78 ../canfestival/SlaveEditor.py:48 +#, python-format +msgid "%s Profile" +msgstr "" + +#: ../Beremiz.py:394 +msgid "&ConfNode" +msgstr "" + +#: ../Beremiz.py:426 +msgid "&Properties" +msgstr "" + +#: ../Beremiz.py:407 +msgid "&Recent Projects" +msgstr "" + +#: ../Beremiz.py:1834 ../Beremiz.py:1836 ../Beremiz.py:1837 msgid ", " msgstr "" -#: ../Beremiz.py:1473 +#: ../Beremiz.py:1832 msgid ". " msgstr "" -#: ../plugger.py:447 +#: ../ProjectController.py:1146 +msgid "... debugger recovered\n" +msgstr "" + +#: ../ConfigTreeNode.py:369 #, python-format msgid "A child names \"%s\" already exist -> \"%s\"\n" msgstr "" -#: ../plugger.py:479 -#, python-format -msgid "A child with IEC channel %d already exist -> %d\n" -msgstr "" - -#: ../Beremiz.py:340 +#: ../Beremiz.py:451 msgid "About" msgstr "" -#: ../Beremiz.py:1420 +#: ../Beremiz.py:1771 msgid "About Beremiz" msgstr "" -#: ../Beremiz.py:1443 -msgid "Add Plugin" -msgstr "" - -#: ../Beremiz.py:618 ../Beremiz.py:883 -msgid "Add a sub plugin" -msgstr "" - -#: ../plugger.py:1822 +#: ../canfestival/NetworkEditor.py:90 ../canfestival/SlaveEditor.py:60 +msgid "Add" +msgstr "" + +#: ../features.py:6 +msgid "Add C code accessing located variables synchronously" +msgstr "" + +#: ../Beremiz.py:1802 +msgid "Add ConfNode" +msgstr "" + +#: ../features.py:7 +msgid "Add Python code executed asynchronously" +msgstr "" + +#: ../features.py:8 +msgid "Add a simple WxGlade based GUI." +msgstr "" + +#: ../Beremiz.py:886 ../Beremiz.py:1231 +msgid "Add a sub confnode" +msgstr "" + +#: ../canfestival/NetworkEditor.py:92 +msgid "Add slave" +msgstr "" + +#: ../ProjectController.py:1213 msgid "Already connected. Please disconnect\n" msgstr "" -#: ../Beremiz.py:1131 +#: ../Beremiz.py:1428 msgid "Append " msgstr "" -#: ../plugins/canfestival/config_utils.py:341 -#: ../plugins/canfestival/config_utils.py:623 +#: ../util/Zeroconf.py:599 +msgid "Bad domain name (circular) at " +msgstr "" + +#: ../util/Zeroconf.py:602 +msgid "Bad domain name at " +msgstr "" + +#: ../canfestival/config_utils.py:341 ../canfestival/config_utils.py:623 #, python-format msgid "Bad location size : %s" msgstr "" -#: ../Beremiz.py:439 +#: ../Beremiz.py:592 msgid "Beremiz" msgstr "" -#: ../Beremiz.py:338 -msgid "Beremiz\tF1" -msgstr "" - -#: ../LPCBeremiz.py:388 ../plugger.py:1955 +#: ../util/BrowseValuesLibraryDialog.py:37 +#, python-format +msgid "Browse %s library" +msgstr "" + +#: ../ProjectController.py:1345 msgid "Build" msgstr "" -#: ../plugger.py:1537 +#: ../ProjectController.py:929 msgid "Build directory already clean\n" msgstr "" -#: ../LPCBeremiz.py:389 ../plugger.py:1956 +#: ../ProjectController.py:1346 msgid "Build project into build folder" msgstr "" -#: ../LPCBeremiz.py:714 ../plugger.py:1491 +#: ../ProjectController.py:865 msgid "C Build crashed !\n" msgstr "" -#: ../LPCBeremiz.py:710 ../plugger.py:1488 +#: ../ProjectController.py:862 msgid "C Build failed.\n" msgstr "" -#: ../plugger.py:1477 +#: ../ProjectController.py:850 msgid "C code generated successfully.\n" msgstr "" -#: ../targets/toolchain_gcc.py:123 +#: ../targets/toolchain_gcc.py:132 #, python-format msgid "C compilation of %s failed.\n" msgstr "" -#: ../plugger.py:1214 -#, python-format -msgid "Can't find module for target %s!\n" -msgstr "" - -#: ../plugger.py:1904 -msgid "Cannot compare latest build to target. Please build.\n" -msgstr "" - -#: ../plugger.py:517 +#: ../features.py:6 +msgid "C extension" +msgstr "" + +#: ../features.py:5 +msgid "CANopen support" +msgstr "" + +#: ../ConfigTreeNode.py:460 #, python-format msgid "Cannot create child %s of type %s " msgstr "" -#: ../plugger.py:472 +#: ../ConfigTreeNode.py:398 #, python-format msgid "Cannot find lower free IEC channel than %d\n" msgstr "" -#: ../connectors/PYRO/__init__.py:76 +#: ../connectors/PYRO/__init__.py:75 msgid "Cannot get PLC status - connection failed.\n" msgstr "" -#: ../plugger.py:1312 +#: ../ProjectController.py:671 msgid "Cannot open/parse VARIABLES.csv!\n" msgstr "" -#: ../plugins/canfestival/config_utils.py:371 +#: ../canfestival/config_utils.py:371 #, python-format msgid "Cannot set bit offset for non bool '%s' variable (ID:%d,Idx:%x,sIdx:%x))" msgstr "" -#: ../Beremiz_service.py:320 +#: ../Beremiz_service.py:322 msgid "Change IP of interface to bind" msgstr "" -#: ../Beremiz_service.py:319 +#: ../Beremiz_service.py:321 msgid "Change Name" msgstr "" -#: ../Beremiz_service.py:323 +#: ../Beremiz_service.py:325 msgid "Change Port Number" msgstr "" -#: ../Beremiz_service.py:325 +#: ../Beremiz_service.py:327 msgid "Change working directory" msgstr "" -#: ../plugins/python/modules/svgui/svgui.py:90 +#: ../util/BrowseValuesLibraryDialog.py:42 +#, python-format +msgid "Choose a %s:" +msgstr "" + +#: ../svgui/svgui.py:92 msgid "Choose a SVG file" msgstr "" -#: ../plugger.py:975 +#: ../ProjectController.py:311 msgid "Choose a directory to save project" msgstr "" -#: ../Beremiz.py:1337 ../Beremiz.py:1366 +#: ../Beremiz.py:1680 ../Beremiz.py:1713 msgid "Choose a project" msgstr "" -#: ../Beremiz_service.py:371 +#: ../Beremiz_service.py:373 msgid "Choose a working directory " msgstr "" -#: ../plugger.py:933 +#: ../ProjectController.py:265 msgid "Chosen folder doesn't contain a program. It's not a valid project!" msgstr "" -#: ../plugger.py:898 +#: ../ProjectController.py:230 msgid "Chosen folder isn't empty. You can't use it for a new project!" msgstr "" -#: ../plugger.py:1959 +#: ../ProjectController.py:1349 msgid "Clean" msgstr "" -#: ../plugger.py:1961 +#: ../ProjectController.py:1351 msgid "Clean project build folder" msgstr "" -#: ../plugger.py:1534 +#: ../ProjectController.py:926 msgid "Cleaning the build directory\n" msgstr "" -#: ../Beremiz.py:517 +#: ../Beremiz.py:698 msgid "Close Application" msgstr "" -#: ../Beremiz.py:309 ../Beremiz.py:502 +#: ../Beremiz.py:658 msgid "Close Project" msgstr "" -#: ../Beremiz.py:307 ../LPCBeremiz.py:750 +#: ../Beremiz.py:416 +msgid "Close Project\tCTRL+SHIFT+W" +msgstr "" + +#: ../Beremiz.py:414 msgid "Close Tab\tCTRL+W" msgstr "" -#: ../plugger.py:1139 +#: ../ProjectController.py:494 msgid "Compiling IEC Program into C code...\n" msgstr "" -#: ../plugger.py:1974 +#: ../ProjectController.py:1364 msgid "Connect" msgstr "" -#: ../plugger.py:1975 +#: ../ProjectController.py:1365 msgid "Connect to the target PLC" msgstr "" -#: ../connectors/PYRO/__init__.py:39 +#: ../connectors/PYRO/__init__.py:38 #, python-format msgid "Connecting to URI : %s\n" msgstr "" -#: ../plugger.py:1841 +#: ../ProjectController.py:1232 msgid "Connection canceled!\n" msgstr "" -#: ../LPCBeremiz.py:459 ../LPCBeremiz.py:632 ../plugger.py:1858 +#: ../ProjectController.py:1249 #, python-format msgid "Connection failed to %s!\n" msgstr "" -#: ../plugger.py:638 +#: ../ConfigTreeNode.py:572 #, python-format msgid "" "Could not add child \"%s\", type %s :\n" "%s\n" msgstr "" -#: ../plugger.py:615 +#: ../ConfigTreeNode.py:549 #, python-format msgid "" -"Couldn't load plugin base parameters %s :\n" +"Couldn't load confnode base parameters %s :\n" " %s" msgstr "" -#: ../plugger.py:626 +#: ../ConfigTreeNode.py:560 #, python-format msgid "" -"Couldn't load plugin parameters %s :\n" +"Couldn't load confnode parameters %s :\n" " %s" msgstr "" -#: ../plugger.py:1785 +#: ../ProjectController.py:1195 msgid "Couldn't start PLC !\n" msgstr "" -#: ../plugger.py:1811 +#: ../ProjectController.py:1203 msgid "Couldn't stop PLC !\n" msgstr "" -#: ../plugins/python/modules/svgui/svgui.py:20 +#: ../ProjectController.py:1173 +msgid "Couldn't stop debugger.\n" +msgstr "" + +#: ../svgui/svgui.py:22 msgid "Create HMI" msgstr "" -#: ../plugger.py:1605 +#: ../canfestival/NetworkEditor.py:86 ../canfestival/SlaveEditor.py:56 +msgid "DS-301 Profile" +msgstr "" + +#: ../canfestival/NetworkEditor.py:87 ../canfestival/SlaveEditor.py:57 +msgid "DS-302 Profile" +msgstr "" + +#: ../ProjectController.py:1000 #, python-format msgid "Debug : Unknown variable %s\n" msgstr "" -#: ../plugger.py:1766 -msgid "Debug Thread couldn't be killed" -msgstr "" - -#: ../LPCBeremiz.py:479 ../plugger.py:1879 +#: ../ProjectController.py:998 +#, python-format +msgid "Debug : Unsuppoted type to debug %s\n" +msgstr "" + +#: ../ProjectController.py:1270 msgid "Debug connect matching running PLC\n" msgstr "" -#: ../plugger.py:1745 -#, python-format -msgid "Debug data do not match requested variable count %d != %d\n" -msgstr "" - -#: ../LPCBeremiz.py:482 ../plugger.py:1882 +#: ../ProjectController.py:1273 msgid "Debug do not match PLC - stop/transfert/start to re-enable\n" msgstr "" -#: ../plugger.py:1757 +#: ../ProjectController.py:1163 msgid "Debugger disabled\n" msgstr "" -#: ../Beremiz.py:874 -msgid "Delete this plugin" -msgstr "" - -#: ../plugger.py:1983 +#: ../ProjectController.py:1175 +msgid "Debugger stopped.\n" +msgstr "" + +#: ../Beremiz.py:1222 +msgid "Delete this confnode" +msgstr "" + +#: ../ProjectController.py:1373 msgid "Disconnect" msgstr "" -#: ../plugger.py:1985 +#: ../ProjectController.py:1375 msgid "Disconnect from PLC" msgstr "" -#: ../plugins/c_ext/c_ext.py:250 ../plugins/c_ext/c_ext.py:251 +#: ../c_ext/c_ext.py:143 ../c_ext/c_ext.py:144 msgid "Edit C File" msgstr "" -#: ../plugins/canfestival/canfestival.py:246 +#: ../canfestival/canfestival.py:274 msgid "Edit CanOpen Network with NetworkEdit" msgstr "" -#: ../plugins/python/modules/wxglade_hmi/wxglade_hmi.py:13 +#: ../py_ext/PythonFileCTNMixin.py:19 ../py_ext/PythonFileCTNMixin.py:20 +msgid "Edit Python File" +msgstr "" + +#: ../wxglade_hmi/wxglade_hmi.py:12 msgid "Edit a WxWidgets GUI with WXGlade" msgstr "" -#: ../plugins/canfestival/canfestival.py:245 +#: ../canfestival/canfestival.py:273 msgid "Edit network" msgstr "" -#: ../plugger.py:1994 +#: ../ProjectController.py:1384 msgid "Edit raw IEC code added to code generated by PLCGenerator" msgstr "" -#: ../Beremiz.py:824 -msgid "Enable/Disable this plugin" -msgstr "" - -#: ../Beremiz_service.py:378 +#: ../Beremiz.py:948 +msgid "Enable/Disable this confnode" +msgstr "" + +#: ../Beremiz_service.py:380 msgid "Enter a name " msgstr "" -#: ../Beremiz_service.py:363 +#: ../Beremiz_service.py:365 msgid "Enter a port number " msgstr "" -#: ../Beremiz_service.py:353 +#: ../Beremiz_service.py:355 msgid "Enter the IP of the interface to bind" msgstr "" -#: ../Beremiz.py:1499 ../Beremiz.py:1509 ../plugger.py:879 -#: ../Beremiz_service.py:268 ../Beremiz_service.py:392 +#: ../util/BrowseValuesLibraryDialog.py:83 ../Beremiz.py:1858 +#: ../ProjectController.py:210 ../Beremiz_service.py:270 +#: ../Beremiz_service.py:394 msgid "Error" msgstr "" -#: ../plugger.py:1187 +#: ../ProjectController.py:543 msgid "Error : At least one configuration and one resource must be declared in PLC !\n" msgstr "" -#: ../plugger.py:1179 +#: ../ProjectController.py:535 #, python-format msgid "Error : IEC to C compiler returned %d\n" msgstr "" -#: ../plugger.py:1121 +#: ../ProjectController.py:476 #, python-format msgid "" "Error in ST/IL/SFC code generator :\n" "%s\n" msgstr "" -#: ../plugger.py:222 +#: ../ConfigTreeNode.py:180 #, python-format msgid "Error while saving \"%s\"\n" msgstr "" -#: ../plugins/canfestival/canfestival.py:237 +#: ../canfestival/canfestival.py:255 msgid "Error: No Master generated\n" msgstr "" -#: ../plugins/canfestival/canfestival.py:232 +#: ../canfestival/canfestival.py:250 msgid "Error: No PLC built\n" msgstr "" -#: ../LPCBeremiz.py:453 ../LPCBeremiz.py:626 ../plugger.py:1852 +#: ../ProjectController.py:1243 #, python-format msgid "Exception while connecting %s!\n" msgstr "" -#: ../plugger.py:1191 +#: ../features.py:9 +msgid "Experimental web based HMI" +msgstr "" + +#: ../ProjectController.py:547 msgid "Extracting Located Variables...\n" msgstr "" -#: ../plugger.py:1919 +#: ../ProjectController.py:1310 msgid "Failed : Must build before transfer.\n" msgstr "" -#: ../LPCBeremiz.py:703 ../plugger.py:1482 +#: ../ProjectController.py:855 msgid "Fatal : cannot get builder.\n" msgstr "" -#: ../connectors/PYRO/__init__.py:109 +#: ../connectors/PYRO/__init__.py:108 msgid "Force runtime reload\n" msgstr "" -#: ../plugger.py:1111 +#: ../ProjectController.py:466 msgid "Generating SoftPLC IEC-61131 ST/IL/SFC code...\n" msgstr "" -#: ../plugger.py:1432 -msgid "Generating plugins C code\n" -msgstr "" - -#: ../LPCBeremiz.py:649 ../plugger.py:1424 +#: ../ProjectController.py:782 msgid "IEC-61131-3 code generation failed !\n" msgstr "" -#: ../Beremiz_service.py:354 ../Beremiz_service.py:355 +#: ../Beremiz_service.py:356 ../Beremiz_service.py:357 msgid "IP is not valid!" msgstr "" -#: ../plugins/python/modules/svgui/svgui.py:15 -#: ../plugins/python/modules/svgui/svgui.py:16 +#: ../svgui/svgui.py:17 ../svgui/svgui.py:18 msgid "Import SVG" msgstr "" -#: ../plugins/python/modules/svgui/svgui.py:19 +#: ../svgui/svgui.py:21 msgid "Inkscape" msgstr "" -#: ../plugins/canfestival/config_utils.py:376 -#: ../plugins/canfestival/config_utils.py:637 +#: ../canfestival/config_utils.py:376 ../canfestival/config_utils.py:637 #, python-format msgid "Invalid type \"%s\"-> %d != %d for location\"%s\"" msgstr "" -#: ../plugger.py:1925 +#: ../ProjectController.py:1316 msgid "Latest build already matches current target. Transfering anyway...\n" msgstr "" -#: ../plugger.py:1893 -msgid "Latest build does not match with target, please transfer.\n" -msgstr "" - -#: ../plugger.py:1897 -msgid "Latest build matches target, no transfer needed.\n" -msgstr "" - -#: ../Beremiz_service.py:322 +#: ../Beremiz_service.py:324 msgid "Launch WX GUI inspector" msgstr "" -#: ../Beremiz_service.py:321 +#: ../Beremiz_service.py:323 msgid "Launch a live Python shell" msgstr "" -#: ../targets/toolchain_gcc.py:131 +#: ../targets/toolchain_gcc.py:142 msgid "Linking :\n" msgstr "" -#: ../discovery.py:107 +#: ../util/discovery.py:107 msgid "Local" msgstr "" -#: ../Beremiz.py:388 ../LPCBeremiz.py:792 +#: ../Beremiz.py:514 msgid "Log Console" msgstr "" -#: ../plugger.py:527 -#, python-format -msgid "Max count (%d) reached for this plugin of type %s " -msgstr "" - -#: ../Beremiz_service.py:379 +#: ../canfestival/NetworkEditor.py:73 ../canfestival/SlaveEditor.py:43 +msgid "Map Variable" +msgstr "" + +#: ../features.py:5 +msgid "Map located variables over CANopen" +msgstr "" + +#: ../canfestival/NetworkEditor.py:95 +msgid "Master" +msgstr "" + +#: ../ConfigTreeNode.py:470 +#, python-format +msgid "Max count (%d) reached for this confnode of type %s " +msgstr "" + +#: ../Beremiz_service.py:381 msgid "Name must not be null!" msgstr "" -#: ../Beremiz.py:299 +#: ../Beremiz.py:443 +msgid "New" +msgstr "" + +#: ../Beremiz.py:404 msgid "New\tCTRL+N" msgstr "" -#: ../plugger.py:1949 +#: ../ProjectController.py:1339 msgid "No PLC to transfer (did build succeed ?)\n" msgstr "" -#: ../Beremiz_service.py:392 +#: ../Beremiz_service.py:394 msgid "No running PLC" msgstr "" -#: ../plugins/python/modules/svgui/svgui.py:96 +#: ../svgui/svgui.py:98 #, python-format msgid "No such SVG file: %s\n" msgstr "" -#: ../plugins/canfestival/config_utils.py:632 +#: ../canfestival/config_utils.py:632 #, python-format msgid "No such index/subindex (%x,%x) (variable %s)" msgstr "" -#: ../plugins/canfestival/config_utils.py:361 +#: ../canfestival/config_utils.py:361 #, python-format msgid "No such index/subindex (%x,%x) in ID : %d (variable %s)" msgstr "" -#: ../plugins/canfestival/config_utils.py:354 +#: ../util/BrowseValuesLibraryDialog.py:83 +msgid "No valid value selected!" +msgstr "" + +#: ../canfestival/NetworkEditor.py:85 ../canfestival/SlaveEditor.py:55 +msgid "Node infos" +msgstr "" + +#: ../canfestival/config_utils.py:354 #, python-format msgid "Non existing node ID : %d (variable %s)" msgstr "" -#: ../plugins/canfestival/config_utils.py:383 +#: ../canfestival/config_utils.py:383 #, python-format msgid "Not PDO mappable variable : '%s' (ID:%d,Idx:%x,sIdx:%x))" msgstr "" -#: ../Beremiz.py:301 +#: ../Beremiz.py:444 +msgid "Open" +msgstr "" + +#: ../Beremiz.py:406 msgid "Open\tCTRL+O" msgstr "" -#: ../plugins/c_ext/c_ext.py:230 -msgid "Open CFileEditor" -msgstr "" - -#: ../plugins/python/modules/svgui/svgui.py:105 +#: ../svgui/svgui.py:107 msgid "Open Inkscape" msgstr "" -#: ../plugins/canfestival/canfestival.py:208 -msgid "Open NetworkEdit" -msgstr "" - -#: ../plugins/canfestival/canfestival.py:108 -msgid "Open ObjDictEdit" -msgstr "" - -#: ../plugins/python/modules/wxglade_hmi/wxglade_hmi.py:107 +#: ../wxglade_hmi/wxglade_hmi.py:109 msgid "Open wxGlade" msgstr "" -#: ../targets/toolchain_gcc.py:99 +#: ../canfestival/NetworkEditor.py:83 ../canfestival/SlaveEditor.py:53 +msgid "Other Profile" +msgstr "" + +#: ../canfestival/NetworkEditor.py:72 ../canfestival/SlaveEditor.py:42 +msgid "PDO Receive" +msgstr "" + +#: ../canfestival/NetworkEditor.py:71 ../canfestival/SlaveEditor.py:41 +msgid "PDO Transmit" +msgstr "" + +#: ../targets/toolchain_gcc.py:107 msgid "PLC :\n" msgstr "" -#: ../LPCBeremiz.py:472 ../plugger.py:1582 ../plugger.py:1872 +#: ../ProjectController.py:974 ../ProjectController.py:1263 #, python-format msgid "PLC is %s\n" msgstr "" -#: ../Beremiz.py:312 ../LPCBeremiz.py:753 -msgid "Page Setup" -msgstr "" - -#: ../Beremiz.py:1443 -msgid "Please enter a name for plugin:" -msgstr "" - -#: ../targets/toolchain_gcc.py:97 -msgid "Plugin : " -msgstr "" - -#: ../plugger.py:1438 -msgid "Plugins code generation failed !\n" -msgstr "" - -#: ../Beremiz_service.py:364 +#: ../Beremiz.py:419 +msgid "Page Setup\tCTRL+ALT+P" +msgstr "" + +#: ../Beremiz.py:1802 +msgid "Please enter a name for confnode:" +msgstr "" + +#: ../Beremiz_service.py:366 msgid "Port number must be 0 <= port <= 65535!" msgstr "" -#: ../Beremiz_service.py:364 +#: ../Beremiz_service.py:366 msgid "Port number must be an integer!" msgstr "" -#: ../Beremiz.py:314 ../LPCBeremiz.py:755 -msgid "Preview" -msgstr "" - -#: ../Beremiz.py:316 ../LPCBeremiz.py:757 +#: ../Beremiz.py:421 +msgid "Preview\tCTRL+SHIFT+P" +msgstr "" + +#: ../Beremiz.py:447 msgid "Print" msgstr "" -#: ../plugger.py:907 +#: ../Beremiz.py:423 +msgid "Print\tCTRL+P" +msgstr "" + +#: ../ProjectController.py:239 msgid "Project not created" msgstr "" -#: ../plugger.py:553 -#, python-format -msgid "Project tree layout do not match plugin.xml %s!=%s " -msgstr "" - -#: ../Beremiz.py:319 ../LPCBeremiz.py:760 -msgid "Properties" -msgstr "" - -#: ../plugins/python/PythonEditor.py:513 ../plugins/python/PythonEditor.py:565 -msgid "PythonEditor" -msgstr "" - -#: ../Beremiz_service.py:326 +#: ../ConfigTreeNode.py:496 +#, python-format +msgid "Project tree layout do not match confnode.xml %s!=%s " +msgstr "" + +#: ../features.py:7 +msgid "Python file" +msgstr "" + +#: ../Beremiz_service.py:328 msgid "Quit" msgstr "" -#: ../Beremiz.py:322 ../LPCBeremiz.py:763 +#: ../Beremiz.py:429 msgid "Quit\tCTRL+Q" msgstr "" -#: ../plugger.py:1993 +#: ../ProjectController.py:1383 msgid "Raw IEC code" msgstr "" -#: ../Beremiz.py:1454 -msgid "Really delete plugin ?" -msgstr "" - -#: ../plugins/python/PythonEditor.py:494 -msgid "Redo\tCTRL+Y" -msgstr "" - -#: ../discovery.py:102 +#: ../Beremiz.py:1813 +msgid "Really delete confnode ?" +msgstr "" + +#: ../util/discovery.py:102 msgid "Refresh" msgstr "" -#: ../plugins/python/PythonEditor.py:490 -msgid "Refresh\tCTRL+R" -msgstr "" - -#: ../Beremiz.py:1454 -msgid "Remove plugin" -msgstr "" - -#: ../LPCBeremiz.py:378 ../plugger.py:1964 +#: ../Beremiz.py:1813 +msgid "Remove confnode" +msgstr "" + +#: ../canfestival/NetworkEditor.py:93 +msgid "Remove slave" +msgstr "" + +#: ../ProjectController.py:1354 msgid "Run" msgstr "" -#: ../plugins/python/modules/svgui/svgui.py:90 +#: ../ProjectController.py:796 ../ProjectController.py:805 +msgid "Runtime extensions C code generation failed !\n" +msgstr "" + +#: ../canfestival/NetworkEditor.py:70 ../canfestival/SlaveEditor.py:40 +msgid "SDO Client" +msgstr "" + +#: ../canfestival/NetworkEditor.py:69 ../canfestival/SlaveEditor.py:39 +msgid "SDO Server" +msgstr "" + +#: ../svgui/svgui.py:92 msgid "SVG files (*.svg)|*.svg|All files|*.*" msgstr "" -#: ../Beremiz.py:303 ../LPCBeremiz.py:748 +#: ../features.py:9 +msgid "SVGUI" +msgstr "" + +#: ../Beremiz.py:445 +msgid "Save" +msgstr "" + +#: ../Beremiz.py:410 msgid "Save\tCTRL+S" msgstr "" -#: ../Beremiz.py:305 +#: ../Beremiz.py:446 +msgid "Save As..." +msgstr "" + +#: ../Beremiz.py:412 msgid "Save as\tCTRL+SHIFT+S" msgstr "" -#: ../discovery.py:81 +#: ../util/discovery.py:81 msgid "Services available:" msgstr "" -#: ../plugger.py:1990 +#: ../ProjectController.py:1380 msgid "Show IEC code generated by PLCGenerator" msgstr "" -#: ../plugins/canfestival/canfestival.py:249 +#: ../canfestival/canfestival.py:277 msgid "Show Master" msgstr "" -#: ../plugins/canfestival/canfestival.py:250 +#: ../canfestival/canfestival.py:278 msgid "Show Master generated by config_utils" msgstr "" -#: ../plugger.py:1988 +#: ../ProjectController.py:1378 msgid "Show code" msgstr "" -#: ../LPCBeremiz.py:374 -msgid "Simulate" -msgstr "" - -#: ../LPCBeremiz.py:375 -msgid "Simulate PLC" -msgstr "" - -#: ../LPCBeremiz.py:380 ../plugger.py:1966 ../Beremiz_service.py:317 +#: ../ProjectController.py:1356 ../Beremiz_service.py:319 msgid "Start PLC" msgstr "" -#: ../plugger.py:1416 +#: ../ProjectController.py:774 #, python-format msgid "Start build in %s\n" msgstr "" -#: ../plugger.py:1782 +#: ../ProjectController.py:1192 msgid "Starting PLC\n" msgstr "" -#: ../LPCBeremiz.py:383 ../plugger.py:1969 +#: ../ProjectController.py:1359 msgid "Stop" msgstr "" -#: ../Beremiz_service.py:318 +#: ../Beremiz_service.py:320 msgid "Stop PLC" msgstr "" -#: ../LPCBeremiz.py:385 ../plugger.py:1971 +#: ../ProjectController.py:1361 msgid "Stop Running PLC" msgstr "" -#: ../plugger.py:1814 -msgid "Stopping debug\n" -msgstr "" - -#: ../Beremiz.py:505 +#: ../ProjectController.py:1170 +msgid "Stopping debugger...\n" +msgstr "" + +#: ../ProjectController.py:870 +msgid "Successfully built.\n" +msgstr "" + +#: ../Beremiz.py:661 msgid "There are changes, do you want to save?" msgstr "" -#: ../Beremiz.py:382 ../LPCBeremiz.py:786 +#: ../Beremiz.py:507 ../Beremiz.py:508 msgid "Topology" msgstr "" -#: ../LPCBeremiz.py:392 ../plugger.py:1978 +#: ../ProjectController.py:1368 msgid "Transfer" msgstr "" -#: ../LPCBeremiz.py:394 ../plugger.py:1980 +#: ../ProjectController.py:1370 msgid "Transfer PLC" msgstr "" -#: ../LPCBeremiz.py:727 ../plugger.py:1945 +#: ../ProjectController.py:1335 msgid "Transfer completed successfully.\n" msgstr "" -#: ../LPCBeremiz.py:729 ../plugger.py:1947 +#: ../ProjectController.py:1337 msgid "Transfer failed\n" msgstr "" -#: ../plugins/canfestival/config_utils.py:335 -#: ../plugins/canfestival/config_utils.py:617 +#: ../canfestival/config_utils.py:335 ../canfestival/config_utils.py:617 #, python-format msgid "Type conflict for location \"%s\"" msgstr "" -#: ../plugins/canfestival/config_utils.py:455 -#: ../plugins/canfestival/config_utils.py:469 +#: ../canfestival/config_utils.py:455 ../canfestival/config_utils.py:469 #, python-format msgid "Unable to define PDO mapping for node %02x" msgstr "" -#: ../targets/Xenomai/__init__.py:27 -msgid "Unable to get Xenomai's CFLAGS\n" -msgstr "" - -#: ../targets/Xenomai/__init__.py:16 -msgid "Unable to get Xenomai's LDFLAGS\n" -msgstr "" - -#: ../plugins/python/PythonEditor.py:492 -msgid "Undo\tCTRL+Z" -msgstr "" - -#: ../plugins/python/modules/wxglade_hmi/wxglade_hmi.py:12 +#: ../targets/Xenomai/__init__.py:14 +#, python-format +msgid "Unable to get Xenomai's %s \n" +msgstr "" + +#: ../canfestival/NetworkEditor.py:74 ../canfestival/SlaveEditor.py:44 +msgid "User Type" +msgstr "" + +#: ../wxglade_hmi/wxglade_hmi.py:11 msgid "WXGLADE GUI" msgstr "" -#: ../plugger.py:1752 +#: ../ProjectController.py:1154 msgid "Waiting debugger to recover...\n" msgstr "" -#: ../plugger.py:1116 +#: ../ProjectController.py:471 msgid "Warnings in ST/IL/SFC code generator :\n" msgstr "" -#: ../connectors/PYRO/__init__.py:47 +#: ../connectors/PYRO/__init__.py:46 msgid "Wrong URI, please check it !\n" msgstr "" -#: ../plugins/c_ext/c_ext.py:229 -msgid "" -"You don't have write permissions.\n" -"Open CFileEditor anyway ?" -msgstr "" - -#: ../plugins/python/modules/svgui/svgui.py:104 +#: ../features.py:8 +msgid "WxGlade GUI" +msgstr "" + +#: ../svgui/svgui.py:106 msgid "" "You don't have write permissions.\n" "Open Inkscape anyway ?" msgstr "" -#: ../plugins/canfestival/canfestival.py:207 -msgid "" -"You don't have write permissions.\n" -"Open NetworkEdit anyway ?" -msgstr "" - -#: ../plugins/canfestival/canfestival.py:107 -msgid "" -"You don't have write permissions.\n" -"Open ObjDictEdit anyway ?" -msgstr "" - -#: ../plugins/python/modules/wxglade_hmi/wxglade_hmi.py:106 +#: ../wxglade_hmi/wxglade_hmi.py:108 msgid "" "You don't have write permissions.\n" "Open wxGlade anyway ?" msgstr "" -#: ../plugger.py:878 +#: ../ProjectController.py:209 msgid "" "You must have permission to work on the project\n" "Work on a project copy ?" msgstr "" -#: ../wxPopen.py:145 +#: ../util/ProcessLogger.py:158 #, python-format msgid "exited with status %s (pid %s)\n" msgstr "" -#: ../Beremiz.py:1475 ../Beremiz.py:1477 +#: ../Beremiz.py:1834 ../Beremiz.py:1836 msgid "file : " msgstr "" -#: ../Beremiz.py:1478 +#: ../Beremiz.py:1837 msgid "function : " msgstr "" -#: ../Beremiz.py:1478 +#: ../Beremiz.py:1837 msgid "line : " msgstr "" #: Extra XSD strings +msgid "CExtension" +msgstr "" + +msgid "CFLAGS" +msgstr "" + +msgid "LDFLAGS" +msgstr "" + msgid "BaseParams" msgstr "" @@ -840,80 +922,68 @@ msgid "Enabled" msgstr "" +msgid "Xenomai" +msgstr "" + +msgid "XenoConfig" +msgstr "" + +msgid "Win32" +msgstr "" + +msgid "Linux" +msgstr "" + +msgid "Compiler" +msgstr "" + +msgid "Linker" +msgstr "" + +msgid "CanFestivalSlaveNode" +msgstr "" + +msgid "CAN_Device" +msgstr "" + +msgid "CAN_Baudrate" +msgstr "" + +msgid "NodeId" +msgstr "" + +msgid "Sync_Align" +msgstr "" + +msgid "Sync_Align_Ratio" +msgstr "" + +msgid "CanFestivalNode" +msgstr "" + +msgid "Sync_TPDOs" +msgstr "" + +msgid "CanFestivalInstance" +msgstr "" + +msgid "CAN_Driver" +msgstr "" + +msgid "Debug_mode" +msgstr "" + msgid "BeremizRoot" msgstr "" msgid "TargetType" msgstr "" +msgid "Libraries" +msgstr "" + msgid "URI_location" msgstr "" -msgid "Enable_Plugins" -msgstr "" - -msgid "CExtension" -msgstr "" - -msgid "CFLAGS" -msgstr "" - -msgid "LDFLAGS" -msgstr "" - -msgid "CanFestivalSlaveNode" -msgstr "" - -msgid "CAN_Device" -msgstr "" - -msgid "CAN_Baudrate" -msgstr "" - -msgid "NodeId" -msgstr "" - -msgid "Sync_Align" -msgstr "" - -msgid "Sync_Align_Ratio" -msgstr "" - -msgid "CanFestivalNode" -msgstr "" - -msgid "Sync_TPDOs" -msgstr "" - -msgid "CanFestivalInstance" -msgstr "" - -msgid "CAN_Driver" -msgstr "" - -msgid "Debug_mode" -msgstr "" - -msgid "Compiler" -msgstr "" - -msgid "Linker" -msgstr "" - -msgid "Linux" -msgstr "" - -msgid "Rtai" -msgstr "" - -msgid "rtai_config" -msgstr "" - -msgid "Win32" -msgstr "" - -msgid "Xenomai" -msgstr "" - -msgid "XenoConfig" -msgstr "" +msgid "Disable_Extensions" +msgstr "" diff -r 915be999f3f0 -r 5c42cafaee15 images/CollapsedIconData.png Binary file images/CollapsedIconData.png has changed diff -r 915be999f3f0 -r 5c42cafaee15 images/ExpandedIconData.png Binary file images/ExpandedIconData.png has changed diff -r 915be999f3f0 -r 5c42cafaee15 py_ext/PythonEditor.py --- a/py_ext/PythonEditor.py Sat May 19 19:00:55 2012 +0200 +++ b/py_ext/PythonEditor.py Sun May 20 19:07:09 2012 +0200 @@ -2,6 +2,8 @@ import wx.stc as stc import keyword +from util import opjimg + from controls import EditorPanel if wx.Platform == '__WXMSW__': @@ -234,8 +236,7 @@ self.DisableEvents = False self.CurrentAction = None - img = wx.Bitmap(self.Controler.GetIconPath("Cfile.png"), wx.BITMAP_TYPE_PNG).ConvertToImage() - self.SetIcon(wx.BitmapFromImage(img.Rescale(16, 16))) + self.SetIcon(wx.Bitmap(opjimg("Cfile"))) def __del__(self): self.Controler.OnCloseEditor(self) diff -r 915be999f3f0 -r 5c42cafaee15 py_ext/PythonFileCTNMixin.py --- a/py_ext/PythonFileCTNMixin.py Sat May 19 19:00:55 2012 +0200 +++ b/py_ext/PythonFileCTNMixin.py Sun May 20 19:07:09 2012 +0200 @@ -1,5 +1,4 @@ import os -from util import opjimg from PLCControler import UndoBuffer from PythonEditor import PythonEditor @@ -16,7 +15,7 @@ def __init__(self): self.ConfNodeMethods.insert(0, - {"bitmap" : opjimg("editPYTHONcode"), + {"bitmap" : "editPYTHONcode", "name" : _("Edit Python File"), "tooltip" : _("Edit Python File"), "method" : "_OpenView"}, diff -r 915be999f3f0 -r 5c42cafaee15 runtime/PLCObject.py --- a/runtime/PLCObject.py Sat May 19 19:00:55 2012 +0200 +++ b/runtime/PLCObject.py Sun May 20 19:07:09 2012 +0200 @@ -183,6 +183,8 @@ self.python_threads_vars["website"] = self.website self.python_threads_vars["_runtime_begin"] = [] self.python_threads_vars["_runtime_cleanup"] = [] + self.python_threads_vars["PLCObject"] = self + self.python_threads_vars["PLCBinary"] = self.PLClibraryHandle for filename in os.listdir(self.workingdir): name, ext = os.path.splitext(filename) diff -r 915be999f3f0 -r 5c42cafaee15 svgui/svgui.py --- a/svgui/svgui.py Sat May 19 19:00:55 2012 +0200 +++ b/svgui/svgui.py Sun May 20 19:07:09 2012 +0200 @@ -13,11 +13,11 @@ class SVGUI: ConfNodeMethods = [ - {"bitmap" : os.path.join("images","ImportSVG"), + {"bitmap" : "ImportSVG", "name" : _("Import SVG"), "tooltip" : _("Import SVG"), "method" : "_ImportSVG"}, - {"bitmap" : os.path.join("images","ImportSVG"), + {"bitmap" : "ImportSVG", # should be something different "name" : _("Inkscape"), "tooltip" : _("Create HMI"), "method" : "_StartInkscape"}, diff -r 915be999f3f0 -r 5c42cafaee15 targets/LPC/XSD --- a/targets/LPC/XSD Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - %(toolchain_makefile)s - - \ No newline at end of file diff -r 915be999f3f0 -r 5c42cafaee15 targets/LPC/__init__.py --- a/targets/LPC/__init__.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -import os -from subprocess import Popen,PIPE -from ..toolchain_makefile import toolchain_makefile -import hashlib - -class LPC_target(toolchain_makefile): - #extension = ".ld" - #DebugEnabled = False - def __init__(self, CTRInstance): - self.binmd5key = None - toolchain_makefile.__init__(self, CTRInstance) - - def _GetBinMD5FileName(self): - return os.path.join(self.buildpath, "lastbuildPLCbin.md5") - - def _get_md5_header(self): - """Returns signature header""" - size = int(Popen( - ['arm-elf-size','-B',os.path.join(self.buildpath,"ArmPLC_rom.elf")], - stdout=PIPE).communicate()[0].splitlines()[1].split()[0]) - res = "&" + hashlib.md5(open(os.path.join(self.buildpath, "ArmPLC_rom.bin"), "rb").read(size)).hexdigest() + '\n' +\ - "$" + str(size) + '\n' - return res - - def GetBinaryCode(self): - """Returns ready to send signed + sized intel formated hex program""" - try: - res = self._get_md5_header() +\ - open(os.path.join(self.buildpath, "ArmPLC_rom.hex"), "r").read() - return res - except Exception, e: - return None - - def _get_cached_md5_header(self): - if self.binmd5key is not None: - return self.binmd5key - else: - try: - return open(self._GetBinMD5FileName(), "r").read() - except IOError, e: - return None - - def ResetBinaryCodeMD5(self, mode): - if mode == "BOOTLOADER": - self.binmd5key = None - try: - os.remove(self._GetBinMD5FileName()) - except Exception, e: - pass - else: - return toolchain_makefile.ResetBinaryCodeMD5(self) - - def GetBinaryCodeMD5(self, mode): - if mode == "BOOTLOADER": - return self._get_cached_md5_header() - else: - return toolchain_makefile.GetBinaryCodeMD5(self) - - def build(self): - res = toolchain_makefile.build(self) - if res: - self.binmd5key = self._get_md5_header() - f = open(self._GetBinMD5FileName(), "w") - f.write(self.binmd5key) - f.close() - try: - self.CTRInstance.logger.write( - _("Binary is %s bytes long\n")% - str(os.path.getsize( - os.path.join(self.buildpath, "ArmPLC_rom.bin")))) - except Exception, e: - pass - return res - diff -r 915be999f3f0 -r 5c42cafaee15 targets/LPC/plc_LPC_main.c --- a/targets/LPC/plc_LPC_main.c Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,145 +0,0 @@ -/** - * Yagarto specific code - **/ - -#include -#include - -/* provided by POUS.C */ -extern unsigned long long common_ticktime__; -extern unsigned long __tick; - -extern unsigned long idLen; -extern unsigned char *idBuf; - -static unsigned char RetainedIdBuf[128] __attribute__((section (".nvolatile"))); -static unsigned char retain_buffer[RETAIN_BUFFER_SIZE] __attribute__((section (".nvolatile"))); - -static int debug_locked = 0; -static int _DebugDataAvailable = 0; -static unsigned long __debug_tick; - -void LPC_GetTime(IEC_TIME*); -void LPC_SetTimer(unsigned long long next, unsigned long long period); - -long AtomicCompareExchange(long* atomicvar,long compared, long exchange) -{ - /* No need for real atomic op on LPC, - * no possible preemption between debug and PLC */ - long res = *atomicvar; - if(res == compared){ - *atomicvar = exchange; - } - return res; -} - -void PLC_GetTime(IEC_TIME *CURRENT_TIME) -{ - /* Call target GetTime function */ - LPC_GetTime(CURRENT_TIME); -} - -void PLC_SetTimer(unsigned long long next, unsigned long long period) -{ - LPC_SetTimer(next, period); -} - -int startPLC(int argc,char **argv) -{ - if(__init(argc,argv) == 0){ - /* sign retain buffer */ - PLC_SetTimer(0, common_ticktime__); - return 0; - }else{ - return 1; - } -} - -int TryEnterDebugSection(void) -{ - if(!debug_locked && __DEBUG){ - debug_locked = 1; - return 1; - } - return 0; -} - -void LeaveDebugSection(void) -{ - debug_locked = 0; -} - -int stopPLC(void) -{ - __cleanup(); - return 0; -} - -/* from plc_debugger.c */ -int WaitDebugData(unsigned long *tick) -{ - /* no blocking call on LPC */ - if(_DebugDataAvailable && !debug_locked){ - /* returns 0 on success */ - *tick = __debug_tick; - _DebugDataAvailable = 0; - return 0; - } - return 1; -} - -/* Called by PLC thread when debug_publish finished - * This is supposed to unlock debugger thread in WaitDebugData*/ -void InitiateDebugTransfer(void) -{ - /* remember tick */ - __debug_tick = __tick; - _DebugDataAvailable = 1; -} - -void suspendDebug(int disable) -{ - /* Prevent PLC to enter debug code */ - __DEBUG = !disable; - debug_locked = !disable; -} - -void resumeDebug(void) -{ - /* Let PLC enter debug code */ - __DEBUG = 1; - debug_locked = 0; -} - -void ValidateRetainBuffer(void) -{ - memcpy(RetainedIdBuf, idBuf, idLen); -} - -void InValidateRetainBuffer(void) -{ - /* invalidate that buffer */ - RetainedIdBuf[0] = 0; -} - -int CheckRetainBuffer(void) -{ - /* compare RETAIN ID buffer with MD5 */ - /* return true if identical */ - int res = memcmp(RetainedIdBuf, idBuf, idLen) == 0; - return res; -} - -void Retain(unsigned int offset, unsigned int count, void *p) -{ - if(offset + count < RETAIN_BUFFER_SIZE) - /* write in RETAIN buffer at offset*/ - memcpy(&retain_buffer[offset], p, count); -} - -void Remind(unsigned int offset, unsigned int count, void *p) -{ - if(offset + count < RETAIN_BUFFER_SIZE) - /* read at offset in RETAIN buffer */ - memcpy(p, &retain_buffer[offset], count); -} diff -r 915be999f3f0 -r 5c42cafaee15 targets/XSD_toolchain_makefile --- a/targets/XSD_toolchain_makefile Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ - - - - - - diff -r 915be999f3f0 -r 5c42cafaee15 targets/__init__.py --- a/targets/__init__.py Sat May 19 19:00:55 2012 +0200 +++ b/targets/__init__.py Sun May 20 19:07:09 2012 +0200 @@ -43,10 +43,7 @@ if path.isdir(path.join(_base_path, name)) and not name.startswith("__")} -toolchains = [name for name in listdir(_base_path) - if not path.isdir(path.join(_base_path, name)) - and name.endswith(".py") - and not name.startswith("__")] +toolchains = {"gcc": path.join(_base_path, "XSD_toolchain_gcc")} def GetBuilder(targetname): return targets[targetname]["class"]() @@ -56,14 +53,12 @@ targetchoices = "" # Get all xsd toolchains - for toolchain in toolchains : - toolchainname = path.splitext(toolchain)[0] - xsdfilename = path.join(_base_path, "XSD_%s"%(toolchainname)) + for toolchainname,xsdfilename in toolchains.iteritems() : if path.isfile(xsdfilename): xsd_toolchain_string = "" for line in open(xsdfilename).readlines(): xsd_toolchain_string += line - DictXSD_toolchain[toolchainname] = xsd_toolchain_string + DictXSD_toolchain["toolchain_"+toolchainname] = xsd_toolchain_string # Get all xsd targets for targetname,nfo in targets.iteritems(): diff -r 915be999f3f0 -r 5c42cafaee15 targets/toolchain_makefile.py --- a/targets/toolchain_makefile.py Sat May 19 19:00:55 2012 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,108 +0,0 @@ -import os, re, operator -from util.ProcessLogger import ProcessLogger -import hashlib - -import time - -includes_re = re.compile('\s*#include\s*["<]([^">]*)[">].*') - -class toolchain_makefile(): - def __init__(self, CTRInstance): - self.CTRInstance = CTRInstance - self.md5key = None - self.buildpath = None - self.SetBuildPath(self.CTRInstance._getBuildPath()) - - def SetBuildPath(self, buildpath): - if self.buildpath != buildpath: - self.buildpath = buildpath - self.md5key = None - - def GetBinaryCode(self): - return None - - def _GetMD5FileName(self): - return os.path.join(self.buildpath, "lastbuildPLC.md5") - - def ResetBinaryCodeMD5(self): - self.md5key = None - try: - os.remove(self._GetMD5FileName()) - except Exception, e: - pass - - def GetBinaryCodeMD5(self): - if self.md5key is not None: - return self.md5key - else: - try: - return open(self._GetMD5FileName(), "r").read() - except IOError, e: - return None - - def concat_deps(self, bn): - # read source - src = open(os.path.join(self.buildpath, bn),"r").read() - # update direct dependencies - deps = [] - for l in src.splitlines(): - res = includes_re.match(l) - if res is not None: - depfn = res.groups()[0] - if os.path.exists(os.path.join(self.buildpath, depfn)): - #print bn + " depends on "+depfn - deps.append(depfn) - # recurse through deps - # TODO detect cicular deps. - return reduce(operator.concat, map(self.concat_deps, deps), src) - - def build(self): - srcfiles= [] - cflags = [] - wholesrcdata = "" - for Location, CFilesAndCFLAGS, DoCalls in self.CTRInstance.LocationCFilesAndCFLAGS: - # Get CFiles list to give it to makefile - for CFile, CFLAGS in CFilesAndCFLAGS: - CFileName = os.path.basename(CFile) - wholesrcdata += self.concat_deps(CFileName) - #wholesrcdata += open(CFile, "r").read() - srcfiles.append(CFileName) - if CFLAGS not in cflags: - cflags.append(CFLAGS) - - oldmd5 = self.md5key - self.md5key = hashlib.md5(wholesrcdata).hexdigest() - props = self.CTRInstance.GetProjectProperties() - self.md5key += '#'.join([props[key] for key in ['companyName', - 'projectName', - 'productName']]) - self.md5key += '#' #+','.join(map(str,time.localtime())) - # Store new PLC filename based on md5 key - f = open(self._GetMD5FileName(), "w") - f.write(self.md5key) - f.close() - - if oldmd5 != self.md5key : - beremizcommand = {"src": ' '.join(srcfiles), - "cflags": ' '.join(cflags), - "md5": '"'+self.md5key+'"' - } - - target = self.CTRInstance.GetTarget().getcontent()["value"] - command = target.getCommand().split(' ') +\ - [target.getBuildPath()] +\ - [arg % beremizcommand for arg in target.getArguments().split(' ')] +\ - target.getRule().split(' ') - - # Call Makefile to build PLC code and link it with target specific code - status, result, err_result = ProcessLogger(self.CTRInstance.logger, - command).spin() - if status : - self.md5key = None - self.CTRInstance.logger.write_error(_("C compilation failed.\n")) - return False - return True - else : - self.CTRInstance.logger.write(_("Source didn't change, no build.\n")) - return True - diff -r 915be999f3f0 -r 5c42cafaee15 tests/python/c_code@c_ext/baseconfnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/python/c_code@c_ext/baseconfnode.xml Sun May 20 19:07:09 2012 +0200 @@ -0,0 +1,2 @@ + + diff -r 915be999f3f0 -r 5c42cafaee15 tests/python/c_code@c_ext/cfile.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/python/c_code@c_ext/cfile.xml Sun May 20 19:07:09 2012 +0200 @@ -0,0 +1,27 @@ + + + + + + + + + + + + + + + + + + + + + + diff -r 915be999f3f0 -r 5c42cafaee15 tests/python/c_code@c_ext/confnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/python/c_code@c_ext/confnode.xml Sun May 20 19:07:09 2012 +0200 @@ -0,0 +1,2 @@ + + diff -r 915be999f3f0 -r 5c42cafaee15 tests/python/plc.xml --- a/tests/python/plc.xml Sat May 19 19:00:55 2012 +0200 +++ b/tests/python/plc.xml Sun May 20 19:07:09 2012 +0200 @@ -1,14 +1,14 @@ - + + modificationDateTime="2012-05-20T18:14:50"> @@ -202,7 +202,7 @@ - 'sys.stdout.write("5678\n")' + 'PLCBinary.Python_to_C_Call(5678)' @@ -247,7 +247,7 @@ - 'myprintfunc("90AB\n")' + 'MyPythonFunc(42)' diff -r 915be999f3f0 -r 5c42cafaee15 tests/python/python@py_ext/py_ext.xml --- a/tests/python/python@py_ext/py_ext.xml Sat May 19 19:00:55 2012 +0200 +++ b/tests/python/python@py_ext/py_ext.xml Sun May 20 19:07:09 2012 +0200 @@ -1,8 +1,11 @@ + return arg +]]> diff -r 915be999f3f0 -r 5c42cafaee15 util/misc.py --- a/util/misc.py Sat May 19 19:00:55 2012 +0200 +++ b/util/misc.py Sun May 20 19:07:09 2012 +0200 @@ -6,7 +6,7 @@ # helper func to get path to images def opjimg(imgname): - return os.path.join(sys.path[0], "images",imgname) + return os.path.join(sys.path[0], "images", imgname+".png") # helper func to check path write permission def CheckPathPerm(path): diff -r 915be999f3f0 -r 5c42cafaee15 wxglade_hmi/wxglade_hmi.py --- a/wxglade_hmi/wxglade_hmi.py Sat May 19 19:00:55 2012 +0200 +++ b/wxglade_hmi/wxglade_hmi.py Sun May 20 19:07:09 2012 +0200 @@ -2,13 +2,12 @@ import os, sys from xml.dom import minidom -from util import opjimg from py_ext import PythonFileCTNMixin class WxGladeHMI(PythonFileCTNMixin): ConfNodeMethods = [ - {"bitmap" : opjimg("editWXGLADE"), + {"bitmap" : "editWXGLADE", "name" : _("WXGLADE GUI"), "tooltip" : _("Edit a WxWidgets GUI with WXGlade"), "method" : "_editWXGLADE"},