79 def GetTaskTriggeringOptions(): |
79 def GetTaskTriggeringOptions(): |
80 _ = NoTranslate |
80 _ = NoTranslate |
81 return [_("Interrupt"), _("Cyclic")] |
81 return [_("Interrupt"), _("Cyclic")] |
82 |
82 |
83 |
83 |
84 TASKTRIGGERINGOPTIONS_DICT = dict([(_(option), option) for option in GetTaskTriggeringOptions()]) |
|
85 |
|
86 |
|
87 def SingleCellEditor(*x): |
84 def SingleCellEditor(*x): |
88 return wx.grid.GridCellChoiceEditor() |
85 return wx.grid.GridCellChoiceEditor() |
89 |
86 |
90 |
87 |
91 def CheckSingle(single, varlist): |
88 def CheckSingle(single, varlist): |
96 _ = NoTranslate |
93 _ = NoTranslate |
97 return [_("Name"), _("Type"), _("Task")] |
94 return [_("Name"), _("Type"), _("Task")] |
98 |
95 |
99 |
96 |
100 class ResourceTable(CustomTable): |
97 class ResourceTable(CustomTable): |
101 |
|
102 """ |
98 """ |
103 A custom wx.grid.Grid Table using user supplied data |
99 A custom wx.grid.Grid Table using user supplied data |
104 """ |
100 """ |
105 def __init__(self, parent, data, colnames): |
101 def __init__(self, parent, data, colnames): |
106 # The base class must be initialized *first* |
102 # The base class must be initialized *first* |
107 CustomTable.__init__(self, parent, data, colnames) |
103 CustomTable.__init__(self, parent, data, colnames) |
108 self.ColAlignements = [] |
104 self.ColAlignements = [] |
109 self.ColSizes = [] |
105 self.ColSizes = [] |
|
106 self.TASKTRIGGERINGOPTIONS_DICT = dict([(_(option), option) |
|
107 for option in GetTaskTriggeringOptions()]) |
110 |
108 |
111 def GetColAlignements(self): |
109 def GetColAlignements(self): |
112 return self.ColAlignements |
110 return self.ColAlignements |
113 |
111 |
114 def SetColAlignements(self, list): |
112 def SetColAlignements(self, list): |
130 |
128 |
131 def SetValue(self, row, col, value): |
129 def SetValue(self, row, col, value): |
132 if col < len(self.colnames): |
130 if col < len(self.colnames): |
133 colname = self.GetColLabelValue(col, False) |
131 colname = self.GetColLabelValue(col, False) |
134 if colname == "Triggering": |
132 if colname == "Triggering": |
135 value = TASKTRIGGERINGOPTIONS_DICT[value] |
133 value = self.TASKTRIGGERINGOPTIONS_DICT[value] |
136 self.data[row][colname] = value |
134 self.data[row][colname] = value |
137 |
135 |
138 def _updateColAttrs(self, grid): |
136 def _updateColAttrs(self, grid): |
139 """ |
137 """ |
140 wx.grid.Grid -> update the column attributes to add the |
138 wx.grid.Grid -> update the column attributes to add the |