Fixed bug when drag'n dropping variable in master startup command grid
authorLaurent Bessard
Mon, 03 Jun 2013 08:24:08 +0200
changeset 2151 015dab6a915f
parent 2150 08514552944f
child 2152 e6946c298a42
Fixed bug when drag'n dropping variable in master startup command grid
etherlab/ConfigEditor.py
--- a/etherlab/ConfigEditor.py	Tue May 21 16:03:40 2013 +0900
+++ b/etherlab/ConfigEditor.py	Mon Jun 03 08:24:08 2013 +0200
@@ -818,20 +818,23 @@
     
     def RefreshStartupCommands(self, position=None, command_idx=None):
         if self.CurrentNodesFilter is not None:
+            col = max(self.StartupCommandsGrid.GetGridCursorCol(), 0)
             self.StartupCommandsTable.SetData(
                 self.Controler.GetStartupCommands(**self.CurrentNodesFilter))
             self.StartupCommandsTable.ResetView(self.StartupCommandsGrid)
             if position is not None and command_idx is not None:
-                wx.CallAfter(self.SelectStartupCommand, position, command_idx)
-    
-    def SelectStartupCommand(self, position, command_idx):
-        self.StartupCommandsGrid.SetSelectedRow(
-            self.StartupCommandsTable.GetCommandIndex(position, command_idx))
+                self.SelectStartupCommand(position, command_idx, col)
+    
+    def SelectStartupCommand(self, position, command_idx, col):
+        self.StartupCommandsGrid.SetSelectedCell(
+            self.StartupCommandsTable.GetCommandIndex(position, command_idx),
+            col)
     
     def GetMasterLocation(self):
         return self.Controler.GetCurrentLocation()
     
     def AddStartupCommand(self, position, index, subindex):
+        col = max(self.StartupCommandsGrid.GetGridCursorCol(), 0)
         command = self.StartupCommandsDefaultValue.copy()
         command["Position"] = position
         command["Index"] = index
@@ -839,8 +842,7 @@
         command_idx = self.Controler.AppendStartupCommand(command)
         self.RefreshStartupCommands()
         self.RefreshBuffer()
-        self.StartupCommandsGrid.SetSelectedRow(
-            self.StartupCommandsTable.GetCommandIndex(position, command_idx))
+        self.SelectStartupCommand(position, command_idx, col)
     
     def OnNodesFilterChanged(self, event):
         self.RefreshCurrentNodesFilter()