order the result of GetBaseTypes to make types easier to find in the UI
authorb.taylor@willowglen.ca
Thu, 03 Sep 2009 08:56:02 -0600
changeset 420 c08d053b74b3
parent 419 8f97ed01a6a6
child 421 9855343da6fc
order the result of GetBaseTypes to make types easier to find in the UI
PLCControler.py
--- a/PLCControler.py	Wed Sep 02 14:55:22 2009 -0600
+++ b/PLCControler.py	Thu Sep 03 08:56:02 2009 -0600
@@ -1228,9 +1228,13 @@
             return project.GetBaseType(type)
         return None
 
-    # Return Base Types
     def GetBaseTypes(self):
-        return [value for value in TypeHierarchy.keys() if not value.startswith("ANY")]
+        '''
+        return the list of datatypes defined in IEC 61131-3.
+        TypeHierarchy_list has a rough order to it (e.g. SINT, INT, DINT, ...),
+        which makes it easy for a user to find a type in a menu.
+        '''
+        return [x for x,y in TypeHierarchy_list if not x.startswith("ANY")]
 
     def IsOfType(self, type, reference, debug = False):
         project = self.GetProject(debug)