if self._autofit:
## dbg('setting client size to:', self._CalcSize())
- size = self._CalcSize()
- self.SetSizeHints(size)
- self.SetClientSize(size)
+ self.SetClientSize(self._CalcSize())
+ self.SetSizeHints(self.GetSize())
# Set value/type-specific formatting
self._applyFormatting()
self._SetInitialValue()
if self._autofit:
- size = self._CalcSize()
- self.SetSizeHints(size)
- self.SetClientSize(size)
+ self.SetClientSize(self._CalcSize())
+ self.SetSizeHints(self.GetSize())
# Set value/type-specific formatting
self._applyFormatting()
def _OnCtrl_A(self,event=None):
""" Handles ctrl-a keypress in control. Should return False to skip other processing. """
end = self._goEnd(getPosOnly=True)
- if not event or event.ShiftDown():
+ if not event or (isinstance(event, wx.KeyEvent) and event.ShiftDown()):
wx.CallAfter(self._SetInsertionPoint, 0)
wx.CallAfter(self._SetSelection, 0, self._masklength)
else:
def _OnContextMenu(self, event):
## dbg('MaskedEditMixin::OnContextMenu()', indent=1)
- menu = wxMenu()
- menu.Append(wxID_UNDO, "Undo", "")
+ menu = wx.Menu()
+ menu.Append(wx.ID_UNDO, "Undo", "")
menu.AppendSeparator()
- menu.Append(wxID_CUT, "Cut", "")
- menu.Append(wxID_COPY, "Copy", "")
- menu.Append(wxID_PASTE, "Paste", "")
- menu.Append(wxID_CLEAR, "Delete", "")
+ menu.Append(wx.ID_CUT, "Cut", "")
+ menu.Append(wx.ID_COPY, "Copy", "")
+ menu.Append(wx.ID_PASTE, "Paste", "")
+ menu.Append(wx.ID_CLEAR, "Delete", "")
menu.AppendSeparator()
- menu.Append(wxID_SELECTALL, "Select All", "")
+ menu.Append(wx.ID_SELECTALL, "Select All", "")
- EVT_MENU(menu, wxID_UNDO, self._OnCtrl_Z)
- EVT_MENU(menu, wxID_CUT, self._OnCtrl_X)
- EVT_MENU(menu, wxID_COPY, self._OnCtrl_C)
- EVT_MENU(menu, wxID_PASTE, self._OnCtrl_V)
- EVT_MENU(menu, wxID_CLEAR, self._OnClear)
- EVT_MENU(menu, wxID_SELECTALL, self._OnCtrl_A)
+ wx.EVT_MENU(menu, wx.ID_UNDO, self._OnCtrl_Z)
+ wx.EVT_MENU(menu, wx.ID_CUT, self._OnCtrl_X)
+ wx.EVT_MENU(menu, wx.ID_COPY, self._OnCtrl_C)
+ wx.EVT_MENU(menu, wx.ID_PASTE, self._OnCtrl_V)
+ wx.EVT_MENU(menu, wx.ID_CLEAR, self._OnClear)
+ wx.EVT_MENU(menu, wx.ID_SELECTALL, self._OnCtrl_A)
# ## WSS: The base control apparently handles
# enable/disable of wID_CUT, wxID_COPY, wxID_PASTE
# so we're keeping track of previous values ourselves.
# Therefore, we have to override the default update for
# that item on the menu:
- EVT_UPDATE_UI(self, wxID_UNDO, self._UndoUpdateUI)
+ wx.EVT_UPDATE_UI(self, wx.ID_UNDO, self._UndoUpdateUI)
self._contextMenu = menu
self.PopupMenu(menu, event.GetPosition())
def _UndoUpdateUI(self, event):
if self._prevValue is None or self._prevValue == self._curValue:
- self._contextMenu.Enable(wxID_UNDO, False)
+ self._contextMenu.Enable(wx.ID_UNDO, False)
else:
- self._contextMenu.Enable(wxID_UNDO, True)
+ self._contextMenu.Enable(wx.ID_UNDO, True)
def _OnCtrlParametersChanged(self):