1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-13 07:47:14 +03:00

systray: Disable whilst we figure out py2exe packaging issue

This commit is contained in:
Athanasius 2021-05-01 19:32:53 +01:00
parent 09cbf1225d
commit 316201eb77
2 changed files with 28 additions and 28 deletions

View File

@ -9,7 +9,7 @@ import locale
import pathlib
import re
import sys
import threading
# import threading
import webbrowser
from builtins import object, str
from os import chdir, environ
@ -264,7 +264,7 @@ if __name__ == '__main__': # noqa: C901
if TYPE_CHECKING:
from logging import trace, TRACE # type: ignore # noqa: F401
import update
from infi.systray import SysTrayIcon
# from infi.systray import SysTrayIcon
# isort: on
def _(x: str) -> str:
@ -332,16 +332,16 @@ class AppWindow(object):
self.prefsdialog = None
if platform == 'win32':
from infi.systray import SysTrayIcon
# if platform == 'win32':
# from infi.systray import SysTrayIcon
def open_window(systray: 'SysTrayIcon') -> None:
self.w.deiconify()
# def open_window(systray: 'SysTrayIcon') -> None:
# self.w.deiconify()
menu_options = (("Open", None, open_window),)
# Method associated with on_quit is called whenever the systray is closing
self.systray = SysTrayIcon("EDMarketConnector.ico", applongname, menu_options, on_quit=self.exit_tray)
self.systray.start()
# menu_options = (("Open", None, open_window),)
# # Method associated with on_quit is called whenever the systray is closing
# self.systray = SysTrayIcon("EDMarketConnector.ico", applongname, menu_options, on_quit=self.exit_tray)
# self.systray.start()
plug.load_plugins(master)
@ -1399,18 +1399,18 @@ class AppWindow(object):
logger.debug('"other" exception', exc_info=e)
self.status['text'] = str(e)
def exit_tray(self, systray: 'SysTrayIcon') -> None:
"""Tray icon is shutting down."""
exit_thread = threading.Thread(target=self.onexit)
exit_thread.setDaemon(True)
exit_thread.start()
# def exit_tray(self, systray: 'SysTrayIcon') -> None:
# """Tray icon is shutting down."""
# exit_thread = threading.Thread(target=self.onexit)
# exit_thread.setDaemon(True)
# exit_thread.start()
def onexit(self, event=None) -> None:
"""Application shutdown procedure."""
if platform == 'win32':
shutdown_thread = threading.Thread(target=self.systray.shutdown)
shutdown_thread.setDaemon(True)
shutdown_thread.start()
# if platform == 'win32':
# shutdown_thread = threading.Thread(target=self.systray.shutdown)
# shutdown_thread.setDaemon(True)
# shutdown_thread.start()
config.set_shutdown() # Signal we're in shutdown now.

View File

@ -636,7 +636,7 @@ class PreferencesDialog(tk.Toplevel):
# Appearance theme and language setting
self.lang = tk.StringVar(value=self.languages.get(config.get_str('language'), _('Default')))
self.always_ontop = tk.BooleanVar(value=bool(config.get_int('always_ontop')))
self.minimize_system_tray = tk.BooleanVar(value=config.get_bool('minimize_system_tray'))
# self.minimize_system_tray = tk.BooleanVar(value=config.get_bool('minimize_system_tray'))
self.theme = tk.IntVar(value=config.get_int('theme'))
self.theme_colors = [config.get_str('dark_text'), config.get_str('dark_highlight')]
self.theme_prompts = [
@ -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
if platform == 'win32':
nb.Checkbutton(
appearance_frame,
text=_('Minimize to system tray'),
variable=self.minimize_system_tray,
command=self.themevarchanged
).grid(columnspan=3, padx=self.BUTTONX, sticky=tk.W, row=row.get()) # Appearance setting
# if platform == 'win32':
# nb.Checkbutton(
# appearance_frame,
# text=_('Minimize to system tray'),
# variable=self.minimize_system_tray,
# command=self.themevarchanged
# ).grid(columnspan=3, padx=self.BUTTONX, sticky=tk.W, row=row.get()) # Appearance setting
nb.Label(appearance_frame).grid(sticky=tk.W) # big spacer
@ -1172,7 +1172,7 @@ class PreferencesDialog(tk.Toplevel):
config.set('ui_scale', self.ui_scale.get())
config.set('ui_transparency', self.transparency.get())
config.set('always_ontop', self.always_ontop.get())
config.set('minimize_system_tray', self.minimize_system_tray.get())
# config.set('minimize_system_tray', self.minimize_system_tray.get())
config.set('theme', self.theme.get())
config.set('dark_text', self.theme_colors[0])
config.set('dark_highlight', self.theme_colors[1])