changeset 1472:c005c212b538

xmlui: minor docstring fixes
author Goffi <goffi@goffi.org>
date Tue, 18 Aug 2015 10:04:47 +0200
parents 934e402c90bf
children 675e0e9f1653
files src/tools/xml_tools.py
diffstat 1 files changed, 21 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/src/tools/xml_tools.py	Tue Aug 18 09:37:25 2015 +0200
+++ b/src/tools/xml_tools.py	Tue Aug 18 10:04:47 2015 +0200
@@ -40,7 +40,6 @@
     """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 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 @@
         @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 @@
 
     def __init__(self, xmlui, parent=None):
         """Create a container element
+
         @param xmlui: XMLUI instance
         @parent: parent element or None
         """
@@ -476,8 +475,8 @@
 
     def getParentContainer(self):
         """ Return first parent container
+
         @return: parent container or None
-
         """
         current = self.parent
         while(not isinstance(current, (Container)) and
@@ -511,18 +510,20 @@
 
     def end(self):
         """ Called when we have finished tabs
+
         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 @@
 
     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 @@
 
     def end(self):
         """ Called when we have finished list
+
         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 @@
 
     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 @@
 
         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 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 @@
 
     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 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 @@
 
     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 @@
 
     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 @@
 
     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 @@
 
 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):
         """