vdat.gui.tabs.tab_widget – The tab widgets¶
-
class
vdat.gui.tabs.tab_widget.UpdateIFUTask(parent=None)[source]¶ Bases:
PyQt5.QtCore.QThreadPyQt5.QtCore.QThreadthat runsifu.prepare_imageon every of the ifus passed to theinit()methodCustom signals¶ Name Signature Description finishedbool Emitted when the run()is stopped (True) or finishes normally (False)ifu_readystr after preparing the image(s) to show, emits the signal with the ifu.ifuslot string. The main thread can then retrieve the ifu and display it. Custom slot¶ Name Signature Description stop()stop and exit from run()before finishing the list of IFUs. If the method is processing one IFU, finishes before exiting.Note
It is not possible to update a pixmap from withing a running
QThread. Therefore we emit theifu_readysignal when the image is ready for display. It is responsibility of the process owning the thread to pain the image into the pixmap and display it.Parameters: - parent :
QWidgetor derived instance, optional the parent of the current widget
Attributes: - ifus : list
IFUs to process. Each object must implement the
prepare_image()
-
finished¶
-
ifu_ready¶
- parent :
-
class
vdat.gui.tabs.tab_widget.BaseFplanePanel(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.interface.FplaneTabTemplateImplementation of the
FplaneTabTemplatethat creates a working fplane panel using theifu_widget.BaseIFUWidget. Connect all the relevant slots to be able to select/deselect the IFUs.Custom signals¶ Name Signature Description sig_thread_stopEmitted to stop the update_threadCustom slot¶ Name Signature Description update_finished bool react to the UpdateIFUTask.finishedsignal. The current implementation does nothing.ifuSelected(),selectAllIFUs(),deselectAllIFUs()see interface.FplaneTabTemplateupdate_ifus()If the update_threadruns, stop it; then pass to it the IFUs list and start the thread.Connections between custom signals and/or slots.¶ Signal Slot UpdateIFUTask.finishedupdate_finished()UpdateIFUTask.ifu_readyshow_ifu_image()sig_thread_stopUpdateIFUTask.stop()ifu_widget.BaseIFUWidget.sig_ifuToggledsig_ifuToggledParameters: - all :
Attributes: - update_thread :
UpdateIFUTask QThread used to update the images to show in the IFUs
ifu_widget_classReturn the name of the class to use to represent IFUs in the focal plane.
- fplane :
FPlane instance of the focal plane constructed using the
ifu_widget_class- main_layout :
PyQt5.QtWidgets.QVBoxLayout main layout of the widget.
- fplane_layout :
PyQt5.QtWidgets.QGridLayout layout containing the IFU widgets
- initialized : bool
if
False, react toshowEvent()drawing the tab content. It is set toFalseat build time and incleanup()- others
-
sig_thread_stop¶
-
setup_qthread()[source]¶ Create and setup the
UpdateIFUTask. Saves it into theupdate_threadattribute.Overrides this method to use other QThread implementations. The rest of the implementation assumes that
update_threadhas astart()method and aifusattibute.This method is called during the initialisation of the object
-
build_gui()[source]¶ Build the GUI calling
set_main_layout()and adding to the main layout the fplane layout frombuild_fplane()
-
set_main_layout()[source]¶ Create and set the default layout. The layout is saved into the
main_layout.Default to
PyQt5.QtWidgets.QVBoxLayout. Override to use a different layout.
-
build_fplane()[source]¶ Create a grid layout, fill it with the IFU widgets returned by
ifu_widget_class, connect the relevant signals and return the layout.The name of the fplane file is taken from the
fp_filenameoption of thefplanesectoin in the main vdat configuration file.Returns: - fplane_layout :
PyQt5.QtWidgets.QGridLayoutinstance layout containing the IFU widgets
- fplane_layout :
-
ifu_widget_class¶ Return the name of the class to use to represent IFUs in the focal plane.
Override in derived classes to use a different IFU widget.
Returns: - :class:`.ifu_widget.BaseIFUWidget`
-
update_finished(stopped)[source]¶ Do nothing method. This method is also a pyqt Slot.
Override this method in derived classes to act upon the
UpdateIFUTask.finishedsignalParameters: - stopped : bool
Trueif the updated has been forcefully stopped,Falseif it finished.
-
show_ifu_image(ifuslot)[source]¶ Call the
show_image()of the ifu withifuslotID.This method is also an pyqt slot.
Parameters: - ifuslot : str
ifuslot ID of the IFU to show
-
ifuSelected(ifuslot, val)[source]¶ Select or deselect an IFU. This method is also a PyQt slot.
Parameters: - ifuslot : string
SLOTID of the selected IFU
- val : bool
If
Trueselected, otherwise deselected
-
selectAllIFUs()[source]¶ Select all IFU. This method is also a PyQt slot.
It emits the
sig_ifuToggledsignal to make sure that all the ifus are registered as selected.
-
deselectAllIFUs()[source]¶ Deselect all IFU. This method is also a PyQt slot.
It emits the
sig_ifuToggledsignal to make sure that all the ifus are registered as deselected.
-
showEvent(e)[source]¶ When the tab becomes visible, this method is triggered by Qt. If
initializedis False, callsupdate_ifus()and then set it to True.Parameters: - e :
PyQt5.QtGui.QShowEvent the tab is show
- e :
-
class
vdat.gui.tabs.tab_widget.BaseFplanePanelSetup(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.BaseFplanePanelAdd a default setup implementation that set the title and the tooltip and then call the setup method for the IFUs
-
setup(target_dir, tab_dict, format_dict)[source]¶ Informations to pass to the tab and to the IFUs.
The method uses directly the following keys of the
tab_dictargument:- title (mandatory): title of the current widget; the title is
formatted using
format_dictand saved intitle. - tool_tip (optional): tool tip to show for the current widget; if
present, the string is formatted using
format_dictand saved intool_tip.
Other keys might be used by the ifu widget setup method.
Parameters: - target_dir : string
directory selected by the user
- tab_dict : dictionary
dictionary with the specifications to use to build the tabs
- format_dict : string
dictionary with the fields and values that can be replaced in file names
- title (mandatory): title of the current widget; the title is
formatted using
-
-
class
vdat.gui.tabs.tab_widget.FitsFplanePanel(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.BaseFplanePanelSetupClass that shows fits files in the focal plane. It allows to select the scaling for the IFUs.
Unless documented below, the class inherits signals, slots and connection from
BaseFplanePanel.Custom slot¶ Name Signature Description toggle_individual_scale()bool When the input is true, redraw the IFU with individual scaling enabled toggle_global_scale()bool When the input is true, redraw the IFU with using a global scaling enabled toggle_custom_scale()bool, optional When the input is true, redraw the IFU using a custom scaling enabled Connections between custom signals and/or slots.¶ Signal Slot toggledof “Individual” radio buttontoggle_individual_scale()toggledof “Global” radio buttontoggle_global_scale()toggledof “Custom” radio buttontoggle_custom_scale()(with bool argument)releasedof custom “Rescale” buttontoggle_custom_scale()(with no argument)Parameters: - all :
see
BaseFplanePanel
Attributes: - scaling_bar :
PyQt5.QtWidgets.QHBoxLayout layout containing the scaling bar
min_scale_customFloat value shown in the minimum scale box.
max_scale_customFloat value shown in the maximum scale box.
- min_scale_global, max_scale_global : int
minimum and maximum global scale used when clicking on the global scale button
radio_individual_scaleIndividual scale radio button
radio_global_scaleGlobal scale radio button
radio_custom_scaleCustom scale radio button
-
ifu_widget_class¶ Return the name of the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.IFUFitsWidget`
-
add_scaling_bar()[source]¶ Create a
PyQt5.QtWidgets.QHBoxLayout, add it to themain_layout. On this layout add buttons and text boxes to chose the scaling to use for the IFUs. Connect all the relevant signals and slots.
Create a radio button, add it to
layoutand return it. The buttons are not marked by default.Parameters: - label : string
label of the button
- layout :
PyQt5.QtWidgets.QLayout layout to which the button is added
Returns: - button :
PyQt5.QtWidgets.QRadioButton
-
_scale_box()[source]¶ Create and return a box where is possible to insert numbers.
Returns: - scale_box :
PyQt5.QtWidgets.QLineEdit box with width of 80 and a double validator
- scale_box :
-
_custom_scale_setter(layout)[source]¶ Setup all the parts needed to set the custom scale.
Parameters: - layout :
PyQt5.QtWidgets.QLayout layout to which the pieces are added
- layout :
-
custom_scale_set_enabled(enable)[source]¶ Enable/disable the labels, input boxes and button used to set the custom scaling.
Parameters: - enable : bool
whether to enable or disable the widgets.
-
min_scale_custom¶ Float value shown in the minimum scale box. Clear the text box with
del min_scale_custom
-
max_scale_custom¶ Float value shown in the maximum scale box. Clear the text box with
del max_scale_custom
-
radio_individual_scale¶ Individual scale radio button
-
radio_global_scale¶ Global scale radio button
-
radio_custom_scale¶ Custom scale radio button
-
toggle_individual_scale(enabled=True)[source]¶ When
enabledisTrueredraw the IFUs using the individual scaling.This method is also a PyQt slot.
Parameters: - enabled : bool
whether the individual scaling is enabled or not
-
toggle_global_scale(enabled)[source]¶ When
enabledisTrueredraw the IFUs using the global scaling, saved inmin_scale_globalandmax_scale_global.This method is also a PyQt slot.
Parameters: - enabled : bool
whether the global scaling is enabled or not
-
toggle_custom_scale(enabled=True)[source]¶ When
enabledisTrueredraw the IFUs using the minimum and maximum values provided by the user.This method is also a PyQt slot.
Parameters: - enabled : bool
whether the custom scaling is enabled or not
-
_zscale_to_ifus(zmin, zmax)[source]¶ Loop over all the IFUs setting
ifu.zmin_globalandifu.zmax_globalto the input values.Parameters: - zmin, zmax : float or None
values to set
-
update_finished(stopped)[source]¶ If the update of the IFUs finished without being stopped, collect all the zmin/zmax from the IFUs and save it for the global scaling. If none of the IFUs has such values disable the global scaling button.
This method is also a pyqt Slot.
Override this method in derived classes to act upon the
UpdateIFUTask.finishedsignalParameters: - stopped : bool
Trueif the updated has been forcefully stopped,Falseif it finished.
-
class
vdat.gui.tabs.tab_widget.QuickReconFplanePanel(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.FitsFplanePanelDo a quick reconstruction with the input files
Unless documented below, the class inherits signals, slots and connection, as well as attributes from
FitsFplanePanel.Parameters: - all :
see
BaseFplanePanel
Attributes: - enabled : bool
if the reconstruction object exists, is set to True, else to False
-
ifu_widget_class¶ Return the name of the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.IFUQuickReconWidget`
-
setup(target_dir, tab_dict, format_dict)[source]¶ Informations to pass to the tab and to the IFUs.
See
FitsFplanePanel.setup()for the keys oftab_dictused here.Parameters: - target_dir : string
directory selected by the user
- tab_dict : dictionary
dictionary with the specifications to use to build the tabs
- format_dict : string
dictionary with the fields and values that can be replaced in file names
-
cleanup()[source]¶ On top of what
FitsFplanePanel.cleanup()does, resetenabledto True
-
class
vdat.gui.tabs.tab_widget.FitsAndReconFplanePanel(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.interface.FplaneTabTemplateThis class provides a tab grouping a
FitsFplanePaneland aQuickReconFplanePaneland providing a button to switch between them.Unless documented below, the class inherits signals, slots and connection from
interface.FplaneTabTemplate.Custom slot¶ Name Signature Description next_widget()go to the next widget Connections between custom signals and/or slots.¶ Signal Slot “Reconstructed” checkbox added in the lower right corner of the widgets next_widget()Parameters: - all :
Attributes: - others
-
_make_widget(Widget, tab_type, is_checked)[source]¶ Create a
Widgetinstance, connect thesig_ifuToggled, add a check box with “Reconstructed” as text and connect it to anext_widget().Parameters: - Widget : class derived from
BaseFplanePanel the widget to create
- tab_type : string
name of the tab
- is_checked : bool
whether the checkbox needs to be always checked or not
Returns: - w : instance of Widget
- button :
PyQt5.QtWidgets.QPushButton button added to the Widget
- Widget : class derived from
-
setup(target_dir, tab_dict, format_dict)[source]¶ Informations to pass to the stacked widgets and to the IFUs.
Make sure that the
FitsFplanePanelis always shown first. If the reconstruction object does not exist, disable the checkbox to switch to the reconstructed widget. The title and tool tip, if present, are taken from the first widget.Parameters: - target_dir : string
directory selected by the user
- tab_dict : dictionary
dictionary with the specifications to use to build the tabs
- format_dict : string
dictionary with the fields and values that can be replaced in file names
-
ifuSelected(ifuslot, val)[source]¶ Select or deselect an IFU. This method is also a PyQt slot.
Call the corresponding method in the stacked widgets.
Parameters: - ifuslot : string
SLOTID of the selected IFU
- val : bool
If
Trueselected, otherwise deselected
-
class
vdat.gui.tabs.tab_widget.CubeFplanePanel(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.FitsFplanePanelClass that shows data cube fits files in the focal plane.
Unless documented below, the class inherits signals, slots and connection from
FitsFplanePanel.Parameters: - all :
see
FitsFplanePanel
Attributes: - all :
see
FitsFplanePanel
-
ifu_widget_class¶ Return the name of the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.IFUCubeWidget`
-
class
vdat.gui.tabs.tab_widget.MultiExtFplanePanel(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.FitsFplanePanelClass that shows one desired extension from fits files in the focal plane.
Unless documented below, the class inherits signals, slots and connection from
FitsFplanePanel.Parameters: - all :
see
FitsFplanePanel
Attributes: - all :
see
FitsFplanePanel
-
ifu_widget_class¶ Return the name of the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.IFUMultiExtWidget`
-
class
vdat.gui.tabs.tab_widget.StaticCheckBox(text, is_checked, parent=None)[source]¶ Bases:
PyQt5.QtWidgets.QCheckBoxA checkbox always checked or un-checked
Custom slot¶ Name Signature Description stay_checked()Keep the “checked” state of the button always the same Connections between custom signals and/or slots.¶ Signal Slot clickedstay_checked()Parameters: - text : string
text showing in the button
- is_checked : bool
whether the checkbox must stay checked or not
- parent :
QWidgetor derived instance, optional the parent of the current widget
-
class
vdat.gui.tabs.tab_widget.TextFilesPanel(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.BaseFplanePanelSetupTab to show the content of a text file.
The IFU in the focal plane shows the number of lines in the file. A double click on the widget brings up a window with the content of the file
Unless documented below, the class inherits signals, slots and connection from
BaseFplanePanel.Parameters: - all :
-
ifu_widget_class¶ Return the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.TextFileWidget`
-
class
vdat.gui.tabs.tab_widget.DistPanel(tab_type, parent=None)[source]¶ Bases:
vdat.gui.tabs.tab_widget.BaseFplanePanelSetupShow the number of lines in the distortion file in the IFUs. A double click on the widget brings up a window with the content of the file. From the window, it is possible to send a region file computed from the distortion to the
ds9.Unless documented below, the class inherits signals, slots and connection from
BaseFplanePanel.Parameters: - all :
-
ifu_widget_class¶ Return the class to use to represent IFUs in the focal plane.
Returns: - :class:`.ifu_widget.BaseIFUWidget`
Inheritance scheme¶