# HG changeset patch # User laurent # Date 1332090706 -3600 # Node ID 435e2d8ee58000579d83be897ff76fcd22c591cb # Parent f8445d00613da87666a90a6418556dac96c3b99d Fixing issues regarding control navigation in EditorPanel and CustomGrid diff -r f8445d00613d -r 435e2d8ee580 RessourceEditor.py --- a/RessourceEditor.py Sun Mar 18 15:37:04 2012 +0100 +++ b/RessourceEditor.py Sun Mar 18 18:11:46 2012 +0100 @@ -270,7 +270,7 @@ def _init_Editor(self, prnt): self.Editor = wx.Panel(id=ID_RESOURCEEDITORPANEL, name='ResourceEditor', parent=prnt, - size=wx.Size(0, 0), style=wx.SUNKEN_BORDER) + size=wx.Size(0, 0), style=wx.SUNKEN_BORDER|wx.TAB_TRAVERSAL) self.staticText1 = wx.StaticText(id=ID_RESOURCEEDITORSTATICTEXT1, label=_(u'Tasks:'), name='staticText2', parent=self.Editor, pos=wx.Point(0, @@ -322,11 +322,11 @@ self.UpInstanceButton = wx.Button(id=ID_RESOURCEEDITORUPINSTANCEBUTTON, label='^', name='UpInstanceButton', parent=self.Editor, pos=wx.Point(0, 0), - size=wx.Size(32, 32), style=0) + size=wx.Size(32, -1), style=0) self.DownInstanceButton = wx.Button(id=ID_RESOURCEEDITORDOWNINSTANCEBUTTON, label='v', name='DownInstanceButton', parent=self.Editor, pos=wx.Point(0, 0), - size=wx.Size(32, 32), style=0) + size=wx.Size(32, -1), style=0) self._init_sizers() @@ -496,7 +496,7 @@ self.RefreshModel() colname = self.TasksTable.GetColLabelValue(col, False) if colname in ["Triggering", "Name"]: - wx.CallAfter(self.RefreshView) + wx.CallAfter(self.RefreshView, False) event.Skip() def OnInstancesGridCellChange(self, event): diff -r f8445d00613d -r 435e2d8ee580 controls/CustomGrid.py --- a/controls/CustomGrid.py Sun Mar 18 15:37:04 2012 +0100 +++ b/controls/CustomGrid.py Sun Mar 18 18:11:46 2012 +0100 @@ -52,6 +52,7 @@ if wx.VERSION >= (2, 6, 0): self.Bind(wx.grid.EVT_GRID_SELECT_CELL, self.OnSelectCell) + self.Bind(wx.grid.EVT_GRID_EDITOR_HIDDEN, self.OnEditorHidden) else: wx.grid.EVT_GRID_SELECT_CELL(self, self.OnSelectCell) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) @@ -151,6 +152,10 @@ wx.CallAfter(self.RefreshButtons) event.Skip() + def OnEditorHidden(self, event): + wx.CallAfter(self.SetFocus) + event.Skip() + def OnKeyDown(self, event): key_handled = False keycode = event.GetKeyCode() diff -r f8445d00613d -r 435e2d8ee580 controls/DurationCellEditor.py --- a/controls/DurationCellEditor.py Sun Mar 18 15:37:04 2012 +0100 +++ b/controls/DurationCellEditor.py Sun Mar 18 18:11:46 2012 +0100 @@ -71,7 +71,10 @@ def __init__(self, parent): self._init_ctrls(parent) + self.Default = None + def SetValue(self, value): + self.Default = value self.Duration.SetValue(value) def GetValue(self): @@ -94,9 +97,11 @@ def OnDurationChar(self, event): keycode = event.GetKeyCode() - if keycode in [wx.WXK_RETURN, wx.WXK_TAB, wx.WXK_ESCAPE]: + if keycode in [wx.WXK_RETURN, wx.WXK_TAB]: self.Parent.Parent.ProcessEvent(event) - self.Parent.Parent.SetFocus() + elif keycode == wx.WXK_ESCAPE: + self.Duration.SetValue(self.Default) + self.Parent.Parent.CloseEditControl() else: event.Skip() diff -r f8445d00613d -r 435e2d8ee580 controls/EditorPanel.py --- a/controls/EditorPanel.py Sun Mar 18 15:37:04 2012 +0100 +++ b/controls/EditorPanel.py Sun Mar 18 18:11:46 2012 +0100 @@ -50,23 +50,22 @@ self.SetNeedUpdating(True) self.SetMinimumPaneSize(1) - self._init_Editor(self) self._init_MenuItems() if self.VARIABLE_PANEL_TYPE is not None: self.VariableEditor = VariablePanel(self, self, self.Controler, self.VARIABLE_PANEL_TYPE, self.Debug) self.VariableEditor.SetTagName(self.TagName) - - if self.Editor is not None: - self.SplitHorizontally(self.VariableEditor, self.Editor, 200) - else: - self.Initialize(self.VariableEditor) - else: self.VariableEditor = None - if self.Editor is not None: - self.Initialize(self.Editor) + self._init_Editor(self) + + if self.Editor is not None and self.VariableEditor is not None: + self.SplitHorizontally(self.VariableEditor, self.Editor, 200) + elif self.VariableEditor is not None: + self.Initialize(self.VariableEditor) + elif self.Editor is not None: + self.Initialize(self.Editor) def __init__(self, parent, tagname, window, controler, debug=False): self.ParentWindow = window diff -r f8445d00613d -r 435e2d8ee580 controls/LocationCellEditor.py --- a/controls/LocationCellEditor.py Sun Mar 18 15:37:04 2012 +0100 +++ b/controls/LocationCellEditor.py Sun Mar 18 18:11:46 2012 +0100 @@ -72,11 +72,13 @@ self._init_ctrls(parent) self.Locations = locations self.VarType = None + self.Default = False def SetVarType(self, vartype): self.VarType = vartype def SetValue(self, value): + self.Default = value self.Location.SetValue(value) def GetValue(self): @@ -100,9 +102,11 @@ def OnLocationChar(self, event): keycode = event.GetKeyCode() - if keycode in [wx.WXK_RETURN, wx.WXK_TAB, wx.WXK_ESCAPE]: + if keycode in [wx.WXK_RETURN, wx.WXK_TAB]: self.Parent.Parent.ProcessEvent(event) - self.Parent.Parent.SetFocus() + elif keycode == wx.WXK_ESCAPE: + self.Location.SetValue(self.Default) + self.Parent.Parent.CloseEditControl() else: event.Skip() @@ -147,7 +151,7 @@ self.Table.SetValueByName(row, 'Location', loc) return True return False - + def SetSize(self, rect): self.CellControl.SetDimensions(rect.x + 1, rect.y, rect.width, rect.height,