summaryrefslogtreecommitdiff
path: root/tidal_dl_ng/dialog.py
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-02-01 07:38:01 +0100
committerRobert Honz <exislow+github@gmail.com>2024-02-01 07:38:01 +0100
commitc1bf278fd77d05425d99284d46728c2afeffb95b (patch)
treefafe8f0c31bc569d2ece769785c42deab5cafbb4 /tidal_dl_ng/dialog.py
parenta994aa629ef8579819380fcd979ea2cf935125b8 (diff)
downloadtidal-dl-ng-c1bf278fd77d05425d99284d46728c2afeffb95b.tar.gz
✨ Implemented login dialog for PKCE login method. Fixes #22.
Diffstat (limited to 'tidal_dl_ng/dialog.py')
-rw-r--r--tidal_dl_ng/dialog.py31
1 files changed, 30 insertions, 1 deletions
diff --git a/tidal_dl_ng/dialog.py b/tidal_dl_ng/dialog.py
index 5370136..788aeba 100644
--- a/tidal_dl_ng/dialog.py
+++ b/tidal_dl_ng/dialog.py
@@ -1,6 +1,7 @@
from PySide6.QtWidgets import QDialog
from tidal_dl_ng import __version__
+from tidal_dl_ng.ui.dialog_login import Ui_DialogLogin
from tidal_dl_ng.ui.dialog_version import Ui_DialogVersion
@@ -9,11 +10,39 @@ class DialogVersion(QDialog):
def __init__(self, parent=None):
super().__init__(parent)
+
# Create an instance of the GUI
self.ui = Ui_DialogVersion()
+
# Run the .setupUi() method to show the GUI
self.ui.setupUi(self)
# Set the version.
self.ui.l_version.setText("v" + __version__)
-
+ # Show
self.exec()
+
+
+class DialogLogin(QDialog):
+ """Version dialog."""
+
+ url_redirect: str
+ return_code: int
+
+ def __init__(self, url_login: str, hint: str, parent=None):
+ super().__init__(parent)
+
+ # 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.l_url_login.setText(f'<a href="{url_login}">{url_login}</a>')
+ self.ui.l_hint.setText(hint)
+ # Show
+ self.return_code = self.exec()
+
+ self.url_redirect = self.ui.te_url_redirect.toPlainText()
+
+ def accept1(self):
+ pass