comparison src/browser/sat_browser/register.py @ 804:1f054ba3245e

browser_side: fixes JID as login detection, can't rely on "@" keycode
author souliane <souliane@mailoo.org>
date Tue, 15 Dec 2015 13:04:20 +0100
parents 3c5b17a3d86e
children f8a7a046ff9c
comparison
equal deleted inserted replaced
803:89a0cd2aa763 804:1f054ba3245e
42 42
43 import re 43 import re
44 44
45 from constants import Const as C 45 from constants import Const as C
46 46
47
48 KEY_AROBASE = 81 # XXX: this is the keycode for onKeyUp, the one which works for onKeyPress is 64!
49 47
50 48
51 class RegisterPanel(FormPanel): 49 class RegisterPanel(FormPanel):
52 50
53 def __init__(self, callback): 51 def __init__(self, callback):
169 self.onRegister(None) 167 self.onRegister(None)
170 168
171 def onKeyUp(self, sender, keycode, modifiers): 169 def onKeyUp(self, sender, keycode, modifiers):
172 # XXX: this is triggered after the textbox value has changed 170 # XXX: this is triggered after the textbox value has changed
173 if sender == self.login_box: 171 if sender == self.login_box:
174 if keycode == KEY_AROBASE: 172 if "@" in self.login_box.getText():
175 self.login_warning_msg.setHTML(_('<span class="formInfo">Entering a full JID is only needed to connect with an external XMPP account.</span>')) 173 self.login_warning_msg.setHTML(_('<span class="formInfo">Entering a full JID is only needed to connect with an external XMPP account.</span>'))
176 elif "@" not in self.login_box.getText(): 174 else:
177 self.login_warning_msg.setHTML("") 175 self.login_warning_msg.setHTML("")
178 176
179 def onKeyDown(self, sender, keycode, modifiers): 177 def onKeyDown(self, sender, keycode, modifiers):
180 pass 178 pass
181 179