Compare commits
4 Commits
57ffa71c86
...
aef8cb5cb5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aef8cb5cb5 | ||
|
|
53664857c1 | ||
|
|
c8b571b38f | ||
|
|
b3bd93d71c |
@ -50,7 +50,8 @@ class PlaydatesTable(Model):
|
|||||||
lastplayed: Mapped[dt.datetime] = mapped_column(index=True)
|
lastplayed: Mapped[dt.datetime] = mapped_column(index=True)
|
||||||
track_id: Mapped[int] = mapped_column(ForeignKey("tracks.id"))
|
track_id: Mapped[int] = mapped_column(ForeignKey("tracks.id"))
|
||||||
track: Mapped["TracksTable"] = relationship(
|
track: Mapped["TracksTable"] = relationship(
|
||||||
"TracksTable", back_populates="playdates"
|
"TracksTable",
|
||||||
|
back_populates="playdates",
|
||||||
)
|
)
|
||||||
|
|
||||||
def __repr__(self) -> str:
|
def __repr__(self) -> str:
|
||||||
@ -103,7 +104,7 @@ class PlaylistRowsTable(Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
playlist: Mapped[PlaylistsTable] = relationship(back_populates="rows")
|
playlist: Mapped[PlaylistsTable] = relationship(back_populates="rows")
|
||||||
track_id: Mapped[Optional[int]] = mapped_column(ForeignKey("tracks.id"))
|
track_id: Mapped[Optional[int]] = mapped_column(ForeignKey("tracks.id", ondelete="CASCADE"))
|
||||||
track: Mapped["TracksTable"] = relationship(
|
track: Mapped["TracksTable"] = relationship(
|
||||||
"TracksTable",
|
"TracksTable",
|
||||||
back_populates="playlistrows",
|
back_populates="playlistrows",
|
||||||
|
|||||||
@ -36,7 +36,6 @@ if DATABASE_URL is None:
|
|||||||
if "unittest" in sys.modules and "sqlite" not in DATABASE_URL:
|
if "unittest" in sys.modules and "sqlite" not in DATABASE_URL:
|
||||||
raise ValueError("Unit tests running on non-Sqlite database")
|
raise ValueError("Unit tests running on non-Sqlite database")
|
||||||
db = DatabaseManager.get_instance(DATABASE_URL, engine_options=Config.ENGINE_OPTIONS).db
|
db = DatabaseManager.get_instance(DATABASE_URL, engine_options=Config.ENGINE_OPTIONS).db
|
||||||
db.create_all()
|
|
||||||
|
|
||||||
|
|
||||||
# Database classes
|
# Database classes
|
||||||
|
|||||||
@ -502,9 +502,7 @@ class Window(QMainWindow):
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
file_menu.addSeparator()
|
file_menu.addSeparator()
|
||||||
file_menu.addAction(
|
file_menu.addAction(self.create_action("Exit", self.close))
|
||||||
self.create_action("Exit", self.close)
|
|
||||||
) # Default action for closing
|
|
||||||
|
|
||||||
# Playlist Menu
|
# Playlist Menu
|
||||||
playlist_menu = menu_bar.addMenu("&Playlist")
|
playlist_menu = menu_bar.addMenu("&Playlist")
|
||||||
@ -768,7 +766,7 @@ class Window(QMainWindow):
|
|||||||
|
|
||||||
def create_playlist_tab(self, playlist: Playlists) -> int:
|
def create_playlist_tab(self, playlist: Playlists) -> int:
|
||||||
"""
|
"""
|
||||||
Take the passed proxy model, create a playlist tab and
|
Take the passed playlist, create a playlist tab and
|
||||||
add tab to display. Return index number of tab.
|
add tab to display. Return index number of tab.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -959,10 +957,10 @@ class Window(QMainWindow):
|
|||||||
if self.hide_played_tracks:
|
if self.hide_played_tracks:
|
||||||
self.hide_played_tracks = False
|
self.hide_played_tracks = False
|
||||||
self.current.base_model.hide_played_tracks(False)
|
self.current.base_model.hide_played_tracks(False)
|
||||||
self.btnHidePlayed.setText("Hide played")
|
self.footer_section.btnHidePlayed.setText("Hide played")
|
||||||
else:
|
else:
|
||||||
self.hide_played_tracks = True
|
self.hide_played_tracks = True
|
||||||
self.btnHidePlayed.setText("Show played")
|
self.footer_section.btnHidePlayed.setText("Show played")
|
||||||
if Config.HIDE_PLAYED_MODE == Config.HIDE_PLAYED_MODE_SECTIONS:
|
if Config.HIDE_PLAYED_MODE == Config.HIDE_PLAYED_MODE_SECTIONS:
|
||||||
self.active_tab().hide_played_sections()
|
self.active_tab().hide_played_sections()
|
||||||
else:
|
else:
|
||||||
|
|||||||
@ -1279,6 +1279,10 @@ class PlaylistModel(QAbstractTableModel):
|
|||||||
unplayed_count: int = 0
|
unplayed_count: int = 0
|
||||||
duration: int = 0
|
duration: int = 0
|
||||||
|
|
||||||
|
if rat.row_number == 0:
|
||||||
|
# Meaningless to have a subtotal on row 0
|
||||||
|
return Config.SUBTOTAL_ON_ROW_ZERO
|
||||||
|
|
||||||
# Show subtotal
|
# Show subtotal
|
||||||
for row_number in range(rat.row_number - 1, -1, -1):
|
for row_number in range(rat.row_number - 1, -1, -1):
|
||||||
row_rat = self.playlist_rows[row_number]
|
row_rat = self.playlist_rows[row_number]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user