From b9d1b57976984d1032b3abc810f462a80fdc55aa Mon Sep 17 00:00:00 2001 From: kali Date: Fri, 5 Oct 2012 07:00:42 +0900 Subject: focus fix for wizard --- src/leap/gui/firstrunwizard.py | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/leap/gui/firstrunwizard.py') diff --git a/src/leap/gui/firstrunwizard.py b/src/leap/gui/firstrunwizard.py index b93dc8e9..cc70daab 100755 --- a/src/leap/gui/firstrunwizard.py +++ b/src/leap/gui/firstrunwizard.py @@ -88,8 +88,11 @@ QLabel { color: red; class FirstRunWizard(QtGui.QWizard): def __init__(self, parent=None, providers=None, success_cb=None): - super(FirstRunWizard, self).__init__(parent) + super(FirstRunWizard, self).__init__( + parent, + QtCore.Qt.WindowStaysOnTopHint) + # XXX hardcoded for tests if not providers: providers = ('springbok',) self.providers = providers @@ -116,6 +119,16 @@ class FirstRunWizard(QtGui.QWizard): # TODO: set style for MAC / windows ... #self.setWizardStyle() + def setWindowFlags(self, flags): + logger.debug('setting window flags') + QtGui.QWizard.setWindowFlags(self, flags) + + def focusOutEvent(self, event): + self.setFocus(True) + self.activateWindow() + self.raise_() + self.show() + def accept(self): print 'chosen provider: ', self.get_provider() print 'username: ', self.field('userName') @@ -219,8 +232,13 @@ class RegisterUserPage(QtGui.QWizardPage): userNameLineEdit = QtGui.QLineEdit() userNameLineEdit.cursorPositionChanged.connect( self.reset_validation_status) + userNameLabel.setBuddy(userNameLineEdit) + # TODO + # add validator + # usernameRe = QRegexp(r"[]") + # userNameLineEdit.setValidator( + # QRegExpValidator(usernameRe, self)) self.userNameLineEdit = userNameLineEdit - userNameLabel.setBuddy(self.userNameLineEdit) userPasswordLabel = QtGui.QLabel("&Password:") self.userPasswordLineEdit = QtGui.QLineEdit() -- cgit v1.2.3