1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-14 08:17:13 +03:00

EDMarketConnector.py: Minor type fixes & ttkHyperlink.py too

This commit is contained in:
Athanasius 2022-12-22 17:03:07 +00:00
parent 37b054b3d3
commit e45a89d970
No known key found for this signature in database
GPG Key ID: 772697E181BB2767
2 changed files with 8 additions and 4 deletions

View File

@ -16,7 +16,7 @@ from builtins import object, str
from os import chdir, environ
from os.path import dirname, join
from time import localtime, strftime, time
from typing import TYPE_CHECKING, Literal, Optional, Tuple, Union
from typing import TYPE_CHECKING, Any, Dict, Literal, Optional, Tuple, Union
# Have this as early as possible for people running EDMarketConnector.exe
# from cmd.exe or a bat file or similar. Else they might not be in the correct
@ -592,7 +592,7 @@ class AppWindow(object):
# The type needs defining for adding the menu entry, but won't be
# properly set until later
self.updater: update.Updater = None
self.updater: update.Updater | None = None
self.menubar = tk.Menu()
if sys.platform == 'darwin':
@ -647,7 +647,9 @@ class AppWindow(object):
self.help_menu.add_command(command=self.help_general)
self.help_menu.add_command(command=self.help_privacy)
self.help_menu.add_command(command=self.help_releases)
self.help_menu.add_command(command=lambda: self.updater.check_for_updates())
if self.updater is not None:
self.help_menu.add_command(command=lambda: self.updater.check_for_updates())
self.help_menu.add_command(command=lambda: not self.HelpAbout.showing and self.HelpAbout(self.w))
self.menubar.add_cascade(menu=self.help_menu)
@ -1005,6 +1007,8 @@ class AppWindow(object):
:param event: Tk generated event details.
"""
logger.trace_if('capi.worker', 'Begin')
should_return: bool
new_data: Dict[str, Any]
should_return, new_data = killswitch.check_killswitch('capi.auth', {})
if should_return:
logger.warning('capi.auth has been disabled via killswitch. Returning.')

View File

@ -29,7 +29,7 @@ if TYPE_CHECKING:
class HyperlinkLabel(sys.platform == 'darwin' and tk.Label or ttk.Label, object): # type: ignore
"""Clickable label for HTTP links."""
def __init__(self, master: Optional[tk.Tk] = None, **kw: Any) -> None:
def __init__(self, master: tk.Frame | None = None, **kw: Any) -> None:
self.url = 'url' in kw and kw.pop('url') or None
self.popup_copy = kw.pop('popup_copy', False)
self.underline = kw.pop('underline', None) # override ttk.Label's underline