vdat.gui.menus_actions – Custom menus and actions

Module that implements custom menus and action

class vdat.gui.menus_actions.RemoveExposuresMenu(parent=None)[source]

Bases: PyQt5.QtWidgets.QMenu

A menu that removes the exposures matching the path and create a list of actions

Custom signals
Name Signature Description
sig_exposure_removed str emitted when an exposure is removed; the value is the expname from the database
Custom slot
Name Signature Description
enable_on_selection() str, str save the first string into a path attribute
about_to_show_slot()   dynamically adds actions to the menu just before showing it
remove_exposure() PyQt5.QtWidgets.QAction receive the triggered action, using its object name find the basename, remove files with that basename and the corresponding entry in the database and in the exposure file
Connections between custom signals and/or slots
Signal Slot
RemoveExposuresMenu.aboutToShow about_to_show_slot()
RemoveExposuresMenu.triggered remove_exposure()
sig_exposure_removed
path

Path where the exposures to remove are located. When setting a non None path, the menu is activated; when setting a None path or the path gets deleted, the menu is deactivated

enable_on_selection(path, typ)[source]

Save the path and the type and enable disabled actions when the path is non-null.

Parameters:
path : string

a path, usually the directory selected in three view

typ : string

type of the path, ignored

about_to_show_slot()[source]

Slot to connect with the aboutToShow signal. If no path has been selected, nothing happens, otherwise dynamically create actions in the menu

remove_exposure(action)[source]

Get the triggered action, remove the files for the given exposure. Then remove the exposure from the VDATExposures database and the metadata file in the directory.

Parameters:
action : PyQt5.QtWidgets.QAction

action triggered

class vdat.gui.menus_actions.QuitAction(connect_to=None, parent=None)[source]

Bases: PyQt5.QtWidgets.QAction

Quit action to plug in menus or toolbars.

Set the icon to window-close, the text to Quit and the shortcut to Ctrl+Q.

Connections between custom signals and/or slots
Signal Slot
triggered connect_to, if present
Parameters:
connect_to : signal or slot, optional

if present connect the triggered

parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the menu’ bar

class vdat.gui.menus_actions.HelpMenu(parent=None, windows_parent=None)[source]

Bases: PyQt5.QtWidgets.QMenu

Create a menu with the various help actions.

Parameters:
parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the menu

help_parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the windows opened by the actions in this menu

class vdat.gui.menus_actions.HandbookAction(parent=None, window_parent=None)[source]

Bases: PyQt5.QtWidgets.QAction

“Show Handbook” action. It Shows vdat.gui.help_window.HelpWindow

Custom slot
Name Signature Description
show_handbook()   Create a vdat.gui.help_window.HelpWindow and show it
Connections between custom signals and/or slots
Signal Slot
triggered show_handbook()
Parameters:
parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the action

window_parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the help window

show_handbook()[source]

open the VDAT handbook in a new window

This method is also a PyQt slot

class vdat.gui.menus_actions.VDATLinksAction(parent=None, window_parent=None)[source]

Bases: PyQt5.QtWidgets.QAction

Show links with the online VDAT documentation.

Custom slot
Name Signature Description
show_links()   Create a QMessageBox showing the links
Connections between custom signals and/or slots
Signal Slot
triggered show_links()
Parameters:
parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the action

window_parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the help window

Display the links to the VDAT documentation and the coverage reports, both for the latest and the development version.

This method is also a PyQt slot

class vdat.gui.menus_actions.VDATAboutAction(parent=None, window_parent=None)[source]

Bases: PyQt5.QtWidgets.QAction

Show a short “about” VDAT. It Shows vdat.gui.help_window.HelpWindow

Custom slot
Name Signature Description
show_about()   Create a QMessageBox showing some information about authors and such
Connections between custom signals and/or slots
Signal Slot
triggered show_about()
Parameters:
parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the action

window_parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the help window

show_about()[source]

Open the VDAT about in a message box.

This method is also a PyQt slot

class vdat.gui.menus_actions.LogAction(fname, parent=None)[source]

Bases: PyQt5.QtWidgets.QAction

Action about the log files

Parameters:
fname : string

name of the file to open

parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the menu

Attributes:
fname : string

name of the file to open

class vdat.gui.menus_actions.LogViewerWindow(file_name, parent=None)[source]

Bases: PyQt5.QtWidgets.QMainWindow

Editor window used to display log files.

Custom slot
Name Signature Description
load_file()   Load the file and disable the refresh action
enable_refresh() string Enable the refresh button
Connections between custom signals and/or slots.
Signal Slot
refresh.triggered load_file()
watcher.fileChanged enable_refresh()
Parameters:
file_names : string

file to display

parent : PyQt5.QtWidgets.QWidget or derivate

parent object of the tree view model

Attributes:
file_name : string

name of the file to display

text_edit : PyQt5.QtWidgets.QTextEdit

display the text

refresh : PyQt5.QtWidgets.QAction

action to refresh the content

watcher : PyQt5.QtCore.QFileSystemWatcher

file watcher

make_text_edit()[source]

Create a QTextEdit edit and returns it

load_file()[source]

Load the file in the text_edit widget and disable the refresh action

This method is also a PyQt slot

enable_refresh(fname)[source]

Enable the refresh button

make_common_actions()[source]

Create actions.

make_menubar()[source]

Create and return the menu

make_toolbar()[source]

Create and return the toolbar

class vdat.gui.menus_actions.LogMenu(parent=None)[source]

Bases: PyQt5.QtWidgets.QMenu

Create a menu with actions related with log files.

Custom slot
Name Signature Description
open_log_file() LogAction open the selected log file in a read-only window
Connections between custom signals and/or slots.
Signal Slot
triggered of the log files menu open_log_file()
Parameters:
parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the menu

open_log_file(action)[source]

Open the given log files

class vdat.gui.menus_actions.TreeViewMenu(parent=None)[source]

Bases: PyQt5.QtWidgets.QMenu

Menu to collapse/expand the tree view

Create the menu with the entries to expand/collapse the menu

Custom signals
Name Signature Description
sig_collapse   emitted when the “Collapse” action is triggered
sig_expand   emitted when the “Expand” action is triggered
Parameters:
parent : PyQt5.QtWidgets.QWidget instance, optional

parent of the menu

sig_collapse
sig_expand