File tree Expand file tree Collapse file tree 1 file changed +19
-12
lines changed Expand file tree Collapse file tree 1 file changed +19
-12
lines changed Original file line number Diff line number Diff line change 33# https://github.com/mathoudebine/turing-smart-screen-python
44import locale
55import os
6- import pystray
76import signal
87import sys
98import time
109
11- from PIL import Image
12-
1310MIN_PYTHON = (3 , 7 )
1411if sys .version_info < MIN_PYTHON :
1512 print ("[ERROR] Python %s.%s or later is required." % MIN_PYTHON )
1815 except :
1916 os ._exit (0 )
2017
18+ from PIL import Image
19+
20+ try :
21+ import pystray
22+ except :
23+ pass
24+
2125from library .log import logger
2226import library .scheduler as scheduler
2327from library .display import display
@@ -99,12 +103,15 @@ def on_exit_tray(tray_icon, item):
99103 scheduler .QueueHandler ()
100104
101105 # Create a tray icon for the program, with an Exit entry in menu
102- tray_icon = pystray .Icon (
103- name = 'Turing System Monitor' ,
104- title = 'Turing System Monitor' ,
105- icon = Image .open ("res/icons/724873501557740364-64.png" ),
106- menu = pystray .Menu (
107- pystray .MenuItem (
108- 'Exit' ,
109- on_exit_tray ))
110- ).run ()
106+ try :
107+ tray_icon = pystray .Icon (
108+ name = 'Turing System Monitor' ,
109+ title = 'Turing System Monitor' ,
110+ icon = Image .open ("res/icons/724873501557740364-64.png" ),
111+ menu = pystray .Menu (
112+ pystray .MenuItem (
113+ 'Exit' ,
114+ on_exit_tray ))
115+ ).run ()
116+ except :
117+ logger .warning ("Tray icon is not supported on your platform" )
You can’t perform that action at this time.
0 commit comments