# HG changeset patch
# User laurent
# Date 1347495220 -7200
# Node ID dec885ba1f2b09a05122dfd28b4082cc24596d54
# Parent  4b9df5bea40045a5a97a73ecb9af0eb95cc3d69c
Adding support for signaling that a task interval isn't well formatted

diff -r 4b9df5bea400 -r dec885ba1f2b controls/VariablePanel.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]
diff -r 4b9df5bea400 -r dec885ba1f2b dialogs/DurationEditorDialog.py
--- 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:')),
diff -r 4b9df5bea400 -r dec885ba1f2b editors/ResourceEditor.py
--- 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()