forked from Wobbl/Wobuzz
Added option to load playlists on start to the settings.
This commit is contained in:
parent
5dc91f6605
commit
65564deb82
7 changed files with 20 additions and 6 deletions
|
@ -20,7 +20,6 @@ def main():
|
|||
from .main import Wobuzz
|
||||
|
||||
app = Wobuzz()
|
||||
app.post_init()
|
||||
|
||||
if arguments.playlist:
|
||||
playlist = Playlist(app, "Temporary Playlist", arguments.playlist)
|
||||
|
|
|
@ -59,6 +59,10 @@ class Library:
|
|||
if playlist.path == self.app.settings.latest_playlist: # start with latest playlist opened
|
||||
playlist_tabs.setCurrentIndex(playlist_tabs.count() - 1)
|
||||
|
||||
if self.app.settings.load_on_start:
|
||||
for playlist in self.playlists:
|
||||
playlist.load()
|
||||
|
||||
def on_exit(self, event):
|
||||
for playlist in self.playlists:
|
||||
if playlist.loaded: # only save loaded playlists, unloaded are empty
|
||||
|
|
|
@ -23,8 +23,10 @@ class Wobuzz:
|
|||
self.player = Player(self)
|
||||
self.gui = GUI(self)
|
||||
|
||||
def post_init(self):
|
||||
self.gui.track_control.track_progress_slider.post_init()
|
||||
self.late_init()
|
||||
|
||||
def late_init(self):
|
||||
self.gui.track_control.track_progress_slider.late_init()
|
||||
self.library.load()
|
||||
|
||||
def on_settings_change(self, key, value):
|
||||
|
|
|
@ -8,6 +8,7 @@ class Settings:
|
|||
window_size: tuple[int, int]=None
|
||||
window_maximized: bool=False
|
||||
library_path: str="~/.wobuzz"
|
||||
clear_track_cache: bool=True,
|
||||
clear_track_cache: bool=True
|
||||
latest_playlist: str=None
|
||||
load_on_start: bool=True
|
||||
|
||||
|
|
|
@ -10,5 +10,8 @@ class BehaviourSettings(QWidget):
|
|||
self.layout = QFormLayout(self)
|
||||
self.setLayout(self.layout)
|
||||
|
||||
self.load_on_start = QCheckBox(self)
|
||||
self.layout.addRow("Load playlists on start", self.load_on_start)
|
||||
|
||||
self.clear_track_cache = QCheckBox(self)
|
||||
self.layout.addRow("Clear track cache immediately when finished", self.clear_track_cache)
|
||||
self.layout.addRow("Clear track cache immediately when finished", self.clear_track_cache)
|
||||
|
|
|
@ -44,6 +44,7 @@ class Settings(QDockWidget):
|
|||
def update_all(self, _=True): # ignore visible parameter passed by visibilityChanged event
|
||||
self.file_settings.library_path_input.setText(self.app.settings.library_path)
|
||||
self.behavior_settings.clear_track_cache.setChecked(self.app.settings.clear_track_cache)
|
||||
self.behavior_settings.load_on_start.setChecked(self.app.settings.load_on_start)
|
||||
|
||||
def update_settings(self, key, value):
|
||||
match key:
|
||||
|
@ -53,7 +54,11 @@ class Settings(QDockWidget):
|
|||
case "clear_track_cache":
|
||||
self.behavior_settings.clear_track_cache.setDown(value)
|
||||
|
||||
case "load_on_start":
|
||||
self.behavior_settings.load_on_start.setChecked(value)
|
||||
|
||||
def write_settings(self):
|
||||
self.app.settings.library_path = self.file_settings.library_path_input.text()
|
||||
self.app.settings.clear_track_cache = self.behavior_settings.clear_track_cache.isChecked()
|
||||
self.app.settings.load_on_start = self.behavior_settings.load_on_start.isChecked()
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ class TrackProgressSlider(QSlider):
|
|||
self.sliderPressed.connect(self.on_press)
|
||||
self.sliderReleased.connect(self.on_release)
|
||||
|
||||
def post_init(self):
|
||||
def late_init(self):
|
||||
self.track_control = self.app.gui.track_control
|
||||
|
||||
def mousePressEvent(self, event: QMouseEvent):
|
||||
|
|
Loading…
Add table
Reference in a new issue