from pycs.frontend.notifications.NotificationManager import NotificationManager class NotificationList: """ stores notifications to fire them later in the correct thread """ def __init__(self, notifications: NotificationManager): self.__list = [] self.notifications = notifications def add(self, fun: callable, *params): """ add a function and parameters to be executed later :param fun: function :param params: parameters """ self.__list.append((fun, *params)) def fire(self): """ fire all stored events and reset the list """ for fun, *params in self.__list: fun(*params) self.__list = []