🧑‍🔧️ GUI buttons correctly prefixed with pb.

This commit is contained in:
Robert Honz
2024-03-22 15:02:26 +01:00
parent 134836d471
commit 12d3360c12
6 changed files with 36 additions and 34 deletions
+3 -1
View File
@@ -284,7 +284,9 @@ class Download:
def metadata_write(self, track: Track, path_file: str): def metadata_write(self, track: Track, path_file: str):
result: bool = False result: bool = False
release_date: str = ( release_date: str = (
track.album.available_release_date.strftime("%Y-%m-%d") if track.album.available_release_date else track.album.release_date.strftime("%Y-%m-%d") if track.album.release_date else "" track.album.available_release_date.strftime("%Y-%m-%d")
if track.album.available_release_date
else track.album.release_date.strftime("%Y-%m-%d") if track.album.release_date else ""
) )
copy_right: str = track.copyright if hasattr(track, "copyright") and track.copyright else "" copy_right: str = track.copyright if hasattr(track, "copyright") and track.copyright else ""
isrc: str = track.isrc if hasattr(track, "isrc") and track.isrc else "" isrc: str = track.isrc if hasattr(track, "isrc") and track.isrc else ""
+10 -10
View File
@@ -287,16 +287,16 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.thread_it(self.list_items_show_result, point=point) self.thread_it(self.list_items_show_result, point=point)
def on_download_list_media(self, point: QtCore.QPoint): def on_download_list_media(self, point: QtCore.QPoint):
self.b_download.setEnabled(False) self.pb_download.setEnabled(False)
self.b_download.setText("Downloading...") self.pb_download.setText("Downloading...")
item = self.tr_lists_user.itemAt(point) item = self.tr_lists_user.itemAt(point)
media = item.data(3, QtCore.Qt.ItemDataRole.UserRole) media = item.data(3, QtCore.Qt.ItemDataRole.UserRole)
self.download(media, self.dl) self.download(media, self.dl)
self.b_download.setText("Download") self.pb_download.setText("Download")
self.b_download.setEnabled(True) self.pb_download.setEnabled(True)
def search_populate_results(self, query: str, type_media: SearchTypes): def search_populate_results(self, query: str, type_media: SearchTypes):
self.tr_results.clear() self.tr_results.clear()
@@ -447,11 +447,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
return result return result
def _init_signals(self): def _init_signals(self):
self.b_download.clicked.connect(lambda: self.thread_it(self.on_download_results)) self.pb_download.clicked.connect(lambda: self.thread_it(self.on_download_results))
self.l_search.returnPressed.connect( self.l_search.returnPressed.connect(
lambda: self.search_populate_results(self.l_search.text(), self.cb_search_type.currentData()) lambda: self.search_populate_results(self.l_search.text(), self.cb_search_type.currentData())
) )
self.b_search.clicked.connect( self.pb_search.clicked.connect(
lambda: self.search_populate_results(self.l_search.text(), self.cb_search_type.currentData()) lambda: self.search_populate_results(self.l_search.text(), self.cb_search_type.currentData())
) )
self.cb_quality_audio.currentIndexChanged.connect(self.on_quality_set_audio) self.cb_quality_audio.currentIndexChanged.connect(self.on_quality_set_audio)
@@ -543,8 +543,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.threadpool.start(worker) self.threadpool.start(worker)
def on_download_results(self): def on_download_results(self):
self.b_download.setEnabled(False) self.pb_download.setEnabled(False)
self.b_download.setText("Downloading...") self.pb_download.setText("Downloading...")
items: [QtWidgets.QTreeWidgetItem] = self.tr_results.selectedItems() items: [QtWidgets.QTreeWidgetItem] = self.tr_results.selectedItems()
@@ -564,8 +564,8 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
self.download(media, self.dl, delay_track=download_delay) self.download(media, self.dl, delay_track=download_delay)
self.b_download.setText("Download") self.pb_download.setText("Download")
self.b_download.setEnabled(True) self.pb_download.setEnabled(True)
def download(self, media: Track | Album | Playlist | Video | Mix, dl: Download, delay_track: bool = False) -> None: def download(self, media: Track | Album | Playlist | Video | Mix, dl: Download, delay_track: bool = False) -> None:
self.s_pb_reset.emit() self.s_pb_reset.emit()
+1 -1
View File
@@ -10,7 +10,7 @@ from tidalapi import Album, Mix, Playlist, Track, UserPlaylist, Video
from tidal_dl_ng import __name_display__ from tidal_dl_ng import __name_display__
from tidal_dl_ng.constants import FILENAME_SANITIZE_PLACEHOLDER, UNIQUIFY_THRESHOLD, AudioExtensions, MediaType from tidal_dl_ng.constants import FILENAME_SANITIZE_PLACEHOLDER, UNIQUIFY_THRESHOLD, AudioExtensions, MediaType
from tidal_dl_ng.helper.tidal import name_builder_artist, name_builder_title, name_builder_album_artist from tidal_dl_ng.helper.tidal import name_builder_album_artist, name_builder_artist, name_builder_title
def path_home() -> str: def path_home() -> str:
+1 -1
View File
@@ -1,5 +1,5 @@
from tidalapi import Album, Mix, Playlist, Session, Track, UserPlaylist, Video from tidalapi import Album, Mix, Playlist, Session, Track, UserPlaylist, Video
from tidalapi.artist import Role, Artist from tidalapi.artist import Artist, Role
from tidalapi.session import SearchTypes from tidalapi.session import SearchTypes
from tidal_dl_ng.constants import MediaType from tidal_dl_ng.constants import MediaType
+19 -19
View File
@@ -187,26 +187,26 @@ class Ui_MainWindow:
self.lh_search.addWidget(self.cb_search_type) self.lh_search.addWidget(self.cb_search_type)
self.b_search = QPushButton(self.w_central) self.pb_search = QPushButton(self.w_central)
self.b_search.setObjectName("b_search") self.pb_search.setObjectName("pb_search")
# if QT_CONFIG(statustip) # if QT_CONFIG(statustip)
self.b_search.setStatusTip("") self.pb_search.setStatusTip("")
# endif // QT_CONFIG(statustip) # endif // QT_CONFIG(statustip)
# if QT_CONFIG(whatsthis) # if QT_CONFIG(whatsthis)
self.b_search.setWhatsThis("") self.pb_search.setWhatsThis("")
# endif // QT_CONFIG(whatsthis) # endif // QT_CONFIG(whatsthis)
# if QT_CONFIG(accessibility) # if QT_CONFIG(accessibility)
self.b_search.setAccessibleName("") self.pb_search.setAccessibleName("")
# endif // QT_CONFIG(accessibility) # endif // QT_CONFIG(accessibility)
# if QT_CONFIG(accessibility) # if QT_CONFIG(accessibility)
self.b_search.setAccessibleDescription("") self.pb_search.setAccessibleDescription("")
# endif // QT_CONFIG(accessibility) # endif // QT_CONFIG(accessibility)
self.b_search.setText("Search") self.pb_search.setText("Search")
# if QT_CONFIG(shortcut) # if QT_CONFIG(shortcut)
self.b_search.setShortcut("") self.pb_search.setShortcut("")
# endif // QT_CONFIG(shortcut) # endif // QT_CONFIG(shortcut)
self.lh_search.addWidget(self.b_search) self.lh_search.addWidget(self.pb_search)
self.lv_search_result.addLayout(self.lh_search) self.lv_search_result.addLayout(self.lh_search)
@@ -315,29 +315,29 @@ class Ui_MainWindow:
self.lh_download.addWidget(self.cb_quality_video) self.lh_download.addWidget(self.cb_quality_video)
self.b_download = QPushButton(self.w_central) self.pb_download = QPushButton(self.w_central)
self.b_download.setObjectName("b_download") self.pb_download.setObjectName("pb_download")
# if QT_CONFIG(tooltip) # if QT_CONFIG(tooltip)
self.b_download.setToolTip("") self.pb_download.setToolTip("")
# endif // QT_CONFIG(tooltip) # endif // QT_CONFIG(tooltip)
# if QT_CONFIG(statustip) # if QT_CONFIG(statustip)
self.b_download.setStatusTip("") self.pb_download.setStatusTip("")
# endif // QT_CONFIG(statustip) # endif // QT_CONFIG(statustip)
# if QT_CONFIG(whatsthis) # if QT_CONFIG(whatsthis)
self.b_download.setWhatsThis("") self.pb_download.setWhatsThis("")
# endif // QT_CONFIG(whatsthis) # endif // QT_CONFIG(whatsthis)
# if QT_CONFIG(accessibility) # if QT_CONFIG(accessibility)
self.b_download.setAccessibleName("") self.pb_download.setAccessibleName("")
# endif // QT_CONFIG(accessibility) # endif // QT_CONFIG(accessibility)
# if QT_CONFIG(accessibility) # if QT_CONFIG(accessibility)
self.b_download.setAccessibleDescription("") self.pb_download.setAccessibleDescription("")
# endif // QT_CONFIG(accessibility) # endif // QT_CONFIG(accessibility)
self.b_download.setText("Download") self.pb_download.setText("Download")
# if QT_CONFIG(shortcut) # if QT_CONFIG(shortcut)
self.b_download.setShortcut("") self.pb_download.setShortcut("")
# endif // QT_CONFIG(shortcut) # endif // QT_CONFIG(shortcut)
self.lh_download.addWidget(self.b_download) self.lh_download.addWidget(self.pb_download)
self.lh_download.setStretch(0, 5) self.lh_download.setStretch(0, 5)
self.lh_download.setStretch(2, 5) self.lh_download.setStretch(2, 5)
+2 -2
View File
@@ -246,7 +246,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="b_search"> <widget class="QPushButton" name="pb_search">
<property name="statusTip"> <property name="statusTip">
<string notr="true"/> <string notr="true"/>
</property> </property>
@@ -436,7 +436,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="b_download"> <widget class="QPushButton" name="pb_download">
<property name="toolTip"> <property name="toolTip">
<string notr="true"/> <string notr="true"/>
</property> </property>