LPCManager.py
changeset 37 6e36ecf3f622
parent 35 cb9da964a178
child 39 38a01052693f
--- a/LPCManager.py	Thu Mar 21 17:29:53 2013 +0100
+++ b/LPCManager.py	Wed Mar 27 00:28:59 2013 +0100
@@ -695,6 +695,7 @@
         
         self.OnlineMode = "OFF"
         self.LPCConnector = None
+        self.ConnectorPath = None
         
         self.CurrentMode = None
         self.previous_mode = None
@@ -758,6 +759,7 @@
             self.OnlineMode = mode.upper()
             
             if self.OnlineMode != "OFF":
+                self.ConnectorPath = path
                 uri = "LPC://%s/%s" % (self.OnlineMode,path)
                 try:
                     self.LPCConnector = connectors.ConnectorFactory(uri, self)
@@ -772,6 +774,7 @@
                 
             else:
                 self.LPCConnector = None
+                self.ConnectorPath = None
             
             self.ApplyOnlineMode()
 
@@ -962,6 +965,27 @@
             self.previous_mode = self.CurrentMode
             if self.AppFrame is not None:
                 self.AppFrame.RefreshStatusToolBar()
+                connection_text = _("Connected to: ")
+                status_text = ""
+                if simulating:
+                    connection_text += _("Simulation")
+                    status_text += _("ON")
+                if status == "Disconnected":
+                    if not simulating:
+                        self.AppFrame.ConnectionStatusBar.SetStatusText(_(status), 1)
+                        self.AppFrame.ConnectionStatusBar.SetStatusText('', 2)
+                    else:
+                        self.AppFrame.ConnectionStatusBar.SetStatusText(connection_text, 1)
+                        self.AppFrame.ConnectionStatusBar.SetStatusText(status_text, 2)
+                else:
+                    if simulating:
+                        connection_text += " (%s)"
+                        status_text += " (%s)"
+                    else:
+                        connection_text += "%s"
+                        status_text += "%s"
+                    self.AppFrame.ConnectionStatusBar.SetStatusText(connection_text % self.ConnectorPath, 1)
+                    self.AppFrame.ConnectionStatusBar.SetStatusText(status_text % _(status), 2)
             return True
         return False
 
@@ -1113,6 +1137,9 @@
         else:
             self.LDFLAGS=[]
         
+        # Header file for extensions
+        open(os.path.join(buildpath,"beremiz.h"), "w").write(targets.GetHeader())
+        
         # Template based part of C code generation
         # files are stacked at the beginning, as files of confnode tree root
         for generator, filename, name in [
@@ -1893,6 +1920,7 @@
             global frame
             if frame is not None:
                 self.CTR.SetAppFrame(frame, frame.Log)
+                self.CTR.UpdateMethodsFromPLCStatus()
                 frame.Show()
                 frame.Raise()
                 self.restore_last_state = True