Skip to content

Commit

Permalink
[2095] Standardize horizontal Padding
Browse files Browse the repository at this point in the history
- Standardizes horizontal Padding.
- Fixes further padding issues.
- Part of EDCD#2095
  • Loading branch information
Phoebe committed Nov 17, 2023
1 parent fc9775b commit a3c1763
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 107 deletions.
26 changes: 17 additions & 9 deletions plugins/coriolis.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,48 +84,56 @@ def plugin_start3(path: str) -> str:
def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Frame:
"""Set up plugin preferences."""
PADX = 10 # noqa: N806
PADY = 1 # noqa: N806
BOXY = 2 # noqa: N806 # box spacing

conf_frame = nb.Frame(parent)
conf_frame.columnconfigure(index=1, weight=1)
cur_row = 0
# LANG: Settings>Coriolis: Help/hint for changing coriolis URLs
nb.Label(conf_frame, text=_(
"Set the URL to use with coriolis.io ship loadouts. Note that this MUST end with '/import?data='"
)).grid(sticky=tk.EW, row=cur_row, column=0, padx=PADX, columnspan=3)
)).grid(sticky=tk.EW, row=cur_row, column=0, padx=PADX, pady=PADY, columnspan=3)
cur_row += 1

# LANG: Settings>Coriolis: Label for 'NOT alpha/beta game version' URL
nb.Label(conf_frame, text=_('Normal URL')).grid(sticky=tk.W, row=cur_row, column=0, padx=PADX)
nb.Label(conf_frame, text=_('Normal URL')).grid(sticky=tk.W, row=cur_row, column=0, padx=PADX, pady=PADY)
nb.Entry(conf_frame,
textvariable=coriolis_config.normal_textvar).grid(sticky=tk.EW, row=cur_row, column=1, padx=PADX)
textvariable=coriolis_config.normal_textvar).grid(
sticky=tk.EW, row=cur_row, column=1, padx=PADX, pady=BOXY
)
# LANG: Generic 'Reset' button label
nb.Button(conf_frame, text=_("Reset"),
command=lambda: coriolis_config.normal_textvar.set(value=DEFAULT_NORMAL_URL)).grid(
sticky=tk.W, row=cur_row, column=2, padx=PADX
sticky=tk.W, row=cur_row, column=2, padx=PADX, pady=0
)
cur_row += 1

# LANG: Settings>Coriolis: Label for 'alpha/beta game version' URL
nb.Label(conf_frame, text=_('Beta URL')).grid(sticky=tk.W, row=cur_row, column=0, padx=PADX)
nb.Entry(conf_frame, textvariable=coriolis_config.beta_textvar).grid(sticky=tk.EW, row=cur_row, column=1, padx=PADX)
nb.Label(conf_frame, text=_('Beta URL')).grid(sticky=tk.W, row=cur_row, column=0, padx=PADX, pady=PADY)
nb.Entry(conf_frame, textvariable=coriolis_config.beta_textvar).grid(
sticky=tk.EW, row=cur_row, column=1, padx=PADX, pady=BOXY
)
# LANG: Generic 'Reset' button label
nb.Button(conf_frame, text=_('Reset'),
command=lambda: coriolis_config.beta_textvar.set(value=DEFAULT_BETA_URL)).grid(
sticky=tk.W, row=cur_row, column=2, padx=PADX
sticky=tk.W, row=cur_row, column=2, padx=PADX, pady=0
)
cur_row += 1

# TODO: This needs a help/hint text to be sure users know what it's for.
# LANG: Settings>Coriolis: Label for selection of using Normal, Beta or 'auto' Coriolis URL
nb.Label(conf_frame, text=_('Override Beta/Normal Selection')).grid(sticky=tk.W, row=cur_row, column=0, padx=PADX)
nb.Label(conf_frame, text=_('Override Beta/Normal Selection')).grid(
sticky=tk.W, row=cur_row, column=0, padx=PADX, pady=PADY
)
nb.OptionMenu(
conf_frame,
coriolis_config.override_textvar,
coriolis_config.override_textvar.get(),
_('Normal'), # LANG: 'Normal' label for Coriolis site override selection
_('Beta'), # LANG: 'Beta' label for Coriolis site override selection
_('Auto') # LANG: 'Auto' label for Coriolis site override selection
).grid(sticky=tk.W, row=cur_row, column=1, padx=PADX)
).grid(sticky=tk.W, row=cur_row, column=1, padx=PADX, pady=BOXY)
cur_row += 1

return conf_frame
Expand Down
4 changes: 2 additions & 2 deletions plugins/eddn.py
Original file line number Diff line number Diff line change
Expand Up @@ -2089,7 +2089,7 @@ def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame:
"""
PADX = 10 # noqa: N806
BUTTONX = 12 # noqa: N806 # indent Checkbuttons and Radiobuttons
PADY = 2 # noqa: N806
PADY = 1 # noqa: N806

if prefsVersion.shouldSetDefaults('0.0.0.0', not bool(config.get_int('output'))):
output: int = config.OUT_EDDN_SEND_STATION_DATA | config.OUT_EDDN_SEND_NON_STATION # default settings
Expand All @@ -2106,7 +2106,7 @@ def plugin_prefs(parent, cmdr: str, is_beta: bool) -> Frame:
background=nb.Label().cget('background'),
url='https://github.com/EDCD/EDDN#eddn---elite-dangerous-data-network',
underline=True
).grid(row=cur_row, padx=PADX, sticky=tk.W) # Don't translate
).grid(row=cur_row, padx=PADX, pady=PADY, sticky=tk.W) # Don't translate
cur_row += 1

this.eddn_station = tk.IntVar(value=(output & config.OUT_EDDN_SEND_STATION_DATA) and 1)
Expand Down
25 changes: 13 additions & 12 deletions plugins/edsm.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,9 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr
"""
PADX = 10 # noqa: N806
BUTTONX = 12 # noqa: N806
PADY = 2 # noqa: N806
SEPY = 10 # noqa: N806
PADY = 1 # noqa: N806
BOXY = 2 # noqa: N806
SEPY = 10 # noqa: N806

