editors/ResourceEditor.py
changeset 831 dec885ba1f2b
parent 814 5743cbdff669
child 879 55b8a16ead2b
equal deleted inserted replaced
830:4b9df5bea400 831:dec885ba1f2b
    24 
    24 
    25 import wx
    25 import wx
    26 import wx.lib.buttons
    26 import wx.lib.buttons
    27 import wx.grid
    27 import wx.grid
    28 
    28 
    29 from graphics.GraphicCommons import REFRESH_HIGHLIGHT_PERIOD
    29 from graphics.GraphicCommons import REFRESH_HIGHLIGHT_PERIOD, ERROR_HIGHLIGHT
    30 from controls import CustomGrid, CustomTable, DurationCellEditor
    30 from controls import CustomGrid, CustomTable, DurationCellEditor
       
    31 from dialogs.DurationEditorDialog import IEC_TIME_MODEL
    31 from EditorPanel import EditorPanel
    32 from EditorPanel import EditorPanel
    32 from util.BitmapLibrary import GetBitmap
    33 from util.BitmapLibrary import GetBitmap
    33 
    34 
    34 #-------------------------------------------------------------------------------
    35 #-------------------------------------------------------------------------------
    35 #                          Configuration Editor class
    36 #                          Configuration Editor class
   161                     editor.SetParameters(self.Parent.TaskList)
   162                     editor.SetParameters(self.Parent.TaskList)
   162                     
   163                     
   163                 grid.SetCellEditor(row, col, editor)
   164                 grid.SetCellEditor(row, col, editor)
   164                 grid.SetCellRenderer(row, col, renderer)
   165                 grid.SetCellRenderer(row, col, renderer)
   165                 
   166                 
   166                 highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
   167                 if colname == "Interval" and IEC_TIME_MODEL.match(self.GetValueByName(row, colname)) is None:
       
   168                     highlight_colours = ERROR_HIGHLIGHT
       
   169                 else:
       
   170                     highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
   167                 grid.SetCellBackgroundColour(row, col, highlight_colours[0])
   171                 grid.SetCellBackgroundColour(row, col, highlight_colours[0])
   168                 grid.SetCellTextColour(row, col, highlight_colours[1])
   172                 grid.SetCellTextColour(row, col, highlight_colours[1])
   169             self.ResizeRow(grid, row)
   173             self.ResizeRow(grid, row)
   170 
   174 
   171     
   175     
   429                 for i in xrange(self.InstancesTable.GetNumberRows()):
   433                 for i in xrange(self.InstancesTable.GetNumberRows()):
   430                     if self.InstancesTable.GetValueByName(i, "Task") == old_name:
   434                     if self.InstancesTable.GetValueByName(i, "Task") == old_name:
   431                         self.InstancesTable.SetValueByName(i, "Task", new_name)
   435                         self.InstancesTable.SetValueByName(i, "Task", new_name)
   432         self.RefreshModel()
   436         self.RefreshModel()
   433         colname = self.TasksTable.GetColLabelValue(col, False)
   437         colname = self.TasksTable.GetColLabelValue(col, False)
   434         if colname in ["Triggering", "Name"]:
   438         if colname in ["Triggering", "Name", "Interval"]:
   435             wx.CallAfter(self.RefreshView, False)
   439             wx.CallAfter(self.RefreshView, False)
   436         event.Skip()
   440         event.Skip()
   437 
   441 
   438     def OnInstancesGridCellChange(self, event):
   442     def OnInstancesGridCellChange(self, event):
   439         self.RefreshModel()
   443         self.RefreshModel()