RessourceEditor.py
changeset 231 fc2d6cbb8b39
parent 145 4fb225afddf4
child 235 7b58a3b5b6ec
--- a/RessourceEditor.py	Tue Aug 12 18:15:35 2008 +0200
+++ b/RessourceEditor.py	Tue Aug 12 18:16:09 2008 +0200
@@ -113,6 +113,7 @@
         wx.grid.PyGridTableBase.__init__(self)
         self.data = data
         self.colnames = colnames
+        self.Errors = {}
         self.Parent = parent
         
         self.ColAlignements = []
@@ -241,7 +242,13 @@
                 grid.SetCellEditor(row, col, editor)
                 grid.SetCellRenderer(row, col, renderer)
                 
-                grid.SetCellBackgroundColour(row, col, wx.WHITE)
+                if row in self.Errors and self.Errors[row][0] == colname.lower():
+                    grid.SetCellBackgroundColour(row, col, wx.Colour(255, 255, 0))
+                    grid.SetCellTextColour(row, col, wx.RED)
+                    grid.MakeCellVisible(row, col)
+                else:
+                    grid.SetCellTextColour(row, col, wx.BLACK)
+                    grid.SetCellBackgroundColour(row, col, wx.WHITE)
     
     def SetData(self, data):
         self.data = data
@@ -271,6 +278,11 @@
         self.data = []
         self.editors = []
 
+    def AddError(self, infos):
+        self.Errors[infos[0]] = infos[1:]
+
+    def ClearErrors(self):
+        self.Errors = {}
 
 [ID_RESOURCEEDITOR, ID_RESOURCEEDITORSTATICTEXT1,
  ID_RESOURCEEDITORSTATICTEXT2, ID_RESOURCEEDITORINSTANCESGRID,
@@ -589,3 +601,20 @@
         self.RefreshModel()
         self.RefreshView()
         event.Skip()
+
+#-------------------------------------------------------------------------------
+#                        Errors showing functions
+#-------------------------------------------------------------------------------
+
+    def ClearErrors(self):
+        self.TasksTable.ClearErrors()
+        self.InstancesTable.ClearErrors()
+        self.TasksTable.ResetView(self.TasksGrid)
+        self.InstancesTable.ResetView(self.InstancesGrid)
+
+    def AddShownError(self, infos, start, end):
+        if infos[0] == "task":
+            self.TasksTable.AddError(infos[1:])
+        elif infos[0] == "instance":
+            self.InstancesTable.AddError(infos[1:])
+        
\ No newline at end of file