Added "library_path" setting, added a gui for the settings, changed the window layout and did a bunch of other things.

This commit is contained in:
The Wobbler 2024-12-24 12:13:24 +01:00
parent 259ec72442
commit 6498f43d5f
10 changed files with 124 additions and 37 deletions

View file

@ -1,6 +1,8 @@
#!/usr/bin/python3
from .menu_bar import MenuBar
from .track_control import TrackControl
from .settings import Settings
class GUICommunication:
@ -11,13 +13,15 @@ class GUICommunication:
def __init__(self, app):
self.app = app
self.menu_bar = MenuBar(self.app)
self.track_control = TrackControl(self.app)
self.settings = Settings(self.app)
self.connect()
def connect(self):
pass
self.settings.update_all()
def on_track_start(self):
self.track_control.on_track_start()
def on_settings_change(self, key, value):
self.settings.update_settings(key, value)

View file

@ -0,0 +1,17 @@
#!/usr/bin/python3
class MenuBar:
def __init__(self, app):
self.app = app
self.window = self.app.gui.window
self.settings_action = self.window.settings_action
self.connect()
def connect(self):
self.settings_action.triggered.connect(self.show_settings)
def show_settings(self):
self.window.settings.show()

View file

@ -0,0 +1,25 @@
#!/usr/bin/python3
class Settings:
def __init__(self, app):
self.app = app
self.settings = self.app.gui.window.settings
self.connect()
def connect(self):
self.settings.file_settings.library_path_input.returnPressed.connect(self.write_settings)
def update_all(self):
self.settings.file_settings.library_path_input.setText(self.app.settings.library_path)
def update_settings(self, key, value):
match key:
case "library_path":
self.settings.file_settings.library_path_input.setText(value)
def write_settings(self):
self.app.settings.library_path = self.settings.file_settings.library_path_input.text()

View file

@ -13,7 +13,7 @@ class TrackControl:
def __init__(self, app):
self.app = app
self.track_control = self.app.gui.window.main_container.track_control
self.track_control = self.app.gui.window.track_control
self.track_progress_slider = self.track_control.track_progress_slider
self.progress_update_timer = QTimer()