From 19eca87c7ef8b1861daeb986f3705f1fd6b489c8 Mon Sep 17 00:00:00 2001 From: ssleg <1537206@mail.ru> Date: Fri, 24 Dec 2021 16:58:20 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=BF=D0=BE=D0=BB=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5,=20=D0=B2=D1=85=D0=BE=D0=B4=20=D0=BF=D0=BE?= =?UTF-8?q?=20=D0=BA=D0=BB=D0=B0=D0=B2=D0=B8=D1=88=D0=B5=20enter=20=D0=B8?= =?UTF-8?q?=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D1=81=D0=BA=D0=BE?= =?UTF-8?q?=D0=BF=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=BB=D0=BE?= =?UTF-8?q?=D0=B3=D0=B8=D0=BD.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/main.py b/main.py index 482e53e..f3d71fb 100755 --- a/main.py +++ b/main.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -# Key Master v1.01 -# 04/09/2021 +# Key Master v1.02 +# 24/12/2021 # https://t.me/ssleg © 2021 import sqlite3 @@ -14,7 +14,7 @@ import cryptocode class LoginCard: - """класс хранения карточки логина/пароля""" + """Класс хранения карточки логина/пароля""" __slots__ = ['__row_id', '__encrypt_key', '__hash', '__name', '__login', '__password'] @@ -95,7 +95,7 @@ class LoginCard: class AllCards: - """класс хранения всех карточек""" + """Класс хранения всех карточек""" __slots__ = ['__encrypt_key', '__cards'] @@ -263,17 +263,19 @@ def system_init(): # окно ввода и проверки пароля def system_login(): + qt_enter_key1 = 'special 16777220' + qt_enter_key2 = 'special 16777221' attempts = 3 status = False password = '' layout = [[Sg.Text('Пароль:'), Sg.InputText(size=(20, 1), border_width=3, password_char='*')], [Sg.Button('Ok'), Sg.Text('', key='Err_text', text_color='firebrick1', font='style:bold')]] - window = Sg.Window("KeyMaster - вход", layout) + window = Sg.Window("KeyMaster - вход", layout, return_keyboard_events=True) while True: event, values = window.read() if event == Sg.WIN_CLOSED: break - if event == 'Ok': + if event == 'Ok' or event in ('\r', qt_enter_key1, qt_enter_key2): input_word = values[0] if len(input_word) >= 4: password = sha256(input_word.encode()).hexdigest() @@ -405,7 +407,8 @@ def main(): size=(20, 10), key='list'), Sg.Text(key='card')], [Sg.Button('Добавить'), Sg.Button('Редактировать', disabled=True, key='edit'), Sg.Button('Скопировать пароль', disabled=True, key='copy')], - [Sg.Button('Удалить', disabled=True, key='delete')]] + [Sg.Button('Удалить', disabled=True, key='delete'), Sg.Text(' '), + Sg.Button('Скопировать логин', disabled=True, key='copy_login')]] window = Sg.Window("KeyMaster - главная", layout) while True: event, values = window.read() @@ -417,6 +420,7 @@ def main(): if not keys_disabled: window.Element('edit').update(disabled=True) window.Element('copy').update(disabled=True) + window.Element('copy_login').update(disabled=True) window.Element('delete').update(disabled=True) keys_disabled = True @@ -434,6 +438,7 @@ def main(): if keys_disabled: window.Element('edit').update(disabled=False) window.Element('copy').update(disabled=False) + window.Element('copy_login').update(disabled=False) window.Element('delete').update(disabled=False) keys_disabled = False @@ -446,6 +451,12 @@ def main(): password = my_cards.get_card_password(name[0]) Sg.clipboard_set(password) + if event == 'copy_login': + name = window.Element('list').get() + if len(name) > 0: + login = my_cards.get_card_login(name[0]) + Sg.clipboard_set(login) + if event == 'edit': name = window.Element('list').get() if len(name) > 0: