xmlui: minor docstring fixes
This commit is contained in:
parent
b36c1d6493
commit
2c37acf27f
1 changed files with 21 additions and 12 deletions
|
|
@ -40,7 +40,6 @@ def _dataFormField2XMLUIData(field, read_only=False):
|
|||
"""Get data needed to create an XMLUI's Widget from Wokkel's data_form's Field.
|
||||
|
||||
The attribute field can be modified (if it's fixed and it has no value).
|
||||
|
||||
@param field (data_form.Field): a field with attributes "value", "fieldType", "label" and "var"
|
||||
@param read_only (bool): if True and it makes sense, create a read only input widget
|
||||
@return: a tuple (widget_type, widget_args, widget_kwargs)
|
||||
|
|
@ -235,7 +234,7 @@ def XMLUIResultToElt(xmlui_data):
|
|||
def tupleList2dataForm(values):
|
||||
"""Convert a list of tuples (name, value) to a wokkel submit data form.
|
||||
|
||||
@param values (list): list of tuples
|
||||
@param values (list): list of tuples
|
||||
@return: data_form.Form
|
||||
"""
|
||||
form = data_form.Form('submit')
|
||||
|
|
@ -449,7 +448,6 @@ class HeaderElement(Element):
|
|||
@param name: name of the container
|
||||
@param label: label to be displayed in columns
|
||||
@param description: long descriptive text
|
||||
|
||||
"""
|
||||
assert(isinstance(parent, AdvancedListContainer))
|
||||
super(HeaderElement, self).__init__(parent.xmlui, parent)
|
||||
|
|
@ -467,6 +465,7 @@ class Container(Element):
|
|||
|
||||
def __init__(self, xmlui, parent=None):
|
||||
"""Create a container element
|
||||
|
||||
@param xmlui: XMLUI instance
|
||||
@parent: parent element or None
|
||||
"""
|
||||
|
|
@ -476,8 +475,8 @@ class Container(Element):
|
|||
|
||||
def getParentContainer(self):
|
||||
""" Return first parent container
|
||||
@return: parent container or None
|
||||
|
||||
@return: parent container or None
|
||||
"""
|
||||
current = self.parent
|
||||
while(not isinstance(current, (Container)) and
|
||||
|
|
@ -511,18 +510,20 @@ class TabsContainer(Container):
|
|||
|
||||
def end(self):
|
||||
""" Called when we have finished tabs
|
||||
change current container to first container parent
|
||||
|
||||
change current container to first container parent
|
||||
"""
|
||||
parent_container = self.getParentContainer()
|
||||
self.xmlui.changeContainer(parent_container)
|
||||
|
||||
|
||||
class AdvancedListContainer(Container):
|
||||
"""A list which can contain other widgets, headers, etc"""
|
||||
type = "advanced_list"
|
||||
|
||||
def __init__(self, xmlui, callback_id=None, name=None, headers=None, items=None, columns=None, selectable='no', auto_index=False, parent=None):
|
||||
"""Create an advanced list
|
||||
|
||||
@param headers: optional headers information
|
||||
@param callback_id: id of the method to call when selection is done
|
||||
@param items: list of widgets to add (just the first row)
|
||||
|
|
@ -574,9 +575,9 @@ class AdvancedListContainer(Container):
|
|||
|
||||
def setRowIndex(self, idx):
|
||||
""" Set index for next row
|
||||
|
||||
index are returned when a row is selected, in data's "index" key
|
||||
@param idx: string index to associate to the next row
|
||||
|
||||
"""
|
||||
self.next_row_idx = idx
|
||||
|
||||
|
|
@ -590,8 +591,8 @@ class AdvancedListContainer(Container):
|
|||
|
||||
def end(self):
|
||||
""" Called when we have finished list
|
||||
change current container to first container parent
|
||||
|
||||
change current container to first container parent
|
||||
"""
|
||||
if self._item_idx % self._columns != 0:
|
||||
raise exceptions.DataError(_("Incorrect number of items in list"))
|
||||
|
|
@ -604,6 +605,7 @@ class Widget(Element):
|
|||
|
||||
def __init__(self, xmlui, name=None, parent=None):
|
||||
"""Create an element
|
||||
|
||||
@param xmlui: XMLUI instance
|
||||
@param name: name of the element or None
|
||||
@param parent: parent element or None
|
||||
|
|
@ -619,7 +621,6 @@ class Widget(Element):
|
|||
|
||||
The internal callbacks are NO callback ids, they are strings from
|
||||
a predefined set of actions that are running in the scope of XMLUI.
|
||||
|
||||
@param callback (string): a value from:
|
||||
- 'copy': process the widgets given in 'fields' two by two, by
|
||||
copying the values of one widget to the other. Target widgets
|
||||
|
|
@ -659,8 +660,9 @@ class TextWidget(Widget):
|
|||
|
||||
|
||||
class LabelWidget(Widget):
|
||||
"""Used for one line blob of text,
|
||||
most of time to display the desciption or name of the next widget
|
||||
"""One line blob of text
|
||||
|
||||
used most of time to display the desciption or name of the next widget
|
||||
"""
|
||||
type = 'label'
|
||||
|
||||
|
|
@ -686,6 +688,7 @@ class DividerWidget(Widget):
|
|||
|
||||
def __init__(self, xmlui, style='line', name=None, parent=None):
|
||||
""" Create a divider
|
||||
|
||||
@param xmlui: XMLUI instance
|
||||
@param style: one of:
|
||||
- line: a simple line
|
||||
|
|
@ -705,7 +708,8 @@ class DividerWidget(Widget):
|
|||
|
||||
|
||||
class InputWidget(Widget):
|
||||
"""Input widget are widget which can accept user inputs,
|
||||
"""Widget which can accept user inputs
|
||||
|
||||
used mainly in forms
|
||||
"""
|
||||
def __init__(self, xmlui, name=None, parent=None, read_only=False):
|
||||
|
|
@ -771,6 +775,7 @@ class ButtonWidget(Widget):
|
|||
|
||||
def __init__(self, xmlui, callback_id, value=None, fields_back=None, name=None, parent=None):
|
||||
"""Add a button
|
||||
|
||||
@param callback_id: callback which will be called if button is pressed
|
||||
@param value: label of the button
|
||||
@fields_back: list of names of field to give back when pushing the button
|
||||
|
|
@ -1046,6 +1051,7 @@ class XMLUI(object):
|
|||
|
||||
def _createContainer(self, container, parent=None, **kwargs):
|
||||
"""Create a container element
|
||||
|
||||
@param type: container type (cf init doc)
|
||||
@parent: parent element or None
|
||||
"""
|
||||
|
|
@ -1057,6 +1063,7 @@ class XMLUI(object):
|
|||
|
||||
def changeContainer(self, container, **kwargs):
|
||||
"""Change the current container
|
||||
|
||||
@param container: either container type (container it then created),
|
||||
or an Container instance"""
|
||||
if isinstance(container, basestring):
|
||||
|
|
@ -1102,8 +1109,10 @@ def note(message, title='', level=C.XMLUI_DATA_LVL_INFO):
|
|||
|
||||
class ElementParser(object):
|
||||
"""callable class to parse XML string into Element
|
||||
|
||||
Found at http://stackoverflow.com/questions/2093400/how-to-create-twisted-words-xish-domish-element-entirely-from-raw-xml/2095942#2095942
|
||||
(c) Karl Anderson"""
|
||||
(c) Karl Anderson
|
||||
"""
|
||||
|
||||
def __call__(self, raw_xml, force_spaces=False):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue