firstrun Package

firstrun Package

intro Module

Intro page used in first run wizard

class leap.gui.firstrun.intro.IntroPage(parent=None)

Bases: PyQt4.QtGui.QWizardPage

nextId()

returns next id in a non-linear wizard

validatePage()

last Module

Last Page, used in First Run Wizard

class leap.gui.firstrun.last.LastPage(parent=None)

Bases: PyQt4.QtGui.QWizardPage

eip_status_handler(*args, **kwargs)
initializePage()
isComplete()
send_status(cb, status)
set_finished_status()
set_status_line(line, status)

login Module

LogIn Page, used inf First Run Wizard

class leap.gui.firstrun.login.LogInPage(parent=None)

Bases: leap.gui.progress.InlineValidationPage, leap.gui.firstrun.mixins.UserFormMixIn

cleanup_errormsg()

we reset bad_string to None should be called before leaving the page

disableFields()
disableNextButton()
green_validation_status()
initializePage()
nextFocus()
nextId()
nextText(text)
onUserNamePositionChanged(*args)
onUserNameTextChanged(*args)
on_checks_validation_ready()

after checks

paintEvent(event)

we hook our populate errors on paintEvent because we need it to catch when user enters the page coming from next, and initializePage does not cover that case. Maybe there’s a better event to hook upon.

populateErrors()
reset_validation_status()

empty the validation msg and clean the inline validation widget.

set_prevalidation_error(error)
setupUI()
validatePage()

if not register done, do checks. if done, wait for click.

mixins Module

mixins used in First Run Wizard

class leap.gui.firstrun.mixins.UserFormMixIn

Bases: object

reset_validation_status()

empty the validation msg

set_validation_status(msg)

set generic validation status

providerinfo Module

Provider Info Page, used in First run Wizard

class leap.gui.firstrun.providerinfo.ProviderInfoPage(parent=None)

Bases: PyQt4.QtGui.QWizardPage

create_info_panel()
initializePage()
nextId()
show_provider_info()

providerselect Module

Select Provider Page, used in First Run Wizard

class leap.gui.firstrun.providerselect.SelectProviderPage(parent=None, providers=None)

Bases: leap.gui.progress.InlineValidationPage

add_cert_info(certinfo)
cleanup_errormsg()

we reset bad_string to None should be called before leaving the page

initializePage()
isComplete()
is_insecure_cert_trusted()
launchChecks
launch_checks()
nextId()
onCheckButtonClicked()
onDisableCheckButton()
onProviderChanged(text)
onTrustCheckChanged(state)
on_checks_validation_ready()

called after _do_checks has finished.

paintEvent(event)

we hook our populate errors on paintEvent because we need it to catch when user enters the page coming from next, and initializePage does not cover that case. Maybe there’s a better event to hook upon.

populateErrors()
reset_validation_status()

empty the validation msg and clean the inline validation widget.

setupCertInfoGroup()
setupUI()

initializes the UI

setupValidationFrame()
validatePage()

providersetup Module

Provider Setup Validation Page, used if First Run Wizard

class leap.gui.firstrun.providersetup.ProviderSetupValidationPage(parent=None)

Bases: leap.gui.progress.ValidationPage

initializePage()
nextId()
on_checks_validation_ready()

called after _do_checks has finished (connected to checker thread finished signal)

register Module

Register User Page, used in First Run Wizard

class leap.gui.firstrun.register.RegisterUserPage(parent=None)

Bases: leap.gui.progress.InlineValidationPage, leap.gui.firstrun.mixins.UserFormMixIn

cleanup_errormsg()

we reset bad_string to None should be called before leaving the page

commitButton
commitFocus()
commitText(text)
disableCommitButton()
disableFields()
green_validation_status()
initializePage()

inits wizard page

markRedAndGetFocus(field)
markRegular(field)
nextId()
on_checks_validation_ready()

after checks

paintEvent(event)

we hook our populate errors on paintEvent because we need it to catch when user enters the page coming from next, and initializePage does not cover that case. Maybe there’s a better event to hook upon.

populateErrors()
reset_validation_status()

empty the validation msg and clean the inline validation widget.

setupUI()
validatePage()

if not register done, do checks. if done, wait for click.

regvalidation Module

wizard Module

class leap.gui.firstrun.wizard.FirstRunWizard(conductor_instance, parent=None, pages_dict=None, username=None, providers=None, success_cb=None, is_provider_setup=False, trusted_certs=None, netchecker=<class 'leap.base.checks.LeapNetworkChecker'>, providercertchecker=<class 'leap.eip.checks.ProviderCertChecker'>, eipconfigchecker=<class 'leap.eip.checks.EIPConfigChecker'>, start_eipconnection_signal=None, eip_statuschange_signal=None, debug_server=None, quitcallback=None)

Bases: PyQt4.QtGui.QWizard

accept()

final step in the wizard. gather the info, update settings and call the success callback if any has been passed.

add_pages_from_dict(pages_dict)
@param pages_dict: the dictionary with pages, where
values are a tuple of InstanceofWizardPage, kwargs.

@type pages_dict: dict

clean_validation_error(pagename)
get_page_index(page_name)

returns the index of the given page @param page_name: the name of the desired page @type page_name: str @rparam: index of page in wizard @rtype: int

get_provider_by_index()

returns the value of a provider given its index. this was used in the select provider page, in the case where we were preseeding providers in a combobox

get_random_str(n)

returns a random string :param n: the length of the desired string :rvalue: str

get_validation_error(pagename)
set_providerconfig(providerconfig)

sets a providerconfig attribute used when we fetch and parse a json configuration

set_validation_error(pagename, error)
leap.gui.firstrun.wizard.get_pages_dict()
leap.gui.firstrun.wizard.logger = <logging.Logger object at 0xb4e7f6c>

This wizard still needs to be refactored out.

TODO-ish:

[X] Break file in wizard / pages files (and its own folder). [ ] Separate presentation from logic. [ ] Have a “manager” class for connections, that can be

dep-injected for testing.

[ ] Document signals used / expected. [ ] Separate style from widgets. [ ] Fix TOFU Widget for provider cert. [X] Refactor widgets out. [ ] Follow more MVC style. [ ] Maybe separate “first run wizard” into different wizards

that share some of the pages?