Skip to content

Latest commit

 

History

History
1077 lines (543 loc) · 22.1 KB

File metadata and controls

1077 lines (543 loc) · 22.1 KB

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


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

Constructer


__init__(label='', defaultValue='', helptext='')

label - Control label.
defaultValue - Initial value of the control.
helptext - Text shown when the mouse is over the control.

Functions


initForm()

Load the control UI and initiate all the events.

load(data)

Loads the value of the control.
data - Is a dictionary with the required information to load the control.

save(data)

Save a value of the control to a dictionary.
data - Dictionary where the control value should be saved.

show()

Show the control.

hide()

Hide the control.

addPopupMenuOption(label, functionAction=None, key=None)

Add an option to the Control popup menu.

addPopupSubMenuOption(label, options, keys={})

Add submenu options to the Control popup menu.

Events


changed()

Function called when ever the Control value is changed.

aboutToShowContextMenuEvent()

Function called before the Control popup menu is opened.

Properties


value

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

name

This property returns or set the name of the control.

label

Returns or sets the label of the control.

form

Returns the QWidget of the control.

parent

Returns or set the parent basewidget where the Control is.

help

Returns or set the tip box of the control.

enabled

Returns or set if the control is enable or disable.

ControlBoundingSlider


Control image

Constructer


__init__(label="", defaultValue=[20,40], min=0, max=100, horizontal=False, **kwargs)

defaultValue - The default value is a list containing in the first element the lower value and in the second element the upper value.
min - Defines the minimum value that can be selected.
max - Defines the maximum value that can be selected.
horizontal - Flag indicating if the Bounding slider should be draw horizontally or vertically.

Properties


value

Gets and sets the value of the Control. This value is a list containing in the first element the lower value and in the second element the upper value.

min

Gets and sets the the minimum value that can be selected in the bounding slider.

max

Gets and sets the the maximum value that can be selected in the bounding slider.

convert_2_int

If True the control works only with Integer values. If False the control will return Float values.

ControlButton


Web ready Terminal ready Docs updated

Control image

Constructer


__init__(label='', defaultValue='', checkable=False)

checkable - Flag indicating if the button is checkable or not.

Functions


load(data)

Because the value of this Control is a function, nothing is loaded

save(data)

Because the value of this Control is a function, nothing is saved

click()

This function simulates a click of a button.

Properties


value

The value should be a pointer to function, that will be called everytime the button is pressed.

checked

In case the button was initiated with the flag checkable=True, it will get and set the checked state of the button.

ControlCheckBox


Web ready Terminal ready Docs updated

Control image

Properties


value

Gets and sets a boolean indicating the state of the checkbox.

ControlCheckBoxList


Docs updated

Control image

Functions


__add__(val)

Add more elements to the list. Usage:

controlVar += ('Element', True)  

or

controlVar += 'Element'

clear()

Clear all the elements from the list.

Properties


count

Return how many elements the list have.

checkedIndexes

Returns the Elements with which have the checkboxes checked.

value

It gets and sets all the List values. This property receives a list where each element is a Row in the list.

controlVar.value = [('item1',True), ('item2',False), 'item3']

ControlCombo


Web ready Terminal ready Docs updated

Control image

Functions


addItem(text, value=None)

Add an item to the ComboBox. Items may have a value associated to it.

controlVar.addItem('Portugal', 	 'pt')
controlVar.addItem('Angola', 	 'ao')
controlVar.addItem('Moçambique', 'mz')
controlVar.addItem('Brazil', 	 'br')
controlVar.addItem('Cabo Verde', 'cv')

clearItems()

Clear all the items of the ComboBox.

Events


activated(index)

Called when the user selectes an item in the combobox.
index - Activated item's index.

highlighted(index)

Called when the user passes with the mouse over an item in the combobox.
index - highlighted item's index.

Properties


items

Returns all the items of the combobox.

value

It returns the selected value of the combo box.

text

Gets and set the current selected item text.

ControlDir


Web ready Terminal ready Docs updated

Control image

This control is used to select a directory.

ControlDockWidget


Docs updated

Control image

This control is used to create DockWidget.

Constructer


__init__(label='', default=None, side='left')

side - Side where the dock widget should be initiated. It can assumes the values: left, right, top or bottom.

ControlEmptyWidget


Docs updated

This Control may be used to display a BaseWidget or another Control inside.

Constructer


__init__(label='')

The constructer receives only a label.

Properties


value

It may receive an element, or a list of elements from the types BaseWidget or BaseControl.

ControlEventTimeline


Control image

Constructor


__init__(label="", defaultValue=0, min=0, max=100, **kwargs)

Functions


getExportFilename()

addRow(values)

addPeriod(value, track=0, color=None) source code

Events


playVideoEvent()

fpsChanged()

pointerChanged()

Properties


value

max

mouseOverLine

ControlFile


Web ready Terminal ready Docs updated

Control image

The control may be used to select a file.

Properties


value

Gets and sets a file path.

ControlFilesTree


Control image

Show the directory files in a tree view

⋅⋅⋅Note Is not fully developed yet.⋅⋅

Properties


value

Gets and sets a directory path.

ControlImage


Web ready Terminal ready Docs updated

Control image

Displays an image or a list of images.

Functions


repaint()

Redraw the image or set of images

Properties


value

This property receives an image path, a numpy image or a list of numpy images.

Usage:

controlVar.value = 'lena_color.png'

or

controlVar.value = cv2.imread('lena_color.png', 1)

or

img1 = cv2.imread('lena_color.png', 1)
img2 = cv2.imread('lena_color.png', 1)
controlVar.value = [img1, img2]

