Auto-hide empty library sections in Library tab
- Hide 'Ready to Transfer' header and list when no tracks are ready - Hide 'Source Files — Need Conversion' header and list when no source files exist - Sections appear/disappear automatically on scan, add, convert, delete
This commit is contained in:
parent
a2d92b75e0
commit
11e4d49e2b
18
src/main.py
18
src/main.py
@ -323,15 +323,15 @@ class MainWindow(QMainWindow):
|
||||
output_layout.addWidget(refresh_btn)
|
||||
layout.addLayout(output_layout)
|
||||
|
||||
ready_label = QLabel("Ready to Transfer:")
|
||||
layout.addWidget(ready_label)
|
||||
self.ready_label = QLabel("Ready to Transfer:")
|
||||
layout.addWidget(self.ready_label)
|
||||
|
||||
self.library_ready_list = QListWidget()
|
||||
self.library_ready_list.setSelectionMode(QListWidget.SelectionMode.ExtendedSelection)
|
||||
layout.addWidget(self.library_ready_list, stretch=2)
|
||||
|
||||
source_label = QLabel("Source Files — Need Conversion:")
|
||||
layout.addWidget(source_label)
|
||||
self.source_label = QLabel("Source Files — Need Conversion:")
|
||||
layout.addWidget(self.source_label)
|
||||
|
||||
self.library_source_list = QListWidget()
|
||||
self.library_source_list.setSelectionMode(QListWidget.SelectionMode.ExtendedSelection)
|
||||
@ -553,7 +553,8 @@ class MainWindow(QMainWindow):
|
||||
self.library_ready_list.addItem(item)
|
||||
|
||||
count = len(self.library_ready)
|
||||
ready_label = self.findChild(QLabel, "ready_label")
|
||||
self.ready_label.setVisible(count > 0)
|
||||
self.library_ready_list.setVisible(count > 0)
|
||||
if count:
|
||||
self.library_status.setText(f"{count} track(s) ready to transfer")
|
||||
self.library_transfer_btn.setEnabled(True)
|
||||
@ -609,10 +610,9 @@ class MainWindow(QMainWindow):
|
||||
self.library_source_list.addItem(item)
|
||||
|
||||
count = len(all_sources)
|
||||
if count:
|
||||
self.library_convert_btn.setEnabled(True)
|
||||
else:
|
||||
self.library_convert_btn.setEnabled(False)
|
||||
self.source_label.setVisible(count > 0)
|
||||
self.library_source_list.setVisible(count > 0)
|
||||
self.library_convert_btn.setEnabled(count > 0)
|
||||
|
||||
def _get_selected_ready_tracks(self) -> List[Tuple[TrackInfo, str]]:
|
||||
selected = self.library_ready_list.selectedItems()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user