Fixing bug in RessourceEditor. Task reference in instance entries wan't updated after task name modification
authorlaurent
Wed, 16 Nov 2011 23:35:15 +0100
changeset 588 4876fedbe9df
parent 587 98445f90f45d
child 589 e3a1d9a59c97
Fixing bug in RessourceEditor. Task reference in instance entries wan't updated after task name modification
RessourceEditor.py
--- a/RessourceEditor.py	Wed Nov 16 23:31:57 2011 +0100
+++ b/RessourceEditor.py	Wed Nov 16 23:35:15 2011 +0100
@@ -375,7 +375,7 @@
         
         self.staticText1 = wx.StaticText(id=ID_RESOURCEEDITORSTATICTEXT1,
               label=_(u'Tasks:'), name='staticText2', parent=self.Editor, pos=wx.Point(0,
-              0), size=wx.DefaultSize, style=wx.ALIGN_CENTER)
+              0), size=wx.DefaultSize, style=0)
 
         self.TasksGrid = CustomGrid(id=ID_RESOURCEEDITORTASKSGRID,
               name='TasksGrid', parent=self.Editor, pos=wx.Point(0, 0), 
@@ -407,7 +407,7 @@
         
         self.staticText2 = wx.StaticText(id=ID_RESOURCEEDITORSTATICTEXT2,
               label=_(u'Instances:'), name='staticText1', parent=self.Editor,
-              pos=wx.Point(0, 0), size=wx.DefaultSize, style=wx.ALIGN_CENTER)
+              pos=wx.Point(0, 0), size=wx.DefaultSize, style=0)
 
         self.InstancesGrid = CustomGrid(id=ID_RESOURCEEDITORINSTANCESGRID,
               name='InstancesGrid', parent=self.Editor, pos=wx.Point(0, 0), 
@@ -592,13 +592,12 @@
         
     def OnTasksGridCellChange(self, event):
         row, col = event.GetRow(), event.GetCol()
-        if self.TasksTable.GetColLabelValue(event.GetCol()) == "Name":
-            tasklist = self.TaskList.split(",")
+        if self.TasksTable.GetColLabelValue(col) == "Name":
+            tasklist = [name for name in self.TaskList.split(",") if name != ""]
             for i in xrange(self.TasksTable.GetNumberRows()):
                 task = self.TasksTable.GetValueByName(i, "Name")
                 if task in tasklist:
                     tasklist.remove(task)
-            tasklist.remove("")
             if len(tasklist) > 0:
                 old_name = tasklist[0]
                 new_name = self.TasksTable.GetValue(row, col)
@@ -607,7 +606,7 @@
                         self.InstancesTable.SetValueByName(i, "Task", new_name)
         self.RefreshModel()
         colname = self.TasksTable.GetColLabelValue(col, False)
-        if colname == "Triggering":
+        if colname in ["Triggering", "Name"]:
             wx.CallAfter(self.RefreshView)
         event.Skip()