qargparser¶
argparser¶
-
class
ArgParser(data=None, label_suffix=None, description='', parent=None)¶ Bases:
PySide.QtGui.QGroupBoxGenerates argument widget instances parented in its layout. You can read its values or save its build data in a .json file and use it to recreate this widget. There are the different argument widget types :
ArrayBooleanEnumIntegerFloatObjectPathStringInfoTextDocPythonMelParameters: - data (dict, optional) – The build data, defaults to None
- label_suffix (str, optional) – The suffix for sub_widgets labels, defaults to None
- description (str, optional) – The description of the widget, defaults to “”
- parent (QWidget instance, optional) – The description of the widget, defaults to None
Returns: The new instance
Return type: ArgParserinstance-
add_arg(name=None, type=None, default=None, **kwargs)¶ Adds an argument.
Parameters: - name (str, optional) – The argument name, defaults to None
- type (str, optional) – The type of the argument [“object”, “enum”, “info”, “string”, “text”, “doc”,”path”, “mel”, “python”, “array”, “item”, “boolean”, “float, “integer”], defaults to None
- default (type, optional) – The default value, defaults to None
Returns: The new argument instance
Return type: Array,Boolean,Enum,Integer,Float,Object,Path,String,Info,Text,Doc,PythonorMelinstance
-
get_arg(key)¶ Gets an argument from a name or an index.
Parameters: key (str, int) – The argument name or its index Returns: The argument Return type: Array,Boolean,Enum,Integer,Float,Object,Path,String,Info,Text,Doc,PythonorMelinstance
-
pop_arg(arg)¶ Removes an argument.
Parameters: arg ( Array,Boolean,Enum,Integer,Float,Object,Path,String,Info,Text,Doc,PythonorMelinstance) – The argument
-
move_arg(key, idx)¶ Move an argument from itself or its index to a target index.
Parameters:
-
build(data)¶ Build itself from data.
Parameters: data (dict) – The data
-
delete_children()¶ Deletes all children arguments.
-
read()¶ Read all arguments values.
Returns: The values read Return type: dict
-
to_data()¶ Gets its data.
Returns: The data Return type: dict
-
save_data(path)¶ Saves its data to a path.
Parameters: path (str) – The path
arg¶
-
class
Arg(name=None, default=None, **kwargs)¶ Bases:
PySide.QtCore.QObjectBase of argument widgets.
Parameters: - name (str, optional) – The name of the widget, defaults to None
- default (type, optional) – The widget default value. Depends widget type, defaults to None
- description (str, optional) – The description of the widget, defaults to “”
Returns: The new instance
Return type: Array,Boolean,Enum,Integer,Float,Object,Path,String,Info,Text,Doc,PythonorMelinstance-
set_data(name, value)¶ Sets its data with new from a name and a value.
Parameters: - name (str) – The data key
- value (type) – The data value
-
update_data(data)¶ Updates its data
Parameters: data (dict) – The new data
-
delete()¶ Deletes itself.
-
get_children()¶ Gets all its children.
Returns: The list of its children Return type: list of Array,Boolean,Enum,Integer,Float,Object,Path,String,Info,Text,Doc,PythonorMelinstance
-
write(value)¶ Writes the value
Parameters: value (type) – The value
-
read()¶ Reads the value.
Returns: The value Return type: type
-
reset()¶ Resets itself
-
to_data()¶ Gets its data.
Returns: The data Return type: dict
array¶
-
class
Array(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.ArgArray argument widget. It creates a list of deletables items. You an can add a sub-argument that will be the items template.
Parameters: - default (list of type, optional) – The default value, defaults to []
- min (int, optional) – The minimal number of items, defaults to 0
- max (int, optional) – The maximal number of items, defaults to 10000
- buttonLabel (str, optional) – The label of the add item button , defaults to “Add Items”
- items ({}, optional) – The item template, defaults to {}
Returns: The new instance
Return type: Arrayinstance
boolean¶
-
class
Boolean(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.ArgBoolean argument widget.
Parameters: default (bool, optional) – The default value, defaults to False Returns: The new instance Return type: Booleaninstance
enum¶
-
class
Enum(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.ArgEnum argument widget. Enumerates choices.
Parameters: - default (list of str, optional) – The default value, defaults to “”
- enums (list of str, optional) – The list of choices, defaults to []
- enumsDescriptions (int, optional) – The list of choices descriptions, defaults to []
Returns: The new instance
Return type: Enuminstance
number¶
-
class
Integer(name=None, default=None, **kwargs)¶ Bases:
qargparser.number.NumberInteger argument widget.
Parameters: - default (int, optional) – The default value, defaults to 0
- step (int, optional) – The step, defaults to 0
- min (int, optional) – The minimum value, defaults to -10000
- max (int, optional) – The maximum value, defaults to 10000
- slider (bool, optional) – Add a slider if True, defaults to False
Returns: The new instance
Return type: Integerinstance
-
class
Float(name=None, default=None, **kwargs)¶ Bases:
qargparser.number.NumberFloat argument widget.
Parameters: - default (float, optional) – The default value, defaults to 0.0
- step (float, optional) – The step, defaults to 0.1
- min (float, optional) – The minimum value, defaults to -10000.0
- max (float, optional) – The maximum value, defaults to 10000.0
- slider (bool, optional) – Add a slider if True, defaults to False
Returns: The new instance
Return type: Floatinstance
object¶
-
class
Object(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.ArgObject argument widget. You an can add all sub-argument types.
Parameters: - default (dict, optional) – The default value, defaults to {}
- items (list of dict, optional) – the list of child data, defaults to False
Returns: The new instance
Return type: Objectinstance
path¶
-
class
Path(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.ArgPath argument widget. A button open an explorer window to choose a path.
Parameters: - default (str, optional) – The default value, defaults to “”
- buttonLabel (str, optional) – The label of the button, defaults to ”...”
- searchMessage (str, optional) – The title message of the explorer window, defaults to “choose a path”
Returns: The new instance
Return type: Pathinstance
string¶
-
class
String(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.ArgString argument widget.
Parameters: - default (str, optional) – The default value, defaults to “”
- placeHolder (str, optional) – The place holder text, defaults to “”
Returns: The new instance
Return type: Stringinstance
-
class
Info(name=None, default=None, **kwargs)¶ Bases:
qargparser.string.StringInfo argument widget. The value is on read-only mode.
Parameters: default (str, optional) – The default value, defaults to “” Returns: The new instance Return type: Infoinstance
text¶
-
class
Text(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.ArgText argument widget.
Parameters: default (str, optional) – The default value, defaults to “” Returns: The new instance Return type: Textinstance
-
class
Doc(name=None, default=None, **kwargs)¶ Bases:
qargparser.text.TextDoc argument widget. The value is on read-only mode.
Parameters: default (str, optional) – The default value, defaults to “” Returns: The new instance Return type: Docinstance