Start implementing coloured text on tabs
This commit is contained in:
parent
e4fe4b576e
commit
0a4730e5a7
@ -6,12 +6,15 @@ class Config(object):
|
||||
AUDIO_SEGMENT_CHUNK_SIZE = 10
|
||||
COLOUR_CURRENT_HEADER = "#d4edda"
|
||||
COLOUR_CURRENT_PLAYLIST = "#28a745"
|
||||
COLOUR_CURRENT_TAB = "#248f24"
|
||||
COLOUR_ODD_PLAYLIST = "#f2f2f2"
|
||||
COLOUR_ENDING_TIMER = "#dc3545"
|
||||
COLOUR_EVEN_PLAYLIST = "#d9d9d9"
|
||||
COLOUR_LONG_START = "#dc3545"
|
||||
COLOUR_NORMAL_TAB = "#000000"
|
||||
COLOUR_NEXT_HEADER = "#fff3cd"
|
||||
COLOUR_NEXT_PLAYLIST = "#ffc107"
|
||||
COLOUR_NEXT_TAB = "#b38600"
|
||||
COLOUR_NOTES_PLAYLIST = "#b8daff"
|
||||
COLOUR_PREVIOUS_HEADER = "#f8d7da"
|
||||
COLOUR_UNREADABLE = "#dc3545"
|
||||
|
||||
@ -479,7 +479,11 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
|
||||
# Play next track
|
||||
self.current_track = self.next_track
|
||||
self.set_tab_colour(self.current_track_playlist_tab,
|
||||
QColor("black"))
|
||||
self.current_track_playlist_tab = self.next_track_playlist_tab
|
||||
self.set_tab_colour(self.current_track_playlist_tab,
|
||||
QColor(Config.COLOUR_CURRENT_TAB))
|
||||
self.next_track = None
|
||||
self.next_track_playlist_tab = None
|
||||
DEBUG(
|
||||
@ -558,7 +562,13 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
if self.next_track_playlist_tab != self.visible_playlist_tab():
|
||||
if self.next_track_playlist_tab:
|
||||
self.next_track_playlist_tab.clear_next()
|
||||
self.set_tab_colour(self.next_track_playlist_tab,
|
||||
QColor("black"))
|
||||
self.next_track_playlist_tab = self.visible_playlist_tab()
|
||||
if (self.next_track_playlist_tab !=
|
||||
self.current_track_playlist_tab):
|
||||
self.set_tab_colour(self.next_track_playlist_tab,
|
||||
QColor(Config.COLOUR_NEXT_TAB))
|
||||
self.next_track = Tracks.get_track(session, next_track_id)
|
||||
self.update_headers()
|
||||
|
||||
@ -567,6 +577,14 @@ class Window(QMainWindow, Ui_MainWindow):
|
||||
|
||||
self.visible_playlist_tab().select_unplayed_tracks()
|
||||
|
||||
def set_tab_colour(self, widget, colour):
|
||||
"""
|
||||
Find the tab containing the widget and set the text colour
|
||||
"""
|
||||
|
||||
idx = self.tabPlaylist.indexOf(widget)
|
||||
self.tabPlaylist.tabBar().setTabTextColor(idx, colour)
|
||||
|
||||
def song_info_search(self):
|
||||
"""
|
||||
Open browser tabs for Wikipedia, searching for
|
||||
|
||||
@ -1195,9 +1195,6 @@ class PlaylistTab(QTableWidget):
|
||||
If multiple rows are selected, display sum of durations in status bar.
|
||||
"""
|
||||
|
||||
# Clear label
|
||||
self.master_process.lblSumPlaytime.setText("")
|
||||
|
||||
rows = set([item.row() for item in self.selectedItems()])
|
||||
notes = self._meta_get_notes()
|
||||
ms = 0
|
||||
@ -1210,6 +1207,8 @@ class PlaylistTab(QTableWidget):
|
||||
if ms > 0:
|
||||
self.master_process.lblSumPlaytime.setText(
|
||||
f"Selected duration: {helpers.ms_to_mmss(ms)}")
|
||||
else:
|
||||
self.master_process.lblSumPlaytime.setText("")
|
||||
|
||||
def _set_column_widths(self):
|
||||
# Column widths from settings
|
||||
|
||||
Loading…
Reference in New Issue
Block a user