Widgets

Base Class

class gpi.widgets.GenericWidgetGroup(title, parent=None)[source]

This is the base-class for all widgets. It provides abstract methods and default behavior. From the node-developer’s perspective, this provides the widget-port, visibility, and collapsibility options.

getSettings()[source]

These are the minimum settings required to re-instantiate each widget. Save all ‘get_<name>’ attributes as ‘<name>’. This list is also used in the GPI_PROCESS to buffer widget attributes.

get_quietval()[source]

Don’t use/implement quietval since networks will use it to modify val.

set_collapsed(col=True)[source]

bool | Only hide the ‘collapsable’ elements of a widget within its groupbox.

set_id(value=None)[source]

int | INTERNAL USE ONLY: used for saving network information that will aid in reinstantiation.

set_inport(st)[source]

bool | Turn the widget inport on/off with a bool.

set_outport(st)[source]

bool | Turn the widget outport on/off with a bool.

set_quietval(val)[source]

(same type as val) | Set the central value of a widget without triggering an event.

set_reset()[source]

No Arg | Widgets that need to be reset automatically implement this function (e.g. pushbuttons where the button needs to be raised again after the node compute()).

set_val(val)[source]

type(val) | Set the central value of a widget.

set_visible(visible=True)[source]

bool | Set the widget groupbox’s visibility within the node menu.

Numerical Controls

class gpi.widgets.Slider(title, parent=None)[source]

A slider for integer values.

set_max(value)[source]

int | Max integer value (<=).

set_min(value)[source]

int | Min integer value (>=).

set_val(value)[source]

int | The value (int).

class gpi.widgets.SpinBox(title, parent=None)[source]

Spin box for integer values.

set_immediate(val)[source]

bool | Make the value changes immediate with scroll wheel etc...

set_label(val)[source]

str | Set a text left of the spinbox (str).

set_max(val)[source]

int | Max integer value (<=).

set_min(val)[source]

int | Min integer value (>=).

set_singlestep(val)[source]

int | The stepsize of one up/down button click (int).

set_val(val)[source]

int | The value (int).

set_wrapping(val)[source]

int | The number of displayed decimal places (int).

class gpi.widgets.DoubleSpinBox(title, parent=None)[source]

Spin box for floating point values.

set_decimals(val)[source]

int | The number of displayed decimal places (int).

set_immediate(val)[source]

bool | Make the value changes immediate with scroll wheel etc...

set_label(val)[source]

str | Set a text left of the spinbox (str).

set_max(val)[source]

float | Max float value (<=).

set_min(val)[source]

float | Min float value (>=).

set_singlestep(val)[source]

float | The stepsize of one up/down button click (float).

set_val(val)[source]

float | The value (float).

set_wrapping(val)[source]

bool | Allow the up/down buttons to cause a wrap when exceeding max or min values (bool).

Selectors

class gpi.widgets.PushButton(title, parent=None)[source]

A simple single pushbutton box.

set_button_title(val)[source]

str | Place a title, centered, on the button.

set_reset()[source]

No Arg | Overrides the generic reset to specifically set the QPushButton. For oneshot functionality this gets called automatically after the node compute().

set_toggle(val)[source]

bool | Make the pushbutton a toggle button on/off -> True/False.

set_val(val)[source]

bool | The button state is a bool: on/off -> True/False.

class gpi.widgets.ComboBox(title, parent=None)[source]

Provides a popup list for different labels.

set_index(index)[source]

int | gives the corresponding index of the chosen item, starting at 0. So, for example, self.getAttr(‘myfruitbox’,index) would return a 2 if ‘orange’ were selected from the item list given in this table, while self.getVal(‘myfruitbox’) would return the string ‘orange’.

set_items(items)[source]

list(str,str,...) | list of items to choose from. Only one item can be chosen from the list.

set_val(item_text)[source]

int | item index

class gpi.widgets.ExclusiveRadioButtons(title, parent=None)[source]

Provides a set of check boxes for different labels. -Buttons are stacked.

set_buttons(names)[source]

list(str,str,...) | A list of labels (e.g. [‘b1’, ‘b2’,...]).

set_val(value)[source]

int | The position of the chosen button (zero-based, int).

class gpi.widgets.ExclusivePushButtons(title, parent=None)[source]

Provides a set of check boxes for different labels. -Buttons are placed side-by-side.

set_buttons(names)[source]

list(str,str,...) | A list of labels (e.g. [‘b1’, ‘b2’,...]).

set_val(value)[source]

int | The position of the chosen button (zero-based, int).

class gpi.widgets.NonExclusivePushButtons(title, parent=None)[source]

Provides a set of check boxes for different labels. -Buttons are placed side-by-side.

set_buttons(names)[source]

list(str,str,...) | A list of labels (e.g. [‘b1’, ‘b2’,...]).

set_val(value)[source]

int or list(int,int,...) | The position of the chosen button (zero-based, int or list).

Image Display

class gpi.widgets.DisplayBox(title, parent=None)[source]

A 2D QPixmap using a QLabel using built-in interpolation schemes.

set_collapsed(val)[source]

bool | Only collapse the display options, not the QPixmap/QLabel window.

set_interp(val)[source]

bool | Interpolated scaling / nearest neighbor, boolean True/False.

set_line(val)[source]

N/A | Doesn’t do anything yet.

set_noscroll(val)[source]

bool | Turn display window scroll on/off with boolean False/True.

set_pixmap(val)[source]

QPixmap | A QPixmap to be displayed.

set_points(val)[source]

N/A | Doesn’t do anything yet.

set_scale(val)[source]

float | Pre-defined image dimension scale (float)

set_val(image)[source]

QImage | Image is a QImage().

somethingChanged()[source]

send a downstream event.

File Browsers

class gpi.widgets.OpenFileBrowser(title, parent=None)[source]

Provide a QFileDialog() at the push of a button.

set_button_title(title)[source]

str | A title centered on the pushbutton (str).

set_caption(val)[source]

str | Set browser title-bar (str).

set_directory(val)[source]

str | Set the default directory (str).

set_filter(val)[source]

str | Set the file extension filter (e.g. ‘io_field (.fld);;all ()’).

set_val(value)[source]

str | The filename and path (str).

class gpi.widgets.SaveFileBrowser(title, parent=None)[source]

Provide a QFileDialog() at the push of a button.

set_button_title(title)[source]

str | A title centered on the pushbutton (str).

set_caption(val)[source]

str | Set browser title-bar (str).

set_directory(val)[source]

str | Set the default directory (str).

set_filter(val)[source]

str | Set the file extension filter (e.g. ‘io_field (.fld);;all ()’).

set_val(value)[source]

str | The filename and path (str).

Text Input/Output

class gpi.widgets.StringBox(title, parent=None)[source]

A simple single line string box.

get_maskedval()[source]

If the string box is acting as a password then this getter must be used.

get_val()[source]

If its in masked mode then it must be specifically handled thru get_maskedval().

set_mask(val)[source]

bool | Toggle input mask

set_maskedval(val)[source]

None | No setter for storing.

set_placeholder(val)[source]

str | Set the placeholder text (str).

set_val(value)[source]

str | Set the string (str).

class gpi.widgets.TextEdit(title, parent=None)[source]

Provides an editable text window with scrollbar and python code syntax highlighting.

set_val(value)[source]

str | The full plain-text to be displayed (str).

class gpi.widgets.TextBox(title, parent=None)[source]

Provides a multi-line plain-text display.

bool | Open hyperrefs

set_val(val)[source]

str | The full plain-text to be displayed (str).

set_wordwrap(val)[source]

bool | Turn on/off with boolean True/False.

class gpi.widgets.WebBox(title, parent=None)[source]

For loading web urls.

set_passwd(passwd)[source]

str | For login sites

set_username(usr)[source]

str | For login sites

set_val(val)[source]

str | The url (str).