mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-07 19:03:23 +03:00
Added windows OS checks
This commit is contained in:
parent
6c0437642e
commit
fa58d2f0c2
@ -9,7 +9,6 @@ import locale
|
|||||||
import pathlib
|
import pathlib
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import threading
|
|
||||||
import webbrowser
|
import webbrowser
|
||||||
from builtins import object, str
|
from builtins import object, str
|
||||||
from os import chdir, environ
|
from os import chdir, environ
|
||||||
@ -18,8 +17,6 @@ from sys import platform
|
|||||||
from time import localtime, strftime, time
|
from time import localtime, strftime, time
|
||||||
from typing import TYPE_CHECKING, Optional, Tuple
|
from typing import TYPE_CHECKING, Optional, Tuple
|
||||||
|
|
||||||
from infi.systray import SysTrayIcon
|
|
||||||
|
|
||||||
# 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
|
||||||
# place for things like config.py reading .gitversion
|
# place for things like config.py reading .gitversion
|
||||||
@ -333,6 +330,10 @@ class AppWindow(object):
|
|||||||
|
|
||||||
self.prefsdialog = None
|
self.prefsdialog = None
|
||||||
|
|
||||||
|
if platform == 'win32':
|
||||||
|
import threading
|
||||||
|
from infi.systray import SysTrayIcon
|
||||||
|
|
||||||
self.only_tray_close = 0
|
self.only_tray_close = 0
|
||||||
|
|
||||||
def open_window(systray) -> None:
|
def open_window(systray) -> None:
|
||||||
@ -1388,6 +1389,7 @@ class AppWindow(object):
|
|||||||
|
|
||||||
def onexit(self, event=None) -> None:
|
def onexit(self, event=None) -> None:
|
||||||
"""Application shutdown procedure."""
|
"""Application shutdown procedure."""
|
||||||
|
if platform == 'win32':
|
||||||
value = bool(config.get_int('close_system_tray'))
|
value = bool(config.get_int('close_system_tray'))
|
||||||
|
|
||||||
if value:
|
if value:
|
||||||
@ -1397,8 +1399,12 @@ class AppWindow(object):
|
|||||||
else:
|
else:
|
||||||
self.exit()
|
self.exit()
|
||||||
|
|
||||||
|
else:
|
||||||
|
self.exit()
|
||||||
|
|
||||||
def exit_tray(self, systray) -> None:
|
def exit_tray(self, systray) -> None:
|
||||||
"""Tray icon is shutting down."""
|
"""Tray icon is shutting down."""
|
||||||
|
import threading
|
||||||
if self.only_tray_close > 0:
|
if self.only_tray_close > 0:
|
||||||
self.only_tray_close -= 1
|
self.only_tray_close -= 1
|
||||||
|
|
||||||
|
6
prefs.py
6
prefs.py
@ -792,13 +792,13 @@ class PreferencesDialog(tk.Toplevel):
|
|||||||
)
|
)
|
||||||
self.ontop_button.grid(columnspan=3, padx=self.BUTTONX, sticky=tk.W, row=row.get()) # Appearance setting
|
self.ontop_button.grid(columnspan=3, padx=self.BUTTONX, sticky=tk.W, row=row.get()) # Appearance setting
|
||||||
|
|
||||||
self.system_tray_button = nb.Checkbutton(
|
if platform == 'win32':
|
||||||
|
nb.Checkbutton(
|
||||||
appearance_frame,
|
appearance_frame,
|
||||||
text=_('Close to system tray'),
|
text=_('Close to system tray'),
|
||||||
variable=self.close_system_tray,
|
variable=self.close_system_tray,
|
||||||
command=self.themevarchanged
|
command=self.themevarchanged
|
||||||
)
|
).grid(columnspan=3, padx=self.BUTTONX, sticky=tk.W, row=row.get()) # Appearance setting
|
||||||
self.system_tray_button.grid(columnspan=3, padx=self.BUTTONX, sticky=tk.W, row=row.get()) # Appearance setting
|
|
||||||
|
|
||||||
nb.Label(appearance_frame).grid(sticky=tk.W) # big spacer
|
nb.Label(appearance_frame).grid(sticky=tk.W) # big spacer
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
certifi==2020.12.5
|
certifi==2020.12.5
|
||||||
requests==2.25.1
|
requests==2.25.1
|
||||||
watchdog==2.0.3
|
watchdog==2.0.3
|
||||||
infi.systray==0.1.12
|
infi.systray==0.1.12; sys_platform == 'win32'
|
||||||
# argh==0.26.2 watchdog dep
|
# argh==0.26.2 watchdog dep
|
||||||
# pyyaml==5.3.1 watchdog dep
|
# pyyaml==5.3.1 watchdog dep
|
||||||
semantic-version==2.8.5
|
semantic-version==2.8.5
|
||||||
|
Loading…
x
Reference in New Issue
Block a user