39 lines
		
	
	
		
			889 B
		
	
	
	
		
			Python
		
	
	
		
		
			
		
	
	
			39 lines
		
	
	
		
			889 B
		
	
	
	
		
			Python
		
	
	
| 
								 | 
							
								#!/usr/bin/env python
							 | 
						||
| 
								 | 
							
								# coding:utf-8
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								def singleton(cls):
							 | 
						||
| 
								 | 
							
								    _instance = {}
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def inner():
							 | 
						||
| 
								 | 
							
								        if cls not in _instance:
							 | 
						||
| 
								 | 
							
								            _instance[cls] = cls()
							 | 
						||
| 
								 | 
							
								        return _instance[cls]
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    return inner
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								@singleton
							 | 
						||
| 
								 | 
							
								class NotificationHelper:
							 | 
						||
| 
								 | 
							
								    def __init__(self):
							 | 
						||
| 
								 | 
							
								        self.message = '########################################\n'
							 | 
						||
| 
								 | 
							
								        self.at_people_list = []
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def append_at_people(self, people):
							 | 
						||
| 
								 | 
							
								        if people not in self.at_people_list:
							 | 
						||
| 
								 | 
							
								            self.at_people_list.append(people)
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def get_people_list(self):
							 | 
						||
| 
								 | 
							
								        return self.at_people_list
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def clear_msg(self):
							 | 
						||
| 
								 | 
							
								        self.message = '########################################\n'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def append_msg(self, msg):
							 | 
						||
| 
								 | 
							
								        self.message += msg + '\n'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def append_end_msg(self):
							 | 
						||
| 
								 | 
							
								        self.message += '########################################\n'
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    def get_msg(self):
							 | 
						||
| 
								 | 
							
								        return self.message
							 |