[Task]: No central connection-state guard on tab actions #5

Open
opened 2026-04-17 11:30:37 +00:00 by tgohle · 0 comments
Owner

Problem

Most tab handlers call self.i.write() or query methods directly and rely on exception handling if the instrument is not connected.

Why this is a problem

Technically this works, because the exception is caught and logged, but the UI still allows actions that are guaranteed to fail.

That makes the tool feel rougher than necessary and creates avoidable error spam.

Fix approach

Add a helper such as:

def _require_connected(self) -> bool:
    if not self.i.sock:
        self.logln("[ERR] Not connected")
        return False
    return True

and call it at the top of handlers that require an active instrument connection.

Optional follow-up:

  • disable relevant controls while disconnected
  • re-enable them after successful connect

Status

Still open.
Not fixed in the current v0.2 working copy.

### Problem Most tab handlers call `self.i.write()` or query methods directly and rely on exception handling if the instrument is not connected. ### Why this is a problem Technically this works, because the exception is caught and logged, but the UI still allows actions that are guaranteed to fail. That makes the tool feel rougher than necessary and creates avoidable error spam. ### Fix approach Add a helper such as: ```python def _require_connected(self) -> bool: if not self.i.sock: self.logln("[ERR] Not connected") return False return True ``` and call it at the top of handlers that require an active instrument connection. Optional follow-up: - disable relevant controls while disconnected - re-enable them after successful connect ### Status Still open. Not fixed in the current v0.2 working copy.
tgohle added the
area/gui-basic
kind
task
3
severity
medium
2
state
confirmed
2
labels 2026-04-17 11:44:46 +00:00
tgohle self-assigned this 2026-04-17 12:09:17 +00:00
tgohle changed title from No central connection-state guard on tab actions to [Task]: No central connection-state guard on tab actions 2026-04-18 11:20:59 +00:00
Sign in to join this conversation.
No description provided.