Skip to content

Keyboard shortcuts#134

Open
osn07 wants to merge 4 commits intotoolsforexperiments:masterfrom
osn07:keyboard-shortcuts
Open

Keyboard shortcuts#134
osn07 wants to merge 4 commits intotoolsforexperiments:masterfrom
osn07:keyboard-shortcuts

Conversation

@osn07
Copy link
Copy Markdown
Contributor

@osn07 osn07 commented May 7, 2026

Adds customizable keyboard shortcuts that a user can execute to streamline instrumentserver workflow

osn07 added 4 commits May 4, 2026 22:57
…es a user's individual shortcut preferences. ShortcutEditorDialog handles UI interactions and updates a KSM class instance accordingly. base_instrument.py was updated to implement these new classes and add a button to edit keyboard shortcuts.
…to Station or Log. alert column on right side indicates three states: ok (white), unsaved (orange), and duplicate (red). alert displays tooltip for each tooltip. ServerGui now holds a shortcut editor and shortcut manager, which is passed to an instrument tab when opened.
@osn07 osn07 force-pushed the keyboard-shortcuts branch from 2525bff to c64a489 Compare May 7, 2026 04:03

from instrumentserver import QtCore, QtGui, QtWidgets

from .shortcuts import KeyboardShortcutManager
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't use . in the imports


@staticmethod
def _matches_any_pattern(name: str, patterns: List[str]) -> bool:
def _matches_any_pattern(name: str, patterns: Optional[List[str]]) -> bool:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why add the Optional but not a None argument? is this really optional?


# Indicates if a column is using delegates.
self.delegateColumns = delegateColumns
self.delegateColumns: List[int] = delegateColumns or []
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does changing the default change the behaviour downstream?

proxyModelType: type = InstrumentSortFilterProxyModel,
viewType: type = InstrumentTreeViewBase,
callSignals: bool = True,
shortcutManager: Optional[KeyboardShortcutManager] = None,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this argument to the docstring

when Save is clicked. Use 'Save to file' / 'Load from file' to persist across sessions.

Each row has a small colored indicator dot in the rightmost column:
- white : saved and unique
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't been able to make it white even when saved

kwargs["sub_port"] = kwargs.get("sub_port", self.stationServer.port + 1) # type: ignore[union-attr]
station_server = self.stationServer
if station_server is None:
raise RuntimeError("addInstrumentToGui called before server started")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is this error and what is it catching?

else QtCore.Qt.SortOrder.DescendingOrder
)
header.setSortIndicator(col, new_order)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need all these new slots?

@marcosfrenkel
Copy link
Copy Markdown
Collaborator

On top of the specific coding things 2 things are left on this:

  • Make sure we can fully navigate the interface with arrow keys; being able to press the right arrow key and edit the value of a parameter directly.
  • Make the config aspect of the shortcuts be in the config of the server itself instead of having its own dedicated file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants