summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/dialog.py
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-11-12 19:15:33 +0100
committerRobert Honz <exislow+github@gmail.com>2024-11-12 19:15:33 +0100
commit618b16257b6f398345bac467aa2706f7385ff577 (patch)
treefca209e4983e81cc2ae3a64ef4731051ee794a7e /tidal_dl_ng/dialog.py
parent4cef07b08f16410f56fa53a34884ce3b5dd6b64e (diff)
downloadtidal-dl-ng-618b16257b6f398345bac467aa2706f7385ff577.tar.gz
✨ Backend and GUI changed to device login. Login dialog needs to be threaded / non blocking.
Diffstat (limited to 'tidal_dl_ng/dialog.py')
-rw-r--r--tidal_dl_ng/dialog.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/tidal_dl_ng/dialog.py b/tidal_dl_ng/dialog.py
index c035867..f82386b 100644
--- a/tidal_dl_ng/dialog.py
+++ b/tidal_dl_ng/dialog.py
@@ -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."""