10.7.1. Class cerebro.gui.AccountDialog

class cerebro.gui.AccountDialog(title, label='', store_key='')[source]
Parameters:
  • title (string) – dialog title.
  • label (string) – text label.
  • store_key (string) – a key to restore previously saved login and password.

Credentials input dialogue class.

Methods

_images/capi_gui_account.png
daccount = cerebro.gui.account_dialog('Example', 'Enter your login and password', 'store_key')
res = daccount.execute()
if res == True:
        print('Login and password entered by user:', daccount.login(), daccount.password())
        daccount.store('store_key') # saving the password for future calls      
execute()[source]
Returns:True, if the user entered login and password and pressed “OK” button or if the login and password were saved earlier.
Return type:bool

Displays a dialog window.

If the login and password were saved during a previous call, the dialog window is not displayed, “True” returns, and then you can resolve the login and password by using the following methods: login() and password().

login()[source]
Returns:login entered by user.
Return type:string

See also

set_login().

password()[source]
Returns:password entered by user.
Return type:string
set_login(login)[source]
Parameters:login (string) – login.

Sets login value.

See also

login().

store(store_key, expires=7)[source]
Parameters:
  • store_key (string) – key for saving login and password.
  • expires (int) – password storage period, days. Setting the argument to -1 means the storage period is unlimited.

The dialog saves login and password by a text key for the desired period of time. To restore a previously saved password, pass the key used for saving to the dialog constructor.

Note

All passwords are stored in encrypted form.