Remove debugging messages
This commit is contained in:
parent
7a3bf578bc
commit
243333f4ef
2 changed files with 1 additions and 15 deletions
12
client.py
12
client.py
|
|
@ -32,7 +32,7 @@ class Client():
|
||||||
self.address,
|
self.address,
|
||||||
enable_multithread=True
|
enable_multithread=True
|
||||||
)
|
)
|
||||||
except ConnectionRefusedError:
|
except:
|
||||||
sys.stderr.write(f"Could not connect to server: {self.address!r}\n")
|
sys.stderr.write(f"Could not connect to server: {self.address!r}\n")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
@ -82,7 +82,6 @@ class Client():
|
||||||
def input_thread(self, scr):
|
def input_thread(self, scr):
|
||||||
while True:
|
while True:
|
||||||
i = scr.get_wch()
|
i = scr.get_wch()
|
||||||
#sys.stderr.write(f"input: {i!r}\n")
|
|
||||||
|
|
||||||
if i == "\x1b": self.stop()
|
if i == "\x1b": self.stop()
|
||||||
elif i == 266: # F2
|
elif i == 266: # F2
|
||||||
|
|
@ -118,11 +117,8 @@ class Client():
|
||||||
#elif i in string.digits + string.ascii_letters + string.punctuation + " ":
|
#elif i in string.digits + string.ascii_letters + string.punctuation + " ":
|
||||||
#self.map_.write(i)
|
#self.map_.write(i)
|
||||||
elif isinstance(i, str) and len(i) == 1 and (i not in string.whitespace or i == " "):
|
elif isinstance(i, str) and len(i) == 1 and (i not in string.whitespace or i == " "):
|
||||||
#sys.stderr.write(f"{i!r}\n")
|
|
||||||
self.map_.write(i)
|
self.map_.write(i)
|
||||||
|
|
||||||
#else: sys.stderr.write(repr(i) + "\n")
|
|
||||||
|
|
||||||
def connection_thread(self):
|
def connection_thread(self):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
|
@ -134,30 +130,24 @@ class Client():
|
||||||
return
|
return
|
||||||
|
|
||||||
def handle_json(self, message):
|
def handle_json(self, message):
|
||||||
sys.stderr.write(f"message: {message}\n")
|
|
||||||
if message["type"] == "apply-changes":
|
if message["type"] == "apply-changes":
|
||||||
changes = dejsonify_changes(message["data"])
|
changes = dejsonify_changes(message["data"])
|
||||||
sys.stderr.write(f"Changes to apply: {changes}\n")
|
|
||||||
self.map_.apply_changes(changes)
|
self.map_.apply_changes(changes)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
sys.stderr.write("Stopping!\n")
|
|
||||||
self.stopping = True
|
self.stopping = True
|
||||||
self._ws.close()
|
self._ws.close()
|
||||||
self.redraw()
|
self.redraw()
|
||||||
|
|
||||||
def request_chunks(self, coords):
|
def request_chunks(self, coords):
|
||||||
#sys.stderr.write(f"requested chunks: {coords}\n")
|
|
||||||
message = {"type": "request-chunks", "data": coords}
|
message = {"type": "request-chunks", "data": coords}
|
||||||
self._ws.send(json.dumps(message))
|
self._ws.send(json.dumps(message))
|
||||||
|
|
||||||
def unload_chunks(self, coords):
|
def unload_chunks(self, coords):
|
||||||
#sys.stderr.write(f"unloading chunks: {coords}\n")
|
|
||||||
message = {"type": "unload-chunks", "data": coords}
|
message = {"type": "unload-chunks", "data": coords}
|
||||||
self._ws.send(json.dumps(message))
|
self._ws.send(json.dumps(message))
|
||||||
|
|
||||||
def send_changes(self, changes):
|
def send_changes(self, changes):
|
||||||
#sys.stderr.write(f"sending changes: {changes}\n")
|
|
||||||
changes = jsonify_changes(changes)
|
changes = jsonify_changes(changes)
|
||||||
message = {"type": "save-changes", "data": changes}
|
message = {"type": "save-changes", "data": changes}
|
||||||
self._ws.send(json.dumps(message))
|
self._ws.send(json.dumps(message))
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,6 @@
|
||||||
import threading
|
import threading
|
||||||
from chunks import ChunkPool
|
from chunks import ChunkPool
|
||||||
|
|
||||||
import sys
|
|
||||||
|
|
||||||
class ClientChunkPool(ChunkPool):
|
class ClientChunkPool(ChunkPool):
|
||||||
"""
|
"""
|
||||||
A ChunkPool that requests/loads chunks from a client.
|
A ChunkPool that requests/loads chunks from a client.
|
||||||
|
|
@ -32,10 +30,8 @@ class ClientChunkPool(ChunkPool):
|
||||||
self._client.redraw()
|
self._client.redraw()
|
||||||
|
|
||||||
def save_changes_delayed(self):
|
def save_changes_delayed(self):
|
||||||
sys.stderr.write("Pre-HEHEHE\n")
|
|
||||||
if not self._save_thread:
|
if not self._save_thread:
|
||||||
def threadf():
|
def threadf():
|
||||||
sys.stderr.write("HEHEHE\n")
|
|
||||||
self.save_changes()
|
self.save_changes()
|
||||||
self._save_thread = None
|
self._save_thread = None
|
||||||
self._save_thread = threading.Timer(.25, threadf)
|
self._save_thread = threading.Timer(.25, threadf)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue