ControlModule()

Abstract Base class common to both DAQ_Move and DAQ_Viewer control modules

8.1.1. ControlModule base classes

Both DAQ_Move and DAQ_Viewer control modules share some specificities and inherit from a base class: the ControlModule

class pymodaq.control_modules.utils.ControlModule[source]

Abstract Base class common to both DAQ_Move and DAQ_Viewer control modules

init_signal

This signal is emitted when the chosen hardware is correctly initialized

Type:

pyqtSignal

command_hardware

This signal is used to communicate with the instrument plugin within a separate thread

Type:

pyqtSignal

command_tcpip

This signal is used to communicate through the TCP/IP Network

Type:

pyqtSignal

quit_signal

This signal is emitted when the user requested to stop the module

Type:

pyqtSignal

Attributes:
h5saver
initialized_state

bool: Check if the module is initialized

module_and_data_saver
module_type

str: Get the module type, either DAQ_Move or DAQ_viewer

title

str: get the title of the module

ui

Methods

grab()

Programmatic entry to grab data from detectors or current value from actuator

init_hardware([do_init])

Programmatic entry to initialize/deinitialize the control module

init_hardware_ui([do_init])

Programmatic entry to simulate a click on the user interface init button

manage_ui_actions(action_name, attribute, value)

Method to manage actions for the UI (if any).

quit_fun()

Programmatic entry to quit the control module

show_config(config)

Display in a tree the current configuration

show_log()

Open the log file in the default text editor

stop_grab()

Programmatic entry to stop data grabbing from detectors or current value polling from actuator

thread_status(status[, control_module_type])

Get back info (using the ThreadCommand object) from the hardware

update_status(txt[, log])

Display a message in the ui status bar and eventually log the message

append_data

close_file

command_hardware

create_new_file

custom_command

custom_sig

init_signal

insert_data

quit_signal

status_sig

grab()[source]

Programmatic entry to grab data from detectors or current value from actuator

init_hardware(do_init=True)[source]

Programmatic entry to initialize/deinitialize the control module

Parameters:

do_init (bool) – if True initialize the selected hardware else deinitialize it

init_hardware_ui(do_init=True)[source]

Programmatic entry to simulate a click on the user interface init button

Parameters:

do_init (bool) – if True initialize the selected hardware else deinitialize it

Notes

This method should be preferred to init_hardware()

manage_ui_actions(action_name, attribute, value)[source]

Method to manage actions for the UI (if any).

Will try to apply the given value to the given attribute of the corresponding action

Parameters:
  • action_name (str)

  • attribute (str)

  • value (object) – actual type and value depend on the triggered attribute

Examples

>>>manage_ui_actions(‘quit’, ‘setEnabled’, False) # will disable the quit action (button) on the UI

quit_fun()[source]

Programmatic entry to quit the control module

show_config(config)[source]

Display in a tree the current configuration

Return type:

Config

show_log()[source]

Open the log file in the default text editor

stop_grab()[source]

Programmatic entry to stop data grabbing from detectors or current value polling from actuator

thread_status(status, control_module_type='detector')[source]

Get back info (using the ThreadCommand object) from the hardware

And re-emit this ThreadCommand using the custom_sig signal if it should be used in a higher level module

Parameters:

status (ThreadCommand) –

The info returned from the hardware, the command (str) can be either:
  • Update_Status: display messages and log info (deprecated)

  • update_status: display info on the UI status bar

  • close: close the current thread and delete corresponding attribute on cascade.

  • update_settings: Update the “detector setting” node in the settings tree.

  • update_main_settings: update the “main setting” node in the settings tree

  • raise_timeout:

  • show_splash: Display the splash screen with attribute as message

  • close_splash

  • show_config: display the plugin configuration

update_status(txt, log=True)[source]

Display a message in the ui status bar and eventually log the message

Parameters:
  • txt (str) – message to display

  • log (bool) – if True, log the message in the logger

property initialized_state

Check if the module is initialized

Type:

bool

property module_type

Get the module type, either DAQ_Move or DAQ_viewer

Type:

str

property title

get the title of the module

Type:

str

The same is also true for the UI of these modules sharing a common UI base class: the ControlModuleUI