automation_messages_form_layout

This module consists of helper functions which define dialog boxes and other messages throughout the project.

microscope_automation.util.automation_messages_form_layout.read_string(title, label, default, return_code=False)[source]

Ask for user input and allows option to abort script.

Input:

title: Title of dialog box

label: Text to display in front of sting input field

default: default input

return_code: if True, will return after cancel with code 0, otherwise will call sys.exit()

Return:

0: User selected to abort script

1: User pressed ok

microscope_automation.util.automation_messages_form_layout.information_message(title, message, return_code=False)[source]

Displays information to user and allows option to abort script.

Input:

title: Title of dialog box

message: Message that will be displayed

return_code: if True, will return after cancel with code 0, otherwise will call sys.exit()

Return:

0: User selected to abort script

1: User pressed ok

microscope_automation.util.automation_messages_form_layout.setup_message(message, return_code=False)[source]

Displays information about setup error and allows option to abort script.

Input:

message: Message that will be displayed

return_code: if True, will return after cancel with code 0, otherwise will call sys.exit()

Return:

0: User selected to abort script

1: User pressed ok

microscope_automation.util.automation_messages_form_layout.operate_message(message, return_code=False)[source]

Ask user to operate microscope manually and allows option to abort script.

Input:

message: Message that will be displayed

return_code: if True, will return after cancel with code 0, otherwise will call sys.exit()

Return:

0: User selected to abort script

1: User pressed ok

microscope_automation.util.automation_messages_form_layout.check_box_message(message, checkBoxList, return_code=False)[source]

Ask user to operate microscope manually and allows option to abort script.

Input:

message: Message that will be displayed

checkBoxList: list with check box names and settings in form:

[(‘Choice 1’, True), (‘Choice 2’, False)

return_code: if True, will return after cancel with code 0, otherwise will call sys.exit()

Return:

0: User selected to abort script

new_check_box_list: User pressed ok result is updated checkBoxList

microscope_automation.util.automation_messages_form_layout.error_message(message, return_code=False, blocking=True)[source]

Show error message and allows option to abort script.

Input:

message: Message that will be displayed

return_code: if True, will return after cancel with code 0, otherwise will call sys.exit()

blocking: if True use modal dialog for error reporting, otherwise print(message)

Return:

0: User selected to abort script

1: User pressed ok

-1: User pressed ok and selected ‘Ignore’

microscope_automation.util.automation_messages_form_layout.wait_message(message, return_code=False)[source]

Interrupt script and wait for user to continue.

Input:

message: Message that will be displayed

return_code: if True, will return after cancel with code 0, otherwise will call sys.exit()

Return:

0: User selected to abort script

True: User pressed ok and want’s to continue to wait after each image

False: User pressed ok and want’s to cancel wait times

microscope_automation.util.automation_messages_form_layout.select_message(message, count=None, return_code=False)[source]

Interrupt script and wait for user to continue.

Input:

message: Message that will be displayed

count: number of collected positions

return_code: if True, will return after cancel with code 0, otherwise will call sys.exit()

Return:

0: User selected to abort script

resultDict: dictionary of form {‘Include’: True/False, ‘Continue’: True/False}

microscope_automation.util.automation_messages_form_layout.file_select_dialog(directory, file_pattern=None, comment=None, return_code=False)[source]

List all files in directory and select one.

Input:

directory: path to directory with files

file_pattern: string with regular expression. If file matches expression it will be pre-selected.

return_code: if True, will return after cancel with code 0, otherwise will call sys.exit()

Output:

file_path: path to selected file

microscope_automation.util.automation_messages_form_layout.pull_down_select_dialog(item_list, message)[source]

Show all items from itemList in pulldown menu and allow user to select one item.

Input:

itemList: list of strings to display in pull down menu

message: string with instructions to user

Output:

selected_item: item selected by user

microscope_automation.util.automation_messages_form_layout.value_calibration_form(title, comment, default, *form_fields)[source]

Attribute selection dialog for value calibration Last result value will always be True or False for whether the value(s) were acceptable

Input:

title: title for the form

comment: comment for the form

form_fields: variable length argument list for all fields to be changed

Output:

result: contents of the calibration form

microscope_automation.util.automation_messages_form_layout.stop_script(message_text=None, allow_continue=False)[source]

Script will stop all Microscope action immediately and ask user to stop execution of script or to continue.

Input:

message_text: Message to user explaining why processing should be stopped.

allow_continue: if True, allow user to continue. Default: False

Output:

none if user selects ‘Continue’, otherwise calls sys.exit()