Reference¶
ONCatLogin¶
- class pyoncatqt.login.ONCatLogin(*args: Any, **kwargs: Any)[source]¶
ONCatLogin widget for connecting to the ONCat service.
This widget provides a status label and a button that starts an interactive, browser-based sign-in using PyONCat’s Device Authorization Grant. When a sign-in is started, a
VerificationDialogshows a link the user opens to approve the sign-in with ORNL credentials.Params¶
- client_idstr, optional
The client_id is an ONCat client ID. Defaults to None. client_id is required or key is required
- keystr, optional
The key used to retrieve ONCat client ID from configuration. Defaults to None.
- parentQWidget, optional
The parent widget.
- timeoutfloat, optional
Request timeout, in seconds, for the ONCat agent. Defaults to 10.0.
- kwargsDict[str, Any], optional
Additional keyword arguments.
login_titleoverrides the sign-in dialog window title.
- connection_updated¶
Signal emitted when the connection status is updated.
- Type:
Signal
- is_connected() bool:¶
Check if connected to OnCat.
- closeEvent(event: qtpy.QtGui.QCloseEvent) None[source]¶
Stop any in-flight background job before the widget is torn down.
The worker thread is unparented and its
succeeded/failedsignals are wired to bound methods on this widget. If the widget were destroyed mid-job, a late-finishing worker could call back into a half-destroyed C++ object. Cancel the poll loop where possible, detach the outcome callbacks so nothing outlives the widget, then stop and wait for the thread.
- connect_to_oncat() None[source]¶
Start an interactive, browser-based sign-in to OnCat.
Sign-in runs on a worker thread while PyONCat polls the IdP; a
VerificationDialogsurfaces the approval link. The connection status is refreshed once sign-in resolves.
- connection_updated¶
alias of
bool
- disconnect_from_oncat() None[source]¶
Log out of OnCat, revoking the current session.
logout()revokes the refresh token server-side rather than only clearing it locally, so it does network I/O and must run on a worker thread. The connection status is refreshed once it resolves.
- get_agent_instance() ONCat[source]¶
Get OnCat agent instance.
- Returns:
The OnCat agent instance.
- Return type:
pyoncat.ONCat
- property is_connected: bool¶
Check if connected to OnCat.
- Returns:
True if connected, False otherwise.
- Return type:
bool
VerificationDialog¶
- class pyoncatqt.login.VerificationDialog(*args: Any, **kwargs: Any)[source]¶
Sign-in dialog showing a clickable link, the user code, and Cancel.
The user approves the sign-in in a browser using ORNL credentials; this dialog only surfaces the verification link and one-time code produced by the Device Authorization Grant.
Params¶
- linkstr
The verification URL to open in a browser.
- user_codestr
The one-time code to enter at the verification URL, if prompted.
- parentQWidget, optional
The parent widget.
- cancelled¶
Emitted when the user dismisses the dialog before sign-in resolves.
- Type:
Signal
- closeEvent(event: qtpy.QtGui.QCloseEvent) None[source]¶
Route the window frame to the cancel signal.
Dismissing the dialog via the window frame sets the cancel event rather than leaving the worker polling.
- reject() None[source]¶
Route the Cancel button and the Escape key to the cancel signal.
Qt sends both the Cancel button (wired here) and the Escape key through
reject(), which dismisses the dialog viadone()without firingcloseEvent(). The cancel signal is emitted here so those paths do not silently leave the worker polling; the guard keeps it from re-emitting after a resolved sign-in or a later close.