def suggest(cls, title, message, callback=None, disabled=False): cls._createInstance() item = QListWidgetItem(cls._instance) w = NotificationItem(title, message, item, ntype=NotificationIcon.Suggest, callback=callback, bg_color=QColor(1, 10, 19), msg_color=rgb2hex(244, 244, 244)) w.closed.connect(cls._instance.removeItem) width = cls._instance.width() - cls._instance.spacing() item.setSizeHint(QSize(width, w.height())) cls._instance.setItemWidget(item, w) cls.saveLastMessage(message)
def last(cls, callback=None, disabled=False): cls._createInstance() item = QListWidgetItem(cls._instance) w = NotificationItem("The Last Message", cls.getLastMessage(), item, cls._instance, ntype=NotificationIcon.Info, callback=callback, bg_color=QColor(237, 242, 252), msg_color=rgb2hex(144, 147, 153)) w.closed.connect(cls._instance.removeItem) item.setSizeHint( QSize(cls._instance.width() - cls._instance.spacing(), w.height())) cls._instance.setItemWidget(item, w) cls.saveLastMessage(cls.getLastMessage())
def warning(cls, title, message, callback=None, disabled=False): cls._createInstance() item = QListWidgetItem(cls._instance) w = NotificationItem(title, message, item, cls._instance, ntype=NotificationIcon.Warning, callback=callback, bg_color=QColor(253, 246, 236), msg_color=rgb2hex(230, 162, 60)) w.closed.connect(cls._instance.removeItem) item.setSizeHint( QSize(cls._instance.width() - cls._instance.spacing(), w.height())) cls._instance.setItemWidget(item, w) cls.saveLastMessage(message)
def success(cls, title, message, callback=None, disabled=False): cls._createInstance() item = QListWidgetItem(cls._instance) w = NotificationItem(title, message, item, cls._instance, ntype=NotificationIcon.Success, callback=callback, bg_color=QColor(240, 249, 235), msg_color=rgb2hex(103, 194, 58)) w.closed.connect(cls._instance.removeItem) item.setSizeHint( QSize(cls._instance.width() - cls._instance.spacing(), w.height())) cls._instance.setItemWidget(item, w) cls.saveLastMessage(message)