Add debug statements for scroll to next/current
This commit is contained in:
parent
3528b58174
commit
5783da051e
@ -834,6 +834,7 @@ 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()
|
||||||
@ -841,6 +842,7 @@ 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()
|
||||||
|
|||||||
@ -823,13 +823,17 @@ 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:
|
||||||
|
|||||||
30
test.py
Executable file
30
test.py
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
#!/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