Fix transfer button enable state and build button state
authorlaurent
Fri, 04 Jun 2010 15:35:28 +0200
changeset 560 681fe60443fc
parent 559 0f5544587037
child 561 4cc6eef4778f
Fix transfer button enable state and build button state
LPCBeremiz.py
--- a/LPCBeremiz.py	Fri Jun 04 15:17:48 2010 +0200
+++ b/LPCBeremiz.py	Fri Jun 04 15:35:28 2010 +0200
@@ -599,17 +599,17 @@
                      "Started" :     [("_Simulate", False),
                                       ("_Run", False),
                                       ("_Stop", True),
-                                      ("_build", False),
+                                      ("_build", True),
                                       ("_Transfer", True)],
                      "Stopped" :     [("_Simulate", False),
                                       ("_Run", True),
                                       ("_Stop", False),
-                                      ("_build", False),
+                                      ("_build", True),
                                       ("_Transfer", True)],
                      "Connected" :   [("_Simulate", not simulating),
                                       ("_Run", False),
                                       ("_Stop", simulating),
-                                      ("_build", False),
+                                      ("_build", True),
                                       ("_Transfer", True)],
                      "Disconnected" :[("_Simulate", not simulating),
                                       ("_Run", False),
@@ -770,6 +770,16 @@
         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 _Transfer(self):
         if self.CurrentMode is None and self.OnlineMode != "OFF":
             self.CurrentMode = TRANSFER_MODE