Note: the value can only be set outside the constructor and the initForm function.

ControlLabel


Docs updated

Control image

Displays a text.

ControlList


Control image

Displays a list of values.

Constructer


__init__(label="", defaultValue="", plusFunction=None, minusFunction=None)

defaultValue - plusFunction - minusFunction -

Functions


clear()

Clear all the values from the list.

__add__(values) source code

Inserts a new row with the list of values.

__sub__(index)

Removes the row with the index.

setValue(column, row, value)

Set the value of a specific cell.

getValue(column, row) source code

Get the value of a specific cell.

Events


dataChangedEvent(row, col, item)

tableWidgetCellChanged(nextRow, nextCol, previousRow, previousCol)

tableWidgetItemChanged(current, previous)

tableWidgetItemSelectionChanged()

itemSelectionChanged()

currentCellChanged(nextRow, nextCol, previousRow, previousCol)

currentItemChanged(current, previous)

Properties


horizontalHeaders

Get and set the horizontal headers in the table list.

selectEntireRow

Accepts a boolean indicating if should allow only the selection of the entire row or not.

count

Return the number of rows.

value

Get and set the list values.

mouseSelectedRowsIndexes

Return the selected indexes.

mouseSelectedRowIndex

Return the selected index.

iconSize

Gets and sets the icon size.

ControlMdiArea


Docs updated

Control image

Constructor


__init__(label='')

The constructer receives only a label.

Functions


__add__(other)

Usage:

controlVar += baseWidget

or

controlVar += [baseWidget1 , baseWidget2]

Properties


showCloseButton

Boolean flag, indicating if should show the subwindows close button or not.

value

Sets a BaseWidget or a list of BaseWidgets representing the windows.

ControlNumber


Docs updated

Control image

Constructor


__init__(label="", defaultValue=0, min=0, max=100)

min - Defines the minimum value that can be selected.
max - Defines the maximum value that can be selected.

Properties


min

Defines the minimum value that can be selected.

max

Defines the maximum value that can be selected.

value

Returns the selected number.

ControlOpenGL


Docs updated

Control image

Functions


repaint()

Refresh the GL scene.

resetZoomAndRotation()

Reset all the zoom and scene rotations.

Properties


value

Gets and sets a GL scene.

width

Gets the GL window width

height

Gets the GL window height

ControlPlayer


Web ready Terminal ready Docs updated

Control image

Functions


pausePlay()

Toggle video play.

refresh()

Refresh the last painted frame.

isPlaying()

Returns a boolean indicating if the video is playing.

Events


processFrame(frame)

Function called before the frame is rendered.

Properties


onDoubleClick

Gets and sets the function called on double click event.
The funtion receives the next parameters: onDoubleClick(event, x, y)

onClick

Gets and sets the function called on click event.
The funtion receives the next parameters: onClick(event, x, y)

onDrag

Gets and sets the function called during a drag event.
The funtion receives the next parameters: onDrag(startPoint, endPoint)

onEndDrag

Gets and sets the function called when a drag event ends.
The funtion receives the next parameters: onEndDrag(startPoint, endPoint)

value

When not None, it returns a cv2.VideoCapture object.
It may receives a video file path, or a cv2.VideoCapture object.

Usage:

controlVar.value = '~/home/ricardo/video.avi'

or

controlVar.value = cv2.VideoCapture('~/home/ricardo/video.avi')

startFrame

Gets and sets the first frame.

endFrame

Gets and sets the last frame.

video_index

Returns the current frame index.

max

Returns the total number of frames of a video.

image

Returns and sets the image beeing rendered.

fps

Returns and sets the video FPS.

helpText

Return and set the help text that should be rendered in the video.

ControlProgress


Terminal ready Docs updated

Control image

Constructor


__init__(label="%p%", defaultValue=0, min=0, max=100)

label - This is the text that will be shown in the ProgressBar. min - Defines the minimum value that can be selected.
max - Defines the maximum value that can be selected.

Properties


min

Defines the minimum value that can be selected.

max

Defines the maximum value that can be selected.

value

Current position.

ControlSlider


Web ready Terminal ready Docs updated

Control image

Constructor


__init__(label="", defaultValue=0, min=0, max=100)

min - Defines the minimum value that can be selected.
max - Defines the maximum value that can be selected.

Properties


min

Defines the minimum value that can be selected.

max

Defines the maximum value that can be selected.

ControlText


Web ready Terminal ready Docs updated

Control image

Events


finishEditing()

Event called when the user ends the control edition.

ControlTextArea


Docs updated

Control image

ControlToolBox


Docs updated

Control image

Properties


value

It returns and receives a list of BaseWidgets.

ControlTree


Control image

iconsize

ControlTreeView


Control image

ControlVisVis


Docs updated

Control image

Functions


refresh()

Repaint the points

Properties


value

Gets and sets a list of 2D or 3D points to display.

legend

Set the graph legend

showGrid

(True or False). Show a grid in the graph

title

Set the graph title

xlabel

Set the x axis label.

ylabel

Set the y axis label.

zlabel

Set the z axis label.

ControlVisVisVolume


Docs updated

Control image

Functions


refresh()

Repaint the image.

Properties


value

Gets and sets an numpy array image with volume.

colorMap

Gets and sets the color map to display.
It can receives the next values: CM_BONE, CM_COOL, CM_COPPER, CM_GRAY, CM_HOT, CM_HSV, CM_JET, CM_PINK, CM_AUTUMN, CM_SPRING, CM_SUMMER, CM_WINTER.
Check out VisVis documentation.