Skip to content

Commit

Permalink
EDCD#2051 And another 3!
Browse files Browse the repository at this point in the history
  • Loading branch information
Rixxan committed Aug 4, 2023
1 parent 82266d6 commit d6efcf7
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 22 deletions.
5 changes: 2 additions & 3 deletions plugins/inara.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def system_url(system_name: str) -> str:
return requests.utils.requote_uri(f'https://inara.cz/galaxy-starsystem/'
f'?search={this.system_address}')

elif system_name:
if system_name:
return requests.utils.requote_uri(f'https://inara.cz/galaxy-starsystem/'
f'?search={system_name}')

Expand Down Expand Up @@ -382,8 +382,7 @@ def credentials(cmdr: Optional[str]) -> Optional[str]:
if cmdr in cmdrs and config.get_list('inara_apikeys'):
return config.get_list('inara_apikeys')[cmdrs.index(cmdr)]

else:
return None
return None


def journal_entry( # noqa: C901, CCR001
Expand Down
27 changes: 16 additions & 11 deletions prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,10 @@ def __setup_output_tab(self, root_notebook: ttk.Notebook) -> None:
self.outdir_entry.grid(columnspan=2, padx=self.PADX, pady=(0, self.PADY), sticky=tk.EW, row=row.get())

if sys.platform == 'darwin':
text = (_('Change...')) # LANG: macOS Preferences - files location selection button
text = _('Change...') # LANG: macOS Preferences - files location selection button

else:
text = (_('Browse...')) # LANG: NOT-macOS Settings - files location selection button
text = _('Browse...') # LANG: NOT-macOS Settings - files location selection button

self.outbutton = nb.Button(
output_frame,
Expand Down Expand Up @@ -434,10 +434,10 @@ def __setup_config_tab(self, notebook: ttk.Notebook) -> None: # noqa: CCR001
self.logdir_entry.grid(columnspan=4, padx=self.PADX, pady=(0, self.PADY), sticky=tk.EW, row=row.get())

if sys.platform == 'darwin':
text = (_('Change...')) # LANG: macOS Preferences - files location selection button
text = _('Change...') # LANG: macOS Preferences - files location selection button

else:
text = (_('Browse...')) # LANG: NOT-macOS Setting - files location selection button
text = _('Browse...') # LANG: NOT-macOS Setting - files location selection button

self.logbutton = nb.Button(
config_frame,
Expand Down Expand Up @@ -924,7 +924,7 @@ def __setup_plugin_tab(self, notebook: ttk.Notebook) -> None: # noqa: CCR001
).grid(columnspan=2, padx=self.PADX, pady=10, sticky=tk.NSEW, row=row.get())

enabled_plugins = list(filter(lambda x: x.folder and x.module, plug.PLUGINS))
if len(enabled_plugins):
if enabled_plugins:
ttk.Separator(plugins_frame, orient=tk.HORIZONTAL).grid(
columnspan=3, padx=self.PADX, pady=self.PADY * 8, sticky=tk.EW
)
Expand All @@ -946,7 +946,7 @@ def __setup_plugin_tab(self, notebook: ttk.Notebook) -> None: # noqa: CCR001
############################################################
# Show which plugins don't have Python 3.x support
############################################################
if len(plug.PLUGINS_not_py3):
if plug.PLUGINS_not_py3:
ttk.Separator(plugins_frame, orient=tk.HORIZONTAL).grid(
columnspan=3, padx=self.PADX, pady=self.PADY * 8, sticky=tk.EW, row=row.get()
)
Expand All @@ -966,24 +966,29 @@ def __setup_plugin_tab(self, notebook: ttk.Notebook) -> None: # noqa: CCR001
).grid(columnspan=2, padx=self.PADX, sticky=tk.W)
############################################################

disabled_plugins = list(filter(lambda x: x.folder and not x.module, plug.PLUGINS))
if len(disabled_plugins):
# Get disabled plugins (plugins without a folder or module)
disabled_plugins = [x for x in plug.PLUGINS if x.folder and not x.module]

if disabled_plugins:
# Create a separator
ttk.Separator(plugins_frame, orient=tk.HORIZONTAL).grid(
columnspan=3, padx=self.PADX, pady=self.PADY * 8, sticky=tk.EW, row=row.get()
)
# Label for the section of disabled plugins
nb.Label(
plugins_frame,
# LANG: Lable on list of user-disabled plugins
text=_('Disabled Plugins')+':' # List of plugins in settings
text=_('Disabled Plugins') + ':' # List of plugins in settings
).grid(padx=self.PADX, sticky=tk.W, row=row.get())

# Show disabled plugins
for plugin in disabled_plugins:
nb.Label(plugins_frame, text=plugin.name).grid(
columnspan=2, padx=self.PADX*2, sticky=tk.W, row=row.get()
columnspan=2, padx=self.PADX * 2, sticky=tk.W, row=row.get()
)

# LANG: Label on Settings > Plugins tab
notebook.add(plugins_frame, text=_('Plugins')) # Tab heading in settings
notebook.add(plugins_frame, text=_('Plugins')) # Tab heading in settings

def cmdrchanged(self, event=None):
"""
Expand Down
13 changes: 5 additions & 8 deletions protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,8 @@ def handleEvent_withReplyEvent_(self, event, replyEvent) -> None: # noqa: N802
# This could be false if you use auth_force_edmc_protocol, but then you get to keep the pieces
assert sys.platform == 'win32'
# spell-checker: words HBRUSH HICON WPARAM wstring WNDCLASS HMENU HGLOBAL
from ctypes import windll # type: ignore
from ctypes import ( # type: ignore
POINTER, WINFUNCTYPE, Structure, byref, c_long, c_void_p, create_unicode_buffer, wstring_at
windll, POINTER, WINFUNCTYPE, Structure, byref, c_long, c_void_p, create_unicode_buffer, wstring_at
)
from ctypes.wintypes import (
ATOM, BOOL, DWORD, HBRUSH, HGLOBAL, HICON, HINSTANCE, HMENU, HWND, INT, LPARAM, LPCWSTR, LPMSG, LPVOID, LPWSTR,
Expand Down Expand Up @@ -426,9 +425,8 @@ def parse(self) -> bool:
protocolhandler.event(url) # noqa: F821
self.send_response(200)
return True
else:
self.send_response(404) # Not found
return False
self.send_response(404) # Not found
return False

def do_HEAD(self) -> None: # noqa: N802 # Required to override
"""Handle HEAD Request."""
Expand Down Expand Up @@ -459,14 +457,13 @@ def get_handler_impl() -> Type[GenericProtocolHandler]:
if sys.platform == 'darwin' and getattr(sys, 'frozen', False):
return DarwinProtocolHandler # pyright: reportUnboundVariable=false

elif (
if (
(sys.platform == 'win32' and config.auth_force_edmc_protocol)
or (getattr(sys, 'frozen', False) and not is_wine and not config.auth_force_localserver)
):
return WindowsProtocolHandler

else:
return LinuxProtocolHandler
return LinuxProtocolHandler


# *late init* singleton
Expand Down

0 comments on commit d6efcf7

Please sign in to comment.