LPCManager.py
changeset 43 003a9ae0cf66
parent 40 000de4f24ab2
child 50 ed1f9752f929
--- a/LPCManager.py	Mon Apr 29 10:39:44 2013 +0900
+++ b/LPCManager.py	Mon Apr 29 17:28:50 2013 +0900
@@ -755,10 +755,10 @@
         return self.Project.setname(name)
 
     def SetOnlineMode(self, mode, path=None):
-        if self.OnlineMode != mode.upper():
-            self.OnlineMode = mode.upper()
-            
-            if self.OnlineMode != "OFF":
+        mode = mode.upper()
+        if self.OnlineMode != mode:
+            if mode not in ["OFF", ""]:
+                self.OnlineMode = mode
                 self.ConnectorPath = path
                 uri = "LPC://%s/%s" % (self.OnlineMode,path)
                 try:
@@ -773,6 +773,7 @@
                     self.logger.write_error(_("Connection failed to %s!\n")%uri)
                 
             else:
+                self.OnlineMode = "OFF"
                 self.LPCConnector = None
                 self.ConnectorPath = None
             
@@ -916,10 +917,7 @@
 
         return None
 
-    ############# Real PLC object access #############
     def UpdateMethodsFromPLCStatus(self):
-        # Get PLC state : Running or Stopped
-        # TODO : use explicit status instead of boolean
         simulating = self.CurrentMode == SIMULATION_MODE
         if self.OnlineMode == "OFF":
             if simulating: