mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-17 17:42:20 +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 import chdir, environ
|
||||||
from os.path import dirname, join
|
from os.path import dirname, join
|
||||||
from time import localtime, strftime, time
|
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
|
# 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
|
# 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.
|
# Ensure the ship type/name text is clickable, if it should be.
|
||||||
if monitor.state['Modules']:
|
if monitor.state['Modules']:
|
||||||
ship_state = True
|
ship_state: Literal['normal', 'disabled'] = tk.NORMAL
|
||||||
|
|
||||||
else:
|
else:
|
||||||
ship_state = tk.DISABLED
|
ship_state = tk.DISABLED
|
||||||
|
Loading…
x
Reference in New Issue
Block a user