✨ Backend and GUI changed to device login. Login dialog needs to be threaded / non blocking.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import os.path
|
||||
import shutil
|
||||
import webbrowser
|
||||
import datetime
|
||||
from enum import Enum, StrEnum
|
||||
from pathlib import Path
|
||||
|
||||
@@ -83,24 +84,25 @@ class DialogLogin(QtWidgets.QDialog):
|
||||
|
||||
ui: Ui_DialogLogin
|
||||
url_redirect: str
|
||||
return_code: int
|
||||
|
||||
def __init__(self, url_login: str, hint: str, parent=None):
|
||||
def __init__(self, url_login: str, hint: str, expires_in: int, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
datetime_current: datetime.datetime = datetime.datetime.now()
|
||||
datetime_expires: datetime.datetime = datetime_current + datetime.timedelta(0, expires_in)
|
||||
|
||||
# Create an instance of the GUI
|
||||
self.ui = Ui_DialogLogin()
|
||||
|
||||
# Run the .setupUi() method to show the GUI
|
||||
self.ui.setupUi(self)
|
||||
# Set data.
|
||||
self.ui.tb_url_login.setText(f'<a href="{url_login}">{url_login}</a>')
|
||||
self.ui.tb_url_login.setText(f'<a href="https://{url_login}">https://{url_login}</a>')
|
||||
self.ui.l_hint.setText(hint)
|
||||
self.ui.l_expires_date_time.setText(datetime_expires.strftime("%Y-%m-%d %H:%M"))
|
||||
# Show
|
||||
self.return_code = self.exec()
|
||||
|
||||
self.url_redirect = self.ui.te_url_redirect.toPlainText()
|
||||
|
||||
|
||||
class DialogPreferences(QtWidgets.QDialog):
|
||||
"""Preferences dialog."""
|
||||
|
||||
Reference in New Issue
Block a user