def __init__(self, root_tk): self.root = root_tk self.queue_update_pc = multiprocessing.Queue() # Set up the GUI part self.frm_main = FrmMain(root_tk, self) self.lock = threading.Lock() self.lstProcess = [] self.root.protocol('WM_DELETE_WINDOW', self.on_closing)
class ThreadedClient: def __init__(self, root_tk): self.root = root_tk self.queue_update_pc = multiprocessing.Queue() # Set up the GUI part self.frm_main = FrmMain(root_tk, self) self.lock = threading.Lock() self.lstProcess = [] self.root.protocol('WM_DELETE_WINDOW', self.on_closing) def remove_client(self, ip_address): self.frm_main.remove_client(ip_address) for p in self.lstProcess: if isinstance(p,PC_Manager): if p.ip_address is ip_address: self.lstProcess.remove(p) return def create_camera(self, ip_address, name_cam, macid, isDevMode): p = PC_Manager(ip_address, self, self.root, self.lock, self.queue_update_pc, name_cam, macid, isDevMode) self.lstProcess.append(p) p.start() def on_closing(self): try: for p in self.lstProcess: p.stop() except: pass try: root.destroy() root.quit() except: pass try: os.kill(os.getpid(),9) except: print 'can not self kill PROCESS' pass