Skip to content

Commit

Permalink
Import shenanigans now that pywinrt works
Browse files Browse the repository at this point in the history
  • Loading branch information
ElSaico committed Jun 24, 2024
1 parent 44d1e68 commit a7361fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
17 changes: 7 additions & 10 deletions EDMarketConnector.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ def already_running_popup():
import tkinter.messagebox
from tkinter import ttk
import commodity
import companion
import plug
import prefs
import protocol
Expand Down Expand Up @@ -672,7 +673,7 @@ def open_window(systray: 'SysTrayIcon', *args) -> None:
self.w.bind_all('<<Quit>>', self.onexit) # Updater

# Check for Valid Providers
validate_providers()
validate_providers(self.w)
if monitor.cmdr is None:
self.status['text'] = tr.tl("Awaiting Full CMDR Login") # LANG: Await Full CMDR Login to Game

Expand Down Expand Up @@ -857,7 +858,7 @@ def login(self):

self.cooldown()

def export_market_data(self, data: 'CAPIData') -> bool: # noqa: CCR001
def export_market_data(self, data: 'companion.CAPIData') -> bool: # noqa: CCR001
"""
Export CAPI market data.
Expand Down Expand Up @@ -1203,7 +1204,7 @@ def capi_handle_response(self, event=None): # noqa: C901, CCR001
if (suit := loadout.get('suit')) is not None:
if (suitname := suit.get('edmcName')) is not None:
# We've been paranoid about loadout->suit->suitname, now just assume loadouts is there
loadout_name = index_possibly_sparse_list(
loadout_name = companion.index_possibly_sparse_list(
capi_response.capi_data['loadouts'], loadout['loadoutSlotId']
)['name']

Expand Down Expand Up @@ -1943,7 +1944,7 @@ def show_killswitch_poppup(root=None):
ok_button.grid(columnspan=2, sticky=tk.EW)


def validate_providers():
def validate_providers(root):
"""Check if Config has an invalid provider set, and reset to default if we do."""
reset_providers = {}
station_provider: str = config.get_str("station_provider")
Expand Down Expand Up @@ -1990,7 +1991,8 @@ def validate_providers():


# Run the app
def main():
def main(): # noqa: C901, CCR001
"""Run the main code of the program."""
logger.info(f'Startup v{appversion()} : Running on Python v{sys.version}')
logger.debug(f'''Platform: {sys.platform} {sys.platform == "win32" and sys.getwindowsversion()}
argv[0]: {sys.argv[0]}
Expand Down Expand Up @@ -2068,11 +2070,6 @@ def main():
else:
log_locale('After switching to UTF-8 encoding (same language)')

# HACK: n/a | 2021-11-24: --force-localserver-auth does not work if companion is imported early -cont.
# HACK: n/a | 2021-11-24: as we modify config before this is used.
import companion
from companion import CAPIData, index_possibly_sparse_list

# Do this after locale silliness, just in case
if args.forget_frontier_auth:
logger.info("Dropping all fdev tokens as --forget-frontier-auth was passed")
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pillow==10.3.0
watchdog==4.0.0
simplesystray==0.1.0; sys_platform == 'win32'
pywin32==306; sys_platform == 'win32'
winrt-Microsoft.UI==2.1.0; sys_platform == 'win32'
winrt-Microsoft.UI.Interop==2.1.0; sys_platform == 'win32'
winrt-Microsoft.UI.Windowing==2.1.0; sys_platform == 'win32'
winrt-Microsoft.Windows.ApplicationModel.DynamicDependency.Bootstrap==2.1.0; sys_platform == 'win32'
Expand Down

0 comments on commit a7361fe

Please sign in to comment.