Skip to content

Commit

Permalink
FIX: parent.attributes('-disabled', bool) only works on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
amilcarlucas committed Nov 1, 2024
1 parent 00a0733 commit 0910339
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
10 changes: 7 additions & 3 deletions MethodicConfigurator/frontend_tkinter_component_editor_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions MethodicConfigurator/frontend_tkinter_parameter_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 0910339

Please sign in to comment.