mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-18 18:07:37 +03:00
EDMarketConnector: Force type of ship_state
It can be `tk.NORMAL` or `tk.DISABLED`. Why `True` was ever used I don't know, possibly relying on undefined behaviour. However, those 'types' end up as `Literal['normal']` and `Literal['disabled']` and the only way to declare a Union of those is to be explicit with the actual strings. tk.(NORMAL|DISABLED) are not a types.
This commit is contained in:
parent
6a580576ec
commit
75ee57939a
@ -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, Optional, Tuple, Union
|
||||
from typing import TYPE_CHECKING, 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
|
||||
@ -1356,7 +1356,7 @@ class AppWindow(object):
|
||||
|
||||
# Ensure the ship type/name text is clickable, if it should be.
|
||||
if monitor.state['Modules']:
|
||||
ship_state = True
|
||||
ship_state: Literal['normal', 'disabled'] = tk.NORMAL
|
||||
|
||||
else:
|
||||
ship_state = tk.DISABLED
|
||||
|
Loading…
x
Reference in New Issue
Block a user