Main window#
The datalab.gui.main module provides the main window of the
DataLab project.
- class datalab.gui.main.DLMainWindow(console=None, hide_on_close=False)[source]#
DataLab main window
- Paramètres:
console – enable internal console
hide_on_close – True to hide window on close
- static xmlrpc_server_started(port)[source]#
XML-RPC server has started, writing comm port in configuration file
- get_group_titles_with_object_info() tuple[list[str], list[list[str]], list[list[str]]][source]#
Return groups titles and lists of inner objects uuids and titles.
- Renvoie:
Groups titles, lists of inner objects uuids and titles
- get_object_titles(panel: Literal['signal', 'image', 'macro'] | None = None) list[str][source]#
Get object (signal/image) list for current panel. Objects are sorted by group number and object index in group.
- Paramètres:
panel – panel name. If None, current data panel is used (i.e. signal or image panel).
- Renvoie:
List of object titles
- Lève:
ValueError – if panel is unknown
- get_object(nb_id_title: int | str | None = None, panel: Literal['signal', 'image'] | None = None) SignalObj | ImageObj[source]#
Get object (signal/image) from index.
- find_object_by_uuid(uuid: str) SignalObj | ImageObj | ObjectGroup | None[source]#
Find an object by UUID, searching across all panels.
This method searches for an object in both signal and image panels, making it suitable for cross-panel operations (e.g., radial profile that takes an ImageObj and produces a SignalObj).
Difference from get_object(): - get_object() requires specifying a panel and accepts number/id/title - find_object_by_uuid() searches all panels automatically using only UUID
- Paramètres:
uuid – UUID of the object to find
- Renvoie:
The object if found in any panel, None otherwise
- get_object_uuids(panel: Literal['signal', 'image'] | None = None, group: int | str | None = None) list[str][source]#
Get object (signal/image) uuid list for current panel. Objects are sorted by group number and object index in group.
- Paramètres:
panel – panel name. If None, current panel is used.
group – Group number, or group id, or group title. Defaults to None (all groups).
- Renvoie:
List of object uuids
- Lève:
ValueError – if panel is unknown
- get_sel_object_uuids(include_groups: bool = False) list[str][source]#
Return selected objects uuids.
- Paramètres:
include_groups – If True, also return objects from selected groups.
- Renvoie:
List of selected objects uuids.
- add_group(title: str, panel: Literal['signal', 'image'] | None = None, select: bool = False) None[source]#
Add group to DataLab.
- Paramètres:
title – Group title
panel – Panel name. Defaults to None.
select – Select the group after creation. Defaults to False.
- select_objects(selection: list[int | str], panel: Literal['signal', 'image'] | None = None) None[source]#
Select objects in current panel.
- Paramètres:
selection – List of object numbers (1 to N) or uuids to select
panel – panel name. If None, current panel is used. Defaults to None.
- select_groups(selection: list[int | str] | None = None, panel: Literal['signal', 'image'] | None = None) None[source]#
Select groups in current panel.
- Paramètres:
selection – List of group numbers (1 to N), or list of group uuids, or None to select all groups. Defaults to None.
panel – panel name. If None, current panel is used. Defaults to None.
- delete_metadata(refresh_plot: bool = True, keep_roi: bool = False) None[source]#
Delete metadata of selected objects
- Paramètres:
refresh_plot – Refresh plot. Defaults to True.
keep_roi – Keep ROI. Defaults to False.
- get_object_shapes(nb_id_title: int | str | None = None, panel: Literal['signal', 'image'] | None = None) list[source]#
Get plot item shapes associated to object (signal/image).
- Paramètres:
nb_id_title – Object number, or object id, or object title. Defaults to None (current object).
panel – Panel name. Defaults to None (current panel).
- Renvoie:
List of plot item shapes
- add_annotations_from_items(items: list, refresh_plot: bool = True, panel: Literal['signal', 'image'] | None = None) None[source]#
Add object annotations (annotation plot items).
- Paramètres:
items – annotation plot items
refresh_plot – refresh plot. Defaults to True.
panel – panel name. If None, current panel is used.
- add_label_with_title(title: str | None = None, panel: Literal['signal', 'image'] | None = None) None[source]#
Add a label with object title on the associated plot
- Paramètres:
title – Label title. Defaults to None. If None, the title is the object title.
panel – panel name. If None, current panel is used.
- run_macro(number_or_title: int | str | None = None) None[source]#
Run macro.
- Paramètres:
number – Number of the macro (starting at 1). Defaults to None (run current macro, or does nothing if there is no macro).
- stop_macro(number_or_title: int | str | None = None) None[source]#
Stop macro.
- Paramètres:
number – Number of the macro (starting at 1). Defaults to None (stop current macro, or does nothing if there is no macro).
- import_macro_from_file(filename: str) None[source]#
Import macro from file
- Paramètres:
filename – Filename.
- property panels: tuple[AbstractPanel, ...]#
Return the tuple of implemented panels (signal, image)
- Renvoie:
Tuple of panels
- confirm_memory_state() bool[source]#
Check memory warning state and eventually show a warning dialog
- Renvoie:
True if memory state is ok
Take menu screenshots
- setup(console: bool = False) None[source]#
Setup main window
- Paramètres:
console – True to setup console
- set_process_isolation_enabled(state: bool) None[source]#
Enable/disable process isolation
- Paramètres:
state – True to enable process isolation
- get_current_panel() str[source]#
Return current panel name
- Renvoie:
« signal », « image », « macro »)
- Type renvoyé:
Panel name (valid values
- set_current_panel(panel: Literal['signal', 'image', 'macro'] | BaseDataPanel) None[source]#
Switch to panel.
- Paramètres:
panel – panel name or panel instance
- Lève:
ValueError – unknown panel
- calc(name: str, param: gds.DataSet | None = None) None[source]#
Call computation feature
nameNote
This calls either the processor’s
compute_<name>method (if it exists), or the processor’s<name>computation feature (if it is registered, using therun_featuremethod). It looks for the function in all panels, starting with the current one.- Paramètres:
name – Compute function name
param – Compute function parameter. Defaults to None.
- Lève:
ValueError – unknown function
- toggle_show_titles(state: bool) None[source]#
Toggle show annotations option
- Paramètres:
state – state
- handle_autorefresh_action(state: bool) None[source]#
Handle auto-refresh action from UI (with confirmation dialog)
- Paramètres:
state – desired state
- toggle_show_first_only(state: bool) None[source]#
Toggle show first only option
- Paramètres:
state – state
- save_to_h5_file(filename=None) None[source]#
Save to a DataLab HDF5 file
- Paramètres:
filename – HDF5 filename. If None, a file dialog is opened.
- Lève:
IOError – if filename is invalid or file cannot be saved.
- open_h5_files(h5files: list[str] | None = None, import_all: bool | None = None, reset_all: bool | None = None) None[source]#
Open a DataLab HDF5 file or import from any other HDF5 file.
- Paramètres:
h5files – HDF5 filenames (optionally with dataset name, separated by « : »)
import_all – Import all datasets from HDF5 files
reset_all – Reset all application data before importing
- browse_h5_files(filenames: list[str], reset_all: bool) None[source]#
Browse HDF5 files
- Paramètres:
filenames – HDF5 filenames
reset_all – Reset all application data before importing
- import_h5_file(filename: str, reset_all: bool | None = None) None[source]#
Import HDF5 file into DataLab
- Paramètres:
filename – HDF5 filename (optionally with dataset name,
" (separated by) – « )
reset_all – Delete all DataLab signals/images before importing data
- add_object(obj: SignalObj | ImageObj, group_id: str = '', set_current=True) None[source]#
Add object - signal or image
- Paramètres:
obj – object to add (signal or image)
group_id – group ID (optional)
set_current – True to set the object as current object
- load_from_files(filenames: list[str]) None[source]#
Open objects from files in current panel (signals/images)
- Paramètres:
filenames – list of filenames
- load_from_directory(path: str) None[source]#
Open objects from directory in current panel (signals/images).
- Paramètres:
path – directory path
- add_signal(title: str, xdata: ndarray, ydata: ndarray, xunit: str = '', yunit: str = '', xlabel: str = '', ylabel: str = '', group_id: str = '', set_current: bool = True) bool[source]#
Add signal data to DataLab.
- Paramètres:
title – Signal title
xdata – X data
ydata – Y data
xunit – X unit. Defaults to « «
yunit – Y unit. Defaults to « «
xlabel – X label. Defaults to « «
ylabel – Y label. Defaults to « «
group_id – group id in which to add the signal. Defaults to « «
set_current – if True, set the added signal as current
- Renvoie:
True if signal was added successfully, False otherwise
- Lève:
ValueError – Invalid xdata dtype
ValueError – Invalid ydata dtype
- add_image(title: str, data: ndarray, xunit: str = '', yunit: str = '', zunit: str = '', xlabel: str = '', ylabel: str = '', zlabel: str = '', group_id: str = '', set_current: bool = True) bool[source]#
Add image data to DataLab.
- Paramètres:
title – Image title
data – Image data
xunit – X unit. Defaults to « «
yunit – Y unit. Defaults to « «
zunit – Z unit. Defaults to « «
xlabel – X label. Defaults to « «
ylabel – Y label. Defaults to « «
zlabel – Z label. Defaults to « «
group_id – group id in which to add the image. Defaults to « «
set_current – if True, set the added image as current
- Renvoie:
True if image was added successfully, False otherwise
- Lève:
ValueError – Invalid data dtype