47 POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES |
47 POUINSTANCEVARIABLESPANEL, LIBRARYTREE, SCALING, PAGETITLES |
48 ] = range(10) |
48 ] = range(10) |
49 |
49 |
50 |
50 |
51 def GetVariableTableColnames(location): |
51 def GetVariableTableColnames(location): |
52 _ = lambda x : x |
52 _ = lambda x: x |
53 if location: |
53 if location: |
54 return ["#", _("Name"), _("Class"), _("Type"), _("Location"), _("Initial Value"), _("Option"), _("Documentation")] |
54 return ["#", _("Name"), _("Class"), _("Type"), _("Location"), _("Initial Value"), _("Option"), _("Documentation")] |
55 return ["#", _("Name"), _("Class"), _("Type"), _("Initial Value"), _("Option"), _("Documentation")] |
55 return ["#", _("Name"), _("Class"), _("Type"), _("Initial Value"), _("Option"), _("Documentation")] |
56 |
56 |
57 |
57 |
58 def GetOptions(constant=True, retain=True, non_retain=True): |
58 def GetOptions(constant=True, retain=True, non_retain=True): |
59 _ = lambda x : x |
59 _ = lambda x: x |
60 options = [""] |
60 options = [""] |
61 if constant: |
61 if constant: |
62 options.append(_("Constant")) |
62 options.append(_("Constant")) |
63 if retain: |
63 if retain: |
64 options.append(_("Retain")) |
64 options.append(_("Retain")) |
67 return options |
67 return options |
68 OPTIONS_DICT = dict([(_(option), option) for option in GetOptions()]) |
68 OPTIONS_DICT = dict([(_(option), option) for option in GetOptions()]) |
69 |
69 |
70 |
70 |
71 def GetFilterChoiceTransfer(): |
71 def GetFilterChoiceTransfer(): |
72 _ = lambda x : x |
72 _ = lambda x: x |
73 return {_("All"): _("All"), _("Interface"): _("Interface"), |
73 return {_("All"): _("All"), _("Interface"): _("Interface"), |
74 _(" Input"): _("Input"), _(" Output"): _("Output"), _(" InOut"): _("InOut"), |
74 _(" Input"): _("Input"), _(" Output"): _("Output"), _(" InOut"): _("InOut"), |
75 _(" External"): _("External"), _("Variables"): _("Variables"), _(" Local"): _("Local"), |
75 _(" External"): _("External"), _("Variables"): _("Variables"), _(" Local"): _("Local"), |
76 _(" Temp"): _("Temp"), _("Global"): _("Global")} #, _("Access") : _("Access")} |
76 _(" Temp"): _("Temp"), _("Global"): _("Global")} #, _("Access") : _("Access")} |
77 VARIABLE_CHOICES_DICT = dict([(_(_class), _class) for _class in GetFilterChoiceTransfer().iterkeys()]) |
77 VARIABLE_CHOICES_DICT = dict([(_(_class), _class) for _class in GetFilterChoiceTransfer().iterkeys()]) |
120 if colname == "Initial Value": |
120 if colname == "Initial Value": |
121 colname = "InitialValue" |
121 colname = "InitialValue" |
122 value = getattr(self.data[row], colname, "") |
122 value = getattr(self.data[row], colname, "") |
123 if colname == "Type" and isinstance(value, TupleType): |
123 if colname == "Type" and isinstance(value, TupleType): |
124 if value[0] == "array": |
124 if value[0] == "array": |
125 return "ARRAY [%s] OF %s" % (",".join(map(lambda x : "..".join(x), value[2])), value[1]) |
125 return "ARRAY [%s] OF %s" % (",".join(map(lambda x: "..".join(x), value[2])), value[1]) |
126 if not isinstance(value, (StringType, UnicodeType)): |
126 if not isinstance(value, (StringType, UnicodeType)): |
127 value = str(value) |
127 value = str(value) |
128 if colname in ["Class", "Option"]: |
128 if colname in ["Class", "Option"]: |
129 return _(value) |
129 return _(value) |
130 return value |
130 return value |
387 var_infos.Location = location |
387 var_infos.Location = location |
388 elif values[1] == "NamedConstant": |
388 elif values[1] == "NamedConstant": |
389 if element_type in ["functionBlock","program"]: |
389 if element_type in ["functionBlock","program"]: |
390 var_infos.Class = "Local" |
390 var_infos.Class = "Local" |
391 var_infos.InitialValue = values[0] |
391 var_infos.InitialValue = values[0] |
392 else : |
392 else: |
393 return |
393 return |
394 else: |
394 else: |
395 var_infos.Class = "External" |
395 var_infos.Class = "External" |
396 var_infos.Number = len(self.ParentWindow.Values) |
396 var_infos.Number = len(self.ParentWindow.Values) |
397 self.ParentWindow.Values.append(var_infos) |
397 self.ParentWindow.Values.append(var_infos) |
489 self.FilterChoiceTransfer = GetFilterChoiceTransfer() |
489 self.FilterChoiceTransfer = GetFilterChoiceTransfer() |
490 |
490 |
491 self.DefaultValue = _VariableInfos("", "", "", "", "", True, "", DefaultType, ([], []), 0) |
491 self.DefaultValue = _VariableInfos("", "", "", "", "", True, "", DefaultType, ([], []), 0) |
492 |
492 |
493 if element_type in ["config", "resource"]: |
493 if element_type in ["config", "resource"]: |
494 self.DefaultTypes = {"All" : "Global"} |
494 self.DefaultTypes = {"All": "Global"} |
495 else: |
495 else: |
496 self.DefaultTypes = {"All" : "Local", "Interface" : "Input", "Variables" : "Local"} |
496 self.DefaultTypes = {"All": "Local", "Interface": "Input", "Variables": "Local"} |
497 |
497 |
498 if element_type in ["config", "resource"] \ |
498 if element_type in ["config", "resource"] \ |
499 or element_type in ["program", "transition", "action"]: |
499 or element_type in ["program", "transition", "action"]: |
500 # this is an element that can have located variables |
500 # this is an element that can have located variables |
501 self.Table = VariableTable(self, [], GetVariableTableColnames(True)) |
501 self.Table = VariableTable(self, [], GetVariableTableColnames(True)) |