diff options
| author | Robert Honz <exislow+github@gmail.com> | 2023-12-19 23:58:57 +0100 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2023-12-19 23:58:57 +0100 |
| commit | 0d4a9d6b8740035346d098f5bc28ebca64f6cd4d (patch) | |
| tree | f52c9569509565e581b03b6e60fe32e611b79ad2 /tidal_dl_ng/ui | |
| parent | 82a8fe96aa08903919a90a76030bacba9f93b8e0 (diff) | |
| download | tidal-dl-ng-0d4a9d6b8740035346d098f5bc28ebca64f6cd4d.tar.gz | |
🌟 Re-add all project files.
Diffstat (limited to 'tidal_dl_ng/ui')
| -rw-r--r-- | tidal_dl_ng/ui/__init__.py | 0 | ||||
| -rw-r--r-- | tidal_dl_ng/ui/icon.png | bin | 0 -> 54166 bytes | |||
| -rw-r--r-- | tidal_dl_ng/ui/main.py | 456 | ||||
| -rw-r--r-- | tidal_dl_ng/ui/main.ui | 590 | ||||
| -rw-r--r-- | tidal_dl_ng/ui/spinner.py | 221 |
5 files changed, 1267 insertions, 0 deletions
diff --git a/tidal_dl_ng/ui/__init__.py b/tidal_dl_ng/ui/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tidal_dl_ng/ui/__init__.py diff --git a/tidal_dl_ng/ui/icon.png b/tidal_dl_ng/ui/icon.png Binary files differnew file mode 100644 index 0000000..8bc9e0d --- /dev/null +++ b/tidal_dl_ng/ui/icon.png diff --git a/tidal_dl_ng/ui/main.py b/tidal_dl_ng/ui/main.py new file mode 100644 index 0000000..c7d86a4 --- /dev/null +++ b/tidal_dl_ng/ui/main.py @@ -0,0 +1,456 @@ +################################################################################ +## Form generated from reading UI file 'main.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, QLocale, QMetaObject, QRect, QSize, Qt +from PySide6.QtGui import QAction +from PySide6.QtWidgets import ( + QAbstractItemView, + QComboBox, + QHBoxLayout, + QLabel, + QLayout, + QLineEdit, + QMenu, + QMenuBar, + QPlainTextEdit, + QPushButton, + QSizePolicy, + QStatusBar, + QTreeWidget, + QTreeWidgetItem, + QVBoxLayout, + QWidget, +) + + +class Ui_MainWindow: + def setupUi(self, 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") + # if QT_CONFIG(tooltip) + self.a_options.setToolTip("Options") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.a_options.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.a_options.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + self.w_central = QWidget(MainWindow) + self.w_central.setObjectName("w_central") + self.w_central.setEnabled(True) + sizePolicy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(100) + sizePolicy.setVerticalStretch(100) + sizePolicy.setHeightForWidth(self.w_central.sizePolicy().hasHeightForWidth()) + self.w_central.setSizePolicy(sizePolicy) + # if QT_CONFIG(tooltip) + self.w_central.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.w_central.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.w_central.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.w_central.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.w_central.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.horizontalLayout = QHBoxLayout(self.w_central) + self.horizontalLayout.setObjectName("horizontalLayout") + self.lh_main = QHBoxLayout() + self.lh_main.setObjectName("lh_main") + self.lh_main.setSizeConstraint(QLayout.SetNoConstraint) + self.tr_lists_user = QTreeWidget(self.w_central) + __qtreewidgetitem = QTreeWidgetItem() + __qtreewidgetitem.setText(1, "Info") + __qtreewidgetitem.setText(0, "Playlist") + self.tr_lists_user.setHeaderItem(__qtreewidgetitem) + __qtreewidgetitem1 = QTreeWidgetItem(self.tr_lists_user) + __qtreewidgetitem1.setFlags(Qt.ItemIsEnabled) + __qtreewidgetitem2 = QTreeWidgetItem(self.tr_lists_user) + __qtreewidgetitem2.setFlags(Qt.ItemIsEnabled) + __qtreewidgetitem3 = QTreeWidgetItem(self.tr_lists_user) + __qtreewidgetitem3.setFlags(Qt.ItemIsEnabled) + self.tr_lists_user.setObjectName("tr_lists_user") + # if QT_CONFIG(tooltip) + self.tr_lists_user.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.tr_lists_user.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.tr_lists_user.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.tr_lists_user.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.tr_lists_user.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.tr_lists_user.setEditTriggers(QAbstractItemView.NoEditTriggers) + self.tr_lists_user.setProperty("showDropIndicator", False) + self.tr_lists_user.setIndentation(10) + self.tr_lists_user.setUniformRowHeights(True) + self.tr_lists_user.setSortingEnabled(True) + self.tr_lists_user.header().setCascadingSectionResizes(True) + self.tr_lists_user.header().setHighlightSections(True) + self.tr_lists_user.header().setProperty("showSortIndicator", True) + + self.lh_main.addWidget(self.tr_lists_user) + + self.lv_search_result = QVBoxLayout() + # ifndef Q_OS_MAC + self.lv_search_result.setSpacing(-1) + # endif + self.lv_search_result.setObjectName("lv_search_result") + self.lh_search = QHBoxLayout() + self.lh_search.setObjectName("lh_search") + self.l_search = QLineEdit(self.w_central) + self.l_search.setObjectName("l_search") + self.l_search.setAcceptDrops(False) + # if QT_CONFIG(tooltip) + self.l_search.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.l_search.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.l_search.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.l_search.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.l_search.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.l_search.setLocale(QLocale(QLocale.English, QLocale.UnitedStates)) + self.l_search.setText("") + self.l_search.setPlaceholderText("Type and press ENTER to search...") + self.l_search.setClearButtonEnabled(True) + + self.lh_search.addWidget(self.l_search) + + self.cb_search_type = QComboBox(self.w_central) + self.cb_search_type.setObjectName("cb_search_type") + # if QT_CONFIG(tooltip) + self.cb_search_type.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.cb_search_type.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.cb_search_type.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.cb_search_type.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.cb_search_type.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.cb_search_type.setCurrentText("") + self.cb_search_type.setPlaceholderText("") + + self.lh_search.addWidget(self.cb_search_type) + + self.b_search = QPushButton(self.w_central) + self.b_search.setObjectName("b_search") + # if QT_CONFIG(statustip) + self.b_search.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.b_search.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.b_search.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.b_search.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.b_search.setText("Search") + # if QT_CONFIG(shortcut) + self.b_search.setShortcut("") + # endif // QT_CONFIG(shortcut) + + self.lh_search.addWidget(self.b_search) + + self.lv_search_result.addLayout(self.lh_search) + + self.tr_results = QTreeWidget(self.w_central) + self.tr_results.setObjectName("tr_results") + self.tr_results.setEditTriggers(QAbstractItemView.NoEditTriggers) + self.tr_results.setProperty("showDropIndicator", False) + self.tr_results.setDragDropOverwriteMode(False) + self.tr_results.setAlternatingRowColors(False) + self.tr_results.setSelectionMode(QAbstractItemView.ExtendedSelection) + self.tr_results.setIndentation(10) + self.tr_results.setSortingEnabled(True) + self.tr_results.header().setProperty("showSortIndicator", True) + self.tr_results.header().setStretchLastSection(False) + + self.lv_search_result.addWidget(self.tr_results) + + self.lh_download = QHBoxLayout() + self.lh_download.setObjectName("lh_download") + self.l_quality_audio = QLabel(self.w_central) + self.l_quality_audio.setObjectName("l_quality_audio") + # if QT_CONFIG(tooltip) + self.l_quality_audio.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.l_quality_audio.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.l_quality_audio.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.l_quality_audio.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.l_quality_audio.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.l_quality_audio.setText("Audio") + self.l_quality_audio.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) + + self.lh_download.addWidget(self.l_quality_audio) + + self.cb_quality_audio = QComboBox(self.w_central) + self.cb_quality_audio.setObjectName("cb_quality_audio") + # if QT_CONFIG(tooltip) + self.cb_quality_audio.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.cb_quality_audio.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.cb_quality_audio.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.cb_quality_audio.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.cb_quality_audio.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.cb_quality_audio.setCurrentText("") + self.cb_quality_audio.setPlaceholderText("") + self.cb_quality_audio.setFrame(True) + + self.lh_download.addWidget(self.cb_quality_audio) + + self.l_quality_video = QLabel(self.w_central) + self.l_quality_video.setObjectName("l_quality_video") + # if QT_CONFIG(tooltip) + self.l_quality_video.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.l_quality_video.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.l_quality_video.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.l_quality_video.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.l_quality_video.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.l_quality_video.setText("Video") + self.l_quality_video.setAlignment(Qt.AlignRight | Qt.AlignTrailing | Qt.AlignVCenter) + + self.lh_download.addWidget(self.l_quality_video) + + self.cb_quality_video = QComboBox(self.w_central) + self.cb_quality_video.setObjectName("cb_quality_video") + # if QT_CONFIG(tooltip) + self.cb_quality_video.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.cb_quality_video.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.cb_quality_video.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.cb_quality_video.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.cb_quality_video.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.cb_quality_video.setCurrentText("") + self.cb_quality_video.setPlaceholderText("") + + self.lh_download.addWidget(self.cb_quality_video) + + self.b_download = QPushButton(self.w_central) + self.b_download.setObjectName("b_download") + # if QT_CONFIG(tooltip) + self.b_download.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.b_download.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.b_download.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.b_download.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.b_download.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.b_download.setText("Download") + # if QT_CONFIG(shortcut) + self.b_download.setShortcut("") + # endif // QT_CONFIG(shortcut) + + self.lh_download.addWidget(self.b_download) + + self.lh_download.setStretch(0, 5) + self.lh_download.setStretch(2, 5) + self.lh_download.setStretch(4, 15) + + self.lv_search_result.addLayout(self.lh_download) + + self.te_debug = QPlainTextEdit(self.w_central) + self.te_debug.setObjectName("te_debug") + self.te_debug.setEnabled(True) + sizePolicy1 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Maximum) + sizePolicy1.setHorizontalStretch(0) + sizePolicy1.setVerticalStretch(0) + sizePolicy1.setHeightForWidth(self.te_debug.sizePolicy().hasHeightForWidth()) + self.te_debug.setSizePolicy(sizePolicy1) + self.te_debug.setMaximumSize(QSize(16777215, 16777215)) + self.te_debug.setAcceptDrops(False) + # if QT_CONFIG(tooltip) + self.te_debug.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.te_debug.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.te_debug.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.te_debug.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.te_debug.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.te_debug.setUndoRedoEnabled(False) + self.te_debug.setReadOnly(True) + + self.lv_search_result.addWidget(self.te_debug) + + self.lh_main.addLayout(self.lv_search_result) + + self.lh_main.setStretch(0, 40) + self.lh_main.setStretch(1, 60) + + self.horizontalLayout.addLayout(self.lh_main) + + MainWindow.setCentralWidget(self.w_central) + self.menubar = QMenuBar(MainWindow) + self.menubar.setObjectName("menubar") + self.menubar.setGeometry(QRect(0, 0, 900, 24)) + # if QT_CONFIG(tooltip) + self.menubar.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.menubar.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.menubar.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.menubar.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.menubar.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.m_file = QMenu(self.menubar) + self.m_file.setObjectName("m_file") + # if QT_CONFIG(tooltip) + self.m_file.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.m_file.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.m_file.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.m_file.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.m_file.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + MainWindow.setMenuBar(self.menubar) + self.statusbar = QStatusBar(MainWindow) + self.statusbar.setObjectName("statusbar") + # if QT_CONFIG(tooltip) + self.statusbar.setToolTip("") + # endif // QT_CONFIG(tooltip) + # if QT_CONFIG(statustip) + self.statusbar.setStatusTip("") + # endif // QT_CONFIG(statustip) + # if QT_CONFIG(whatsthis) + self.statusbar.setWhatsThis("") + # endif // QT_CONFIG(whatsthis) + # if QT_CONFIG(accessibility) + self.statusbar.setAccessibleName("") + # endif // QT_CONFIG(accessibility) + # if QT_CONFIG(accessibility) + self.statusbar.setAccessibleDescription("") + # endif // QT_CONFIG(accessibility) + self.statusbar.setLayoutDirection(Qt.LeftToRight) + MainWindow.setStatusBar(self.statusbar) + + self.menubar.addAction(self.m_file.menuAction()) + self.m_file.addAction(self.a_options) + + self.retranslateUi(MainWindow) + + QMetaObject.connectSlotsByName(MainWindow) + + # setupUi + + def retranslateUi(self, MainWindow): + MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", "MainWindow", None)) + ___qtreewidgetitem = self.tr_lists_user.headerItem() + ___qtreewidgetitem.setText(2, QCoreApplication.translate("MainWindow", "obj", None)) + + __sortingEnabled = self.tr_lists_user.isSortingEnabled() + self.tr_lists_user.setSortingEnabled(False) + ___qtreewidgetitem1 = self.tr_lists_user.topLevelItem(0) + ___qtreewidgetitem1.setText(0, QCoreApplication.translate("MainWindow", "Playlists", None)) + ___qtreewidgetitem2 = self.tr_lists_user.topLevelItem(1) + ___qtreewidgetitem2.setText(0, QCoreApplication.translate("MainWindow", "Mixes", None)) + ___qtreewidgetitem3 = self.tr_lists_user.topLevelItem(2) + ___qtreewidgetitem3.setText(0, QCoreApplication.translate("MainWindow", "Favorites", None)) + self.tr_lists_user.setSortingEnabled(__sortingEnabled) + + ___qtreewidgetitem4 = self.tr_results.headerItem() + ___qtreewidgetitem4.setText(5, QCoreApplication.translate("MainWindow", "obj", None)) + ___qtreewidgetitem4.setText(4, QCoreApplication.translate("MainWindow", "Duration", None)) + ___qtreewidgetitem4.setText(3, QCoreApplication.translate("MainWindow", "Album", None)) + ___qtreewidgetitem4.setText(2, QCoreApplication.translate("MainWindow", "Title", None)) + ___qtreewidgetitem4.setText(1, QCoreApplication.translate("MainWindow", "Artist", None)) + ___qtreewidgetitem4.setText(0, QCoreApplication.translate("MainWindow", "#", None)) + self.te_debug.setPlaceholderText(QCoreApplication.translate("MainWindow", "Logs...", None)) + self.m_file.setTitle(QCoreApplication.translate("MainWindow", "File", None)) + + # retranslateUi diff --git a/tidal_dl_ng/ui/main.ui b/tidal_dl_ng/ui/main.ui new file mode 100644 index 0000000..e4584d1 --- /dev/null +++ b/tidal_dl_ng/ui/main.ui @@ -0,0 +1,590 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MainWindow</class> + <widget class="QMainWindow" name="MainWindow"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>900</width> + <height>700</height> + </rect> + </property> + <property name="windowTitle"> + <string>MainWindow</string> + </property> + <widget class="QWidget" name="w_central"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Expanding"> + <horstretch>100</horstretch> + <verstretch>100</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QHBoxLayout" name="lh_main" stretch="40,60"> + <property name="sizeConstraint"> + <enum>QLayout::SetNoConstraint</enum> + </property> + <item> + <widget class="QTreeWidget" name="tr_lists_user"> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="editTriggers"> + <set>QAbstractItemView::NoEditTriggers</set> + </property> + <property name="showDropIndicator" stdset="0"> + <bool>false</bool> + </property> + <property name="indentation"> + <number>10</number> + </property> + <property name="uniformRowHeights"> + <bool>true</bool> + </property> + <property name="sortingEnabled"> + <bool>true</bool> + </property> + <attribute name="headerCascadingSectionResizes"> + <bool>true</bool> + </attribute> + <attribute name="headerHighlightSections"> + <bool>true</bool> + </attribute> + <attribute name="headerShowSortIndicator" stdset="0"> + <bool>true</bool> + </attribute> + <column> + <property name="text"> + <string notr="true">Playlist</string> + </property> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + </column> + <column> + <property name="text"> + <string notr="true">Info</string> + </property> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + </column> + <column> + <property name="text"> + <string>obj</string> + </property> + </column> + <item> + <property name="text"> + <string>Playlists</string> + </property> + <property name="text"> + <string/> + </property> + <property name="text"> + <string/> + </property> + <property name="flags"> + <set>ItemIsEnabled</set> + </property> + </item> + <item> + <property name="text"> + <string>Mixes</string> + </property> + <property name="text"> + <string/> + </property> + <property name="text"> + <string/> + </property> + <property name="flags"> + <set>ItemIsEnabled</set> + </property> + </item> + <item> + <property name="text"> + <string>Favorites</string> + </property> + <property name="text"> + <string/> + </property> + <property name="text"> + <string/> + </property> + <property name="flags"> + <set>ItemIsEnabled</set> + </property> + </item> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="lv_search_result" stretch="0,0,0,0"> + <property name="spacing"> + <number>-1</number> + </property> + <item> + <layout class="QHBoxLayout" name="lh_search"> + <item> + <widget class="QLineEdit" name="l_search"> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="locale"> + <locale language="English" country="UnitedStates"/> + </property> + <property name="text"> + <string notr="true"/> + </property> + <property name="placeholderText"> + <string notr="true">Type and press ENTER to search...</string> + </property> + <property name="clearButtonEnabled"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="cb_search_type"> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="currentText"> + <string notr="true"/> + </property> + <property name="placeholderText"> + <string notr="true"/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="b_search"> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="text"> + <string notr="true">Search</string> + </property> + <property name="shortcut"> + <string notr="true"/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QTreeWidget" name="tr_results"> + <property name="editTriggers"> + <set>QAbstractItemView::NoEditTriggers</set> + </property> + <property name="showDropIndicator" stdset="0"> + <bool>false</bool> + </property> + <property name="dragDropOverwriteMode"> + <bool>false</bool> + </property> + <property name="alternatingRowColors"> + <bool>false</bool> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::ExtendedSelection</enum> + </property> + <property name="indentation"> + <number>10</number> + </property> + <property name="sortingEnabled"> + <bool>true</bool> + </property> + <attribute name="headerShowSortIndicator" stdset="0"> + <bool>true</bool> + </attribute> + <attribute name="headerStretchLastSection"> + <bool>false</bool> + </attribute> + <column> + <property name="text"> + <string>#</string> + </property> + </column> + <column> + <property name="text"> + <string>Artist</string> + </property> + </column> + <column> + <property name="text"> + <string>Title</string> + </property> + </column> + <column> + <property name="text"> + <string>Album</string> + </property> + </column> + <column> + <property name="text"> + <string>Duration</string> + </property> + </column> + <column> + <property name="text"> + <string>obj</string> + </property> + </column> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="lh_download" stretch="5,0,5,0,15"> + <item> + <widget class="QLabel" name="l_quality_audio"> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="text"> + <string notr="true">Audio</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="cb_quality_audio"> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="currentText"> + <string notr="true"/> + </property> + <property name="placeholderText"> + <string notr="true"/> + </property> + <property name="frame"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="l_quality_video"> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="text"> + <string notr="true">Video</string> + </property> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="cb_quality_video"> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="currentText"> + <string notr="true"/> + </property> + <property name="placeholderText"> + <string notr="true"/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="b_download"> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="text"> + <string notr="true">Download</string> + </property> + <property name="shortcut"> + <string notr="true"/> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QPlainTextEdit" name="te_debug"> + <property name="enabled"> + <bool>true</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Maximum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="maximumSize"> + <size> + <width>16777215</width> + <height>16777215</height> + </size> + </property> + <property name="acceptDrops"> + <bool>false</bool> + </property> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="undoRedoEnabled"> + <bool>false</bool> + </property> + <property name="readOnly"> + <bool>true</bool> + </property> + <property name="placeholderText"> + <string>Logs...</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + </layout> + </widget> + <widget class="QMenuBar" name="menubar"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>900</width> + <height>24</height> + </rect> + </property> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <widget class="QMenu" name="m_file"> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="title"> + <string>File</string> + </property> + <addaction name="a_options"/> + </widget> + <addaction name="m_file"/> + </widget> + <widget class="QStatusBar" name="statusbar"> + <property name="toolTip"> + <string notr="true"/> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + <property name="accessibleName"> + <string notr="true"/> + </property> + <property name="accessibleDescription"> + <string notr="true"/> + </property> + <property name="layoutDirection"> + <enum>Qt::LeftToRight</enum> + </property> + </widget> + <action name="a_options"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="text"> + <string notr="true">Options</string> + </property> + <property name="iconText"> + <string notr="true">Options</string> + </property> + <property name="toolTip"> + <string notr="true">Options</string> + </property> + <property name="statusTip"> + <string notr="true"/> + </property> + <property name="whatsThis"> + <string notr="true"/> + </property> + </action> + </widget> + <resources/> + <connections/> +</ui> diff --git a/tidal_dl_ng/ui/spinner.py b/tidal_dl_ng/ui/spinner.py new file mode 100644 index 0000000..124b7f4 --- /dev/null +++ b/tidal_dl_ng/ui/spinner.py @@ -0,0 +1,221 @@ +""" +The MIT License (MIT) + +Copyright (c) 2012-2014 Alexander Turkin +Copyright (c) 2014 William Hallatt +Copyright (c) 2015 Jacob Dawid +Copyright (c) 2016 Luca Weiss + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +""" + +import math + +from PySide6.QtCore import QRect, Qt, QTimer +from PySide6.QtGui import QColor, QPainter +from PySide6.QtWidgets import QWidget + + +# Taken from https://github.com/COOLMSF/QtWaitingSpinnerForPyQt6 and adapted for PySide6. +class QtWaitingSpinner(QWidget): + def __init__( + self, parent, centerOnParent=True, disableParentWhenSpinning=False, modality=Qt.WindowModality.NonModal + ): + super().__init__(parent) + + self._centerOnParent = centerOnParent + self._disableParentWhenSpinning = disableParentWhenSpinning + + # WAS IN initialize() + self._color = QColor(Qt.GlobalColor.black) + self._roundness = 100.0 + self._minimumTrailOpacity = 3.14159265358979323846 + self._trailFadePercentage = 80.0 + self._revolutionsPerSecond = 1.57079632679489661923 + self._numberOfLines = 20 + self._lineLength = 10 + self._lineWidth = 2 + self._innerRadius = 10 + self._currentCounter = 0 + self._isSpinning = False + + self._timer = QTimer(self) + self._timer.timeout.connect(self.rotate) + self.updateSize() + self.updateTimer() + self.hide() + # END initialize() + + self.setWindowModality(modality) + self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground) + + def paintEvent(self, QPaintEvent): + self.updatePosition() + painter = QPainter(self) + painter.fillRect(self.rect(), Qt.GlobalColor.transparent) + # Can't found in Qt6 + # painter.setRenderHint(QPainter.Antialiasing, True) + + if self._currentCounter >= self._numberOfLines: + self._currentCounter = 0 + + painter.setPen(Qt.PenStyle.NoPen) + for i in range(0, self._numberOfLines): + painter.save() + painter.translate(self._innerRadius + self._lineLength, self._innerRadius + self._lineLength) + rotateAngle = float(360 * i) / float(self._numberOfLines) + painter.rotate(rotateAngle) + painter.translate(self._innerRadius, 0) + distance = self.lineCountDistanceFromPrimary(i, self._currentCounter, self._numberOfLines) + color = self.currentLineColor( + distance, self._numberOfLines, self._trailFadePercentage, self._minimumTrailOpacity, self._color + ) + painter.setBrush(color) + rect = QRect(0, int(-self._lineWidth / 2), int(self._lineLength), int(self._lineWidth)) + painter.drawRoundedRect(rect, self._roundness, self._roundness, Qt.SizeMode.RelativeSize) + painter.restore() + + def start(self): + self.updatePosition() + self._isSpinning = True + self.show() + + if self.parentWidget and self._disableParentWhenSpinning: + self.parentWidget().setEnabled(False) + + if not self._timer.isActive(): + self._timer.start() + self._currentCounter = 0 + + def stop(self): + self._isSpinning = False + self.hide() + + if self.parentWidget() and self._disableParentWhenSpinning: + self.parentWidget().setEnabled(True) + + if self._timer.isActive(): + self._timer.stop() + self._currentCounter = 0 + + def setNumberOfLines(self, lines): + self._numberOfLines = lines + self._currentCounter = 0 + self.updateTimer() + + def setLineLength(self, length): + self._lineLength = length + self.updateSize() + + def setLineWidth(self, width): + self._lineWidth = width + self.updateSize() + + def setInnerRadius(self, radius): + self._innerRadius = radius + self.updateSize() + + def color(self): + return self._color + + def roundness(self): + return self._roundness + + def minimumTrailOpacity(self): + return self._minimumTrailOpacity + + def trailFadePercentage(self): + return self._trailFadePercentage + + def revolutionsPersSecond(self): + return self._revolutionsPerSecond + + def numberOfLines(self): + return self._numberOfLines + + def lineLength(self): + return self._lineLength + + def lineWidth(self): + return self._lineWidth + + def innerRadius(self): + return self._innerRadius + + def isSpinning(self): + return self._isSpinning + + def setRoundness(self, roundness): + self._roundness = max(0.0, min(100.0, roundness)) + + def setColor(self, color=Qt.GlobalColor.black): + self._color = QColor(color) + + def setRevolutionsPerSecond(self, revolutionsPerSecond): + self._revolutionsPerSecond = revolutionsPerSecond + self.updateTimer() + + def setTrailFadePercentage(self, trail): + self._trailFadePercentage = trail + + def setMinimumTrailOpacity(self, minimumTrailOpacity): + self._minimumTrailOpacity = minimumTrailOpacity + + def rotate(self): + self._currentCounter += 1 + if self._currentCounter >= self._numberOfLines: + self._currentCounter = 0 + self.update() + + def updateSize(self): + size = int((self._innerRadius + self._lineLength) * 2) + self.setFixedSize(size, size) + + def updateTimer(self): + self._timer.setInterval(int(1000 / (self._numberOfLines * self._revolutionsPerSecond))) + + def updatePosition(self): + if self.parentWidget() and self._centerOnParent: + self.move( + int(self.parentWidget().width() / 2 - self.width() / 2), + int(self.parentWidget().height() / 2 - self.height() / 2), + ) + + def lineCountDistanceFromPrimary(self, current, primary, totalNrOfLines): + distance = primary - current + if distance < 0: + distance += totalNrOfLines + return distance + + def currentLineColor(self, countDistance, totalNrOfLines, trailFadePerc, minOpacity, colorinput): + color = QColor(colorinput) + if countDistance == 0: + return color + minAlphaF = minOpacity / 100.0 + distanceThreshold = int(math.ceil((totalNrOfLines - 1) * trailFadePerc / 100.0)) + if countDistance > distanceThreshold: + color.setAlphaF(minAlphaF) + else: + alphaDiff = color.alphaF() - minAlphaF + gradient = alphaDiff / float(distanceThreshold + 1) + resultAlpha = color.alphaF() - gradient * countDistance + # If alpha is out of bounds, clip it. + resultAlpha = min(1.0, max(0.0, resultAlpha)) + color.setAlphaF(resultAlpha) + return color |
