1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-06-08 19:32:15 +03:00

EDMarketConnector.py: Guard platform specific func

Some callback functions are only used on windows, but defined for
everyone, this causes mypy to fail in fun ways.
This commit is contained in:
A_D 2022-12-23 18:17:33 +02:00
parent 490bd9dbdd
commit f94072a99e
No known key found for this signature in database
GPG Key ID: 4BE9EB7DF45076C4

View File

@ -1617,10 +1617,11 @@ class AppWindow(object):
monitor.system and monitor.system and
tk.NORMAL or tk.DISABLED) tk.NORMAL or tk.DISABLED)
def ontop_changed(self, event=None) -> None: if sys.platform == 'win32':
"""Set main window 'on top' state as appropriate.""" def ontop_changed(self, event=None) -> None:
config.set('always_ontop', self.always_ontop.get()) """Set main window 'on top' state as appropriate."""
self.w.wm_attributes('-topmost', self.always_ontop.get()) config.set('always_ontop', self.always_ontop.get())
self.w.wm_attributes('-topmost', self.always_ontop.get())
def copy(self, event=None) -> None: def copy(self, event=None) -> None:
"""Copy system, and possible station, name to clipboard.""" """Copy system, and possible station, name to clipboard."""
@ -1760,13 +1761,14 @@ class AppWindow(object):
with open(f, 'wb') as h: with open(f, 'wb') as h:
h.write(str(companion.session.capi_raw_data).encode(encoding='utf-8')) h.write(str(companion.session.capi_raw_data).encode(encoding='utf-8'))
def exit_tray(self, systray: 'SysTrayIcon') -> None: if sys.platform == 'win32':
"""Tray icon is shutting down.""" def exit_tray(self, systray: 'SysTrayIcon') -> None:
exit_thread = threading.Thread( """Tray icon is shutting down."""
target=self.onexit, exit_thread = threading.Thread(
daemon=True, target=self.onexit,
) daemon=True,
exit_thread.start() )
exit_thread.start()
def onexit(self, event=None) -> None: def onexit(self, event=None) -> None:
"""Application shutdown procedure.""" """Application shutdown procedure."""