本文整理汇总了Python中login.Login.close方法的典型用法代码示例。如果您正苦于以下问题:Python Login.close方法的具体用法?Python Login.close怎么用?Python Login.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类login.Login
的用法示例。
在下文中一共展示了Login.close方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Client
# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import close [as 别名]
class Client(QtGui.QWidget):
def __init__(self, app):
super(Client, self).__init__()
self.app = app
self._load_securedrop_list()
# open SecureDropList window
self.choose_org = ChooseOrg(self.securedrop_list)
self.choose_org.show()
# launch login window
self.choose_org.org_button_clicked.connect(self.launch_login)
self.choose_org.other_button_clicked.connect(self.other_org)
def launch_login(self, instance):
self.login = Login(instance)
self.login.back_button_clicked.connect(self.login_to_choose_org)
self.choose_org.hide()
def login_to_choose_org(self):
self.login.close()
self.choose_org.show()
def other_org(self):
common.alert('This has not been implemented yet. For now, choose one of the SecureDrop instances from the official list.')
def _load_securedrop_list(self):
# TODO: download securedrop_list.txt and securedrop_list.txt.asc from https://freedom.press/
# over Tor (or better yet, a hidden service) for updated list of instances
# make a temporary gpg homedir and import securedrop pubkey
homedir = tempfile.mkdtemp()
subprocess.Popen(['/usr/bin/gpg', '--homedir', homedir, '--import', common.get_resource_path('securedrop.asc')]).wait()
# verify the sig
list_sig = common.get_resource_path('securedrop_list.txt.asc')
p = subprocess.Popen(['/usr/bin/gpg', '--homedir', homedir, '--verify', list_sig])
p.wait()
if p.returncode != 0:
shutil.rmtree(homedir)
raise ListVerificationFailed
# parse the list
self.securedrop_list = []
list_filename = common.get_resource_path('securedrop_list.txt')
for line in open(list_filename, 'r').readlines():
line = line.strip()
if line.startswith('#'):
continue
org, landing_page, hs = line.split('\t')
if org == 'Organization':
continue
self.securedrop_list.append({ 'org': org, 'landing_page': landing_page, 'hs': hs })
# clean up temp files
shutil.rmtree(homedir)