Workspaces¶
Workspaces provide a way for the user to set up, save, and load customised configurations of the DataLogger. In this way, specific workspaces can be created (eg. for undergraduate teaching) to limit the functionality available.
The .wsp
format¶
Workspaces are saved in a unique format, .wsp
. WSP files are effectively a list of the settings for the DataLogger, allowing the user to enable add ons, set display options and suchlike.
An example of a .wsp file can be found in tests/test_workspace.wsp
.
Rules for a ``.wsp`` file:
- Only settings defined in the
Workspace
class are permitted (see below) - Settings that are strings (eg. workspace names, paths) must use single quotes ‘’
- Either boolean (
False
/True
) or integer (0
/1
) values may be used for flags. It is recommended to use integers, for clarity - The only form of line that will be interpreted as a setting is
variable_name=variable_value
wherevariable_value
can either be a string (variable_name='example'
), integervariable_name=1
, or boolean (variable_name=False
) - Hence comments may be inserted into the
.wsp
file. It is recommended to use Python comment syntax (#
and""" """
)
Running the DataLogger with a Workspace¶
To specify a Workspace when running the DataLogger, use:
cued_datalogger -w /path/to/workspace.wsp
The Workspace
class¶
-
class
cued_datalogger.api.workspace.
Workspace
¶ Bases:
object
The
Workspace
class stores the workspace attributes and has methods for saving, loading, configuring, and displaying the workspace settings.Workspaces are designed so that specific configurations of the DataLogger can be created, eg. for undergraduate labs, with different features enabled or disabled, and stored in a
.wsp
file that can be read using theWorkspace
class. In the DataLogger, aCurrentWorkspace
instance is normally initiated that will store the current settings and all the workspace functionality will be accessed through theCurrentWorkspace
.Attributes
name (str) A human-readable name for this workspace, eg. "Lab 4C6"
path (str) The path to this workspace’s directory. Addons will be loaded from the directory path/addons/
, and files will be saved topath
(not implemented yet). Default value is"./"
.add_ons_enabled (bool) Flag that sets whether to addons are enabled (not implemented yet - currently has no effect). Default value is True
pyqtgraph_inverted (bool) Flag that sets whether pyqtgraph uses a white background and black lines ( False
), or black background and white lines (True
). Default value isFalse
.default_pen (str) The default colour of the pen, set by pyqtgraph_inverted
. Cannot be set manually.pyqtgraph_antialias (bool) Flag that sets whether pyqtgraph uses antialiasing for smoother lines. Default value is True
.Methods
-
configure
()¶ Set the global configuration of the DataLogger to the settings in this workspace.
-
load
(workspace)¶ Load the settings found in the .wsp file given by *workspace*` (of the form
"/path/to/workspace.wsp"
).
-
save
(destination)¶ Save this workspace to destination (of the form
"/path/to/workspace.wsp"
).
-
settings
()¶ A convenience method to access this workspace’s configuration
-
Widgets¶
Not implemented yet.