# HG changeset patch # User Edouard Tisserant # Date 1362557156 -32400 # Node ID e3edaf98a44a0de2882013a2e91b6582afd52423 # Parent d72a866cf9b07ac6046902f98a8b25c61bfdbfb4# Parent f1c6b7a6f44b3e8ade94d5107b603389958b5e7c merge diff -r f1c6b7a6f44b -r e3edaf98a44a Beremiz.py --- a/Beremiz.py Tue Mar 05 17:56:51 2013 +0100 +++ b/Beremiz.py Wed Mar 06 17:05:56 2013 +0900 @@ -493,13 +493,15 @@ self.runtime_port = int(random.random() * 1000) + 61131 # launch local runtime self.local_runtime = ProcessLogger(self.Log, - "\"%s\" \"%s\" -p %s -i localhost %s %s"%(sys.executable, - Bpath("Beremiz_service.py"), - self.runtime_port, - {False : "-x 0", True :"-x 1"}[taskbaricon], - self.local_runtime_tmpdir), - no_gui=False, - timeout=500, keyword = "working") + "\"%s\" \"%s\" -p %s -i localhost %s %s"%( + sys.executable, + Bpath("Beremiz_service.py"), + self.runtime_port, + {False : "-x 0", True :"-x 1"}[taskbaricon], + self.local_runtime_tmpdir), + no_gui=False, + timeout=500, keyword = "working", + cwd = self.local_runtime_tmpdir) self.local_runtime.spin() return self.runtime_port diff -r f1c6b7a6f44b -r e3edaf98a44a Beremiz_service.py --- a/Beremiz_service.py Tue Mar 05 17:56:51 2013 +0100 +++ b/Beremiz_service.py Wed Mar 06 17:05:56 2013 +0900 @@ -389,28 +389,27 @@ self.pyroserver.Restart() evt.Skip() + def _LiveShellLocals(self): + if self.pyroserver.plcobj is not None: + return {"locals":self.pyroserver.plcobj.python_threads_vars} + else: + return {} + def OnTaskBarLiveShell(self, evt): - if self.pyroserver.plcobj is not None and self.pyroserver.plcobj.python_threads_vars is not None: - from wx import py - #frame = py.shell.ShellFrame(locals=self.pyroserver.plcobj.python_threads_vars) - frame = py.crust.CrustFrame(locals=self.pyroserver.plcobj.python_threads_vars) - frame.Show() - else: - wx.MessageBox(_("No running PLC"), _("Error")) + from wx import py + frame = py.crust.CrustFrame(**self._LiveShellLocals()) + frame.Show() evt.Skip() def OnTaskBarWXInspector(self, evt): # Activate the widget inspection tool from wx.lib.inspection import InspectionTool if not InspectionTool().initialized: - InspectionTool().Init(locals=self.pyroserver.plcobj.python_threads_vars) - - # Find a widget to be selected in the tree. Use either the - # one under the cursor, if any, or this frame. - wnd = wx.FindWindowAtPointer() - if not wnd: - wnd = wx.GetApp() + InspectionTool().Init(**self._LiveShellLocals()) + + wnd = wx.GetApp() InspectionTool().Show(wnd, True) + evt.Skip() def OnTaskBarQuit(self, evt): diff -r f1c6b7a6f44b -r e3edaf98a44a canfestival/canfestival.py --- a/canfestival/canfestival.py Tue Mar 05 17:56:51 2013 +0100 +++ b/canfestival/canfestival.py Wed Mar 06 17:05:56 2013 +0900 @@ -25,23 +25,6 @@ from util.TranslationCatalogs import AddCatalog AddCatalog(os.path.join(CanFestivalPath, "objdictgen", "locale")) -if wx.Platform == '__WXMSW__': - DEFAULT_SETTINGS = { - "CAN_Driver": "can_tcp_win32", - "CAN_Device": "127.0.0.1", - "CAN_Baudrate": "125K", - "Slave_NodeId": 2, - "Master_NodeId": 1, - } -else: - DEFAULT_SETTINGS = { - "CAN_Driver": "../CanFestival-3/drivers/can_socket/libcanfestival_can_socket.so", - "CAN_Device": "vcan0", - "CAN_Baudrate": "125K", - "Slave_NodeId": 2, - "Master_NodeId": 1, - } - #-------------------------------------------------- # SLAVE #-------------------------------------------------- @@ -51,9 +34,9 @@ - - - + + + @@ -66,7 +49,7 @@ - """ % DEFAULT_SETTINGS + """ EditorType = SlaveEditor IconPath = os.path.join(CanFestivalPath, "objdictgen", "networkedit.png") @@ -247,14 +230,14 @@ - - - + + + - """ % DEFAULT_SETTINGS + """ EditorType = NetworkEditor IconPath = os.path.join(CanFestivalPath, "objdictgen", "networkedit.png") @@ -399,30 +382,32 @@ - + - """ % DEFAULT_SETTINGS + """ CTNChildrenTypes = [("CanOpenNode",_NodeListCTN, "CanOpen Master"), ("CanOpenSlave",_SlaveCTN, "CanOpen Slave")] def GetParamsAttributes(self, path = None): - infos = ConfigTreeNode.GetParamsAttributes(self, path = None) + infos = ConfigTreeNode.GetParamsAttributes(self, path = path) for element in infos: if element["name"] == "CanFestivalInstance": for child in element["children"]: if child["name"] == "CAN_Driver": - DLL_LIST= getattr(local_canfestival_config,"DLL_LIST",None) - if DLL_LIST is not None: - child["type"] = DLL_LIST + child["type"] = local_canfestival_config.DLL_LIST return infos def CTNGenerate_C(self, buildpath, locations): can_driver = self.CanFestivalInstance.getCAN_Driver() + if not can_driver : + can_driver = local_canfestival_config.DLL_LIST[0] + can_drv_ext = self.GetCTRoot().GetBuilder().extension + can_driver_name = "libcanfestival_" + can_driver + can_drv_ext format_dict = {"locstr" : "_".join(map(str,self.GetCurrentLocation())), - "candriver" : can_driver, + "candriver" : can_driver_name, "nodes_includes" : "", "board_decls" : "", "nodes_init" : "", @@ -516,10 +501,9 @@ res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True - can_drv_ext = self.GetCTRoot().GetBuilder().extension - can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,"libcanfestival_"+can_driver+can_drv_ext) + can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name) if os.path.exists(can_driver_path): - res += ((can_driver+can_drv_ext, file(can_driver_path,"rb")),) + res += ((can_driver_name, file(can_driver_path,"rb")),) return res diff -r f1c6b7a6f44b -r e3edaf98a44a util/ProcessLogger.py --- a/util/ProcessLogger.py Tue Mar 05 17:56:51 2013 +0100 +++ b/util/ProcessLogger.py Wed Mar 06 17:05:56 2013 +0900 @@ -71,7 +71,7 @@ def __init__(self, logger, Command, finish_callback = None, no_stdout = False, no_stderr = False, no_gui = True, timeout = None, outlimit = None, errlimit = None, - endlog = None, keyword = None, kill_it = False): + endlog = None, keyword = None, kill_it = False, cwd = None): self.logger = logger if not isinstance(Command, list): self.Command_str = Command @@ -107,7 +107,7 @@ self.endlock = Lock() popenargs= { - "cwd":os.getcwd(), + "cwd":os.getcwd() if cwd is None else cwd, "stdin":subprocess.PIPE, "stdout":subprocess.PIPE, "stderr":subprocess.PIPE}