def render(self, result=None): unicurses.wclear(self.scr.win) unicurses.waddstr(self.scr.win, self.title, self.scr.attr['ttl']) tdone, ttotal, terror, = 0, 0, 0 mdone, mtotal, mname, mset = 0, 0, None, False for step in self.steps: n, d, t, e, a = step tdone += d ttotal += t terror += e if mdone >= mtotal and d > 0 and not mset: mdone, mtotal, mname = d, t, n else: mset = True self.renderStep(step) unicurses.waddstr(self.scr.win, "\n Total Progress:\n") self.renderProgress(tdone, ttotal) if result != None: timerep = self.drawTime(int(round(time.time() - self.started))) msg = "\n Migration Successful!" unicurses.waddstr(self.scr.win, msg, self.scr.attr['val']) msg = "\n Completed in " + timerep msg += "\n\n Press 'q' to continue.\n\n" unicurses.waddstr(self.scr.win, msg) unicurses.flushinp() while chr(self.scr.getch(self.scr.win)) != 'q': pass elif mname != None: unicurses.waddstr(self.scr.win, "\n " + mname + " Progress:\n") self.renderProgress(mdone, mtotal) if self.current != None: unicurses.waddstr(self.scr.win, self.current + "\n") if self.currentartifact != None: unicurses.waddstr(self.scr.win, self.currentartifact + "\n") unicurses.waddstr(self.scr.win, "\n") else: unicurses.waddstr(self.scr.win, "\n")
def showCall(self, sel, act): sel['wait'] = True self.render() unicurses.wrefresh(self.scr.win) cont = act(sel) sel['wait'] = False self.render() unicurses.flushinp() return cont != False
print("Can't connect: " + HOST + ':' + str(PORT)) continue break sock.sendall(bytes(channel + chr(0) + chr(3) + chr(0) + args.user, "utf-8")) stdscr = u.initscr() u.curs_set(0) chat_win = u.newwin(25, 90, 0, 0) input_win = u.newwin(5, 90, 25, 0) people_win = u.newwin(30, 30, 0, 90) message_refresh_thread.start() while True: sock = socket.socket() u.wclear(input_win) u.mvwaddstr(input_win, 1, 1, '> ') refresh() u.flushinp() data = u.mvwgetstr(input_win, 1, 3) send = True # if len(data.split()) > 1: # if data.split()[0] == ":send": # file = data.split()[1] # if os.path.exists(file) and not os.path.isdir(file): # bdata = open(file, 'rb').read() # sock.connect((HOST, PORT)) # sock.sendall(bytes(channel + chr(0) + chr(5) + chr(0) + file + chr(0) + str(bdata) + "\n", "utf-8")) # sock.close() # send = False if data in [":exit", "^C", ":quit", ":q"]: break if send: try: