-
Notifications
You must be signed in to change notification settings - Fork 0
Replay timing and Executable #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
GalDotan
wants to merge
18
commits into
main
Choose a base branch
from
Replay-Timing-
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d444775
Added buttons cahnging color and fixed zoom
GalDotan d341c3c
Merge branch 'UI-Fixes'
GalDotan 99b1bc9
Fixed Timing
GalDotan 2a8f944
All workinggg
GalDotan 38339d9
UI Fixes
GalDotan be89e4e
Started building
GalDotan dc31166
*
GalDotan 4d58a32
Added exectution
GalDotan 25a55c8
Added cahngable icons
GalDotan 4314fa6
Added README
GalDotan 33f8b32
Fixed gif
GalDotan 2fe0530
Update README.md
GalDotan 1492592
Update README.md
GalDotan 28f4f72
Updated REAMME and added License
GalDotan 5e5bb7d
Added logo
GalDotan 079bcfa
Update License.md
GalDotan 89e16e8
Added basic keyboard shortcuts
GalDotan fcc5978
Updated to use FMS Control data
GalDotan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
|
|
||
| import subprocess, sys, threading | ||
| from pathlib import Path | ||
|
|
||
| class BackendProcess: | ||
| def __init__(self): | ||
| self.proc = None | ||
| self.lock = threading.Lock() | ||
|
|
||
| def start(self, host: str, port: int, csv_path: str | None = None): | ||
| if self.proc and self.proc.poll() is None: | ||
| return | ||
| # locate script path for dev; use flag for frozen exe | ||
| script = str(Path(__file__).parent / "publisher_process.py") | ||
| if getattr(sys, 'frozen', False): | ||
| # We are running as PyInstaller exe: re-run same exe in backend mode | ||
| args = [sys.executable, '--publisher'] | ||
| creationflags = 0 | ||
| if os.name == 'nt': | ||
| creationflags = 0x08000000 # CREATE_NO_WINDOW (avoid flashing console) | ||
| else: | ||
| args = [sys.executable, script] | ||
| creationflags = 0 | ||
|
|
||
| self.proc = subprocess.Popen( | ||
| args, | ||
| stdin=subprocess.PIPE, | ||
| stdout=subprocess.PIPE, | ||
| stderr=subprocess.PIPE, | ||
| text=True, | ||
| bufsize=1, | ||
| creationflags=creationflags | ||
| ) | ||
| threading.Thread(target=self._drain, daemon=True).start() | ||
| self.set_server(host, port) | ||
| if csv_path: | ||
| self.load_csv(csv_path) | ||
|
|
||
| def _drain(self): | ||
| if not self.proc: | ||
| return | ||
| for line in self.proc.stderr: | ||
| sys.stderr.write("[backend] " + line) | ||
|
|
||
| def _send(self, cmd: str): | ||
| if not self.proc or self.proc.poll() is not None: | ||
| raise RuntimeError("Backend not running") | ||
| with self.lock: | ||
| self.proc.stdin.write(cmd + "\n") | ||
| self.proc.stdin.flush() | ||
| return self.proc.stdout.readline().strip() | ||
|
|
||
| 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): | ||
|
Comment on lines
+53
to
+61
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a repetitive and hard to read way to write this, use partial methods to clean this up |
||
| try: self._send("QUIT") | ||
| except Exception: pass | ||
| if self.proc: | ||
| self.proc.terminate() | ||
| self.proc = None | ||
File renamed without changes.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to backend_client.py no need to state py in name the extension is enogh