qargparser¶

argparser¶
-
class
ArgParser
(data=None, label_suffix=None, description='', parent=None)¶ Bases:
PySide.QtGui.QGroupBox
Generates 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 :
Array
Boolean
Enum
Integer
Float
Object
Path
String
Info
Text
Doc
Python
Mel
Parameters: - 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: ArgParser
instance-
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
,Python
orMel
instance
-
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
,Python
orMel
instance
-
pop_arg
(arg)¶ Removes an argument.
Parameters: arg ( Array
,Boolean
,Enum
,Integer
,Float
,Object
,Path
,String
,Info
,Text
,Doc
,Python
orMel
instance) – 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.QObject
Base 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
,Python
orMel
instance-
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
,Python
orMel
instance
-
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.Arg
Array 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: Array
instance
boolean¶
-
class
Boolean
(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.Arg
Boolean argument widget.
Parameters: default (bool, optional) – The default value, defaults to False Returns: The new instance Return type: Boolean
instance
enum¶
-
class
Enum
(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.Arg
Enum 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: Enum
instance
number¶
-
class
Integer
(name=None, default=None, **kwargs)¶ Bases:
qargparser.number.Number
Integer 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: Integer
instance
-
class
Float
(name=None, default=None, **kwargs)¶ Bases:
qargparser.number.Number
Float 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: Float
instance
object¶
-
class
Object
(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.Arg
Object 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: Object
instance
path¶
-
class
Path
(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.Arg
Path 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: Path
instance
string¶
-
class
String
(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.Arg
String 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: String
instance
-
class
Info
(name=None, default=None, **kwargs)¶ Bases:
qargparser.string.String
Info argument widget. The value is on read-only mode.
Parameters: default (str, optional) – The default value, defaults to “” Returns: The new instance Return type: Info
instance
text¶
-
class
Text
(name=None, default=None, **kwargs)¶ Bases:
qargparser.arg.Arg
Text argument widget.
Parameters: default (str, optional) – The default value, defaults to “” Returns: The new instance Return type: Text
instance
-
class
Doc
(name=None, default=None, **kwargs)¶ Bases:
qargparser.text.Text
Doc argument widget. The value is on read-only mode.
Parameters: default (str, optional) – The default value, defaults to “” Returns: The new instance Return type: Doc
instance