def _create(login: str, password: str, appurl: str, desc: str): try: FileMG.new_password(login, password, appurl, desc) except Exception as err: print(err) else: Utilities.clear_layout(self.screen_lay) self.find_password()
def _draw_list(): def _show_pass(entry, en_pass): entry.setText(FileMG.show_password(en_pass)) def _copy_pass(passwo): Utilities.copy_clip(FileMG.show_password(passwo)) Utilities.clear_layout(entry_layout) login_lbl = QLabel("Login name:") login_lbl.setAlignment(Qt.AlignCenter) entry_layout.addWidget(login_lbl, 0, 0) pass_lbl = QLabel("Password:"******"URL/Application:") url_lbl.setAlignment(Qt.AlignCenter) entry_layout.addWidget(url_lbl, 0, 4) desc_lbl = QLabel("Description:") desc_lbl.setAlignment(Qt.AlignCenter) entry_layout.addWidget(desc_lbl, 0, 5) for i in range(1, 11): if i - 1 + self.entry_id >= len(self.entry_arr): break curr_entry = self.entry_arr[i - 1 + self.entry_id] if curr_entry[0].isspace() or not curr_entry[0]: continue login_inp = QLineEdit(curr_entry[0]) login_inp.setReadOnly(True) entry_layout.addWidget(login_inp, i, 0) pass_inp = QLineEdit(curr_entry[1]) pass_inp.setReadOnly(True) entry_layout.addWidget(pass_inp, i, 1) show_btn = QPushButton("*") show_btn.clicked.connect( lambda state, entry=pass_inp, password=curr_entry[ 1]: _show_pass(entry, password)) entry_layout.addWidget(show_btn, i, 2) copy_btn = QPushButton("Copy") copy_btn.clicked.connect( lambda state, password=curr_entry[1]: _copy_pass(password)) entry_layout.addWidget(copy_btn, i, 3) url_inp = QLineEdit(curr_entry[2]) url_inp.setReadOnly(True) entry_layout.addWidget(url_inp, i, 4) desc_inp = QLineEdit(curr_entry[3]) desc_inp.setReadOnly(True) entry_layout.addWidget(desc_inp, i, 5)
def _submit(): try: password = password_ent.text() if password != cpassword_ent.text(): raise ValueError("Passwords Don't Match") FileMG.register_user(user_ent.text(), password) except Exception as err: print(err) QMessageBox.critical(None, "Error", str(err)) Utilities.clear_layout(self.root) self.initUI()
def _off(): Utilities.clear_layout(self.root) self.listener()
def _find(): Utilities.clear_layout(self.screen_lay) self.find_password()
def _delete(): FileMG.delete_password(login_inp.text()) self.window.close() Utilities.clear_layout(self.screen_lay) self.find_password()
def _update(login: str, password: str, appurl: str, desc: str): FileMG.update_password(login, password, appurl, desc) Utilities.clear_layout(self.screen_lay) self.find_password()
def after_login(self, user_id): Utilities.clear_layout(self.layout) Home(self.layout, self.login, user_id)
def _back(): Utilities.clear_layout(self.root) self.initUI()
def _register(): Utilities.clear_layout(self.root) self.press_register()