Skip to content

Commit

Permalink
[EDCD#1293][EDCD#1124] Resize Settings Window, Reorder Plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Rixxan committed May 28, 2024
1 parent 5fa8f68 commit 6660ab7
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class PreferencesDialog(tk.Toplevel):
"""The EDMC preferences dialog."""

def __init__(self, parent: tk.Tk, callback: Optional[Callable]):
tk.Toplevel.__init__(self, parent)
super().__init__(parent)

self.parent = parent
self.callback = callback
Expand All @@ -242,42 +242,48 @@ def __init__(self, parent: tk.Tk, callback: Optional[Callable]):
if parent.winfo_viewable():
self.transient(parent)

# position over parent
# http://core.tcl.tk/tk/tktview/c84f660833546b1b84e7
# TODO this is fixed supposedly.
# Position over parent
self.geometry(f'+{parent.winfo_rootx()}+{parent.winfo_rooty()}')

# remove decoration
# Remove decoration
if sys.platform == 'win32':
self.attributes('-toolwindow', tk.TRUE)

self.resizable(tk.FALSE, tk.FALSE)
# Allow the window to be resizable
self.resizable(tk.TRUE, tk.TRUE)

self.cmdr: str | bool | None = False # Note if Cmdr changes in the Journal
self.is_beta: bool = False # Note if Beta status changes in the Journal
self.cmdrchanged_alarm: Optional[str] = None # This stores an ID that can be used to cancel a scheduled call

# Set up the main frame
frame = ttk.Frame(self)
frame.grid(sticky=tk.NSEW)
self.columnconfigure(0, weight=1)
self.rowconfigure(0, weight=1)
frame.columnconfigure(0, weight=1)
frame.rowconfigure(0, weight=1)
frame.rowconfigure(1, weight=0)

notebook: ttk.Notebook = nb.Notebook(frame)
notebook: nb.Notebook = nb.Notebook(frame)
notebook.bind('<<NotebookTabChanged>>', self.tabchanged) # Recompute on tab change

self.PADX = 10
self.BUTTONX = 12 # indent Checkbuttons and Radiobuttons
self.LISTX = 25 # indent listed items
self.PADY = 1 # close spacing
self.BOXY = 2 # box spacing
self.SEPY = 10 # seperator line spacing
self.SEPY = 10 # separator line spacing

# Set up different tabs
self.__setup_output_tab(notebook)
self.__setup_plugin_tabs(notebook)
self.__setup_config_tab(notebook)
self.__setup_privacy_tab(notebook)
self.__setup_appearance_tab(notebook)
self.__setup_output_tab(notebook)
self.__setup_privacy_tab(notebook)
self.__setup_plugin_tab(notebook)
self.__setup_plugin_tabs(notebook)

# Set up the button frame
buttonframe = ttk.Frame(frame)
buttonframe.grid(padx=self.PADX, pady=self.PADX, sticky=tk.NSEW)
buttonframe.columnconfigure(0, weight=1)
Expand All @@ -298,7 +304,7 @@ def __init__(self, parent: tk.Tk, callback: Optional[Callable]):

# wait for window to appear on screen before calling grab_set
self.parent.update_idletasks()
self.parent.wm_attributes('-topmost', 0) # needed for dialog to appear ontop of parent on Linux
self.parent.wm_attributes('-topmost', 0) # needed for dialog to appear on top of parent on Linux
self.wait_visibility()
self.grab_set()

Expand Down

0 comments on commit 6660ab7

Please sign in to comment.