Controls

A form Control is a UI interface for the user to interact with the application.

Bellow we can find the description of all the Controls implemented in the PyForms library.

ControlBase

class pyforms_gui.controls.control_base.ControlBase(*args, **kwargs)[source]

Bases: object

All the Controls inherit from this Control, therefore you can find its functions and properties in all the other controls listed below.

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

init_form()[source]

Load the control UI and initiate all the events.

load_form(data, path=None)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

show()[source]

Show the control

hide()[source]

Hide the control

add_popup_submenu(label, submenu=None)[source]

It returns a new sub popup menu. If submenu is open the menu is added to the main popup menu.

Parameters
  • label (str) – Label of the option

  • submenu (QMenu) – Parent submenu to which the option should be added. If no value is set, then the option will be added to the main popup menu.

add_popup_menu_option(label, function_action=None, key=None, icon=None, menu=None)[source]

Add an option to the Control popup menu.

Parameters
  • label (str) – Label of the option

  • function_action (function) – The function that should be executed when the menu is selected.

  • key (str) – Short key.

  • or str icon (QIcon) – Icon.

  • submenu (QMenu) – Parent submenu to which the option should be added. If no value is set, then the option will be added to the main popup menu.

control.add_popup_menu_option('option 0', function_action=self._do_something)
submenu1 = control.add_popup_submenu('menu 1')
submenu2 = control.add_popup_submenu('menu 2', submenu=submenu1)
control.add_popup_menu_option('option 1', function_action=self._do_something, key='Control+Q', submenu=submenu2)
changed_event()[source]

Function called when ever the Control value is changed. The event function should return True if the data was saved with success.

about_to_show_contextmenu_event()[source]

Function called before the Control popup menu is opened.

property enabled

Returns or set if the control is enable or disable.

property value

This property returns or set what the control should manage or store.

property name

This property returns or set the name of the control.

property label

Returns or sets the label of the control.

property parent

Returns or set the parent basewidget where the Control is.

property visible

Return the control visibility.

property help

Returns or set the tip box of the control.

property readonly

Set and return the control readonly state.

property form

Returns the QWidget of the control.


ControlBoundingSlider

class pyforms_gui.controls.control_boundingslider.ControlBoundingSlider(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

https://raw.githubusercontent.com/UmSenhorQualquer/pyforms/master/tutorials/Controls4Docs/ControlBoundingSlider.png
Parameters
  • default (tupple) – The default value is a list containing in the first element the lower value and in the second element the upper value. Default = [20,40].

  • horizontal (bool) – Flag indicating if the Bounding slider should be draw horizontally or vertically. Default = True.

  • show_spinboxes (bool) – Show or hide the spinboxes. Default = True

  • minimum (float) – Defines the minimum value that can be selected.

  • maximum (float) – Defines the maximum value that can be selected.

  • convert_2_int (bool) – Flag to define if the control should return floats or integers.

property label

Returns or sets the label of the control.

property value

Sets and gets the control value. It should be a list or tuple of 2 values.

property min

Sets and gets the minimum value possible.

property max

Sets and gets the maximum value possible.

property scale

Sets and gets the scale value.

property convert_2_int

Flag to define if the control should return floats or integers.


ControlButton

class pyforms_gui.controls.control_button.ControlButton(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • icon (str) – Button icon

  • checkable (bool) – Flag to set the button checkable.

click()[source]

Trigger a click event

property icon

Sets and gets the icon of the button.

property value

Sets and gets the value of the Button. The value should be a function

property checked

Sets and gets the button checked state


ControlCheckBox

class pyforms_gui.controls.control_checkbox.ControlCheckBox(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

load_form(data, path=None)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

property value

This property returns or set what the control should manage or store.


ControlCheckBoxList

class pyforms_gui.controls.control_checkboxlist.ControlCheckBoxList(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

save_form(data={}, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

load_form(data, path=None)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

item_changed(item)[source]
clear()[source]
refresh()[source]
selection_changed_event()[source]
property count
property checked_indexes
property value

This property returns or set what the control should manage or store.

property selected_row_index
property items

ControlCodeEditor

class pyforms_gui.controls.control_codeeditor.ControlCodeEditor(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Control that offers a code editor with pretty-print and line numbers and a save button

Parameters
  • label

  • default

  • helptext

ARROW_MARKER_NUM = 8
on_margin_clicked(nmargin, nline, modifiers)[source]

On margin clicked, toggle marker for the line the margin was clicked on :param nmargin: :type nmargin: :param nline: :type nline: :param modifiers: :type modifiers:

on_modification_changed()[source]

On modification change, re-enable save button

on_save_changes()[source]

On button save clicked, save changes made on the code editor to file

on_discard_changes()[source]
discard_event()[source]
key_pressed_event(event)[source]

Override KeyPressed event as you like :param event: key event

property is_modified
property lexer
property value

This property returns or set what the control should manage or store.

property changed_event

Function called when ever the Control value is changed. The event function should return True if the data was saved with success.


ControlCombo

class pyforms_gui.controls.control_combo.ControlCombo(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWidgets.QWidget

This class represents a wrapper to the combo box

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

clear()[source]
add_item(label, value=<class 'pyforms_gui.controls.control_combo.ValueNotSet'>)[source]
get_item_index_by_name(item_name)[source]

Returns the index of the item containing the given name :param item_name: item name in combo box :type item_name: string

count()[source]
show()[source]

Show the control

hide()[source]

Hide the control

current_index_changed_event(index)[source]

Called when the user chooses an item in the combobox and the selected choice is different from the last one selected. @index: item’s index

activated_event(index)[source]

Called when the user chooses an item in the combobox. Note that this signal happens even when the choice is not changed @index: item’s index

highlighted_event(index)[source]
edittext_changed_event(text)[source]
property form

Returns the QWidget of the control.

property current_index
property values
property items
property value

This property returns or set what the control should manage or store.

property text
property label

Returns or sets the label of the control.


ControlDir

class pyforms_gui.controls.control_dir.ControlDir(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

click()[source]
finishEditing()[source]

Function called when the lineEdit widget is edited

property value

This property returns or set what the control should manage or store.

property label

Returns or sets the label of the control.


ControlDockWidget

class pyforms_gui.controls.control_dockwidget.ControlDockWidget(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_emptywidget.ControlEmptyWidget

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

SIDE_LEFT = 'left'
SIDE_RIGHT = 'right'
SIDE_TOP = 'top'
SIDE_BOTTOM = 'bottom'
SIDE_DETACHED = 'detached'
property label

Returns or sets the label of the control.

save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

load_form(data)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

show()[source]

Show the control

hide()[source]

Hide the control


ControlEmptyWidget

class pyforms_gui.controls.control_emptywidget.ControlEmptyWidget(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWidgets.QWidget

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

property value

This property returns or set what the control should manage or store.

property form

Returns the QWidget of the control.

save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

load_form(data, path=None)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

show()[source]

Show the control

hide()[source]

Hide the control


ControlFile

class pyforms_gui.controls.control_file.ControlFile(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

finishEditing()[source]

Function called when the lineEdit widget is edited

click()[source]
property value

This property returns or set what the control should manage or store.

property label

Returns or sets the label of the control.


ControlFilesTree

class pyforms_gui.controls.control_filestree.ControlFilesTree(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

property value

This property returns or set what the control should manage or store.


ControlImage

class pyforms_gui.controls.control_image.ControlImage(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

property value

This property returns or set what the control should manage or store.

property double_click_event
property click_event
property drag_event
property end_drag_event
property key_release_event

ControlLabel

class pyforms_gui.controls.control_label.ControlLabel(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

load_form(data, path=None)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

property selectable
property form

Returns the QWidget of the control.

property value

This property returns or set what the control should manage or store.


ControlList

class pyforms_gui.controls.control_list.ControlList(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWidgets.QWidget

This class represents a wrapper to the table widget It allows to implement a list view

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

CELL_VALUE_BEFORE_CHANGE = None
clear(headers=False)[source]
save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

load_form(data, path=None)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

set_value(column, row, value)[source]
get_value(column, row)[source]
resize_rows_contents()[source]
get_currentrow_value()[source]
get_cell(column, row)[source]
set_sorting_enabled(value)[source]

Enable or disable columns sorting

Parameters

value (bool) – True to enable sorting, False otherwise

data_changed_event(row, col, item)[source]
item_selection_changed_event()[source]
current_cell_changed_event(next_row, next_col, previous_row, previous_col)[source]
current_item_changed_event(current, previous)[source]
cell_double_clicked_event(row, column)[source]
property height
property horizontal_headers
property word_wrap
property readonly

Set and return the control readonly state.

property select_entire_row
property rows_count
property columns_count
property value

This property returns or set what the control should manage or store.

property selected_rows_indexes
property selected_row_index
property label

Returns or sets the label of the control.

property form

Returns the QWidget of the control.

property icon_size
property autoscroll
property resizecolumns
tableWidgetCellChanged(nextRow, nextCol, previousRow, previousCol)[source]
tableWidgetItemChanged(current, previous)[source]
tableWidgetItemSelectionChanged()[source]
tableWidgetCellDoubleClicked(row, column)[source]

(From PyQt) This signal is emitted whenever a cell in the table is double clicked. The row and column specified is the cell that was double clicked.

Besides firing this signal, we save the current value, in case the user needs to know the old value. :param row: :param column: :return:

empty_signal(*args, **kwargs)[source]

Use this function if you want to disconnect a signal temporarily


ControlPlayer


ControlMatplotlib

class pyforms_gui.controls.control_matplotlib.ControlMatplotlib(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWidgets.QWidget

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

property value

This property returns or set what the control should manage or store.

draw()[source]
on_draw(figure)[source]

Redraws the figure

property fig
property form

Returns the QWidget of the control.


ControlMdiArea

class pyforms_gui.controls.control_mdiarea.ControlMdiArea(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWidgets.QMdiArea

The ControlMdiArea wraps a QMdiArea widget which provides

an area in which MDI windows are displayed.

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

property show_subwin_close_button
property label

Returns or sets the label of the control.

property form

Returns the QWidget of the control.


ControlNumber

class pyforms_gui.controls.control_number.ControlNumber(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • minimum (int) – Minimum value.

  • maximum (int) – Maximum value.

  • default (float) – Set the value. Default = 0.

  • decimals (int) – Decimals precision.

  • step (float) – Step jump value.

update_event(value)[source]
property label

Returns or sets the label of the control.

property value

This property returns or set what the control should manage or store.

property min
property max
property decimals
property step

ControlPassword

class pyforms_gui.controls.control_password.ControlPassword(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_text.ControlText

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.


ControlOpenGL

class pyforms_gui.controls.control_opengl.ControlOpenGL(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

repaint()[source]
reset_zoom_and_rotation()[source]
property value

This property returns or set what the control should manage or store.

property clear_color
property width
property height

ControlProgress

class pyforms_gui.controls.control_progress.ControlProgress(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

property label

Returns or sets the label of the control.

property value

This property returns or set what the control should manage or store.

property min
property max

ControlSlider

class pyforms_gui.controls.control_slider.ControlSlider(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

valueChanged(value)[source]
load_form(data, path=None)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

property value

This property returns or set what the control should manage or store.

property min
property max

ControlText

class pyforms_gui.controls.control_text.ControlText(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

finishEditing()[source]

Function called when the lineEdit widget is edited

key_pressed_event(evt)[source]
property value

This property returns or set what the control should manage or store.

property label

Returns or sets the label of the control.

property readonly

Set and return the control readonly state.


ControlTextArea

class pyforms_gui.controls.control_textarea.ControlTextArea(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

finishEditing()[source]

Function called when the lineEdit widget is edited

property value

This property returns or set what the control should manage or store.

property readonly

Set and return the control readonly state.

property autoscroll

ControlToolBox

class pyforms_gui.controls.control_toolbox.ControlToolBox(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

property value

This property returns or set what the control should manage or store.

set_item_enabled(index, enabled)[source]

Enable or disable an item

is_item_enabled(index)[source]

Check if an item is enabled or disabled


ControlToolButton

class pyforms_gui.controls.control_toolbutton.ControlToolButton(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

click()[source]
load_form(data, path=None)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

property label

Returns or sets the label of the control.

property icon
property value

This property returns or set what the control should manage or store.

property checked

ControlTree

class pyforms_gui.controls.control_tree.ControlTree(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWidgets.QTreeWidget

This class represents a wrapper to the QTreeWidget

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

save_form(data, path=None)[source]

Save a value of the control to a dictionary.

Parameters
  • data (dict) – Dictionary where the control value should be saved.

  • path (str) – Optional parameter that can be used to load the data.

load_form(data, path=None)[source]

Loads the value of the control.

Parameters
  • data (dict) – It is a dictionary with the required information to load the control.

  • path (str) – Optional parameter that can be used to save the data.

add_popup_menu_option(label='', function_action=None, key=None, item=None, icon=None, submenu=None)[source]

Add an option to the Control popup menu @param label: label of the option. @param function_action: function called when the option is selected. @param key: shortcut key @param key: shortcut key

clear(self)[source]
expand_item(item, expand=True, parents=True)[source]
create_child(name, parent=None, icon=None)[source]

Create a new child for to the parent item. If the parent is None it add to the root.

item_changed_event(item)[source]
item_selection_changed_event()[source]
item_double_clicked_event(item)[source]
key_press_event(event)[source]
rows_inserted_event(parent, start, end)[source]

This event is called every time a new row is added to the tree

property show_header
property selected_rows_indexes
property selected_row_index
property selected_item
property form

Returns the QWidget of the control.

property value

This property returns or set what the control should manage or store.

property icon_size
rowsInserted(self, QModelIndex, int, int)[source]
selectionChanged(self, QItemSelection, QItemSelection)[source]
keyPressEvent(self, QKeyEvent)[source]
about_to_show_contextmenu_event()[source]

Function called before open the Control popup menu

clone_item(parent, item, copy_function=None)[source]
clone_tree(tree, copy_function=None)[source]

ControlTreeView

class pyforms_gui.controls.control_treeview.ControlTreeView(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWidgets.QTreeView

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

default_width = None
item_selection_changed_event(selected, deselected)[source]
item_double_clicked_event(evt)[source]
property selected_row_index
property selected_item
property value

This property returns or set what the control should manage or store.

property form

Returns the QWidget of the control.


ControlVisVis

class pyforms_gui.controls.control_visvis.ControlVisVis(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

refresh()[source]
paint(visvis)[source]
property legend
property show_grid
property title
property xlabel
property ylabel
property zlabel
property value

This property returns or set what the control should manage or store.


ControlVisVisVolume

class pyforms_gui.controls.control_visvisvolume.ControlVisVisVolume(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

property color_map
refresh()[source]
property value

This property returns or set what the control should manage or store.

property colors_limits
property visvis

ControlWeb

class pyforms_gui.controls.control_web.ControlWeb(*args, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWebEngineWidgets.QWebEngineView

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

load_finished_event(ok)[source]
property value

This property returns or set what the control should manage or store.

property html
property form

Returns the QWidget of the control.


ControlEventTimeline

class pyforms_gui.controls.control_event_timeline.control_eventtimeline.ControlEventTimeline(label='', default=0, max=100)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWidgets.QWidget

Timeline events editor

Short keys:

  • Control + Left: Move event to the left.

  • Control + Right: Move event to the right.

  • Delete: Delete an event.

  • L: Lock an event.

  • Control + Up: Move an event up.

  • Control + Down: Move an event down.

  • Shift + Control + Left: Move an event end time to the left.

  • Shift + Control + Right: Move an event end to the right.

  • Shift + Left: Move an event beginning to the left.

  • Shift + Right: Move an event beginning to the right.

  • S: First press, mark the beginning of an event, Second press, create an event ending in the current cursor time.

  • A: Move the cursor to the left.

  • D: Move the cursor to the right.

  • Q: Select the previous event in the selected row.

  • E: Select the next event in the selected row.

Parameters
  • label (str) – Control label. Default = ‘’.

  • helptext (str) – Text shown when the mouse is over the control. Default = None.

  • default (str) – Initial value of the control. Default = None.

  • visible (bool) – Flag to set the control visible or hidden. Default = True.

  • enabled (bool) – Flag to set the control enabled or Disabled. Default = True.

  • readonly (bool) – Flag to set the control readonly. Default = False.

  • changed_event (function) – Function to call whenever the control value is updated. Default = None.

move_selected_event_or_pointer_left()[source]

Move the selected event or pointer to the left. :return:

move_selected_event_or_pointer_right()[source]

Move the selected event or pointer to the right. :return:

remove_selected_event()[source]

Remove the selected event. :return:

toggle_selected_event_lock()[source]

Toggle the lock of the selected event. :return:

select_next_event()[source]

Select the next event. :return:

select_previous_event()[source]

Select the previous event. :return:

select_first_event()[source]

Select the first event. :return:

select_last_event()[source]

Select the last event. :return:

move_selected_event_up()[source]

Move the selected event to the track above. :return:

move_selected_event_down()[source]

Move the selected event to the track bellow. :return:

move_selected_event_end_left()[source]

Move the selected event end to the left. :return:

move_selected_event_end_right()[source]

Move the selected event end to the right. :return:

move_selected_event_begin_left()[source]

Move the selected event begin to the left. :return:

move_selected_event_begin_right()[source]

Move the selected event begin to the right. :return:

open_and_close_event()[source]

Open and close and event. The first time the function is called an event is opened. On the second call the event is closed and added to the timeline. :return:

add_event(begin, end, title='', row=0, track=None)[source]
Parameters
  • begin – Initial frame

  • end – Last frame

  • title – Event title

  • row – Row to which the event should be added.

add_graph(name, data)[source]
Parameters
  • name

  • data

Returns

add_track(title='', color=None)[source]

Add a new track. :param str title: Title of the track. :param QColor color: Default color of the events in the track. :return: Return the added track.

get_track(title)[source]

Get a track by its title :param str title: Title of the track. :return: Return the track with the matching title.

rename_graph(graph_index, newname)[source]

Rename a graph by index. :param int graph_index: Index of the graph to rename. :param str newname: New name

import_graph_csv(filepath, separator=';', ignore_rows=0)[source]

Import a new graph from a csv file. :param filename: :param separator: :param ignore_rows: :return:

export_csv_file(filename)[source]
import_csv_file(filename)[source]
import_csv(csvfile)[source]
Parameters

csvfile

open_graphs_properties()[source]

Opens the graphs properties.

open_import_graph_win(filepath, frame_col=0, val_col=1)[source]

Open a window to import a graph from a csv file. :param str filepath: Path of the file to import. :param int frame_col: Column corresponding to the frames number in the csv file. :param int val_col: Column corresponding to the values in the csv file.

mouse_moveover_timeline_event(event)[source]
property pointer_changed_event
property timeline_widget
property value

This property returns or set what the control should manage or store.

property max
property form

Returns the QWidget of the control.

property rows
property graphs
property key_release_event
about_to_show_contextmenu_event()[source]

Hide and show context menu options.

clean()[source]

ControlEventsGraph

class pyforms_gui.controls.control_events_graph.control_eventsgraph.ControlEventsGraph(label='', default=0, min=0, max=100, **kwargs)[source]

Bases: pyforms_gui.controls.control_base.ControlBase, PyQt5.QtWidgets.QWidget

Timeline events editor

Parameters
  • label

  • default

  • min

  • max

  • kwargs

add_track(title=None)[source]
Parameters

title

add_event(begin, end, title='', track=0, color='#FFFF00')[source]
Parameters
  • begin

  • end

  • title

  • track

  • color

Returns

get_export_filename()[source]
export_csv(filename)[source]

Export annotations to a file. :param str filename: filename to open

repaint()[source]
property changed_event

Function called when ever the Control value is changed. The event function should return True if the data was saved with success.

property value

This property returns or set what the control should manage or store.

property form

Returns the QWidget of the control.

property tracks
property tracks_height
property scale