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/baseapp/mainwindow.py | 10 ++++++++++ src/leap/gui/firstrunwizard.py | 22 ++++++++++++++++++++-- 2 files changed, 30 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/leap/baseapp/mainwindow.py b/src/leap/baseapp/mainwindow.py index 63242fd2..1accac30 100644 --- a/src/leap/baseapp/mainwindow.py +++ b/src/leap/baseapp/mainwindow.py @@ -26,6 +26,7 @@ class LeapWindow(QtGui.QMainWindow, newLogLine = QtCore.pyqtSignal([str]) statusChange = QtCore.pyqtSignal([object]) + mainappReady = QtCore.pyqtSignal([]) initReady = QtCore.pyqtSignal([]) def __init__(self, opts): @@ -57,13 +58,22 @@ class LeapWindow(QtGui.QMainWindow, lambda status: self.onStatusChange(status)) self.timer.timeout.connect( lambda: self.onTimerTick()) + + # do frwizard and init signals + self.mainappReady.connect(self.do_first_run_wizard_check) self.initReady.connect(self.runchecks_and_eipconnect) # ... all ready. go! + # calls do_first_run_wizard_check + self.mainappReady.emit() + + def do_first_run_wizard_check(self): + logger.debug('first run wizard check...') if self.wizard_done: self.initReady.emit() else: # need to run first-run-wizard + logger.debug('running first run wizard') from leap.gui.firstrunwizard import FirstRunWizard wizard = FirstRunWizard( parent=self, 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