--- a/ProjectController.py Thu Oct 27 17:07:44 2016 +0300
+++ b/ProjectController.py Fri Oct 28 17:21:42 2016 +0300
@@ -381,15 +381,7 @@
#Load and init all the children
self.RefreshConfNodesBlockLists()
- if os.path.exists(self._getBuildPath()):
- self.EnableMethod("_Clean", True)
- if os.path.isfile(self._getIECcodepath()):
- self.ShowMethod("_showIECcode", True)
- self.UpdateMethodsFromPLCStatus()
def RecursiveConfNodeInfos(self, confnode):
@@ -971,15 +963,13 @@
# Eventually create build dir
if not os.path.exists(buildpath):
- # There is something to clean
- self.EnableMethod("_Clean", True)
self.logger.write(_("Start build in %s\n") % buildpath)
# Generate SoftPLC IEC code
IECGenRes = self._Generate_SoftPLC()
- self.ShowMethod("_showIECcode", True)
# If IEC code gen fail, bail out.
@@ -1221,18 +1211,28 @@
shutil.rmtree(os.path.join(self._getBuildPath()))
self.logger.write_error(_("Build directory already clean\n"))
- self.ShowMethod("_showIECcode", False)
- self.EnableMethod("_Clean", False)
self.CompareLocalAndRemotePLC()
+ def _UpdateButtons(self): + self.EnableMethod("_Clean", os.path.exists(self._getBuildPath())) + self.ShowMethod("_showIECcode", os.path.isfile(self._getIECcodepath())) + if not self.UpdateMethodsFromPLCStatus(): + self.AppFrame.RefreshStatusToolBar() + def UpdateButtons(self): + wx.CallAfter(self._UpdateButtons) def UpdatePLCLog(self, log_count):
if self.AppFrame is not None:
self.AppFrame.LogViewer.SetLogCounters(log_count)
def UpdateMethodsFromPLCStatus(self):
if self._connector is not None:
PLCstatus = self._connector.GetPLCstatus()
@@ -1260,6 +1260,7 @@
self.previous_plcstate = status
if self.AppFrame is not None:
self.AppFrame.RefreshStatusToolBar()
if status == "Disconnected":
self.AppFrame.ConnectionStatusBar.SetStatusText(_(status), 1)
@@ -1268,6 +1269,7 @@
self.AppFrame.ConnectionStatusBar.SetStatusText(
_("Connected to URI: %s") % self.BeremizRoot.getURI_location().strip(), 1)
self.AppFrame.ConnectionStatusBar.SetStatusText(_(status), 2)
def PullPLCStatusProc(self, event):
self.UpdateMethodsFromPLCStatus()