mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2024-11-16 07:15:24 +01:00
Fix control+c not working
This commit is contained in:
parent
9a715a72b8
commit
9b6a195b6a
@ -69,6 +69,10 @@ class ServerConnection(threading.Thread):
|
||||
self.NoGUI = False
|
||||
self.window = window
|
||||
|
||||
def disconnect(self):
|
||||
self.listener.kill = True
|
||||
self.socket.close()
|
||||
|
||||
def setWindow(self, window):
|
||||
self.window = window
|
||||
|
||||
@ -214,6 +218,7 @@ class PacketListener(threading.Thread):
|
||||
self.FileObject = FileObject
|
||||
self.window = window
|
||||
self.encryptedConnection = False
|
||||
self.kill = False
|
||||
|
||||
def enableEncryption(self):
|
||||
#Create an AES cipher from the previously obtained public key
|
||||
@ -234,6 +239,8 @@ class PacketListener(threading.Thread):
|
||||
|
||||
def run(self):
|
||||
while True:
|
||||
if (self.kill):
|
||||
break
|
||||
try:
|
||||
response = self.FileObject.read(1)
|
||||
if (response == ""):
|
||||
|
7
start.py
7
start.py
@ -121,7 +121,12 @@ if __name__ == "__main__":
|
||||
port = 25565
|
||||
connection = NetworkManager.ServerConnection(None, derp['Username'], passwd, sessionid, host, port)
|
||||
connection.start()
|
||||
raw_input()
|
||||
while True:
|
||||
try:
|
||||
raw_input()
|
||||
except KeyboardInterrupt, e:
|
||||
connection.disconnect()
|
||||
sys.exit(1)
|
||||
else:
|
||||
app = wx.PySimpleApp()
|
||||
Login = GUI.MainFrame(None, -1, "")
|
||||
|
Loading…
Reference in New Issue
Block a user