Data items¶
Numeric items¶
- class guidata.dataset.dataitems.FloatItem(label: str, default: Optional[float] = None, min: Optional[float] = None, max: Optional[float] = None, nonzero: Optional[bool] = None, unit: str = '', step: float = 0.1, slider: bool = False, help: str = '', check: bool = True)¶
- Construct a float data item
label [string]: name
default [float]: default value (optional)
min [float]: minimum value (optional)
max [float]: maximum value (optional)
slider [bool]: if True, shows a slider widget right after the line edit widget (default is False)
step [float]: step between tick values with a slider widget (optional)
nonzero [bool]: if True, zero is not a valid value (optional)
unit [string]: physical unit (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
- type¶
alias of
float
- get_value_from_reader(reader: Union[HDF5Reader, JSONReader, UserConfigReader]) float ¶
Reads value from the reader object, inside the try…except statement defined in the base item deserialize method
- class guidata.dataset.dataitems.IntItem(label: str, default: Optional[int] = None, min: Optional[int] = None, max: Optional[int] = None, nonzero: Optional[bool] = None, unit: str = '', even: Optional[bool] = None, slider: bool = False, help: str = '', check: bool = True)¶
- Construct an integer data item
label [string]: name
default [int]: default value (optional)
min [int]: minimum value (optional)
max [int]: maximum value (optional)
nonzero [bool]: if True, zero is not a valid value (optional)
unit [string]: physical unit (optional)
even [bool]: if True, even values are valid, if False, odd values are valid if None (default), ignored (optional)
slider [bool]: if True, shows a slider widget right after the line edit widget (default is False)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
- type¶
alias of
int
- check_value(value: Any) bool ¶
Override DataItem method
- get_value_from_reader(reader: Union[HDF5Reader, JSONReader, UserConfigReader]) Any ¶
Reads value from the reader object, inside the try…except statement defined in the base item deserialize method
- class guidata.dataset.dataitems.FloatArrayItem(label: str, default: Optional[ndarray] = None, help: str = '', format: str = '%.3f', transpose: bool = False, minmax: str = 'all', check: bool = True)¶
- Construct a float array data item
label [string]: name
default [numpy.ndarray]: default value (optional)
help [string]: text shown in tooltip (optional)
format [string]: formatting string (example: ‘%.3f’) (optional)
transpose [bool]: transpose matrix (display only)
large [bool]: view all float of the array
minmax [string]: “all” (default), “columns”, “rows”
check [bool]: if False, value is not checked (optional, default=True)
- format_string(instance: DataSet, value: Any, fmt: str, func: Callable) str ¶
Override DataItem method
- serialize(instance: DataSet, writer: Union[HDF5Writer, JSONWriter, UserConfigWriter]) None ¶
Serialize this item
- get_value_from_reader(reader: Union[HDF5Reader, JSONReader, UserConfigReader]) Any ¶
Reads value from the reader object, inside the try…except statement defined in the base item deserialize method
Text items¶
- class guidata.dataset.dataitems.StringItem(label: str, default: Optional[str] = None, notempty: Optional[bool] = None, wordwrap: bool = False, help: str = '')¶
- Construct a string data item
label [string]: name
default [string]: default value (optional)
help [string]: text shown in tooltip (optional)
notempty [bool]: if True, empty string is not a valid value (opt.)
wordwrap [bool]: toggle word wrapping (optional)
- type¶
alias of
str
- check_value(value: Any) bool ¶
Override DataItem method
- from_string(value: str) str ¶
Override DataItem method
- get_value_from_reader(reader: Union[HDF5Reader, JSONReader, UserConfigReader]) Any ¶
Reads value from the reader object, inside the try…except statement defined in the base item deserialize method
- class guidata.dataset.dataitems.TextItem(label: str, default: Optional[str] = None, notempty: Optional[bool] = None, wordwrap: bool = True, help: str = '')¶
- Construct a text data item (multiline string)
label [string]: name
default [string]: default value (optional)
help [string]: text shown in tooltip (optional)
notempty [bool]: if True, empty string is not a valid value (opt.)
wordwrap [bool]: toggle word wrapping (optional)
Date and time items¶
- class guidata.dataset.dataitems.DateItem(label: str, default: Optional[Any] = None, help: Optional[str] = '', check: Optional[bool] = True)¶
- Construct a date data item.
text [string]: form’s field name (optional)
label [string]: name
default [datetime.date]: default value (optional)
help [string]: text shown in tooltip (optional)
- type¶
alias of
date
- class guidata.dataset.dataitems.DateTimeItem(label: str, default: Optional[Any] = None, help: Optional[str] = '', check: Optional[bool] = True)¶
- Construct a date time data item.
text [string]: form’s field name (optional)
label [string]: name
default [datetime.date]: default value (optional)
help [string]: text shown in tooltip (optional)
Color items¶
- class guidata.dataset.dataitems.ColorItem(label: str, default: Optional[str] = None, notempty: Optional[bool] = None, wordwrap: bool = False, help: str = '')¶
- Construct a color data item
label [string]: name
default [string]: default value (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
Color values are encoded as hexadecimal strings or Qt color names
- check_value(value: str) bool ¶
Override DataItem method
- get_value_from_reader(reader: Union[HDF5Reader, JSONReader, UserConfigReader]) str ¶
Reads value from the reader object, inside the try…except statement defined in the base item deserialize method
File items¶
- class guidata.dataset.dataitems.FileSaveItem(label: str, formats: Union[Tuple[str, ...], str] = '*', default: Optional[Union[List[str], str]] = None, basedir: Optional[str] = None, all_files_first: bool = False, help: str = '', check: bool = True)¶
- Construct a path data item for a file to be saved
label [string]: name
formats [string (or string list)]: wildcard filter
default [string]: default value (optional)
basedir [string]: default base directory (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
- check_value(value: str) bool ¶
Override DataItem method
- from_string(value) str ¶
Override DataItem method
- add_extension(value) str ¶
Add extension to filename value: possible value for data item
- class guidata.dataset.dataitems.FileOpenItem(label: str, formats: Union[Tuple[str, ...], str] = '*', default: Optional[Union[List[str], str]] = None, basedir: Optional[str] = None, all_files_first: bool = False, help: str = '', check: bool = True)¶
- Construct a path data item for a file to be opened
label [string]: name
formats [string (or string list)]: wildcard filter
default [string]: default value (optional)
basedir [string]: default base directory (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
- check_value(value: str) bool ¶
Override DataItem method
- class guidata.dataset.dataitems.FilesOpenItem(label: str, formats: str = '*', default: Optional[Union[List[str], str]] = None, basedir: Optional[str] = None, all_files_first: bool = False, help: str = '', check: bool = True)¶
- Construct a path data item for multiple files to be opened.
label [string]: name
formats [string (or string list)]: wildcard filter
default [string]: default value (optional)
basedir [string]: default base directory (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
- type¶
alias of
list
- check_value(value: str) bool ¶
Override DataItem method
- from_string(value: Any) List[str] ¶
Override DataItem method
- serialize(instance: DataSet, writer: Union[HDF5Writer, JSONWriter, UserConfigWriter]) None ¶
Serialize this item
- get_value_from_reader(reader: Union[HDF5Reader, JSONReader, UserConfigReader]) List[str] ¶
Reads value from the reader object, inside the try…except statement defined in the base item deserialize method
- class guidata.dataset.dataitems.DirectoryItem(label: str, default: Optional[str] = None, notempty: Optional[bool] = None, wordwrap: bool = False, help: str = '')¶
- Construct a path data item for a directory.
label [string]: name
default [string]: default value (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
- check_value(value: str) bool ¶
Override DataItem method
Choice items¶
- class guidata.dataset.dataitems.BoolItem(text: str = '', label: str = '', default: Optional[bool] = None, help: str = '', check: bool = True)¶
- Construct a boolean data item
text [string]: form’s field name (optional)
label [string]: name
default [string]: default value (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
- type¶
alias of
bool
- get_value_from_reader(reader: Union[HDF5Reader, JSONReader, UserConfigReader]) bool ¶
Reads value from the reader object, inside the try…except statement defined in the base item deserialize method
- class guidata.dataset.dataitems.ChoiceItem(label: str, choices: ~typing.Any, default: ~typing.Optional[~typing.Union[~typing.Tuple, ~typing.Type[~guidata.dataset.dataitems.FirstChoice], int]] = <class 'guidata.dataset.dataitems.FirstChoice'>, help: str = '', check: bool = True, radio: bool = False)¶
- Construct a data item for a list of choices.
label [string]: name
choices [list, tuple or function]: string list or (key, label) list function of two arguments (item, value) returning a list of tuples (key, label, image) where image is an icon path, a QIcon instance or a function of one argument (key) returning a QIcon instance
default [-]: default label or default key (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
radio [bool]: if True, shows radio buttons instead of a combo box (default is False)
- class guidata.dataset.dataitems.MultipleChoiceItem(label: str, choices: List[str], default: Tuple = (), help: str = '', check: bool = True)¶
- Construct a data item for a list of choices – multiple choices can be selected
label [string]: name
choices [list or tuple]: string list or (key, label) list
default [-]: default label or default key (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
- horizontal(row_nb: int = 1) MultipleChoiceItem ¶
Method to arange choice list horizontally on n rows
Example: nb = MultipleChoiceItem(“Number”, [‘1’, ‘2’, ‘3’] ).horizontal(2)
- vertical(col_nb: int = 1) MultipleChoiceItem ¶
Method to arange choice list vertically on n columns
Example: nb = MultipleChoiceItem(“Number”, [‘1’, ‘2’, ‘3’] ).vertical(2)
- class guidata.dataset.dataitems.ImageChoiceItem(label: str, choices: ~typing.Any, default: ~typing.Optional[~typing.Union[~typing.Tuple, ~typing.Type[~guidata.dataset.dataitems.FirstChoice], int]] = <class 'guidata.dataset.dataitems.FirstChoice'>, help: str = '', check: bool = True, radio: bool = False)¶
- Construct a data item for a list of choices with images
label [string]: name
choices [list, tuple or function]: (label, image) list or (key, label, image) list function of two arguments (item, value) returning a list of tuples (key, label, image) where image is an icon path, a QIcon instance or a function of one argument (key) returning a QIcon instance
default [-]: default label or default key (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
Other items¶
- class guidata.dataset.dataitems.ButtonItem(label: str, callback: Callable, icon: Optional[str] = None, default: Optional[Any] = None, help: str = '', check: bool = True)¶
- Construct a simple button that calls a method when hit
label [string]: text shown on the button
- callback [function]: function with four parameters (dataset, item, value, parent)
dataset [DataSet]: instance of the parent dataset
item [DataItem]: instance of ButtonItem (i.e. self)
value [unspecified]: value of ButtonItem (default ButtonItem value or last value returned by the callback)
parent [QObject]: button’s parent widget
icon [QIcon or string]: icon show on the button (optional) (string: icon filename as in guidata/guiqwt image search paths)
default [unspecified]: default value passed to the callback (optional)
help [string]: text shown in button’s tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
The value of this item is unspecified but is passed to the callback along with the whole dataset. The value is assigned the callback`s return value.
- class guidata.dataset.dataitems.DictItem(label: str, default: Optional[dict] = None, help: str = '', check: bool = True)¶
- Construct a dictionary data item
label [string]: name
default [dict]: default value (optional)
help [string]: text shown in tooltip (optional)
check [bool]: if False, value is not checked (optional, default=True)
- class guidata.dataset.dataitems.FontFamilyItem(label: str, default: Optional[str] = None, notempty: Optional[bool] = None, wordwrap: bool = False, help: str = '')¶
- Construct a font family name item
label [string]: name
default [string]: default value (optional)
help [string]: text shown in tooltip (optional)