✨ Added version dialog. See File -> Version.

This commit is contained in:
Robert Honz
2024-01-19 10:00:27 +01:00
parent 038eaf85cb
commit 6cf723b2b8
8 changed files with 189 additions and 27 deletions
Generated
+6 -6
View File
@@ -587,13 +587,13 @@ test = ["black", "coverage[toml]", "ddt (>=1.1.1,!=1.4.3)", "mock", "mypy", "pre
[[package]] [[package]]
name = "griffe" name = "griffe"
version = "0.39.0" version = "0.39.1"
description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API." description = "Signatures for entire Python programs. Extract the structure, the frame, the skeleton of your project, to generate API documentation or find breaking changes in your API."
optional = false optional = false
python-versions = ">=3.8" python-versions = ">=3.8"
files = [ files = [
{file = "griffe-0.39.0-py3-none-any.whl", hash = "sha256:b5e2f249d86feaad1d3068b33b1c8c2ecf39cb870bf292f2af3a4311891a4835"}, {file = "griffe-0.39.1-py3-none-any.whl", hash = "sha256:6ce4ecffcf0d2f96362c5974b3f7df812da8f8d4cfcc5ebc8202ef72656fc087"},
{file = "griffe-0.39.0.tar.gz", hash = "sha256:34461730c975a31c4ffa413bdad841f217a5d1a1c611b95f6110ed0f2b2fc04d"}, {file = "griffe-0.39.1.tar.gz", hash = "sha256:ead8dfede6e6531cce6bf69090a4f3c6d36fdf923c43f8e85aa530552cef0c09"},
] ]
[package.dependencies] [package.dependencies]
@@ -1407,13 +1407,13 @@ hook-testing = ["execnet (>=1.5.0)", "psutil", "pytest (>=2.7.3)"]
[[package]] [[package]]
name = "pyinstaller-hooks-contrib" name = "pyinstaller-hooks-contrib"
version = "2023.12" version = "2024.0"
description = "Community maintained hooks for PyInstaller" description = "Community maintained hooks for PyInstaller"
optional = false optional = false
python-versions = ">=3.7" python-versions = ">=3.7"
files = [ files = [
{file = "pyinstaller-hooks-contrib-2023.12.tar.gz", hash = "sha256:11a9d59d903723dd693e8c10b054f3ea1ecad390623c9fa527c731d715fc5b3f"}, {file = "pyinstaller-hooks-contrib-2024.0.tar.gz", hash = "sha256:a7118c1a5c9788595e5c43ad058a7a5b7b6d59e1eceb42362f6ec1f0b61986b0"},
{file = "pyinstaller_hooks_contrib-2023.12-py2.py3-none-any.whl", hash = "sha256:6a601a0d783fa725327fc6ac712779475dc8979f639419c7fcd460dd8d0a6d2a"}, {file = "pyinstaller_hooks_contrib-2024.0-py2.py3-none-any.whl", hash = "sha256:469b5690df53223e2e8abffb2e44d6ee596e7d79d4b1eed9465123b67439875a"},
] ]
[package.dependencies] [package.dependencies]
+2
View File
@@ -154,6 +154,8 @@ exclude = '''
| venv | venv
| site | site
| docs | docs
| tidal_dl_ng/ui/main.py
| tidal_dl_ng/ui/dialog_version.py
)/ )/
''' '''
+19
View File
@@ -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()
+20 -7
View File
@@ -2,6 +2,7 @@ import math
import sys import sys
from collections.abc import Callable 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.path import get_format_template
from tidal_dl_ng.helper.tidal import items_results_all, search_results_all, user_media_lists 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 tidal: Tidal = None
dl: Download = None dl: Download = None
threadpool: QtCore.QThreadPool = None threadpool: QtCore.QThreadPool = None
tray: QtWidgets.QSystemTrayIcon = None
spinner: QtWaitingSpinner = None spinner: QtWaitingSpinner = None
spinner_start: QtCore.Signal = QtCore.Signal(QtWidgets.QWidget) spinner_start: QtCore.Signal = QtCore.Signal(QtWidgets.QWidget)
spinner_stop: QtCore.Signal = QtCore.Signal() spinner_stop: QtCore.Signal = QtCore.Signal()
@@ -54,13 +56,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.setupUi(self) self.setupUi(self)
# self.setGeometry(50, 50, 500, 300) # self.setGeometry(50, 50, 500, 300)
self.setWindowTitle("TIDAL Downloader Next Gen!") self.setWindowTitle("TIDAL Downloader Next Gen!")
# TODO: Fix icons (make them visible). self._init_tray()
# 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)
# Logging redirect. # Logging redirect.
XStream.stdout().messageWritten.connect(self._log_output) 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_statusbar_message.connect(self.on_statusbar_message)
self.s_tr_results_add_top_level_item.connect(self.on_tr_results_add_top_level_item) 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): def on_progress_list(self, value: float):
self.pb_list.setValue(int(math.ceil(value))) 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)) 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. # TODO: Comment with Google Docstrings.
def gui_activate(tidal: Tidal | None = None): def gui_activate(tidal: Tidal | None = None):
+47
View File
@@ -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
+61
View File
@@ -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>
+17 -9
View File
@@ -33,20 +33,24 @@ class Ui_MainWindow:
if not MainWindow.objectName(): if not MainWindow.objectName():
MainWindow.setObjectName("MainWindow") MainWindow.setObjectName("MainWindow")
MainWindow.resize(900, 700) MainWindow.resize(900, 700)
self.a_options = QAction(MainWindow) self.a_preferences = QAction(MainWindow)
self.a_options.setObjectName("a_options") self.a_preferences.setObjectName("a_preferences")
self.a_options.setEnabled(False) self.a_preferences.setEnabled(False)
self.a_options.setText("Options") self.a_preferences.setText("Preferences...")
self.a_options.setIconText("Options") self.a_preferences.setIconText("Preferences...")
# if QT_CONFIG(tooltip) # if QT_CONFIG(tooltip)
self.a_options.setToolTip("Options") self.a_preferences.setToolTip("Preferences...")
# endif // QT_CONFIG(tooltip) # endif // QT_CONFIG(tooltip)
# if QT_CONFIG(statustip) # if QT_CONFIG(statustip)
self.a_options.setStatusTip("") self.a_preferences.setStatusTip("")
# endif // QT_CONFIG(statustip) # endif // QT_CONFIG(statustip)
# if QT_CONFIG(whatsthis) # if QT_CONFIG(whatsthis)
self.a_options.setWhatsThis("") self.a_preferences.setWhatsThis("")
# endif // QT_CONFIG(whatsthis) # 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 = QWidget(MainWindow)
self.w_central.setObjectName("w_central") self.w_central.setObjectName("w_central")
self.w_central.setEnabled(True) self.w_central.setEnabled(True)
@@ -420,7 +424,9 @@ class Ui_MainWindow:
MainWindow.setStatusBar(self.statusbar) MainWindow.setStatusBar(self.statusbar)
self.menubar.addAction(self.m_file.menuAction()) 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) self.retranslateUi(MainWindow)
@@ -430,6 +436,8 @@ class Ui_MainWindow:
def retranslateUi(self, MainWindow): def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", "MainWindow", None)) 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 = self.tr_lists_user.headerItem()
___qtreewidgetitem.setText(2, QCoreApplication.translate("MainWindow", "obj", None)) ___qtreewidgetitem.setText(2, QCoreApplication.translate("MainWindow", "obj", None))
+17 -5
View File
@@ -540,7 +540,9 @@
<property name="title"> <property name="title">
<string>File</string> <string>File</string>
</property> </property>
<addaction name="a_options"/> <addaction name="a_preferences"/>
<addaction name="a_version"/>
<addaction name="a_exit"/>
</widget> </widget>
<addaction name="m_file"/> <addaction name="m_file"/>
</widget> </widget>
@@ -564,18 +566,18 @@
<enum>Qt::LeftToRight</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
</widget> </widget>
<action name="a_options"> <action name="a_preferences">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="text"> <property name="text">
<string notr="true">Options</string> <string notr="true">Preferences...</string>
</property> </property>
<property name="iconText"> <property name="iconText">
<string notr="true">Options</string> <string notr="true">Preferences...</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string notr="true">Options</string> <string notr="true">Preferences...</string>
</property> </property>
<property name="statusTip"> <property name="statusTip">
<string notr="true"/> <string notr="true"/>
@@ -584,6 +586,16 @@
<string notr="true"/> <string notr="true"/>
</property> </property>
</action> </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> </widget>
<resources/> <resources/>
<connections/> <connections/>