git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33436
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
# be a good place to implement the 2.3 logger class
from wx.tools.dbg import Logger
##dbg = Logger()
# be a good place to implement the 2.3 logger class
from wx.tools.dbg import Logger
##dbg = Logger()
## ---------- ---------- ---------- ---------- ---------- ---------- ----------
## Because calling SetSelection programmatically does not fire EVT_COMBOBOX
## ---------- ---------- ---------- ---------- ---------- ---------- ----------
## Because calling SetSelection programmatically does not fire EVT_COMBOBOX
Allow mixin to get the text selection of this control.
REQUIRED by any class derived from MaskedEditMixin.
"""
Allow mixin to get the text selection of this control.
REQUIRED by any class derived from MaskedEditMixin.
"""
+## dbg('MaskedComboBox::_GetSelection()')
return self.GetMark()
def _SetSelection(self, sel_start, sel_to):
return self.GetMark()
def _SetSelection(self, sel_start, sel_to):
Allow mixin to set the text selection of this control.
REQUIRED by any class derived from MaskedEditMixin.
"""
Allow mixin to set the text selection of this control.
REQUIRED by any class derived from MaskedEditMixin.
"""
+## dbg('MaskedComboBox::_SetSelection: setting mark to (%d, %d)' % (sel_start, sel_to))
return self.SetMark( sel_start, sel_to )
def _GetInsertionPoint(self):
return self.SetMark( sel_start, sel_to )
def _GetInsertionPoint(self):
- return self.GetInsertionPoint()
+## dbg('MaskedComboBox::_GetInsertionPoint()', indent=1)
+## ret = self.GetInsertionPoint()
+ # work around new bug in 2.5, in which the insertion point
+ # returned is always at the right side of the selection,
+ # rather than the start, as is the case with TextCtrl.
+ ret = self.GetMark()[0]
+## dbg('returned', ret, indent=0)
+ return ret
def _SetInsertionPoint(self, pos):
def _SetInsertionPoint(self, pos):
+## dbg('MaskedComboBox::_SetInsertionPoint(%d)' % pos)
self.SetInsertionPoint(pos)
self.SetInsertionPoint(pos)
## dbg('computed selection:', sel_start, sel_to, indent=0, suspend=0)
return sel_start, sel_to
## dbg('computed selection:', sel_start, sel_to, indent=0, suspend=0)
return sel_start, sel_to
+ else:
+ def GetMark(self):
+## dbg('MaskedComboBox::GetMark()', indent = 1)
+ ret = wx.ComboBox.GetMark(self)
+## dbg('returned', ret, indent=0)
+ return ret
def SetSelection(self, index):
def SetSelection(self, index):
if pos == year2dig and unadjusted[year2dig] != newstr[year2dig]:
newpos = pos+2
if pos == year2dig and unadjusted[year2dig] != newstr[year2dig]:
newpos = pos+2
+## dbg('queuing insertion point: (%d)' % newpos)
wx.CallAfter(self._SetInsertionPoint, newpos)
if match_field is not None:
wx.CallAfter(self._SetInsertionPoint, newpos)
if match_field is not None:
else:
newfield = self._FindField(newpos)
if newfield != field and newfield._selectOnFieldEntry:
else:
newfield = self._FindField(newpos)
if newfield != field and newfield._selectOnFieldEntry:
+## dbg('queuing insertion point: (%d)' % newfield._extent[0])
+ wx.CallAfter(self._SetInsertionPoint, newfield._extent[0])
## dbg('queuing selection: (%d, %d)' % (newfield._extent[0], newfield._extent[1]))
wx.CallAfter(self._SetSelection, newfield._extent[0], newfield._extent[1])
else:
## dbg('queuing selection: (%d, %d)' % (newfield._extent[0], newfield._extent[1]))
wx.CallAfter(self._SetSelection, newfield._extent[0], newfield._extent[1])
else:
## dbg('match found:', choice)
match = index
break
## dbg('match found:', choice)
match = index
break
- else: dbg('choice: "%s" - no match' % choice)
+ else:
+## dbg('choice: "%s" - no match' % choice)
+ pass
if match is not None:
## dbg('matched', match)
pass
if match is not None:
## dbg('matched', match)
pass
old_right_signpos = text.find(')')
if field._allowInsert and not field._insertRight and sel_to <= end and sel_start >= start:
old_right_signpos = text.find(')')
if field._allowInsert and not field._insertRight and sel_to <= end and sel_start >= start:
- # inserting within a left-insert-capable field
+## dbg('inserting within a left-insert-capable field')
field_len = end - start
before = text[start:sel_start]
after = text[sel_to:end].strip()
field_len = end - start
before = text[start:sel_start]
after = text[sel_to:end].strip()
char = char.decode(self._defaultEncoding)
newtext = left + char + right
char = char.decode(self._defaultEncoding)
newtext = left + char + right
+#### dbg('left: "%s"' % left)
+#### dbg('right: "%s"' % right)
+#### dbg('newtext: "%s"' % newtext)
if self._signOk and self._useParens:
# Balance parentheses:
if self._signOk and self._useParens:
# Balance parentheses: