Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: #678 refresh the engine configuration if settings change #700

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/main/python/main/ayab/ayab.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def __activate_menu(self) -> None:
def __set_prefs(self) -> None:
self.prefs.open_dialog()
self.scene.refresh()
self.engine.reload_settings()

def __quit(self) -> None:
logging.debug("Quitting")
Expand Down
7 changes: 5 additions & 2 deletions src/main/python/main/ayab/engine/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def __init__(self, parent: GuiMain):
self.ui.setupUi(self)
self.config: OptionsTab = OptionsTab(parent)
self.config.portname = self.__read_portname()
self.config.refresh()
self.reload_settings()
self.status = StatusTab()
self.setup_ui()
parent.ui.dock_container_layout.addWidget(self)
Expand All @@ -70,7 +70,6 @@ def __init__(self, parent: GuiMain):
self.control = Control(parent, self)
self.__feedback = FeedbackHandler(parent)
self.__logger = logging.getLogger(type(self).__name__)
self.setWindowTitle("Machine: " + Machine(self.config.machine).name)

def __del__(self) -> None:
self.control.stop()
Expand All @@ -90,6 +89,10 @@ def setup_ui(self) -> None:
# activate UI elements
self.__activate_ui()

def reload_settings(self) -> None:
self.config.refresh()
self.setWindowTitle("Machine: " + Machine(self.config.machine).name)

def __disable_status_tab(self) -> None:
self.ui.tab_widget.setTabEnabled(1, False)
self.status.ui.label_progress.setText("")
Expand Down