etherlab/ConfigEditor.py
changeset 2151 015dab6a915f
parent 2147 a8b095de63e8
child 2152 e6946c298a42
equal deleted inserted replaced
2150:08514552944f 2151:015dab6a915f
   816                 self.Controler.SetProcessVariables(self.ProcessVariablesTable.GetData())
   816                 self.Controler.SetProcessVariables(self.ProcessVariablesTable.GetData())
   817             self.RefreshBuffer()
   817             self.RefreshBuffer()
   818     
   818     
   819     def RefreshStartupCommands(self, position=None, command_idx=None):
   819     def RefreshStartupCommands(self, position=None, command_idx=None):
   820         if self.CurrentNodesFilter is not None:
   820         if self.CurrentNodesFilter is not None:
       
   821             col = max(self.StartupCommandsGrid.GetGridCursorCol(), 0)
   821             self.StartupCommandsTable.SetData(
   822             self.StartupCommandsTable.SetData(
   822                 self.Controler.GetStartupCommands(**self.CurrentNodesFilter))
   823                 self.Controler.GetStartupCommands(**self.CurrentNodesFilter))
   823             self.StartupCommandsTable.ResetView(self.StartupCommandsGrid)
   824             self.StartupCommandsTable.ResetView(self.StartupCommandsGrid)
   824             if position is not None and command_idx is not None:
   825             if position is not None and command_idx is not None:
   825                 wx.CallAfter(self.SelectStartupCommand, position, command_idx)
   826                 self.SelectStartupCommand(position, command_idx, col)
   826     
   827     
   827     def SelectStartupCommand(self, position, command_idx):
   828     def SelectStartupCommand(self, position, command_idx, col):
   828         self.StartupCommandsGrid.SetSelectedRow(
   829         self.StartupCommandsGrid.SetSelectedCell(
   829             self.StartupCommandsTable.GetCommandIndex(position, command_idx))
   830             self.StartupCommandsTable.GetCommandIndex(position, command_idx),
       
   831             col)
   830     
   832     
   831     def GetMasterLocation(self):
   833     def GetMasterLocation(self):
   832         return self.Controler.GetCurrentLocation()
   834         return self.Controler.GetCurrentLocation()
   833     
   835     
   834     def AddStartupCommand(self, position, index, subindex):
   836     def AddStartupCommand(self, position, index, subindex):
       
   837         col = max(self.StartupCommandsGrid.GetGridCursorCol(), 0)
   835         command = self.StartupCommandsDefaultValue.copy()
   838         command = self.StartupCommandsDefaultValue.copy()
   836         command["Position"] = position
   839         command["Position"] = position
   837         command["Index"] = index
   840         command["Index"] = index
   838         command["Subindex"] = subindex
   841         command["Subindex"] = subindex
   839         command_idx = self.Controler.AppendStartupCommand(command)
   842         command_idx = self.Controler.AppendStartupCommand(command)
   840         self.RefreshStartupCommands()
   843         self.RefreshStartupCommands()
   841         self.RefreshBuffer()
   844         self.RefreshBuffer()
   842         self.StartupCommandsGrid.SetSelectedRow(
   845         self.SelectStartupCommand(position, command_idx, col)
   843             self.StartupCommandsTable.GetCommandIndex(position, command_idx))
       
   844     
   846     
   845     def OnNodesFilterChanged(self, event):
   847     def OnNodesFilterChanged(self, event):
   846         self.RefreshCurrentNodesFilter()
   848         self.RefreshCurrentNodesFilter()
   847         if self.CurrentNodesFilter is not None:
   849         if self.CurrentNodesFilter is not None:
   848             self.RefreshProcessVariables()
   850             self.RefreshProcessVariables()