Fix quit script action

This commit is contained in:
Grégory Soutadé 2020-11-18 16:32:29 +01:00
parent 4438709a99
commit 11acefa076
3 changed files with 11 additions and 7 deletions

View File

@ -178,7 +178,7 @@ class EventThread(Thread,GenericMonitor):
def signalHandler(signal_received, frame):
eventThread.stop()
eventThread.join()
groups = {'groups':['Mail', 'Pidgin']}
groups = ['Mail', 'Pidgin']
eventThread.deleteGroups(groups)
sys.exit(0)

View File

@ -29,10 +29,6 @@ import signal
from genericmonitor import *
def signal_handler(sig, frame):
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
class PicturePopup(GenericMonitor):
def __init__(self):
@ -40,9 +36,11 @@ class PicturePopup(GenericMonitor):
self.item = None
self.imgs_idx = 0
self.setupMonitor()
def run(self):
self.display_next_img()
self.runMainLoop()
def display_next_img(self):
filedata = urllib.request.urlopen('https://source.unsplash.com/random')
# Get redirected URL without parameters
@ -91,4 +89,10 @@ class PicturePopup(GenericMonitor):
self.deleteItems([self.item.getFullName()])
self.stopMainLoop()
def signal_handler(sig, frame):
picture.deleteGroups(['PicturePopup'])
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
picture = PicturePopup()
picture.run()

View File

@ -113,7 +113,7 @@ class TimerThread(Thread,GenericMonitor):
def signalHandler(signal_received, frame):
timerThread.stop()
timerThread.join()
groups = {'groups':['Timer']}
groups = ['Timer']
timerThread.deleteGroups(groups)
sys.exit(0)