frame = nb.Frame(parent)
frame.columnconfigure(1, weight=1)
Expand All @@ -306,7 +307,7 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr
background=nb.Label().cget('background'),
url='https://www.edsm.net/',
underline=True
).grid(row=cur_row, columnspan=2, padx=PADX, sticky=tk.W)
).grid(row=cur_row, columnspan=2, padx=PADX, pady=PADY, sticky=tk.W)
cur_row += 1

this.log = tk.IntVar(value=config.get_int('edsm_out') and 1)
Expand All @@ -317,7 +318,7 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr
command=prefsvarchanged
)
if this.log_button:
this.log_button.grid(row=cur_row, columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
this.log_button.grid(row=cur_row, columnspan=2, padx=BUTTONX, pady=PADY, sticky=tk.W)
cur_row += 1

ttk.Separator(frame, orient=tk.HORIZONTAL).grid(
Expand All @@ -333,27 +334,27 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str | None, is_beta: bool) -> tk.Fr
underline=True
)
if this.label:
this.label.grid(row=cur_row, columnspan=2, padx=PADX, sticky=tk.W)
this.label.grid(row=cur_row, columnspan=2, padx=PADX, pady=PADY, 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_label.grid(row=cur_row, padx=PADX, pady=PADY, sticky=tk.W)
this.cmdr_text = nb.Label(frame)
this.cmdr_text.grid(row=cur_row, column=1, padx=PADX, pady=PADY, sticky=tk.W)
this.cmdr_text.grid(row=cur_row, column=1, padx=PADX, pady=BOXY, sticky=tk.W)

cur_row += 1
# LANG: EDSM Commander name label in EDSM settings
this.user_label = nb.Label(frame, text=_('Commander Name'))
this.user_label.grid(row=cur_row, padx=PADX, sticky=tk.W)
this.user_label.grid(row=cur_row, padx=PADX, pady=PADY, sticky=tk.W)
this.user = nb.Entry(frame)
this.user.grid(row=cur_row, column=1, padx=PADX, pady=PADY, sticky=tk.EW)
this.user.grid(row=cur_row, column=1, padx=PADX, pady=BOXY, sticky=tk.EW)

cur_row += 1
# LANG: EDSM API key label
this.apikey_label = nb.Label(frame, text=_('API Key'))
this.apikey_label.grid(row=cur_row, padx=PADX, sticky=tk.W)
this.apikey_label.grid(row=cur_row, padx=PADX, pady=PADY, 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)
this.apikey.grid(row=cur_row, column=1, padx=PADX, pady=BOXY, sticky=tk.EW)
cur_row += 1

prefs_cmdr_changed(cmdr, is_beta)
Expand All @@ -366,7 +367,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(row=cur_row, columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
show_password_checkbox.grid(row=cur_row, columnspan=2, padx=BUTTONX, pady=PADY, sticky=tk.W)

return frame

Expand Down
17 changes: 9 additions & 8 deletions plugins/inara.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,16 +249,17 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str, is_beta: bool) -> tk.Frame:
"""Plugin Preferences UI hook."""
PADX = 10 # noqa: N806
BUTTONX = 12 # noqa: N806 # indent Checkbuttons and Radiobuttons
PADY = 2 # noqa: N806 # close spacing
PADY = 1 # noqa: N806 # close spacing
BOXY = 2 # noqa: N806 # box spacing
SEPY = 10 # noqa: N806 # seperator line spacing
cur_row = 0 # noqa: N806
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(row=cur_row, columnspan=2, padx=PADX, sticky=tk.W) # Don't translate
).grid(row=cur_row, columnspan=2, padx=PADX, pady=PADY, sticky=tk.W) # Don't translate
cur_row += 1

this.log = tk.IntVar(value=config.get_int('inara_out') and 1)
Expand All @@ -269,7 +270,7 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str, is_beta: bool) -> tk.Frame:
command=prefsvarchanged
)

this.log_button.grid(row=cur_row, columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
this.log_button.grid(row=cur_row, columnspan=2, padx=BUTTONX, pady=PADY, sticky=tk.W)
cur_row += 1

ttk.Separator(frame, orient=tk.HORIZONTAL).grid(
Expand All @@ -286,14 +287,14 @@ def plugin_prefs(parent: ttk.Notebook, cmdr: str, is_beta: bool) -> tk.Frame:
underline=True
)

this.label.grid(row=cur_row, columnspan=2, padx=PADX, sticky=tk.W)
this.label.grid(row=cur_row, columnspan=2, padx=PADX, pady=PADY, 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=cur_row, padx=PADX, sticky=tk.W)
this.apikey_label.grid(row=cur_row, padx=PADX, pady=PADY, 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)
this.apikey.grid(row=cur_row, column=1, padx=PADX, pady=BOXY, sticky=tk.EW)
cur_row += 1

prefs_cmdr_changed(cmdr, is_beta)
Expand All @@ -305,7 +306,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(row=cur_row, columnspan=2, padx=BUTTONX, pady=(5, 0), sticky=tk.W)
show_password_checkbox.grid(row=cur_row, columnspan=2, padx=BUTTONX, pady=PADY, sticky=tk.W)

return frame

Expand Down
Loading

0 comments on commit a3c1763

Please sign in to comment.