mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-18 18:07:37 +03:00
Removed cast calls
This commit is contained in:
parent
dc793e62c4
commit
f76e5d331e
@ -390,7 +390,7 @@ class AppWindow(object):
|
||||
|
||||
def __init__(self, master: tk.Tk): # noqa: C901, CCR001 # TODO - can possibly factor something out
|
||||
|
||||
self.holdofftime = cast(int, config.get_int('querytime', 0)) + companion.holdoff
|
||||
self.holdofftime = config.get_int('querytime', 0) + companion.holdoff
|
||||
|
||||
self.w = master
|
||||
self.w.title(applongname)
|
||||
@ -532,13 +532,13 @@ class AppWindow(object):
|
||||
self.menubar.add_cascade(menu=self.help_menu)
|
||||
if platform == 'win32':
|
||||
# Must be added after at least one "real" menu entry
|
||||
self.always_ontop = tk.BooleanVar(value=cast(int, config.get_int('always_ontop')))
|
||||
self.system_menu = tk.Menu(self.menubar, name='system', tearoff=tk.FALSE) # type: ignore # https://github.com/python/typeshed/issues/4658 # noqa: E501
|
||||
self.always_ontop = tk.BooleanVar(value=config.get_int('always_ontop')))
|
||||
self.system_menu=tk.Menu(self.menubar, name = 'system', tearoff = tk.FALSE) # type: ignore # https://github.com/python/typeshed/issues/4658 # noqa: E501
|
||||
self.system_menu.add_separator()
|
||||
self.system_menu.add_checkbutton(label=_('Always on top'),
|
||||
variable=self.always_ontop,
|
||||
command=self.ontop_changed) # Appearance setting
|
||||
self.menubar.add_cascade(menu=self.system_menu)
|
||||
self.system_menu.add_checkbutton(label = _('Always on top'),
|
||||
variable = self.always_ontop,
|
||||
command = self.ontop_changed) # Appearance setting
|
||||
self.menubar.add_cascade(menu = self.system_menu)
|
||||
self.w.bind('<Control-c>', self.copy)
|
||||
self.w.protocol("WM_DELETE_WINDOW", self.onexit)
|
||||
theme.register(self.menubar) # menus and children aren't automatically registered
|
||||
@ -547,9 +547,9 @@ class AppWindow(object):
|
||||
theme.register(self.help_menu)
|
||||
|
||||
# Alternate title bar and menu for dark theme
|
||||
self.theme_menubar = tk.Frame(frame)
|
||||
self.theme_menubar.columnconfigure(2, weight=1)
|
||||
theme_titlebar = tk.Label(self.theme_menubar, text=applongname,
|
||||
self.theme_menubar=tk.Frame(frame)
|
||||
self.theme_menubar.columnconfigure(2, weight = 1)
|
||||
theme_titlebar=tk.Label(self.theme_menubar, text = applongname,
|
||||
image=self.theme_icon, cursor='fleur',
|
||||
anchor=tk.W, compound=tk.LEFT)
|
||||
theme_titlebar.grid(columnspan=3, padx=2, sticky=tk.NSEW)
|
||||
|
12
companion.py
12
companion.py
@ -285,13 +285,13 @@ class Auth(object):
|
||||
logger.debug(f'Trying for "{self.cmdr}"')
|
||||
|
||||
self.verifier = None
|
||||
cmdrs = cast(List[str], config.get_list('cmdrs', []))
|
||||
cmdrs = config.get_list('cmdrs', [])
|
||||
logger.debug(f'Cmdrs: {cmdrs}')
|
||||
|
||||
idx = cmdrs.index(self.cmdr)
|
||||
logger.debug(f'idx = {idx}')
|
||||
|
||||
tokens = cast('List[str]', config.get_list('fdev_apikeys', []))
|
||||
tokens = config.get_list('fdev_apikeys', [])
|
||||
tokens = tokens + [''] * (len(cmdrs) - len(tokens))
|
||||
if tokens[idx]:
|
||||
logger.debug('We have a refresh token for that idx')
|
||||
@ -375,9 +375,9 @@ class Auth(object):
|
||||
data = r.json()
|
||||
if r.status_code == requests.codes.ok:
|
||||
logger.info(f'Frontier CAPI Auth: New token for \"{self.cmdr}\"')
|
||||
cmdrs = cast(List[str], config.get_list('cmdrs', []))
|
||||
cmdrs = config.get_list('cmdrs', [])
|
||||
idx = cmdrs.index(self.cmdr)
|
||||
tokens = cast(List[str], config.get_list('fdev_apikeys', []))
|
||||
tokens = config.get_list('fdev_apikeys', [])
|
||||
tokens = tokens + [''] * (len(cmdrs) - len(tokens))
|
||||
tokens[idx] = data.get('refresh_token', '')
|
||||
config.set('fdev_apikeys', tokens)
|
||||
@ -404,9 +404,9 @@ class Auth(object):
|
||||
def invalidate(cmdr: str) -> None:
|
||||
"""Invalidate Refresh Token for specified Commander."""
|
||||
logger.info(f'Frontier CAPI Auth: Invalidated token for "{cmdr}"')
|
||||
cmdrs = cast(List[str], config.get_list('cmdrs', []))
|
||||
cmdrs = config.get_list('cmdrs', [])
|
||||
idx = cmdrs.index(cmdr)
|
||||
tokens = cast(List[str], config.get_list('fdev_apikeys', []))
|
||||
tokens = config.get_list('fdev_apikeys', [])
|
||||
tokens = tokens + [''] * (len(cmdrs) - len(tokens))
|
||||
tokens[idx] = ''
|
||||
config.set('fdev_apikeys', tokens)
|
||||
|
Loading…
x
Reference in New Issue
Block a user