lib settings
This commit is contained in:
@@ -21,10 +21,13 @@ class SettingsDialogLike(Protocol):
|
||||
@property
|
||||
def snap_to_grid_size(self) -> int: ...
|
||||
|
||||
@property
|
||||
def library_paths(self) -> list[str]: ...
|
||||
|
||||
def exec(self) -> int: ...
|
||||
|
||||
|
||||
SettingsDialogFactory = Callable[[int, int, MainWindow], SettingsDialogLike]
|
||||
SettingsDialogFactory = Callable[[int, int, list[str], MainWindow], SettingsDialogLike]
|
||||
|
||||
|
||||
class SettingsController(QObject):
|
||||
@@ -44,12 +47,13 @@ class SettingsController(QObject):
|
||||
window.ui.actionSettings.triggered.connect(self.open_settings)
|
||||
|
||||
def open_settings(self) -> None:
|
||||
dialog = self.dialog_factory(self.settings.log_level, self.settings.snap_to_grid_size, self.window)
|
||||
dialog = self.dialog_factory(self.settings.log_level, self.settings.snap_to_grid_size, self.settings.library_paths, self.window)
|
||||
if dialog.exec() != QDialog.DialogCode.Accepted:
|
||||
return
|
||||
|
||||
self.settings.log_level = dialog.log_level
|
||||
self.settings.snap_to_grid_size = dialog.snap_to_grid_size
|
||||
self.settings.library_paths = dialog.library_paths
|
||||
self.window.graph_editor.set_snap_to_grid_size(dialog.snap_to_grid_size)
|
||||
set_log_level(dialog.log_level)
|
||||
logger.info("Application settings updated")
|
||||
|
||||
Reference in New Issue
Block a user