equal
deleted
inserted
replaced
111 def __init__(self, parent, data, colnames): |
111 def __init__(self, parent, data, colnames): |
112 # The base class must be initialized *first* |
112 # The base class must be initialized *first* |
113 wx.grid.PyGridTableBase.__init__(self) |
113 wx.grid.PyGridTableBase.__init__(self) |
114 self.data = data |
114 self.data = data |
115 self.colnames = colnames |
115 self.colnames = colnames |
|
116 self.Errors = {} |
116 self.Parent = parent |
117 self.Parent = parent |
117 |
118 |
118 self.ColAlignements = [] |
119 self.ColAlignements = [] |
119 self.ColSizes = [] |
120 self.ColSizes = [] |
120 # XXX |
121 # XXX |
239 editor.SetParameters(self.Parent.TaskList) |
240 editor.SetParameters(self.Parent.TaskList) |
240 |
241 |
241 grid.SetCellEditor(row, col, editor) |
242 grid.SetCellEditor(row, col, editor) |
242 grid.SetCellRenderer(row, col, renderer) |
243 grid.SetCellRenderer(row, col, renderer) |
243 |
244 |
244 grid.SetCellBackgroundColour(row, col, wx.WHITE) |
245 if row in self.Errors and self.Errors[row][0] == colname.lower(): |
|
246 grid.SetCellBackgroundColour(row, col, wx.Colour(255, 255, 0)) |
|
247 grid.SetCellTextColour(row, col, wx.RED) |
|
248 grid.MakeCellVisible(row, col) |
|
249 else: |
|
250 grid.SetCellTextColour(row, col, wx.BLACK) |
|
251 grid.SetCellBackgroundColour(row, col, wx.WHITE) |
245 |
252 |
246 def SetData(self, data): |
253 def SetData(self, data): |
247 self.data = data |
254 self.data = data |
248 |
255 |
249 def GetData(self): |
256 def GetData(self): |
269 |
276 |
270 def Empty(self): |
277 def Empty(self): |
271 self.data = [] |
278 self.data = [] |
272 self.editors = [] |
279 self.editors = [] |
273 |
280 |
|
281 def AddError(self, infos): |
|
282 self.Errors[infos[0]] = infos[1:] |
|
283 |
|
284 def ClearErrors(self): |
|
285 self.Errors = {} |
274 |
286 |
275 [ID_RESOURCEEDITOR, ID_RESOURCEEDITORSTATICTEXT1, |
287 [ID_RESOURCEEDITOR, ID_RESOURCEEDITORSTATICTEXT1, |
276 ID_RESOURCEEDITORSTATICTEXT2, ID_RESOURCEEDITORINSTANCESGRID, |
288 ID_RESOURCEEDITORSTATICTEXT2, ID_RESOURCEEDITORINSTANCESGRID, |
277 ID_RESOURCEEDITORTASKSGRID, ID_RESOURCEEDITORADDINSTANCEBUTTON, |
289 ID_RESOURCEEDITORTASKSGRID, ID_RESOURCEEDITORADDINSTANCEBUTTON, |
278 ID_RESOURCEEDITORDELETEINSTANCEBUTTON, ID_RESOURCEEDITORUPINSTANCEBUTTON, |
290 ID_RESOURCEEDITORDELETEINSTANCEBUTTON, ID_RESOURCEEDITORUPINSTANCEBUTTON, |
587 |
599 |
588 def OnInstancesGridCellChange(self, event): |
600 def OnInstancesGridCellChange(self, event): |
589 self.RefreshModel() |
601 self.RefreshModel() |
590 self.RefreshView() |
602 self.RefreshView() |
591 event.Skip() |
603 event.Skip() |
|
604 |
|
605 #------------------------------------------------------------------------------- |
|
606 # Errors showing functions |
|
607 #------------------------------------------------------------------------------- |
|
608 |
|
609 def ClearErrors(self): |
|
610 self.TasksTable.ClearErrors() |
|
611 self.InstancesTable.ClearErrors() |
|
612 self.TasksTable.ResetView(self.TasksGrid) |
|
613 self.InstancesTable.ResetView(self.InstancesGrid) |
|
614 |
|
615 def AddShownError(self, infos, start, end): |
|
616 if infos[0] == "task": |
|
617 self.TasksTable.AddError(infos[1:]) |
|
618 elif infos[0] == "instance": |
|
619 self.InstancesTable.AddError(infos[1:]) |
|
620 |