forked from Wobbl/Wobuzz
OOPing it more: Removed gui_communication/settings.py
This commit is contained in:
parent
3685f25882
commit
d2c74438cb
5 changed files with 24 additions and 35 deletions
|
@ -6,9 +6,11 @@ from .file import FileSettings
|
|||
|
||||
|
||||
class Settings(QDockWidget):
|
||||
def __init__(self, parent=None):
|
||||
def __init__(self, app, parent=None):
|
||||
super().__init__(parent)
|
||||
|
||||
self.app = app
|
||||
|
||||
self.setAllowedAreas(
|
||||
Qt.DockWidgetArea.LeftDockWidgetArea |
|
||||
Qt.DockWidgetArea.RightDockWidgetArea |
|
||||
|
@ -32,3 +34,17 @@ class Settings(QDockWidget):
|
|||
|
||||
self.setWidget(self.content)
|
||||
|
||||
self.visibilityChanged.connect(self.update_all)
|
||||
self.save_button.pressed.connect(self.write_settings)
|
||||
|
||||
def update_all(self, _=True): # ignore visible parameter passed by visibilityChanged event
|
||||
self.file_settings.library_path_input.setText(self.app.settings.library_path)
|
||||
|
||||
def update_settings(self, key, value):
|
||||
match key:
|
||||
case "library_path":
|
||||
self.file_settings.library_path_input.setText(value)
|
||||
|
||||
def write_settings(self):
|
||||
self.app.settings.library_path = self.file_settings.library_path_input.text()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue