Options¶
- class understand.Options¶
Bases:
object
All plugins options object
Use this class to define options that users can change. Find the value of an option with
lookup
.In builds before 7.1 (1221) Graph plugins only support defining options with the
define
method and IReports and Codechecks only support defining options withcheckbox
,checkbox_horiz
,checkbox_vert
,choice
,file
,integer
,radio_horiz
,radio_vert
, ortext
.In builds 7.1 (1221) and later Graph plugins may use any option method because options are displayed in the graph sidebar. The
define
method is equivalent to thechoice
method with the text and id set to the name. However, the context menu only supportscheckbox
,checkbox_horiz
,checkbox_vert
,choice
,radio_horiz
andradio_vert
options Theinteger
method can appear in the context menu when given a range (builds 1225+).Methods Summary
Create a checkbox option.
Create a horizontal group of checkbox options.
Create a vertical group of checkbox options.
Create a choice option.
Define a context menu option.
Create a file option.
Create an integer option.
Create a label.
Lookup an option value by name.
Create a horizontal radio box option.
Create a vertical radio box option.
Create a text option.
Methods Documentation
- checkbox(name, text[, default]) None ¶
Create a checkbox option.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display next to the check box
default (bool or None) – optional, the check state. False (unchecked) by default
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221).
- checkbox_horiz(name, text, choices[, default]) None ¶
Create a horizontal group of checkbox options.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display next to the check boxes
choices (list[str]) – the options to choose from
default (list[str] or None) – optional, the list of options currently checked
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221). When lookup is called, a list[str] containing the options that were checked is returned:# Create option with three checkboxes where items 2 and 3 are initally checked option.checkbox_horiz("HorizCheck","Displayed Text",["Item1","Item2","Item3"],["Item2","Item3"]) # Lookup option later option.lookup("HorizCheck") # Returns None if nothing checked, or list of checked items such as # ["Item1","Item2","Item3"]
- checkbox_vert(name, text, choices[, default]) None ¶
Create a vertical group of checkbox options.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display next to the check boxes
choices (list[str]) – the options to choose from
default (list[str] or None) – optional, the list of options currently checked
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221). When lookup is called, a list[str] containing the options that were checked is returned:# Create option with three checkboxes where items 2 and 3 are initally checked option.checkbox_vert("VertCheck","Displayed Text",["Item1","Item2","Item3"],["Item2","Item3"]) # Lookup option later option.lookup("VertCheck") # Returns None if nothing checked, or list of checked items such as # ["Item1","Item2","Item3"]
- choice(name, text, choices[, default]) None ¶
Create a choice option.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display next to the choices combination box
choices (list[str]) – the options to choose from
default (str or None) – optional, the default choice
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221).
- define(name, values[, value]) None ¶
Define a context menu option.
- Parameters:
name (str) – the option name. This appears as a graph menu option.
values (list[str]) – the possible values for the option. These appear in a submenu beneath the option name.
value (str or None) – the default value for the option.
- Return type:
None
Before 7.1 (build 1121) this method was not valid for
CodeCheck
orIReport
plugins. Now it is the equivalent ofchoice
with id and text both set to the name.
- file(name, text, default) None ¶
Create a file option.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display next to the file entry field
default (str or None) – optional, the default file. “” if not provided
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221).
- integer(name, text, default) None ¶
Create an integer option.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display next to the integer entry field
default (int or None) – optional, the default value. 0 if not provided
min (int) – optional, the minimum value of the spin box. 0 if not provided
max (int) – optional, the maximum value of the spin box. 1000000 if not provided
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221). The min and max parameters were added in build 1225.
- label(name, text) None ¶
Create a label.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221).
- lookup(name) Any ¶
Lookup an option value by name.
- Parameters:
name (str) – the option name
- Returns:
the value. The type of the value depends on the type of the option. For example, checkbox options will be True or False, integer options are int, other option types are str.
- radio_horiz(name, text, choices[, default]) None ¶
Create a horizontal radio box option.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display next to the radio boxes
choices (list[str]) – the options to choose from
default (str or None) – optional, the default choice
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221).
- radio_vert(name, text, choices[, default]) None ¶
Create a vertical radio box option.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display next to the radio boxes
choices (list[str]) – the options to choose from
default (str or None) – optional, the default choice
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221).
- text(name, text, default) None ¶
Create a text option.
- Parameters:
name (str) – the internal name to use with
lookup
text (str) – the text to display next to the text entry field
default (str or None) – optional, the default text. “” if not provided
- Return type:
None
This method was not available for
Graph
options before 7.1 (build 1221).