Adding support for signaling that a task interval isn't well formatted
authorlaurent
Thu, 13 Sep 2012 02:13:40 +0200
changeset 831 dec885ba1f2b
parent 830 4b9df5bea400
child 832 b2609a8e4cb6
Adding support for signaling that a task interval isn't well formatted
controls/VariablePanel.py
dialogs/DurationEditorDialog.py
editors/ResourceEditor.py
--- a/controls/VariablePanel.py	Wed Sep 12 19:12:13 2012 +0200
+++ b/controls/VariablePanel.py	Thu Sep 13 02:13:40 2012 +0200
@@ -204,7 +204,7 @@
                 grid.SetCellEditor(row, col, editor)
                 grid.SetCellRenderer(row, col, renderer)
                 
-                if colname == "Location" and LOCATION_MODEL.match(self.GetValueByName(row, "Location")) is None:
+                if colname == "Location" and LOCATION_MODEL.match(self.GetValueByName(row, colname)) is None:
                     highlight_colours = ERROR_HIGHLIGHT
                 else:
                     highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
--- a/dialogs/DurationEditorDialog.py	Wed Sep 12 19:12:13 2012 +0200
+++ b/dialogs/DurationEditorDialog.py	Thu Sep 13 02:13:40 2012 +0200
@@ -37,7 +37,7 @@
 HOUR = 60 * MINUTE
 DAY = 24 * HOUR
 
-IEC_TIME_MODEL = re.compile("(?:(?:T|TIME)#)?(-)?(?:(%(float)s)D_?)?(?:(%(float)s)H_?)?(?:(%(float)s)M(?!S)_?)?(?:(%(float)s)S_?)?(?:(%(float)s)MS)?" % {"float": "[0-9]+(?:\.[0-9]+)?"})
+IEC_TIME_MODEL = re.compile("(?:T|TIME)#(-)?(?:(%(float)s)D_?)?(?:(%(float)s)H_?)?(?:(%(float)s)M(?!S)_?)?(?:(%(float)s)S_?)?(?:(%(float)s)MS)?" % {"float": "[0-9]+(?:\.[0-9]+)?"})
 
 CONTROLS = [
     ("Days", _('Days:')),
--- a/editors/ResourceEditor.py	Wed Sep 12 19:12:13 2012 +0200
+++ b/editors/ResourceEditor.py	Thu Sep 13 02:13:40 2012 +0200
@@ -26,8 +26,9 @@
 import wx.lib.buttons
 import wx.grid
 
-from graphics.GraphicCommons import REFRESH_HIGHLIGHT_PERIOD
+from graphics.GraphicCommons import REFRESH_HIGHLIGHT_PERIOD, ERROR_HIGHLIGHT
 from controls import CustomGrid, CustomTable, DurationCellEditor
+from dialogs.DurationEditorDialog import IEC_TIME_MODEL
 from EditorPanel import EditorPanel
 from util.BitmapLibrary import GetBitmap
 
@@ -163,7 +164,10 @@
                 grid.SetCellEditor(row, col, editor)
                 grid.SetCellRenderer(row, col, renderer)
                 
-                highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
+                if colname == "Interval" and IEC_TIME_MODEL.match(self.GetValueByName(row, colname)) is None:
+                    highlight_colours = ERROR_HIGHLIGHT
+                else:
+                    highlight_colours = row_highlights.get(colname.lower(), [(wx.WHITE, wx.BLACK)])[-1]
                 grid.SetCellBackgroundColour(row, col, highlight_colours[0])
                 grid.SetCellTextColour(row, col, highlight_colours[1])
             self.ResizeRow(grid, row)
@@ -431,7 +435,7 @@
                         self.InstancesTable.SetValueByName(i, "Task", new_name)
         self.RefreshModel()
         colname = self.TasksTable.GetColLabelValue(col, False)
-        if colname in ["Triggering", "Name"]:
+        if colname in ["Triggering", "Name", "Interval"]:
             wx.CallAfter(self.RefreshView, False)
         event.Skip()