def disconnected(gui): gui.socketStatus = "disconnected" ConnectionUtils.disconnect(gui) if gui.configList["reconnectMode"] == 'auto': TabUtils.writeMessage(gui,"Lost the connection, trying to reconnect automaticly") ConnectionUtils.connect(gui) else: TabUtils.writeMessage(gui,"Lost the connection. Use /connect IP to connect manually")
def connect(argument,gui): if(gui.socketStatus == "disconnected"): if gui.configList["ipAdress"] != argument[1]: TabUtils.deleteAllTabs(gui) TabUtils.clearWindowList(gui.windowList) gui.configList["ipAdress"] = argument[1] ConnectionUtils.connect(gui) else: if argument[1] == gui.configList["ipAdress"]: TabUtils.writeMessage(gui,"You are already connected to " +argument[1]) else: ConnectionUtils.disconnect(gui) TabUtils.deleteAllTabs(gui) TabUtils.clearWindowList(gui.windowList) gui.configList["ipAdress"] = argument[1] if gui.configList["reconnectMode"] != "auto": gui.master.after(100,ConnectionUtils.connect,gui) gui.message.delete(0,END)