mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 07:47:14 +03:00
[2088] fix UI bugs, introduce standard
- Fixes #2088 and #2089. - Adds usage of ``row=`` for ``.grid()`` for all config entries in included plugins. - Changes all config pages to start at row 0. - Starts introducing a standard for config panel layouts.
This commit is contained in:
parent
fae7b32e43
commit
07ae14be5a
@ -2098,13 +2098,15 @@ def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame:
|
||||
|
||||
eddnframe = nb.Frame(parent)
|
||||
|
||||
cur_row = 0
|
||||
HyperlinkLabel(
|
||||
eddnframe,
|
||||
text='Elite Dangerous Data Network',
|
||||
background=nb.Label().cget('background'),
|
||||
url='https://github.com/EDCD/EDDN#eddn---elite-dangerous-data-network',
|
||||
underline=True
|
||||
).grid(padx=PADX, sticky=tk.W) # Don't translate
|
||||
).grid(row=cur_row, padx=PADX, sticky=tk.W) # Don't translate
|
||||
cur_row += 1
|
||||
|
||||
this.eddn_station = tk.IntVar(value=(output & config.OUT_EDDN_SEND_STATION_DATA) and 1)
|
||||
this.eddn_station_button = nb.Checkbutton(
|
||||
@ -2114,8 +2116,9 @@ def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame:
|
||||
variable=this.eddn_station,
|
||||
command=prefsvarchanged
|
||||
) # Output setting
|
||||
this.eddn_station_button.grid(row=cur_row, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
|
||||
cur_row += 1
|
||||
|
||||
this.eddn_station_button.grid(padx=BUTTONX, pady=(5, 0), sticky=tk.W)
|
||||
this.eddn_system = tk.IntVar(value=(output & config.OUT_EDDN_SEND_NON_STATION) and 1)
|
||||
# Output setting new in E:D 2.2
|
||||
this.eddn_system_button = nb.Checkbutton(
|
||||
@ -2125,8 +2128,9 @@ def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame:
|
||||
variable=this.eddn_system,
|
||||
command=prefsvarchanged
|
||||
)
|
||||
this.eddn_system_button.grid(row=cur_row, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
|
||||
cur_row += 1
|
||||
|
||||
this.eddn_system_button.grid(padx=BUTTONX, pady=(5, 0), sticky=tk.W)
|
||||
this.eddn_delay = tk.IntVar(value=(output & config.OUT_EDDN_DELAY) and 1)
|
||||
# Output setting under 'Send system and scan data to the Elite Dangerous Data Network' new in E:D 2.2
|
||||
this.eddn_delay_button = nb.Checkbutton(
|
||||
@ -2135,7 +2139,7 @@ def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame:
|
||||
text=_('Delay sending until docked'),
|
||||
variable=this.eddn_delay
|
||||
)
|
||||
this.eddn_delay_button.grid(padx=BUTTONX, sticky=tk.W)
|
||||
this.eddn_delay_button.grid(row=cur_row, padx=BUTTONX, sticky=tk.W)
|
||||
|
||||
return eddnframe
|
||||
|
||||
|
@ -298,13 +298,15 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr
|
||||
frame = nb.Frame(parent)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
cur_row = 0
|
||||
HyperlinkLabel(
|
||||
frame,
|
||||
text='Elite Dangerous Star Map',
|
||||
background=nb.Label().cget('background'),
|
||||
url='https://www.edsm.net/',
|
||||
underline=True
|
||||
).grid(columnspan=2, padx=PADX, sticky=tk.W)
|
||||
).grid(row=cur_row, columnspan=2, padx=PADX, sticky=tk.W)
|
||||
cur_row += 1
|
||||
|
||||
this.log = tk.IntVar(value=config.get_int('edsm_out') and 1)
|
||||
this.log_button = nb.Checkbutton(
|
||||
@ -314,9 +316,11 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr
|
||||
command=prefsvarchanged
|
||||
)
|
||||
if this.log_button:
|
||||
this.log_button.grid(columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
|
||||
this.log_button.grid(row=cur_row, columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
|
||||
cur_row += 1
|
||||
|
||||
nb.Label(frame).grid(sticky=tk.W) # big spacer
|
||||
nb.Label(frame).grid(row=cur_row, sticky=tk.W) # big spacer
|
||||
cur_row += 1
|
||||
|
||||
this.label = HyperlinkLabel(
|
||||
frame,
|
||||
@ -325,10 +329,10 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr
|
||||
url='https://www.edsm.net/settings/api',
|
||||
underline=True
|
||||
)
|
||||
cur_row = 10
|
||||
if this.label:
|
||||
this.label.grid(columnspan=2, padx=PADX, sticky=tk.W)
|
||||
this.label.grid(row=cur_row, columnspan=2, padx=PADX, sticky=tk.W)
|
||||
# LANG: Game Commander name label in EDSM settings
|
||||
cur_row += 1
|
||||
this.cmdr_label = nb.Label(frame, text=_('Cmdr'))
|
||||
this.cmdr_label.grid(row=cur_row, padx=PADX, sticky=tk.W)
|
||||
this.cmdr_text = nb.Label(frame)
|
||||
@ -347,6 +351,7 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr
|
||||
this.apikey_label.grid(row=cur_row, padx=PADX, sticky=tk.W)
|
||||
this.apikey = nb.Entry(frame, show="*", width=50)
|
||||
this.apikey.grid(row=cur_row, column=1, padx=PADX, pady=PADY, sticky=tk.EW)
|
||||
cur_row += 1
|
||||
|
||||
prefs_cmdr_changed(cmdr, is_beta)
|
||||
|
||||
@ -358,7 +363,7 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr
|
||||
variable=show_password_var,
|
||||
command=toggle_password_visibility
|
||||
)
|
||||
show_password_checkbox.grid(columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
|
||||
show_password_checkbox.grid(row=cur_row, columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
|
||||
|
||||
return frame
|
||||
|
||||
|
@ -250,13 +250,15 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str, is_beta: bool) -> tk.Frame:
|
||||
x_padding = 10
|
||||
x_button_padding = 12 # indent Checkbuttons and Radiobuttons
|
||||
y_padding = 2 # close spacing
|
||||
cur_row = 0
|
||||
|
||||
frame = nb.Frame(parent)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
|
||||
HyperlinkLabel(
|
||||
frame, text='Inara', background=nb.Label().cget('background'), url='https://inara.cz/', underline=True
|
||||
).grid(columnspan=2, padx=x_padding, sticky=tk.W) # Don't translate
|
||||
).grid(row=cur_row, columnspan=2, padx=x_padding, sticky=tk.W) # Don't translate
|
||||
cur_row += 1
|
||||
|
||||
this.log = tk.IntVar(value=config.get_int('inara_out') and 1)
|
||||
this.log_button = nb.Checkbutton(
|
||||
@ -266,9 +268,11 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str, is_beta: bool) -> tk.Frame:
|
||||
command=prefsvarchanged
|
||||
)
|
||||
|
||||
this.log_button.grid(columnspan=2, padx=x_button_padding, pady=(5, 0), sticky=tk.W)
|
||||
this.log_button.grid(row=cur_row, columnspan=2, padx=x_button_padding, pady=(5, 0), sticky=tk.W)
|
||||
cur_row += 1
|
||||
|
||||
nb.Label(frame).grid(sticky=tk.W) # big spacer
|
||||
nb.Label(frame).grid(row=cur_row, sticky=tk.W) # big spacer
|
||||
cur_row += 1
|
||||
|
||||
# Section heading in settings
|
||||
this.label = HyperlinkLabel(
|
||||
@ -279,13 +283,15 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str, is_beta: bool) -> tk.Frame:
|
||||
underline=True
|
||||
)
|
||||
|
||||
this.label.grid(columnspan=2, padx=x_padding, sticky=tk.W)
|
||||
this.label.grid(row=cur_row, columnspan=2, padx=x_padding, sticky=tk.W)
|
||||
cur_row += 1
|
||||
|
||||
# LANG: Inara API key label
|
||||
this.apikey_label = nb.Label(frame, text=_('API Key')) # Inara setting
|
||||
this.apikey_label.grid(row=12, padx=x_padding, sticky=tk.W)
|
||||
this.apikey_label.grid(row=cur_row, padx=x_padding, sticky=tk.W)
|
||||
this.apikey = nb.Entry(frame, show="*", width=50)
|
||||
this.apikey.grid(row=12, column=1, padx=x_padding, pady=y_padding, sticky=tk.EW)
|
||||
this.apikey.grid(row=cur_row, column=1, padx=x_padding, pady=y_padding, sticky=tk.EW)
|
||||
cur_row += 1
|
||||
|
||||
prefs_cmdr_changed(cmdr, is_beta)
|
||||
|
||||
@ -296,7 +302,7 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str, is_beta: bool) -> tk.Frame:
|
||||
variable=show_password_var,
|
||||
command=toggle_password_visibility,
|
||||
)
|
||||
show_password_checkbox.grid(columnspan=2, padx=x_padding, pady=(5, 0), sticky=tk.W)
|
||||
show_password_checkbox.grid(row=cur_row, columnspan=2, padx=x_padding, pady=(5, 0), sticky=tk.W)
|
||||
|
||||
return frame
|
||||
|
||||
|
45
prefs.py
45
prefs.py
@ -347,7 +347,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
else:
|
||||
output = config.get_int('output')
|
||||
|
||||
row = AutoInc(start=1)
|
||||
row = AutoInc(start=0)
|
||||
|
||||
# LANG: Settings > Output - choosing what data to save to files
|
||||
self.out_label = nb.Label(output_frame, text=_('Please choose what data to save'))
|
||||
@ -396,7 +396,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
# LANG: Settings > Output - Label for "where files are located"
|
||||
self.outdir_label = nb.Label(output_frame, text=_('File location')+':') # Section heading in settings
|
||||
# Type ignored due to incorrect type annotation. a 2 tuple does padding for each side
|
||||
self.outdir_label.grid(padx=self.PADX, pady=(5, 0), sticky=tk.W, row=row.get()) # type: ignore
|
||||
self.outdir_label.grid(padx=self.PADX, pady=(0, self.PADY), sticky=tk.W, row=row.get()) # type: ignore
|
||||
|
||||
self.outdir_entry = nb.Entry(output_frame, takefocus=False)
|
||||
self.outdir_entry.grid(columnspan=2, padx=self.PADX, pady=(0, self.PADY), sticky=tk.EW, row=row.get())
|
||||
@ -415,7 +415,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
# LANG: Settings > Output - Label for "where files are located"
|
||||
command=lambda: self.filebrowse(_('File location'), self.outdir)
|
||||
)
|
||||
self.outbutton.grid(column=1, padx=self.PADX, pady=self.PADY, sticky=tk.NSEW, row=row.get())
|
||||
self.outbutton.grid(column=1, padx=self.PADX, pady=self.PADY, sticky=tk.EW, row=row.get())
|
||||
|
||||
nb.Frame(output_frame).grid(row=row.get()) # bottom spacer # TODO: does nothing?
|
||||
|
||||
@ -431,7 +431,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
def __setup_config_tab(self, notebook: ttk.Notebook) -> None: # noqa: CCR001
|
||||
config_frame = nb.Frame(notebook)
|
||||
config_frame.columnconfigure(1, weight=1)
|
||||
row = AutoInc(start=1)
|
||||
row = AutoInc(start=0)
|
||||
|
||||
self.logdir = tk.StringVar()
|
||||
default = config.default_journal_dir if config.default_journal_dir_path is not None else ''
|
||||
@ -709,21 +709,21 @@ class PreferencesDialog(tk.Toplevel):
|
||||
frame = nb.Frame(notebook)
|
||||
self.hide_multicrew_captain = tk.BooleanVar(value=config.get_bool('hide_multicrew_captain', default=False))
|
||||
self.hide_private_group = tk.BooleanVar(value=config.get_bool('hide_private_group', default=False))
|
||||
row = AutoInc()
|
||||
row = AutoInc(start=0)
|
||||
|
||||
# LANG: UI elements privacy section header in privacy tab of preferences
|
||||
nb.Label(frame, text=_('Main UI privacy options')).grid(
|
||||
row=row.get(), column=0, sticky=tk.W, padx=self.PADX, pady=self.PADY
|
||||
row=row.get(), column=0, sticky=tk.W, padx=self.PADX
|
||||
)
|
||||
|
||||
nb.Checkbutton(
|
||||
frame, text=_('Hide private group name in UI'), # LANG: Hide private group owner name from UI checkbox
|
||||
variable=self.hide_private_group
|
||||
).grid(row=row.get(), column=0, padx=self.PADX, pady=self.PADY)
|
||||
).grid(row=row.get(), column=0, padx=self.BUTTONX, pady=self.PADY, sticky=tk.W)
|
||||
nb.Checkbutton(
|
||||
frame, text=_('Hide multi-crew captain name'), # LANG: Hide multicrew captain name from main UI checkbox
|
||||
variable=self.hide_multicrew_captain
|
||||
).grid(row=row.get(), column=0, padx=self.PADX, pady=self.PADY)
|
||||
).grid(row=row.get(), column=0, padx=self.BUTTONX, pady=self.PADY, sticky=tk.W)
|
||||
|
||||
notebook.add(frame, text=_('Privacy')) # LANG: Preferences privacy tab title
|
||||
|
||||
@ -743,7 +743,7 @@ class PreferencesDialog(tk.Toplevel):
|
||||
_('Highlighted text'), # Dark theme color setting
|
||||
]
|
||||
|
||||
row = AutoInc(start=1)
|
||||
row = AutoInc(start=0)
|
||||
|
||||
appearance_frame = nb.Frame(notebook)
|
||||
appearance_frame.columnconfigure(2, weight=1)
|
||||
@ -923,30 +923,29 @@ class PreferencesDialog(tk.Toplevel):
|
||||
plugins_frame.columnconfigure(0, weight=1)
|
||||
plugdir = tk.StringVar()
|
||||
plugdir.set(config.plugin_dir)
|
||||
row = AutoInc(1)
|
||||
row = AutoInc(start=0)
|
||||
|
||||
# Section heading in settings
|
||||
# LANG: Label for location of third-party plugins folder
|
||||
nb.Label(plugins_frame, text=_('Plugins folder') + ':').grid(padx=self.PADX, pady=(0, self.PADY), sticky=tk.W, row=row.get())
|
||||
|
||||
plugdirentry = nb.Entry(plugins_frame, justify=tk.LEFT)
|
||||
self.displaypath(plugdir, plugdirentry)
|
||||
with row as cur_row:
|
||||
# Section heading in settings
|
||||
# LANG: Label for location of third-party plugins folder
|
||||
nb.Label(plugins_frame, text=_('Plugins folder') + ':').grid(padx=self.PADX, sticky=tk.W, row=cur_row)
|
||||
plugdirentry.grid(columnspan=2, padx=self.PADX, pady=(0, self.PADY), sticky=tk.EW, row=row.get())
|
||||
|
||||
plugdirentry.grid(padx=self.PADX, sticky=tk.EW, row=cur_row)
|
||||
|
||||
nb.Button(
|
||||
plugins_frame,
|
||||
# LANG: Label on button used to open a filesystem folder
|
||||
text=_('Open'), # Button that opens a folder in Explorer/Finder
|
||||
command=lambda: webbrowser.open(f'file:///{config.plugin_dir_path}')
|
||||
).grid(column=1, padx=(0, self.PADX), sticky=tk.NSEW, row=cur_row)
|
||||
nb.Button(
|
||||
plugins_frame,
|
||||
# LANG: Label on button used to open a filesystem folder
|
||||
text=_('Open'), # Button that opens a folder in Explorer/Finder
|
||||
command=lambda: webbrowser.open(f'file:///{config.plugin_dir_path}')
|
||||
).grid(column=1, padx=self.PADX, pady=self.PADY, sticky=tk.EW, row=row.get())
|
||||
|
||||
nb.Label(
|
||||
plugins_frame,
|
||||
# Help text in settings
|
||||
# LANG: Tip/label about how to disable plugins
|
||||
text=_("Tip: You can disable a plugin by{CR}adding '{EXT}' to its folder name").format(EXT='.disabled')
|
||||
).grid(columnspan=2, padx=self.PADX, pady=10, sticky=tk.NSEW, row=row.get())
|
||||
).grid(columnspan=2, padx=self.PADX, pady=10, sticky=tk.EW, row=row.get())
|
||||
|
||||
enabled_plugins = list(filter(lambda x: x.folder and x.module, plug.PLUGINS))
|
||||
if len(enabled_plugins):
|
||||
|
Loading…
x
Reference in New Issue
Block a user