Skip to content

Commit 30b68b2

Browse files
committed
update README, add robot logs path to settings
1 parent fdda88a commit 30b68b2

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ Download the latest version for your operating system from the [Releases](https:
1919
3. When you open it for the first time, MacOS will complain about it not being signed. You can override this at the bottom of System Settings/Privacy & Security. **Open**.
2020

2121
### Windows
22-
1. Download \`RioLogManager-Windows.exe\`.
23-
2. Run the executable directly; no installation required.
22+
1. Download \`RioLogManager-Windows.zip\`.
23+
2. Extract the application and run the executable; no installation required.
2424
2. Windows will complain about the app not being signed—you'll have to override this.
2525

2626
## Usage

log.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class SettingsDialog(QDialog):
3535
def __init__(self, parent=None):
3636
super().__init__(parent)
3737
self.setWindowTitle("Preferences")
38-
self.setFixedSize(450, 320)
38+
self.setFixedSize(450, 380)
3939
self.settings = QSettings("CavalierRobotics", "LogSync")
4040

4141
is_dark = self.settings.value("dark_mode", "false") == "true"
@@ -98,11 +98,13 @@ def __init__(self, parent=None):
9898

9999
self.ip_input = QLineEdit(self.settings.value("rio_ip", "10.6.19.2"))
100100
self.path_input = QLineEdit(self.settings.value("save_path", os.path.expanduser("~/Documents/619_Logs")))
101+
self.robot_path_input = QLineEdit(self.settings.value("robot_path", "/home/lvuser/akitlogs"))
101102
self.dark_mode_check = QCheckBox("Dark Mode")
102103
self.dark_mode_check.setChecked(self.settings.value("dark_mode", "false") == "true")
103104

104105
form.addRow("RoboRIO IP:", self.ip_input)
105106
form.addRow("Save Location:", self.path_input)
107+
form.addRow("Robot Logs:", self.robot_path_input)
106108
form.addRow("", self.dark_mode_check)
107109

108110
layout.addLayout(form)
@@ -116,15 +118,17 @@ def __init__(self, parent=None):
116118
def save(self):
117119
self.settings.setValue("rio_ip", self.ip_input.text())
118120
self.settings.setValue("save_path", self.path_input.text())
121+
self.settings.setValue("robot_path", self.robot_path_input.text())
119122
self.settings.setValue("dark_mode", "true" if self.dark_mode_check.isChecked() else "false")
120123
self.accept()
121124

122125
class StorageMonitorWorker(QThread):
123126
status_updated = pyqtSignal(bool, str, str) # connected, usage_percent, raw_stats
124127

125-
def __init__(self, ip):
128+
def __init__(self, ip, robot_path):
126129
super().__init__()
127130
self.ip = ip
131+
self.robot_path = robot_path
128132
self.running = True
129133

130134
def run(self):
@@ -135,9 +139,10 @@ def run(self):
135139
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
136140
ssh.connect(self.ip, username="lvuser", password="", timeout=2)
137141

138-
# Get disk usage for /
142+
# Get disk usage for the configured log path
139143
# Output format: Size Used Avail Use% Mounted
140-
stdin, stdout, stderr = ssh.exec_command("df -h / | tail -1 | awk '{print $2, $3, $5}'")
144+
cmd = f"df -h '{self.robot_path}' | tail -1 | awk '{{print $2, $3, $5}}'"
145+
stdin, stdout, stderr = ssh.exec_command(cmd)
141146
stats = stdout.read().decode().strip().split()
142147

143148
ssh.close()
@@ -162,10 +167,11 @@ class SyncWorker(QThread):
162167
finished = pyqtSignal(int)
163168
error = pyqtSignal(str)
164169

165-
def __init__(self, ip, local_dir, delete_after):
170+
def __init__(self, ip, local_dir, robot_dir, delete_after):
166171
super().__init__()
167172
self.ip = ip
168173
self.local_dir = local_dir
174+
self.robot_dir = robot_dir
169175
self.delete_after = delete_after
170176

171177
def run(self):
@@ -177,12 +183,14 @@ def run(self):
177183
ssh.connect(self.ip, username="lvuser", password="", timeout=5)
178184
sftp = ssh.open_sftp()
179185

180-
files = sftp.listdir("/home/lvuser/akitlogs")
186+
files = sftp.listdir(self.robot_dir)
181187
if not os.path.exists(self.local_dir): os.makedirs(self.local_dir)
182188

183189
count = 0
184190
for f in files:
185-
remote_path = f"/home/lvuser/akitlogs/{f}"
191+
remote_path = f"{self.robot_dir}/{f}" if self.robot_dir.endswith('/') else f"{self.robot_dir}/{f}"
192+
# Better safe than sorry with path joining for remote
193+
remote_path = os.path.join(self.robot_dir, f).replace("\\", "/") # Ensure forward slashes for Linux
186194
local_path = os.path.join(self.local_dir, f)
187195
if S_ISREG(sftp.stat(remote_path).st_mode):
188196
self.progress.emit(f"Pulling {f}...")
@@ -274,7 +282,8 @@ def start_monitoring(self):
274282
self.monitor_worker.wait()
275283

276284
ip = self.settings.value("rio_ip", "10.6.19.2")
277-
self.monitor_worker = StorageMonitorWorker(ip)
285+
robot_path = self.settings.value("robot_path", "/home/lvuser/akitlogs")
286+
self.monitor_worker = StorageMonitorWorker(ip, robot_path)
278287
self.monitor_worker.status_updated.connect(self.update_status_ui)
279288
self.monitor_worker.start()
280289

@@ -460,8 +469,9 @@ def start_sync(self):
460469

461470
ip = self.settings.value("rio_ip", "10.6.19.2")
462471
path = self.settings.value("save_path", "./logs")
472+
robot_path = self.settings.value("robot_path", "/home/lvuser/akitlogs")
463473

464-
self.worker = SyncWorker(ip, path, self.del_check.isChecked())
474+
self.worker = SyncWorker(ip, path, robot_path, self.del_check.isChecked())
465475
self.worker.progress.connect(lambda m: self.console.append(f"<span style='color: #505759;'>• {m}</span>"))
466476
self.worker.finished.connect(self.on_sync_finished)
467477
self.worker.error.connect(self.on_sync_error)

0 commit comments

Comments
 (0)