Conversation
AsafMeizner
left a comment
There was a problem hiding this comment.
Couldent test the code so il take your word it works but some cleanup is necessery as the code is very hard to read and will be impossible to maintain and upgrade in the future
There was a problem hiding this comment.
add pycache to gitignore (both files and folder)
There was a problem hiding this comment.
rename to backend_client.py no need to state py in name the extension is enogh
There was a problem hiding this comment.
Dont have space in folder names, and call its something other than app data like source or just app
There was a problem hiding this comment.
place all icons in a single icons folder
There was a problem hiding this comment.
Split to diffrent files components and helpers! dont have everything in one main file.
| try: | ||
| from ntcore import NetworkTableInstance | ||
| except ImportError: | ||
| NetworkTableInstance = None |
| if NetworkTableInstance is None: | ||
| print("ERR ntcore not installed", flush=True); return |
There was a problem hiding this comment.
just throw an exeption on init if not installed
| if cmd == "SET_SERVER": | ||
| host, port = rest[0].split() | ||
| pub.set_server(host, int(port)); print("OK", flush=True) | ||
| elif cmd == "LOAD_CSV": | ||
| path = rest[0] | ||
| if (path.startswith('"') and path.endswith('"')) or (path.startswith("'") and path.endswith("'")): | ||
| path = path[1:-1] | ||
| pub.load_csv(path) # prints OK/ERR | ||
| elif cmd == "SEEK": | ||
| pub.seek(float(rest[0])); print("OK", flush=True) | ||
| elif cmd == "PLAY": | ||
| pub.play(); print("OK", flush=True) | ||
| elif cmd == "PAUSE": | ||
| pub.pause(); print("OK", flush=True) | ||
| elif cmd == "STOP": | ||
| pub.stop(); print("OK", flush=True) | ||
| elif cmd == "PUBLISH_ON": | ||
| pub.set_publish(True); print("OK", flush=True) | ||
| elif cmd == "PUBLISH_OFF": | ||
| pub.set_publish(False); print("OK", flush=True) | ||
| elif cmd == "QUIT": | ||
| pub.exit = True; print("BYE", flush=True); break | ||
| else: | ||
| print("ERR", flush=True) |
There was a problem hiding this comment.
What am i seeing?! use a switch or dict with an enum, similar to the robot state machine. or you can simply use a dict with string to function
There was a problem hiding this comment.
would appreciate build instructions
| def set_server(self, host: str, port: int): return self._send(f"SET_SERVER {host} {port}") | ||
| def load_csv(self, path: str): return self._send(f"LOAD_CSV {path}") | ||
| def seek(self, t: float): return self._send(f"SEEK {t}") | ||
| def play(self): return self._send("PLAY") | ||
| def pause(self): return self._send("PAUSE") | ||
| def stop(self): return self._send("STOP") | ||
| def pub_on(self): return self._send("PUBLISH_ON") | ||
| def pub_off(self): return self._send("PUBLISH_OFF") | ||
| def quit(self): |
There was a problem hiding this comment.
this is a repetitive and hard to read way to write this, use partial methods to clean this up
There was a problem hiding this comment.
your logo is invisible in dark mode
|
Create a new release on github with the updated executable |
Fixed timing, Added Executable