From 09103392bbdf5c2f611c8a1df4c317e26c509a0a Mon Sep 17 00:00:00 2001 From: "Dr.-Ing. Amilcar do Carmo Lucas" Date: Fri, 1 Nov 2024 16:36:00 +0100 Subject: [PATCH] FIX: parent.attributes('-disabled', bool) only works on windows --- .../frontend_tkinter_component_editor_base.py | 10 +++++++--- .../frontend_tkinter_parameter_editor.py | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/MethodicConfigurator/frontend_tkinter_component_editor_base.py b/MethodicConfigurator/frontend_tkinter_component_editor_base.py index 1db4540..2f1687f 100644 --- a/MethodicConfigurator/frontend_tkinter_component_editor_base.py +++ b/MethodicConfigurator/frontend_tkinter_component_editor_base.py @@ -19,6 +19,8 @@ from tkinter import ttk from tkinter import messagebox +from platform import system as platform_system + from MethodicConfigurator.common_arguments import add_common_arguments_and_parse from MethodicConfigurator.backend_filesystem import LocalFilesystem @@ -115,7 +117,7 @@ def __init__(self, version, local_filesystem: LocalFilesystem=None): def __display_component_editor_usage_instructions(parent: tk.Tk): usage_popup_window = BaseWindow(parent) usage_popup_window.root.title(_("How to use the component editor")) - usage_popup_window.root.geometry("690x150") + usage_popup_window.root.geometry("690x160") style = ttk.Style() @@ -145,12 +147,14 @@ def __display_component_editor_usage_instructions(parent: tk.Tk): BaseWindow.center_window(usage_popup_window.root, parent) usage_popup_window.root.attributes('-topmost', True) - parent.attributes('-disabled', True) # Disable parent window input + if platform_system() == 'Windows': + parent.attributes('-disabled', True) # Disable parent window input @staticmethod def __close_instructions_window(welcome_window, parent): welcome_window.root.destroy() - parent.attributes('-disabled', False) # Re-enable the parent window + if platform_system() == 'Windows': + parent.attributes('-disabled', False) # Re-enable the parent window parent.focus_set() def update_json_data(self): # should be overwritten in child classes diff --git a/MethodicConfigurator/frontend_tkinter_parameter_editor.py b/MethodicConfigurator/frontend_tkinter_parameter_editor.py index 38682d9..626d5fb 100644 --- a/MethodicConfigurator/frontend_tkinter_parameter_editor.py +++ b/MethodicConfigurator/frontend_tkinter_parameter_editor.py @@ -26,6 +26,8 @@ from typing import List from typing import Tuple +from platform import system as platform_system + from webbrowser import open as webbrowser_open # to open the blog post documentation from MethodicConfigurator.annotate_params import Par @@ -387,12 +389,14 @@ def __please_read_the_docs(parent: tk.Tk): BaseWindow.center_window(welcome_window.root, parent) welcome_window.root.attributes('-topmost', True) - parent.attributes('-disabled', True) # Disable parent window input + if platform_system() == 'Windows': + parent.attributes('-disabled', True) # Disable parent window input @staticmethod def __close_instructions_window(welcome_window, parent): welcome_window.root.destroy() - parent.attributes('-disabled', False) # Re-enable the parent window + if platform_system() == 'Windows': + parent.attributes('-disabled', False) # Re-enable the parent window parent.focus_set() def __do_tempcal_imu(self, selected_file:str):