PLCOpenEditor.py
changeset 49 1762276019fb
parent 48 2675bf9b0a01
child 51 47c72c77590a
equal deleted inserted replaced
48:2675bf9b0a01 49:1762276019fb
  1898         return row
  1898         return row
  1899 
  1899 
  1900     def GetValue(self, row, col):
  1900     def GetValue(self, row, col):
  1901         if row < self.GetNumberRows():
  1901         if row < self.GetNumberRows():
  1902             if col == 0:
  1902             if col == 0:
  1903                 return "d"
  1903                 return self.Parent.Values.index(self.data[row]) + 1
  1904             name = str(self.data[row].get(self.GetColLabelValue(col), ""))
  1904             name = str(self.data[row].get(self.GetColLabelValue(col), ""))
  1905             return name
  1905             return name
  1906     
  1906     
  1907     def GetValueByName(self, row, colname):
  1907     def GetValueByName(self, row, colname):
  1908         return self.data[row].get(colname)
  1908         return self.data[row].get(colname)
  1965             for col in range(self.GetNumberCols()):
  1965             for col in range(self.GetNumberCols()):
  1966                 editor = None
  1966                 editor = None
  1967                 renderer = None
  1967                 renderer = None
  1968                 colname = self.GetColLabelValue(col)
  1968                 colname = self.GetColLabelValue(col)
  1969                 grid.SetReadOnly(row, col, False)
  1969                 grid.SetReadOnly(row, col, False)
  1970                 if colname == "Drag":
  1970                 if col == 0:
  1971                     grid.SetReadOnly(row, col, True)
  1971                     grid.SetReadOnly(row, col, True)
  1972                 elif colname == "Name":
  1972                 elif colname == "Name":
  1973                     if self.Parent.PouIsUsed and self.GetValueByName(row, "Class") in ["Input", "Output", "InOut"]:
  1973                     if self.Parent.PouIsUsed and self.GetValueByName(row, "Class") in ["Input", "Output", "InOut"]:
  1974                         grid.SetReadOnly(row, col, True)
  1974                         grid.SetReadOnly(row, col, True)
  1975                     else:
  1975                     else:
  2235             self.DefaultValue = {"Name" : "", "Class" : "", "Type" : "INT", "Location" : "", "Initial Value" : "", "Retain" : "No", "Constant" : "No"}
  2235             self.DefaultValue = {"Name" : "", "Class" : "", "Type" : "INT", "Location" : "", "Initial Value" : "", "Retain" : "No", "Constant" : "No"}
  2236         else:
  2236         else:
  2237             self.DefaultTypes = {"All" : "Local", "Interface" : "Input", "Variables" : "Local"}
  2237             self.DefaultTypes = {"All" : "Local", "Interface" : "Input", "Variables" : "Local"}
  2238             self.DefaultValue = {"Name" : "", "Class" : "", "Type" : "INT", "Location" : "", "Initial Value" : "", "Retain" : "No", "Constant" : "No"}
  2238             self.DefaultValue = {"Name" : "", "Class" : "", "Type" : "INT", "Location" : "", "Initial Value" : "", "Retain" : "No", "Constant" : "No"}
  2239         if pou_type in ["config", "resource"] or pou_type == "program":
  2239         if pou_type in ["config", "resource"] or pou_type == "program":
  2240             self.Table = VariableTable(self, [], ["Drag", "Name", "Class", "Type", "Location", "Initial Value", "Retain", "Constant"])
  2240             self.Table = VariableTable(self, [], ["#", "Name", "Class", "Type", "Location", "Initial Value", "Retain", "Constant"])
  2241             if pou_type not in ["config", "resource"]:
  2241             if pou_type not in ["config", "resource"]:
  2242                 self.FilterChoices = ["All","Interface","   Input","   Output","   InOut","   External","Variables","   Local","   Temp","Global","Access"]
  2242                 self.FilterChoices = ["All","Interface","   Input","   Output","   InOut","   External","Variables","   Local","   Temp","Global","Access"]
  2243             else:
  2243             else:
  2244                 self.FilterChoices = ["All","Global","Access"]
  2244                 self.FilterChoices = ["All","Global","Access"]
  2245             self.ColSizes = [40, 80, 70, 80, 80, 80, 60, 70]
  2245             self.ColSizes = [40, 80, 70, 80, 80, 80, 60, 70]
  2246             self.ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]
  2246             self.ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]
  2247         else:
  2247         else:
  2248             self.Table = VariableTable(self, [], ["Drag", "Name", "Class", "Type", "Initial Value", "Retain", "Constant"])
  2248             self.Table = VariableTable(self, [], ["#", "Name", "Class", "Type", "Initial Value", "Retain", "Constant"])
  2249             self.FilterChoices = ["All","Interface","   Input","   Output","   InOut","   External","Variables","   Local","   Temp"]
  2249             self.FilterChoices = ["All","Interface","   Input","   Output","   InOut","   External","Variables","   Local","   Temp"]
  2250             self.ColSizes = [40, 120, 70, 80, 120, 60, 70]
  2250             self.ColSizes = [40, 120, 70, 80, 120, 60, 70]
  2251             self.ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]
  2251             self.ColAlignements = [wxALIGN_CENTER, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_LEFT, wxALIGN_CENTER, wxALIGN_CENTER]
  2252         for choice in self.FilterChoices:
  2252         for choice in self.FilterChoices:
  2253             self.ClassFilter.Append(choice)
  2253             self.ClassFilter.Append(choice)