pypeit.setup_gui.controller module
The controller portion of the PypeIt Setup GUI.
- class pypeit.setup_gui.controller.MetadataOperation(name, model)[source]
Bases:
QObject
Base class for Metadata operations that take long enough that they should take place in a background thread.
- Parameters:
model (PypeItSetupGUIModel) – The PypeIt Setup GUI’s model object.
- _addedMetadata(name, match)[source]
Callback used to report progress on reading files when building metadata.
- _buildingMetadata(name, match)[source]
Callback used to find the total number of files being read when building metadata.
- preRun()[source]
Perform setup required before running the operation. This involves watching the log for files being added to the metadata.
- progressMade
Signal emitted emit when progress has been made. This will be reflected in the view’s progress dialog.
- class pypeit.setup_gui.controller.MetadataPasteAction(controller, menu_text, handler, shortcut=None)[source]
Bases:
QAction
An action (caused by the right click menu in the GUI, a button, or keyboard short cut) for pasting metadata into a PypeItMetadataModel object.
- Parameters:
controller (PypeItMetadataController) – The controller for the PypeItMetadataModel/PypeItMetadataView MVC triplet.
menu_text (str) – The text name for the menu/button that triggers the action.
handler (Callable) – The signal handler to enact the action. This receives the “triggered” event from the parent class.
shortcut (PySide2.QtGui.QKeySequence.StandardKey, Optional) – The keyboard shortcut to initiate the action.
- class pypeit.setup_gui.controller.MetadataReadOnlyAction(controller, menu_text, handler, shortcut=None)[source]
Bases:
QAction
An action (caused by the right click menu in the GUI, a button, or keyboard short cut) that is read only and therefore can be performed on the ObsLog.
- Parameters:
controller (PypeItMetadataController) – The controller for the PypeItMetadataModel/PypeItMetadataView MVC triplet.
menu_text (str) – The text name for the menu/button that triggers the action.
handler (Callable) – The signal handler to enact the action. This receives the “triggered” event from the parent class.
shortcut (PySide2.QtGui.QKeySequence.StandardKey, Optional) – The keyboard shortcut to initiate the action.
- class pypeit.setup_gui.controller.MetadataWriteAction(controller, menu_text, handler, shortcut=None)[source]
Bases:
QAction
An action (caused by the right click menu in the GUI, a button, or keyboard short cut) that can change the file metadata and therefore can only be performed on a PypeItFileModel.
- Parameters:
controller (PypeItMetadataController) – The controller for the PypeItMetadataModel/PypeItMetadataView MVC triplet.
menu_text (str) – The text name for the menu/button that triggers the action.
handler (Callable) – The signal handler to enact the action. This receives the “triggered” event from the parent class.
shortcut (PySide2.QtGui.QKeySequence.StandardKey, Optional) – The keyboard shortcut to initiate the action.
- exception pypeit.setup_gui.controller.OpCanceledError[source]
Bases:
Exception
Exception thrown when a background operation has been canceled.
- class pypeit.setup_gui.controller.OpenFileOperation(model, file)[source]
Bases:
MetadataOperation
Background operation to open a PypeIt file
- Parameters:
model (PypeItSetupGUIModel) – The PypeIt Setup GUI’s model object.
() (file) – The file to open.
- class pypeit.setup_gui.controller.OperationThread[source]
Bases:
QThread
Thread to run a background operation.
- _cancel_op()[source]
Cancels an in progress background operation when the user cancels the progress dialog.
- _op_complete(canceled, exc_info)[source]
Signal handler that is notified when a background operation completes.
- _op_progress(max_progress, progress_message=None)[source]
Signal handler that receives progress information from a background operation as it proceeds. It passes this to the view to increase the value showing in the progress dialog.
- completed
Signal send the operation has completed.
- startOperation(operation)[source]
Start a background operation.
- Parameters:
operation (MetadataOperation) – The MetadataOperation to start in the background thread.
- class pypeit.setup_gui.controller.PypeItFileController(model)[source]
Bases:
QObject
PypeItFileController responsible for responding to user interaction as part of a MVC triplet with PypeItFileView and PypeItFileModel
- Parameters:
main_window (
UserPromptDelegate
) – A view object that can prompt the user.model (
PypeItFileModel
) – The model for the obs log.
- class pypeit.setup_gui.controller.PypeItMetadataController(model, is_pypeit_file)[source]
Bases:
QObject
A Controller object for performing actions iniitiated by the user file metadata. Part of a MVC triplet involving PypeItMetadataModel/PypeItMetadataController/PypeItMetadataView.
- Parameters:
model (PypeItMetatadataModel) – The model this controller acts with.
is_pypeit_file (bool) – True if the model is for a PypeItFileModel (that is writeable model), False if it is from a PypeItObsLog model (read only)
- getActions(parent)[source]
Returns the actions that this controller supports.
Returns: (list of QAction): List of the actions that can be performed on the PypeItMetadataModel.
- setView(view)[source]
Set the view that is responsible for displaying and receiving input for the PypeItMetadataModel.
- Parameters:
view (PypeItMetadataView) – The view.
- class pypeit.setup_gui.controller.PypeItObsLogController(model, setup_gui_controller)[source]
Bases:
QObject
PypeItObsLogController responsible for responding to user interaction as part of a MVC triplet with PypeItObsLogView and PypeItObsLogModel
- Parameters:
main_window (
UserPromptDelegate
) – A view object that can prompt the user.model (
PypeItObsLogModel
) – The model for the obs log.operation_thread (
pypeit.setup_gui.controller.SetupGUIController
) – The main Setup GUI controller.
- class pypeit.setup_gui.controller.SetupGUIController(args)[source]
Bases:
QObject
Controller for the PypeIt setup gui. It is responsible for initializing the GUI, and performing actions requested by the user.
- Parameters:
args (
argparse.Namespace
) – The non-QT command line arguments used to start the GUI.
- clear()[source]
Resets the GUI to it’s initial state. Called in response to the user clicking the “Clear” button. This will prompt the user if they want to save any unsaved changes first.
- exit()[source]
Exits the GUI. Called in response to the user clicking the “Exit” button. This will prompt the user if they want to save any unsaved changes first.
- getObsLogController(model)[source]
Create the PypeItObsLogController as part of a MVC triplet.
- Parameters:
model (
PypeItObsLogModel
) – The model for the obs log.main_window (
SetupGUIMainWindow
) – The mainwindow of the setup GUI.
- getPypeItFileController(model)[source]
Create the PypeItObsLogController as part of a MVC triplet.
- Parameters:
model (
PypeItFileModel
) – The model for the obs log.
- main_window = None
- model = <pypeit.setup_gui.model.PypeItSetupGUIModel object>
- open_pypeit_file()[source]
Opens a PypeIt file. Called in response to the user the clicking the “Open” button. This method prompts the user to discard or save any current changes, prompts the user for a pypeit to open, and opens it.
- run_setup()[source]
Runs setup on the currently selected raw data directories. Called in response to the user the clicking the “Run Setup” or changing the spectrograph. This will prompt the user if they want to save any unsaved changes first and start the operation in a background thread.
- save_all()[source]
” Save all unique configurations as pypeit files. Called in response to the user clicking the “Save All” button.
- class pypeit.setup_gui.controller.SetupOperation(model)[source]
Bases:
MetadataOperation
Background operation to run pypeit setup.
- Parameters:
model (PypeItSetupGUIModel) – The PypeIt Setup GUI’s model object.