WIP (working on marking next track)
This commit is contained in:
parent
c8194fad80
commit
70c2c18fb3
@ -14,7 +14,7 @@ import sys
|
|||||||
#
|
#
|
||||||
# from PyQt5.QtCore import QDate, QEvent, QProcess, Qt, QTime, QTimer, QUrl
|
# from PyQt5.QtCore import QDate, QEvent, QProcess, Qt, QTime, QTimer, QUrl
|
||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
# from PyQt5.QtGui import QColor
|
from PyQt5.QtGui import QColor
|
||||||
# from PyQt5.QtWebEngineWidgets import QWebEngineView as QWebView
|
# from PyQt5.QtWebEngineWidgets import QWebEngineView as QWebView
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QApplication,
|
QApplication,
|
||||||
@ -42,7 +42,7 @@ from models import (
|
|||||||
Tracks
|
Tracks
|
||||||
)
|
)
|
||||||
from playlists import PlaylistTab
|
from playlists import PlaylistTab
|
||||||
# from sqlalchemy.orm.exc import DetachedInstanceError
|
from sqlalchemy.orm.exc import DetachedInstanceError
|
||||||
# from ui.dlg_search_database_ui import Ui_Dialog
|
# from ui.dlg_search_database_ui import Ui_Dialog
|
||||||
from ui.dlg_SelectPlaylist_ui import Ui_dlgSelectPlaylist
|
from ui.dlg_SelectPlaylist_ui import Ui_dlgSelectPlaylist
|
||||||
# from ui.downloadcsv_ui import Ui_DateSelect
|
# from ui.downloadcsv_ui import Ui_DateSelect
|
||||||
@ -52,18 +52,17 @@ from ui.main_window_ui import Ui_MainWindow
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# log = logging.getLogger(Config.LOG_NAME)
|
# log = logging.getLogger(Config.LOG_NAME)
|
||||||
# class TrackData:
|
class TrackData:
|
||||||
# def __init__(self, track):
|
def __init__(self, track):
|
||||||
# self.id = track.id
|
self.id = track.id
|
||||||
# self.title = track.title
|
self.title = track.title
|
||||||
# self.artist = track.artist
|
self.artist = track.artist
|
||||||
# self.duration = track.duration
|
self.duration = track.duration
|
||||||
# self.start_gap = track.start_gap
|
self.start_gap = track.start_gap
|
||||||
# self.fade_at = track.fade_at
|
self.fade_at = track.fade_at
|
||||||
# self.silence_at = track.silence_at
|
self.silence_at = track.silence_at
|
||||||
# self.path = track.path
|
self.path = track.path
|
||||||
# self.mtime = track.mtime
|
self.mtime = track.mtime
|
||||||
# self.lastplayed = track.lastplayed
|
|
||||||
|
|
||||||
|
|
||||||
class Window(QMainWindow, Ui_MainWindow):
|
class Window(QMainWindow, Ui_MainWindow):
|
||||||
@ -77,14 +76,14 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
# self.disable_play_next_controls()
|
# self.disable_play_next_controls()
|
||||||
#
|
#
|
||||||
# self.music: music.Music = music.Music()
|
# self.music: music.Music = music.Music()
|
||||||
# self.current_track: Optional[Tracks] = None
|
self.current_track: Optional[TrackData] = None
|
||||||
# self.current_track_playlist_tab: Optional[PlaylistTab] = None
|
self.current_track_playlist_tab: Optional[PlaylistTab] = None
|
||||||
# self.info_tabs: Optional[Dict[str, QWebView]] = {}
|
self.info_tabs: Optional[Dict[str, QWebView]] = {}
|
||||||
# self.next_track: Optional[Tracks] = None
|
self.next_track: Optional[TrackData] = None
|
||||||
# self.next_track_playlist_tab: Optional[PlaylistTab] = None
|
self.next_track_playlist_tab: Optional[PlaylistTab] = None
|
||||||
# self.previous_track: Optional[Tracks] = None
|
self.previous_track: Optional[TrackData] = None
|
||||||
# self.previous_track_position: Optional[int] = None
|
self.previous_track_position: Optional[int] = None
|
||||||
#
|
|
||||||
# self.set_main_window_size()
|
# self.set_main_window_size()
|
||||||
self.lblSumPlaytime = QLabel("")
|
self.lblSumPlaytime = QLabel("")
|
||||||
self.statusbar.addPermanentWidget(self.lblSumPlaytime)
|
self.statusbar.addPermanentWidget(self.lblSumPlaytime)
|
||||||
@ -118,10 +117,10 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
# return
|
# return
|
||||||
#
|
#
|
||||||
# @staticmethod
|
# @staticmethod
|
||||||
# def kae():
|
# def print_current_database():
|
||||||
# with Session() as session:
|
# with Session() as session:
|
||||||
# db = session.bind.engine.url.database
|
# db = session.bind.engine.url.database
|
||||||
# print(f"kae(): {db=}")
|
# print(f"{db=}")
|
||||||
#
|
#
|
||||||
# @staticmethod
|
# @staticmethod
|
||||||
# def check_audacity() -> None:
|
# def check_audacity() -> None:
|
||||||
@ -757,14 +756,14 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
# """Select all unplayed tracks in playlist"""
|
# """Select all unplayed tracks in playlist"""
|
||||||
#
|
#
|
||||||
# self.visible_playlist_tab().select_unplayed_tracks()
|
# self.visible_playlist_tab().select_unplayed_tracks()
|
||||||
#
|
|
||||||
# def set_tab_colour(self, widget, colour) -> None:
|
def set_tab_colour(self, widget: PlaylistTab, colour: QColor) -> None:
|
||||||
# """
|
"""
|
||||||
# Find the tab containing the widget and set the text colour
|
Find the tab containing the widget and set the text colour
|
||||||
# """
|
"""
|
||||||
#
|
|
||||||
# idx: int = self.tabPlaylist.indexOf(widget)
|
idx = self.tabPlaylist.indexOf(widget)
|
||||||
# self.tabPlaylist.tabBar().setTabTextColor(idx, colour)
|
self.tabPlaylist.tabBar().setTabTextColor(idx, colour)
|
||||||
#
|
#
|
||||||
# def song_info_search(self) -> None:
|
# def song_info_search(self) -> None:
|
||||||
# """
|
# """
|
||||||
@ -849,9 +848,6 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# ***kae
|
|
||||||
return
|
|
||||||
|
|
||||||
# Clear next track if on another tab
|
# Clear next track if on another tab
|
||||||
if self.next_track_playlist_tab != playlist_tab:
|
if self.next_track_playlist_tab != playlist_tab:
|
||||||
# We need to reset the ex-next-track playlist
|
# We need to reset the ex-next-track playlist
|
||||||
@ -964,36 +960,32 @@ class Window(QMainWindow, Ui_MainWindow):
|
|||||||
# else:
|
# else:
|
||||||
# if self.playing:
|
# if self.playing:
|
||||||
# self.stop_playing()
|
# self.stop_playing()
|
||||||
#
|
|
||||||
# def update_headers(self) -> None:
|
def update_headers(self) -> None:
|
||||||
# """
|
"""
|
||||||
# Update last / current / next track headers
|
Update last / current / next track headers
|
||||||
#
|
"""
|
||||||
# If multiple tracks are played quickly in succession, it's possible
|
|
||||||
# for the self.{previous,current,next} track to not be in the session.
|
try:
|
||||||
# Unlikely to happen in normal use so handle by blanking title.
|
self.hdrPreviousTrack.setText(
|
||||||
# """
|
f"{self.previous_track.title} - {self.previous_track.artist}"
|
||||||
#
|
)
|
||||||
# try:
|
except (AttributeError, DetachedInstanceError):
|
||||||
# self.hdrPreviousTrack.setText(
|
self.hdrPreviousTrack.setText("")
|
||||||
# f"{self.previous_track.title} - {self.previous_track.artist}"
|
|
||||||
# )
|
try:
|
||||||
# except (AttributeError, DetachedInstanceError):
|
self.hdrCurrentTrack.setText(
|
||||||
# self.hdrPreviousTrack.setText("")
|
f"{self.current_track.title} - {self.current_track.artist}"
|
||||||
#
|
)
|
||||||
# try:
|
except (AttributeError, DetachedInstanceError):
|
||||||
# self.hdrCurrentTrack.setText(
|
self.hdrCurrentTrack.setText("")
|
||||||
# f"{self.current_track.title} - {self.current_track.artist}"
|
|
||||||
# )
|
try:
|
||||||
# except (AttributeError, DetachedInstanceError):
|
self.hdrNextTrack.setText(
|
||||||
# self.hdrCurrentTrack.setText("")
|
f"{self.next_track.title} - {self.next_track.artist}"
|
||||||
#
|
)
|
||||||
# try:
|
except (AttributeError, DetachedInstanceError):
|
||||||
# self.hdrNextTrack.setText(
|
self.hdrNextTrack.setText("")
|
||||||
# f"{self.next_track.title} - {self.next_track.artist}"
|
|
||||||
# )
|
|
||||||
# except (AttributeError, DetachedInstanceError):
|
|
||||||
# self.hdrNextTrack.setText("")
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# class DbDialog(QDialog):
|
# class DbDialog(QDialog):
|
||||||
|
|||||||
@ -701,7 +701,7 @@ class PlaylistTab(QTableWidget):
|
|||||||
|
|
||||||
# We possibly don't need to save the playlist here, but row
|
# We possibly don't need to save the playlist here, but row
|
||||||
# numbers may have changed during population, and it's cheap to do
|
# numbers may have changed during population, and it's cheap to do
|
||||||
# KAE self.save_playlist(session)
|
# self.save_playlist(session)
|
||||||
self.update_display(session)
|
self.update_display(session)
|
||||||
|
|
||||||
def remove_selected_rows(self) -> None:
|
def remove_selected_rows(self) -> None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user