# HG changeset patch
# User laurent
# Date 1275658528 -7200
# Node ID 681fe60443fcc970b67a4517f42035f5c3aa7544
# Parent  0f55445870370a9ce0001639dd061e5525ac616e
Fix transfer button enable state and build button state

diff -r 0f5544587037 -r 681fe60443fc 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