Small fix to make sure the cursor stays where it is using the Pro GUI

This commit is contained in:
Maran 2012-09-04 19:54:01 +02:00
parent 3f499d7048
commit 9407dd3f2f
1 changed files with 2 additions and 0 deletions

View File

@ -54,6 +54,7 @@ ALIAS_REGEXP = '^(|([\w\-\.]+)@)((\w[\w\-]+\.)+[\w\-]+)$'
def numbify(entry, is_int = False):
text = unicode(entry.text()).strip()
pos = entry.cursorPosition()
chars = '0123456789'
if not is_int: chars +='.'
s = ''.join([i for i in text if i in chars])
@ -72,6 +73,7 @@ def numbify(entry, is_int = False):
except:
amount = None
entry.setText(s)
entry.setCursorPosition(pos)
return amount