Queue processor¶
-
class mundo.api.queue_processor.QueueProcessor(
parent: PySide2.QtWidgets.QWidget,
system: mundo.api.system.System
)¶ The sample queue processor. This class implements the logic needed to automatically and manually analyse samples from the queue.
-
__init__(
parent: PySide2.QtWidgets.QWidget,
system: mundo.api.system.System
) None ¶ Creates a new queue processor.
- Parameters
parent – The parent widget. This is used to display error dialogs if needed
system – The system class instance
-
__update_current_sample_state(
state: mundo.api.sample.SampleState
) None ¶ Updates the state of the currently processing sample, if any.
-
__get_sample_time(
sample: Optional[mundo.api.sample.Sample]
) int ¶ Get the sample time for a sample, or the default if no sample time is set.
- Returns
The sample time in seconds for the specified sample
- __is_queue_empty() bool ¶
Checks if the queue is empty.
- Returns
True if the queue is empty. False otherwise
- __on_mode_update() None ¶
Event handler for the global process mode update event. This will make sure that the queue is only auto processed if the auto mode is indeed enabled.
If the auto mode is enabled, the next sample will be automatically analysed, unless another sample is already being analysed.
- __should_auto_process() bool ¶
Check if the queue should be auto processed.
- Returns
True if the queue is auto processed. False otherwise
- __on_second_timer_timeout() None ¶
- __on_timer_timeout() None ¶
Event handler for when the sample time is complete. This will automatically stop the timer to ensure that the timeout will not be triggered again, as well as finishing the processing of the current sample by ejecting.
-
__on_stop_process_result(
result: bool
) None ¶ Handle the stop process result event that is sent once the process has been executed successfully. It might still have failed, depending on the value of the result parameter.
- Parameters
result – If the process was stopped successfully or not
-
__on_stop_process_error(
error: Tuple[Type[BaseException], BaseException, str]
) None ¶ Handle the stop process error event that is sent if the worker failed to execute the stop method.
- Parameters
error – The thrown exception from the worker
-
__on_reset_process_result(
result: Tuple[bool, Optional[mundo.api.sample.Sample]]
) None ¶ Handle the reset process result event that is sent once the process has been executed successfully. It might still have failed, depending on the value of the result parameter.
- Parameters
result – A tuple containing the success and the previously processed sample, if any
-
__on_reset_process_error(
error: Tuple[Type[BaseException], BaseException, str]
) None ¶ Handle the reset process error event that is sent if the worker failed to execute the reset method.
- Parameters
error – The thrown exception from the worker
-
__on_next_sample_result(
result: Tuple[bool, Optional[mundo.api.sample.Sample]]
) None ¶ Handle the next sample result event that is sent once the next sample is being analysed. It might still have failed, depending on the value of the result parameter.
- Parameters
result – A tuple containing the success and the sample that is being processed, if any.
-
__on_next_sample_error(
error: Tuple[Type[BaseException], BaseException, str]
) None ¶ Handle the next sample error event that is sent if the worker failed to execute the next sample method.
- Parameters
error – The thrown exception from the worker
-
__on_finish_sample_result(
result: Tuple[bool, Optional[mundo.api.sample.Sample]]
) None ¶ Handle the finish sample result event that is sent once the currently processing sample is done being analysed. It might still have failed, depending on the value of the result parameter.
- Parameters
result – A tuple containing the success and the sample that is finished being processed, if any.
-
__on_finish_sample_error(
error: Tuple[Type[BaseException], BaseException, str]
) None ¶ Handle the finish sample error event that is sent if the worker failed to execute the finish sample method.
- Parameters
error – The thrown exception from the worker
-
__on_resume_process_result(
result: bool
) None ¶ Handle the resume process result event that is sent once the movement has been attempted to be resumed. It might still have failed, depending on the value of the result parameter.
- Parameters
result – If the movement was resumed successfully or not
-
__on_resume_process_error(
error: Tuple[Type[BaseException], BaseException, str]
) None ¶ Handle the resume process error event that is sent if the worker failed to resume the movement of the motors.
- Parameters
error – The thrown exception from the worker
-
start(
first_sample=False
) None ¶ Starts analysing samples in the queue.
- Parameters
first_sample – If the first sample in the queue should be analysed or not. This is used when the manual mode is activated to ensure that the first sample is always automatically processed
- next_sample() None ¶
Analyse the next sample in the queue.
- stop() None ¶
Stop the running queue process.
- resume() None ¶
Resumes the queue processing.
- reset() None ¶
Resets the current queue process.
- staticMetaObject = <PySide2.QtCore.QMetaObject object>¶
-
__init__(