1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-18 09:57:40 +03:00

Merge pull request #1183 from A-UNDERSCORE-D/fix/1182/Option-to-hide-private-group-name

Add options to hide private group name and multicrew commander name from UI
This commit is contained in:
Athanasius 2021-08-07 19:30:42 +01:00 committed by GitHub
commit 9a393af430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 46 additions and 2 deletions

View File

@ -1096,12 +1096,17 @@ class AppWindow(object):
# Update main window # Update main window
self.cooldown() self.cooldown()
if monitor.cmdr and monitor.state['Captain']: if monitor.cmdr and monitor.state['Captain']:
self.cmdr['text'] = f'{monitor.cmdr} / {monitor.state["Captain"]}' if not config.get_bool('hide_multicrew_captain', default=False):
self.cmdr['text'] = f'{monitor.cmdr} / {monitor.state["Captain"]}'
else:
self.cmdr['text'] = f'{monitor.cmdr}'
self.ship_label['text'] = _('Role') + ':' # LANG: Multicrew role label in main window self.ship_label['text'] = _('Role') + ':' # LANG: Multicrew role label in main window
self.ship.configure(state=tk.NORMAL, text=crewroletext(monitor.state['Role']), url=None) self.ship.configure(state=tk.NORMAL, text=crewroletext(monitor.state['Role']), url=None)
elif monitor.cmdr: elif monitor.cmdr:
if monitor.group: if monitor.group and not config.get_bool("hide_private_group", default=False):
self.cmdr['text'] = f'{monitor.cmdr} / {monitor.group}' self.cmdr['text'] = f'{monitor.cmdr} / {monitor.group}'
else: else:

View File

@ -630,3 +630,15 @@
/* stats.py: Status dialog title; In files: stats.py:376; */ /* stats.py: Status dialog title; In files: stats.py:376; */
"Ships" = "Ships"; "Ships" = "Ships";
/* prefs.py: UI elements privacy section header in privacy tab of preferences; In files: prefs.py:682; */
"Main UI privacy options" = "Main UI privacy options";
/* prefs.py: Hide private group owner name from UI checkbox; In files: prefs.py:687; */
"Hide private group name in UI" = "Hide private group name in UI";
/* prefs.py: Hide multicrew captain name from main UI checkbox; In files: prefs.py:691; */
"Hide multi-crew captain name" = "Hide multi-crew captain name";
/* prefs.py: Preferences privacy tab title; In files: prefs.py:695; */
"Privacy" = "Privacy";

View File

@ -289,6 +289,7 @@ class PreferencesDialog(tk.Toplevel):
self.__setup_output_tab(notebook) self.__setup_output_tab(notebook)
self.__setup_plugin_tabs(notebook) self.__setup_plugin_tabs(notebook)
self.__setup_config_tab(notebook) self.__setup_config_tab(notebook)
self.__setup_privacy_tab(notebook)
self.__setup_appearance_tab(notebook) self.__setup_appearance_tab(notebook)
self.__setup_plugin_tab(notebook) self.__setup_plugin_tab(notebook)
@ -671,6 +672,28 @@ class PreferencesDialog(tk.Toplevel):
# LANG: Label for 'Configuration' tab in Settings # LANG: Label for 'Configuration' tab in Settings
notebook.add(config_frame, text=_('Configuration')) notebook.add(config_frame, text=_('Configuration'))
def __setup_privacy_tab(self, notebook: Notebook) -> None:
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()
# 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
)
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)
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)
notebook.add(frame, text=_('Privacy')) # LANG: Preferences privacy tab title
def __setup_appearance_tab(self, notebook: Notebook) -> None: def __setup_appearance_tab(self, notebook: Notebook) -> None:
self.languages = Translations.available_names() self.languages = Translations.available_names()
# Appearance theme and language setting # Appearance theme and language setting
@ -1234,6 +1257,10 @@ class PreferencesDialog(tk.Toplevel):
config.set('language', lang_codes.get(self.lang.get()) or '') # or '' used here due to Default being None above config.set('language', lang_codes.get(self.lang.get()) or '') # or '' used here due to Default being None above
Translations.install(config.get_str('language', default=None)) # type: ignore # This sets self in weird ways. Translations.install(config.get_str('language', default=None)) # type: ignore # This sets self in weird ways.
# Privacy options
config.set('hide_private_group', self.hide_private_group.get())
config.set('hide_multicrew_captain', self.hide_multicrew_captain.get())
config.set('ui_scale', self.ui_scale.get()) config.set('ui_scale', self.ui_scale.get())
config.set('ui_transparency', self.transparency.get()) config.set('ui_transparency', self.transparency.get())
config.set('always_ontop', self.always_ontop.get()) config.set('always_ontop', self.always_ontop.get())