summaryrefslogtreecommitdiff
path: root/tidal_dl_ng
diff options
context:
space:
mode:
authorRobert Honz <exislow+github@gmail.com>2024-01-19 10:00:27 +0100
committerRobert Honz <exislow+github@gmail.com>2024-01-19 10:00:27 +0100
commit6cf723b2b8ec824c25c6a46de50215797518ea14 (patch)
tree05a1541c555470a03d78c8e1910367c75aa8c69d /tidal_dl_ng
parent038eaf85cbc24166935f1392dc2432f3886a59c8 (diff)
downloadtidal-dl-ng-6cf723b2b8ec824c25c6a46de50215797518ea14.tar.gz
✨ Added version dialog. See File -> Version.
Diffstat (limited to 'tidal_dl_ng')
-rw-r--r--tidal_dl_ng/dialog.py19
-rw-r--r--tidal_dl_ng/gui.py27
-rw-r--r--tidal_dl_ng/ui/dialog_version.py47
-rw-r--r--tidal_dl_ng/ui/dialog_version.ui61
-rw-r--r--tidal_dl_ng/ui/main.py26
-rw-r--r--tidal_dl_ng/ui/main.ui22
6 files changed, 181 insertions, 21 deletions
diff --git a/tidal_dl_ng/dialog.py b/tidal_dl_ng/dialog.py
new file mode 100644
index 0000000..5370136
--- /dev/null
+++ b/tidal_dl_ng/dialog.py
@@ -0,0 +1,19 @@
+from PySide6.QtWidgets import QDialog
+
+from tidal_dl_ng import __version__
+from tidal_dl_ng.ui.dialog_version import Ui_DialogVersion
+
+
+class DialogVersion(QDialog):
+ """Version dialog."""
+
+ 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__)
+
+ self.exec()
diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py
index b8b626e..5a2501a 100644
--- a/tidal_dl_ng/gui.py
+++ b/tidal_dl_ng/gui.py
@@ -2,6 +2,7 @@ import math
import sys
from collections.abc import Callable
+from tidal_dl_ng.dialog import DialogVersion
from tidal_dl_ng.helper.path import get_format_template
from tidal_dl_ng.helper.tidal import items_results_all, search_results_all, user_media_lists
@@ -35,6 +36,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
tidal: Tidal = None
dl: Download = None
threadpool: QtCore.QThreadPool = None
+ tray: QtWidgets.QSystemTrayIcon = None
spinner: QtWaitingSpinner = None
spinner_start: QtCore.Signal = QtCore.Signal(QtWidgets.QWidget)
spinner_stop: QtCore.Signal = QtCore.Signal()
@@ -54,13 +56,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.setupUi(self)
# self.setGeometry(50, 50, 500, 300)
self.setWindowTitle("TIDAL Downloader Next Gen!")
- # TODO: Fix icons (make them visible).
- # my_pixmap = QtGui.QPixmap("tidal_dl_ng/ui/icon.png")
- my_icon = QtGui.QIcon("tidal_dl_ng/ui/icon.png")
- self.setWindowIcon(my_icon)
- tray = QtWidgets.QSystemTrayIcon()
- tray.setIcon(my_icon)
- tray.setVisible(True)
+ self._init_tray()
# Logging redirect.
XStream.stdout().messageWritten.connect(self._log_output)
@@ -381,6 +377,10 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.s_statusbar_message.connect(self.on_statusbar_message)
self.s_tr_results_add_top_level_item.connect(self.on_tr_results_add_top_level_item)
+ # Menubar
+ self.a_exit.triggered.connect(sys.exit)
+ self.a_version.triggered.connect(self.on_version)
+
def on_progress_list(self, value: float):
self.pb_list.setValue(int(math.ceil(value)))
@@ -470,6 +470,19 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.s_statusbar_message.emit(StatusbarMessage(message="Download finished.", timout=2000))
+ def on_version(self) -> None:
+ DialogVersion(self)
+
+ def _init_tray(self):
+ # TODO: Fix icons (make them visible).
+ # my_pixmap = QtGui.QPixmap("tidal_dl_ng/ui/icon.png")
+ my_icon = QtGui.QIcon("tidal_dl_ng/ui/icon.png")
+ # self.setWindowIcon(my_icon)
+ self.tray = QtWidgets.QSystemTrayIcon()
+ self.tray.setIcon(my_icon)
+ self.tray.setVisible(True)
+ self.tray.setContextMenu(self.m_file)
+
# TODO: Comment with Google Docstrings.
def gui_activate(tidal: Tidal | None = None):
diff --git a/tidal_dl_ng/ui/dialog_version.py b/tidal_dl_ng/ui/dialog_version.py
new file mode 100644
index 0000000..52556c3
--- /dev/null
+++ b/tidal_dl_ng/ui/dialog_version.py
@@ -0,0 +1,47 @@
+################################################################################
+## Form generated from reading UI file 'dialog_version.ui'
+##
+## Created by: Qt User Interface Compiler version 6.6.1
+##
+## WARNING! All changes made in this file will be lost when recompiling UI file!
+################################################################################
+
+from PySide6.QtCore import QCoreApplication, QMetaObject, QRect
+from PySide6.QtWidgets import QLabel
+
+
+class Ui_DialogVersion:
+ def setupUi(self, DialogVersion):
+ if not DialogVersion.objectName():
+ DialogVersion.setObjectName("DialogVersion")
+ DialogVersion.resize(436, 235)
+ self.l_version = QLabel(DialogVersion)
+ self.l_version.setObjectName("l_version")
+ self.l_version.setGeometry(QRect(190, 100, 61, 16))
+ self.l_url_github = QLabel(DialogVersion)
+ self.l_url_github.setObjectName("l_url_github")
+ self.l_url_github.setGeometry(QRect(160, 200, 251, 20))
+ self.l_url_github.setOpenExternalLinks(True)
+ self.l_name_app = QLabel(DialogVersion)
+ self.l_name_app.setObjectName("l_name_app")
+ self.l_name_app.setGeometry(QRect(110, 30, 231, 16))
+
+ self.retranslateUi(DialogVersion)
+
+ QMetaObject.connectSlotsByName(DialogVersion)
+
+ # setupUi
+
+ def retranslateUi(self, DialogVersion):
+ DialogVersion.setWindowTitle(QCoreApplication.translate("DialogVersion", "Version", None))
+ self.l_version.setText(QCoreApplication.translate("DialogVersion", "v1.2.3", None))
+ self.l_url_github.setText(
+ QCoreApplication.translate(
+ "DialogVersion",
+ '<a href="https://github.com/exislow/tidal-dl-ng/">https://github.com/exislow/tidal-dl-ng/</a>',
+ None,
+ )
+ )
+ self.l_name_app.setText(QCoreApplication.translate("DialogVersion", "TIDAL Downloader Next Generation", None))
+
+ # retranslateUi
diff --git a/tidal_dl_ng/ui/dialog_version.ui b/tidal_dl_ng/ui/dialog_version.ui
new file mode 100644
index 0000000..e061f75
--- /dev/null
+++ b/tidal_dl_ng/ui/dialog_version.ui
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogVersion</class>
+ <widget class="QDialog" name="DialogVersion">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>436</width>
+ <height>235</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Version</string>
+ </property>
+ <widget class="QLabel" name="l_version">
+ <property name="geometry">
+ <rect>
+ <x>190</x>
+ <y>100</y>
+ <width>61</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>v1.2.3</string>
+ </property>
+ </widget>
+ <widget class="QLabel" name="l_url_github">
+ <property name="geometry">
+ <rect>
+ <x>160</x>
+ <y>200</y>
+ <width>251</width>
+ <height>20</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>&lt;a href=&quot;https://github.com/exislow/tidal-dl-ng/&quot;&gt;https://github.com/exislow/tidal-dl-ng/&lt;/a&gt;</string>
+ </property>
+ <property name="openExternalLinks">
+ <bool>true</bool>
+ </property>
+ </widget>
+ <widget class="QLabel" name="l_name_app">
+ <property name="geometry">
+ <rect>
+ <x>110</x>
+ <y>30</y>
+ <width>231</width>
+ <height>16</height>
+ </rect>
+ </property>
+ <property name="text">
+ <string>TIDAL Downloader Next Generation</string>
+ </property>
+ </widget>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/tidal_dl_ng/ui/main.py b/tidal_dl_ng/ui/main.py
index c7d86a4..50c1b2f 100644
--- a/tidal_dl_ng/ui/main.py
+++ b/tidal_dl_ng/ui/main.py
@@ -33,20 +33,24 @@ class Ui_MainWindow:
if not MainWindow.objectName():
MainWindow.setObjectName("MainWindow")
MainWindow.resize(900, 700)
- self.a_options = QAction(MainWindow)
- self.a_options.setObjectName("a_options")
- self.a_options.setEnabled(False)
- self.a_options.setText("Options")
- self.a_options.setIconText("Options")
+ self.a_preferences = QAction(MainWindow)
+ self.a_preferences.setObjectName("a_preferences")
+ self.a_preferences.setEnabled(False)
+ self.a_preferences.setText("Preferences...")
+ self.a_preferences.setIconText("Preferences...")
# if QT_CONFIG(tooltip)
- self.a_options.setToolTip("Options")
+ self.a_preferences.setToolTip("Preferences...")
# endif // QT_CONFIG(tooltip)
# if QT_CONFIG(statustip)
- self.a_options.setStatusTip("")
+ self.a_preferences.setStatusTip("")
# endif // QT_CONFIG(statustip)
# if QT_CONFIG(whatsthis)
- self.a_options.setWhatsThis("")
+ self.a_preferences.setWhatsThis("")
# endif // QT_CONFIG(whatsthis)
+ self.a_version = QAction(MainWindow)
+ self.a_version.setObjectName("a_version")
+ self.a_exit = QAction(MainWindow)
+ self.a_exit.setObjectName("a_exit")
self.w_central = QWidget(MainWindow)
self.w_central.setObjectName("w_central")
self.w_central.setEnabled(True)
@@ -420,7 +424,9 @@ class Ui_MainWindow:
MainWindow.setStatusBar(self.statusbar)
self.menubar.addAction(self.m_file.menuAction())
- self.m_file.addAction(self.a_options)
+ self.m_file.addAction(self.a_preferences)
+ self.m_file.addAction(self.a_version)
+ self.m_file.addAction(self.a_exit)
self.retranslateUi(MainWindow)
@@ -430,6 +436,8 @@ class Ui_MainWindow:
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", "MainWindow", None))
+ self.a_version.setText(QCoreApplication.translate("MainWindow", "Version", None))
+ self.a_exit.setText(QCoreApplication.translate("MainWindow", "Exit", None))
___qtreewidgetitem = self.tr_lists_user.headerItem()
___qtreewidgetitem.setText(2, QCoreApplication.translate("MainWindow", "obj", None))
diff --git a/tidal_dl_ng/ui/main.ui b/tidal_dl_ng/ui/main.ui
index e4584d1..4152dd7 100644
--- a/tidal_dl_ng/ui/main.ui
+++ b/tidal_dl_ng/ui/main.ui
@@ -540,7 +540,9 @@
<property name="title">
<string>File</string>
</property>
- <addaction name="a_options"/>
+ <addaction name="a_preferences"/>
+ <addaction name="a_version"/>
+ <addaction name="a_exit"/>
</widget>
<addaction name="m_file"/>
</widget>
@@ -564,18 +566,18 @@
<enum>Qt::LeftToRight</enum>
</property>
</widget>
- <action name="a_options">
+ <action name="a_preferences">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
- <string notr="true">Options</string>
+ <string notr="true">Preferences...</string>
</property>
<property name="iconText">
- <string notr="true">Options</string>
+ <string notr="true">Preferences...</string>
</property>
<property name="toolTip">
- <string notr="true">Options</string>
+ <string notr="true">Preferences...</string>
</property>
<property name="statusTip">
<string notr="true"/>
@@ -584,6 +586,16 @@
<string notr="true"/>
</property>
</action>
+ <action name="a_version">
+ <property name="text">
+ <string>Version</string>
+ </property>
+ </action>
+ <action name="a_exit">
+ <property name="text">
+ <string>Exit</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>