controls/VariablePanel.py
changeset 1522 fef49488b5c7
parent 1510 7272baadd7f6
child 1571 486f94a8032c
equal deleted inserted replaced
1518:a656ccb868d4 1522:fef49488b5c7
   141                 colname = "InitialValue"
   141                 colname = "InitialValue"
   142             setattr(self.data[row], colname, value)
   142             setattr(self.data[row], colname, value)
   143 
   143 
   144     def GetOldValue(self):
   144     def GetOldValue(self):
   145         return self.old_value
   145         return self.old_value
       
   146 
       
   147     def _GetRowEdit(self, row):
       
   148         row_edit = self.GetValueByName(row, "Edit")
       
   149         var_type = self.Parent.GetTagName()
       
   150         bodytype = self.Parent.Controler.GetEditedElementBodyType(var_type)
       
   151         if bodytype in ["ST", "IL"]:
       
   152             row_edit = True;
       
   153         return row_edit
   146 
   154 
   147     def _updateColAttrs(self, grid):
   155     def _updateColAttrs(self, grid):
   148         """
   156         """
   149         wx.grid.Grid -> update the column attributes to add the
   157         wx.grid.Grid -> update the column attributes to add the
   150         appropriate renderer given the column name.
   158         appropriate renderer given the column name.
   169                         if len(options) > 1:
   177                         if len(options) > 1:
   170                             editor = wx.grid.GridCellChoiceEditor()
   178                             editor = wx.grid.GridCellChoiceEditor()
   171                             editor.SetParameters(",".join(map(_, options)))
   179                             editor.SetParameters(",".join(map(_, options)))
   172                         else:
   180                         else:
   173                             grid.SetReadOnly(row, col, True)
   181                             grid.SetReadOnly(row, col, True)
   174                     elif col != 0 and self.GetValueByName(row, "Edit"):
   182                     elif col != 0 and self._GetRowEdit(row):
   175                         grid.SetReadOnly(row, col, False)
   183                         grid.SetReadOnly(row, col, False)
   176                         if colname == "Name":
   184                         if colname == "Name":
   177                             editor = wx.grid.GridCellTextEditor()
   185                             editor = wx.grid.GridCellTextEditor()
   178                             renderer = wx.grid.GridCellStringRenderer()
   186                             renderer = wx.grid.GridCellStringRenderer()
   179                         elif colname == "Initial Value":
   187                         elif colname == "Initial Value":