Compare commits
No commits in common. "bf67866f8a21f4f8943ef6dd076256298547dda6" and "3528b5817446894c750cd0179ccdb77eb03046c3" have entirely different histories.
bf67866f8a
...
3528b58174
@ -260,7 +260,7 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
def debug(self):
|
def debug(self):
|
||||||
"""Invoke debugger"""
|
"""Invoke debugger"""
|
||||||
|
|
||||||
import ipdb # type: ignore
|
import ipdb
|
||||||
ipdb.set_trace()
|
ipdb.set_trace()
|
||||||
|
|
||||||
def disable_play_next_controls(self) -> None:
|
def disable_play_next_controls(self) -> None:
|
||||||
@ -834,7 +834,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
def show_current(self) -> None:
|
def show_current(self) -> None:
|
||||||
"""Scroll to show current track"""
|
"""Scroll to show current track"""
|
||||||
|
|
||||||
log.debug(f"musicmuster.show_current()")
|
|
||||||
if self.current_track_playlist_tab != self.visible_playlist_tab:
|
if self.current_track_playlist_tab != self.visible_playlist_tab:
|
||||||
self.tabPlaylist.setCurrentWidget(self.current_track_playlist_tab)
|
self.tabPlaylist.setCurrentWidget(self.current_track_playlist_tab)
|
||||||
self.tabPlaylist.currentWidget().scroll_current_to_top()
|
self.tabPlaylist.currentWidget().scroll_current_to_top()
|
||||||
@ -842,7 +841,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
def show_next(self) -> None:
|
def show_next(self) -> None:
|
||||||
"""Scroll to show next track"""
|
"""Scroll to show next track"""
|
||||||
|
|
||||||
log.debug(f"musicmuster.show_next()")
|
|
||||||
if self.next_track_playlist_tab != self.visible_playlist_tab:
|
if self.next_track_playlist_tab != self.visible_playlist_tab:
|
||||||
self.tabPlaylist.setCurrentWidget(self.next_track_playlist_tab)
|
self.tabPlaylist.setCurrentWidget(self.next_track_playlist_tab)
|
||||||
self.tabPlaylist.currentWidget().scroll_next_to_top()
|
self.tabPlaylist.currentWidget().scroll_next_to_top()
|
||||||
|
|||||||
@ -415,7 +415,7 @@ class PlaylistTab(QTableWidget):
|
|||||||
|
|
||||||
# Determin cell type changed
|
# Determin cell type changed
|
||||||
with Session() as session:
|
with Session() as session:
|
||||||
if self.edit_cell_type == ROW_NOTES:
|
if self.edit_cell_type == "row_notes":
|
||||||
# Get playlistrow object
|
# Get playlistrow object
|
||||||
plr_id = self._get_playlistrow_id(row)
|
plr_id = self._get_playlistrow_id(row)
|
||||||
plr_item = session.get(PlaylistRows, plr_id)
|
plr_item = session.get(PlaylistRows, plr_id)
|
||||||
@ -434,10 +434,9 @@ class PlaylistTab(QTableWidget):
|
|||||||
if track:
|
if track:
|
||||||
update_current = row == self._get_current_track_row()
|
update_current = row == self._get_current_track_row()
|
||||||
update_next = row == self._get_next_track_row()
|
update_next = row == self._get_next_track_row()
|
||||||
if self.edit_cell_type == TITLE:
|
if self.edit_cell_type == "title":
|
||||||
log.debug(f"KAE: _cell_changed:438, {new_text=}")
|
|
||||||
track.title = new_text
|
track.title = new_text
|
||||||
elif self.edit_cell_type == ARTIST:
|
elif self.edit_cell_type == "artist":
|
||||||
track.artist = new_text
|
track.artist = new_text
|
||||||
if update_current:
|
if update_current:
|
||||||
self.musicmuster.update_current_track(track)
|
self.musicmuster.update_current_track(track)
|
||||||
@ -488,21 +487,25 @@ class PlaylistTab(QTableWidget):
|
|||||||
# If a track row, we only allow editing of title, artist and
|
# If a track row, we only allow editing of title, artist and
|
||||||
# note. Check that this column is one of those.
|
# note. Check that this column is one of those.
|
||||||
self.edit_cell_type = None
|
self.edit_cell_type = None
|
||||||
if column in [TITLE, ARTIST, ROW_NOTES]:
|
if column == TITLE:
|
||||||
self.edit_cell_type = column
|
self.edit_cell_type = "title"
|
||||||
|
elif column == ARTIST:
|
||||||
|
self.edit_cell_type = "artist"
|
||||||
|
elif column == ROW_NOTES:
|
||||||
|
self.edit_cell_type = "row_notes"
|
||||||
else:
|
else:
|
||||||
# Can't edit other columns
|
# Can't edit other columns
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Check whether we're editing a notes row for later
|
# Check whether we're editing a notes row for later
|
||||||
if self.edit_cell_type == ROW_NOTES:
|
if self.edit_cell_type == "row_notes":
|
||||||
note_column = ROW_NOTES
|
note_column = ROW_NOTES
|
||||||
else:
|
else:
|
||||||
# This is a section header.
|
# This is a section header.
|
||||||
if column != HEADER_NOTES_COLUMN:
|
if column != HEADER_NOTES_COLUMN:
|
||||||
return False
|
return False
|
||||||
note_column = HEADER_NOTES_COLUMN
|
note_column = HEADER_NOTES_COLUMN
|
||||||
self.edit_cell_type = ROW_NOTES
|
self.edit_cell_type = "row_notes"
|
||||||
|
|
||||||
# Disable play controls so that keyboard input doesn't
|
# Disable play controls so that keyboard input doesn't
|
||||||
# disturb playing
|
# disturb playing
|
||||||
@ -612,7 +615,6 @@ class PlaylistTab(QTableWidget):
|
|||||||
self.setItem(row, START_GAP, start_gap_item)
|
self.setItem(row, START_GAP, start_gap_item)
|
||||||
|
|
||||||
title_item = QTableWidgetItem(row_data.track.title)
|
title_item = QTableWidgetItem(row_data.track.title)
|
||||||
log.debug(f"KAE: insert_row:615, {title_item.text()=}")
|
|
||||||
self.setItem(row, TITLE, title_item)
|
self.setItem(row, TITLE, title_item)
|
||||||
|
|
||||||
artist_item = QTableWidgetItem(row_data.track.artist)
|
artist_item = QTableWidgetItem(row_data.track.artist)
|
||||||
@ -821,17 +823,13 @@ class PlaylistTab(QTableWidget):
|
|||||||
def scroll_current_to_top(self) -> None:
|
def scroll_current_to_top(self) -> None:
|
||||||
"""Scroll currently-playing row to top"""
|
"""Scroll currently-playing row to top"""
|
||||||
|
|
||||||
log.debug("playlists.scroll_current_to_top()")
|
|
||||||
current_row = self._get_current_track_row()
|
current_row = self._get_current_track_row()
|
||||||
log.debug(f"playlists.scroll_current_to_top(), {current_row=}")
|
|
||||||
self._scroll_to_top(current_row)
|
self._scroll_to_top(current_row)
|
||||||
|
|
||||||
def scroll_next_to_top(self) -> None:
|
def scroll_next_to_top(self) -> None:
|
||||||
"""Scroll nextly-playing row to top"""
|
"""Scroll nextly-playing row to top"""
|
||||||
|
|
||||||
log.debug("playlists.scroll_next_to_top()")
|
|
||||||
next_row = self._get_next_track_row()
|
next_row = self._get_next_track_row()
|
||||||
log.debug(f"playlists.scroll_next_to_top(), {next_row=}")
|
|
||||||
self._scroll_to_top(next_row)
|
self._scroll_to_top(next_row)
|
||||||
|
|
||||||
def set_search(self, text: str) -> None:
|
def set_search(self, text: str) -> None:
|
||||||
@ -1955,7 +1953,6 @@ class PlaylistTab(QTableWidget):
|
|||||||
item_startgap.setBackground(QColor("white"))
|
item_startgap.setBackground(QColor("white"))
|
||||||
|
|
||||||
item_title = self.item(row, TITLE)
|
item_title = self.item(row, TITLE)
|
||||||
log.debug(f"KAE: _update_row:1958, {track.title=}")
|
|
||||||
item_title.setText(track.title)
|
item_title.setText(track.title)
|
||||||
|
|
||||||
item_artist = self.item(row, ARTIST)
|
item_artist = self.item(row, ARTIST)
|
||||||
|
|||||||
@ -134,15 +134,9 @@ border: 1px solid rgb(85, 87, 83);</string>
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="hdrPreviousTrack">
|
<widget class="QLabel" name="hdrPreviousTrack">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="minimumSize">
|
<property name="minimumSize">
|
||||||
<size>
|
<size>
|
||||||
<width>0</width>
|
<width>16</width>
|
||||||
<height>0</height>
|
<height>0</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
@ -166,18 +160,12 @@ border: 1px solid rgb(85, 87, 83);</string>
|
|||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="hdrCurrentTrack">
|
<widget class="QPushButton" name="hdrCurrentTrack">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>20</pointsize>
|
<pointsize>20</pointsize>
|
||||||
@ -186,9 +174,7 @@ border: 1px solid rgb(85, 87, 83);</string>
|
|||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: #d4edda;
|
<string notr="true">background-color: #d4edda;
|
||||||
border: 1px solid rgb(85, 87, 83);
|
border: 1px solid rgb(85, 87, 83);
|
||||||
text-align: left;
|
text-align: left;</string>
|
||||||
padding-left: 8px;
|
|
||||||
</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
@ -200,12 +186,6 @@ padding-left: 8px;
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="hdrNextTrack">
|
<widget class="QPushButton" name="hdrNextTrack">
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>20</pointsize>
|
<pointsize>20</pointsize>
|
||||||
@ -214,8 +194,7 @@ padding-left: 8px;
|
|||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">background-color: #fff3cd;
|
<string notr="true">background-color: #fff3cd;
|
||||||
border: 1px solid rgb(85, 87, 83);
|
border: 1px solid rgb(85, 87, 83);
|
||||||
text-align: left;
|
text-align: left;</string>
|
||||||
padding-left: 8px;</string>
|
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string/>
|
<string/>
|
||||||
|
|||||||
@ -80,12 +80,7 @@ class Ui_MainWindow(object):
|
|||||||
self.verticalLayout = QtWidgets.QVBoxLayout()
|
self.verticalLayout = QtWidgets.QVBoxLayout()
|
||||||
self.verticalLayout.setObjectName("verticalLayout")
|
self.verticalLayout.setObjectName("verticalLayout")
|
||||||
self.hdrPreviousTrack = QtWidgets.QLabel(self.centralwidget)
|
self.hdrPreviousTrack = QtWidgets.QLabel(self.centralwidget)
|
||||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
self.hdrPreviousTrack.setMinimumSize(QtCore.QSize(16, 0))
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(self.hdrPreviousTrack.sizePolicy().hasHeightForWidth())
|
|
||||||
self.hdrPreviousTrack.setSizePolicy(sizePolicy)
|
|
||||||
self.hdrPreviousTrack.setMinimumSize(QtCore.QSize(0, 0))
|
|
||||||
self.hdrPreviousTrack.setMaximumSize(QtCore.QSize(16777215, 16777215))
|
self.hdrPreviousTrack.setMaximumSize(QtCore.QSize(16777215, 16777215))
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setFamily("Sans")
|
font.setFamily("Sans")
|
||||||
@ -94,40 +89,27 @@ class Ui_MainWindow(object):
|
|||||||
self.hdrPreviousTrack.setStyleSheet("background-color: #f8d7da;\n"
|
self.hdrPreviousTrack.setStyleSheet("background-color: #f8d7da;\n"
|
||||||
"border: 1px solid rgb(85, 87, 83);")
|
"border: 1px solid rgb(85, 87, 83);")
|
||||||
self.hdrPreviousTrack.setText("")
|
self.hdrPreviousTrack.setText("")
|
||||||
self.hdrPreviousTrack.setWordWrap(False)
|
self.hdrPreviousTrack.setWordWrap(True)
|
||||||
self.hdrPreviousTrack.setObjectName("hdrPreviousTrack")
|
self.hdrPreviousTrack.setObjectName("hdrPreviousTrack")
|
||||||
self.verticalLayout.addWidget(self.hdrPreviousTrack)
|
self.verticalLayout.addWidget(self.hdrPreviousTrack)
|
||||||
self.hdrCurrentTrack = QtWidgets.QPushButton(self.centralwidget)
|
self.hdrCurrentTrack = QtWidgets.QPushButton(self.centralwidget)
|
||||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(self.hdrCurrentTrack.sizePolicy().hasHeightForWidth())
|
|
||||||
self.hdrCurrentTrack.setSizePolicy(sizePolicy)
|
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setPointSize(20)
|
font.setPointSize(20)
|
||||||
self.hdrCurrentTrack.setFont(font)
|
self.hdrCurrentTrack.setFont(font)
|
||||||
self.hdrCurrentTrack.setStyleSheet("background-color: #d4edda;\n"
|
self.hdrCurrentTrack.setStyleSheet("background-color: #d4edda;\n"
|
||||||
"border: 1px solid rgb(85, 87, 83);\n"
|
"border: 1px solid rgb(85, 87, 83);\n"
|
||||||
"text-align: left;\n"
|
"text-align: left;")
|
||||||
"padding-left: 8px;\n"
|
|
||||||
"")
|
|
||||||
self.hdrCurrentTrack.setText("")
|
self.hdrCurrentTrack.setText("")
|
||||||
self.hdrCurrentTrack.setFlat(True)
|
self.hdrCurrentTrack.setFlat(True)
|
||||||
self.hdrCurrentTrack.setObjectName("hdrCurrentTrack")
|
self.hdrCurrentTrack.setObjectName("hdrCurrentTrack")
|
||||||
self.verticalLayout.addWidget(self.hdrCurrentTrack)
|
self.verticalLayout.addWidget(self.hdrCurrentTrack)
|
||||||
self.hdrNextTrack = QtWidgets.QPushButton(self.centralwidget)
|
self.hdrNextTrack = QtWidgets.QPushButton(self.centralwidget)
|
||||||
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
|
|
||||||
sizePolicy.setHorizontalStretch(0)
|
|
||||||
sizePolicy.setVerticalStretch(0)
|
|
||||||
sizePolicy.setHeightForWidth(self.hdrNextTrack.sizePolicy().hasHeightForWidth())
|
|
||||||
self.hdrNextTrack.setSizePolicy(sizePolicy)
|
|
||||||
font = QtGui.QFont()
|
font = QtGui.QFont()
|
||||||
font.setPointSize(20)
|
font.setPointSize(20)
|
||||||
self.hdrNextTrack.setFont(font)
|
self.hdrNextTrack.setFont(font)
|
||||||
self.hdrNextTrack.setStyleSheet("background-color: #fff3cd;\n"
|
self.hdrNextTrack.setStyleSheet("background-color: #fff3cd;\n"
|
||||||
"border: 1px solid rgb(85, 87, 83);\n"
|
"border: 1px solid rgb(85, 87, 83);\n"
|
||||||
"text-align: left;\n"
|
"text-align: left;")
|
||||||
"padding-left: 8px;")
|
|
||||||
self.hdrNextTrack.setText("")
|
self.hdrNextTrack.setText("")
|
||||||
self.hdrNextTrack.setFlat(True)
|
self.hdrNextTrack.setFlat(True)
|
||||||
self.hdrNextTrack.setObjectName("hdrNextTrack")
|
self.hdrNextTrack.setObjectName("hdrNextTrack")
|
||||||
|
|||||||
30
test.py
30
test.py
@ -1,30 +0,0 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
from PyQt5 import QtGui, QtWidgets
|
|
||||||
|
|
||||||
class TabBar(QtWidgets.QTabWidget):
|
|
||||||
def paintEvent(self, event):
|
|
||||||
painter = QtGui.QStylePainter(self)
|
|
||||||
option = QtGui.QStyleOptionTab()
|
|
||||||
for index in range(self.count()):
|
|
||||||
self.initStyleOption(option, index)
|
|
||||||
bgcolor = QtGui.QColor(self.tabText(index))
|
|
||||||
option.palette.setColor(QtGui.QPalette.Window, bgcolor)
|
|
||||||
painter.drawControl(QtGui.QStyle.CE_TabBarTabShape, option)
|
|
||||||
painter.drawControl(QtGui.QStyle.CE_TabBarTabLabel, option)
|
|
||||||
|
|
||||||
class Window(QtWidgets.QTabWidget):
|
|
||||||
def __init__(self):
|
|
||||||
QtGui.QTabWidget.__init__(self)
|
|
||||||
self.setTabBar(TabBar(self))
|
|
||||||
for color in 'tomato orange yellow lightgreen skyblue plum'.split():
|
|
||||||
self.addTab(QtGui.QWidget(self), color)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
|
|
||||||
import sys
|
|
||||||
app = QtGui.QApplication(sys.argv)
|
|
||||||
window = Window()
|
|
||||||
window.resize(420, 200)
|
|
||||||
window.show()
|
|
||||||
sys.exit(app.exec_())
|
|
||||||
Loading…
Reference in New Issue
Block a user