BeremizIDE.py
changeset 1744 69dfdb26f600
parent 1742 92932cd370a4
child 1745 f9d32913bad4
equal deleted inserted replaced
1743:c3c3d1318130 1744:69dfdb26f600
   105         self.TimerAccessLock = Lock()
   105         self.TimerAccessLock = Lock()
   106         self.stack = []
   106         self.stack = []
   107         self.LastRefreshTime = gettime()
   107         self.LastRefreshTime = gettime()
   108         self.LastRefreshTimer = None
   108         self.LastRefreshTimer = None
   109 
   109 
   110     def write(self, s, style = None):
   110     def write(self, s, style=None):
   111         if self.lock.acquire():
   111         if self.lock.acquire():
   112             self.stack.append((s, style))
   112             self.stack.append((s, style))
   113             self.lock.release()
   113             self.lock.release()
   114             current_time = gettime()
   114             current_time = gettime()
   115             self.TimerAccessLock.acquire()
   115             self.TimerAccessLock.acquire()
   380 
   380 
   381         self.AUIManager.Update()
   381         self.AUIManager.Update()
   382 
   382 
   383         self.ConnectionStatusBar = esb.EnhancedStatusBar(self, style=wx.ST_SIZEGRIP)
   383         self.ConnectionStatusBar = esb.EnhancedStatusBar(self, style=wx.ST_SIZEGRIP)
   384         self._init_coll_ConnectionStatusBar_Fields(self.ConnectionStatusBar)
   384         self._init_coll_ConnectionStatusBar_Fields(self.ConnectionStatusBar)
   385         self.ProgressStatusBar = wx.Gauge(self.ConnectionStatusBar, -1, range = 100)
   385         self.ProgressStatusBar = wx.Gauge(self.ConnectionStatusBar, -1, range=100)
   386         self.ConnectionStatusBar.AddWidget(self.ProgressStatusBar, esb.ESB_EXACT_FIT, esb.ESB_EXACT_FIT, 2)
   386         self.ConnectionStatusBar.AddWidget(self.ProgressStatusBar, esb.ESB_EXACT_FIT, esb.ESB_EXACT_FIT, 2)
   387         self.ProgressStatusBar.Hide()
   387         self.ProgressStatusBar.Hide()
   388         self.SetStatusBar(self.ConnectionStatusBar)
   388         self.SetStatusBar(self.ConnectionStatusBar)
   389 
   389 
   390     def __init_execute_path(self):
   390     def __init_execute_path(self):
   470                 projectname = "~%s~" % projectname
   470                 projectname = "~%s~" % projectname
   471             self.SetTitle("%s - %s" % (name, projectname))
   471             self.SetTitle("%s - %s" % (name, projectname))
   472         else:
   472         else:
   473             self.SetTitle(name)
   473             self.SetTitle(name)
   474 
   474 
   475     def StartLocalRuntime(self, taskbaricon = True):
   475     def StartLocalRuntime(self, taskbaricon=True):
   476         if (self.local_runtime is None) or (self.local_runtime.exitcode is not None):
   476         if (self.local_runtime is None) or (self.local_runtime.exitcode is not None):
   477             # create temporary directory for runtime working directory
   477             # create temporary directory for runtime working directory
   478             self.local_runtime_tmpdir = tempfile.mkdtemp()
   478             self.local_runtime_tmpdir = tempfile.mkdtemp()
   479             # choose an arbitrary random port for runtime
   479             # choose an arbitrary random port for runtime
   480             self.runtime_port = int(random.random() * 1000) + 61131
   480             self.runtime_port = int(random.random() * 1000) + 61131
   485                     Bpath("Beremiz_service.py"),
   485                     Bpath("Beremiz_service.py"),
   486                     self.runtime_port,
   486                     self.runtime_port,
   487                     {False: "-x 0", True: "-x 1"}[taskbaricon],
   487                     {False: "-x 0", True: "-x 1"}[taskbaricon],
   488                     self.local_runtime_tmpdir),
   488                     self.local_runtime_tmpdir),
   489                 no_gui=False,
   489                 no_gui=False,
   490                 timeout=500, keyword = self.local_runtime_tmpdir,
   490                 timeout=500, keyword=self.local_runtime_tmpdir,
   491                 cwd = self.local_runtime_tmpdir)
   491                 cwd=self.local_runtime_tmpdir)
   492             self.local_runtime.spin()
   492             self.local_runtime.spin()
   493         return self.runtime_port
   493         return self.runtime_port
   494 
   494 
   495     def KillLocalRuntime(self):
   495     def KillLocalRuntime(self):
   496         if self.local_runtime is not None:
   496         if self.local_runtime is not None: