Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Attributes
Archetypes.generator.widget.widget Class Reference
Inheritance diagram for Archetypes.generator.widget.widget:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def __call__
def getContext
def Label
def Description

Static Public Attributes

tuple security = ClassSecurityInfo()

Private Member Functions

def _process_args
def _translate_attribute

Static Private Attributes

tuple __implements__ = (iwidget,)
dictionary _properties

Detailed Description

Base class for widgets.

A dynamic widget with a reference to a macro that can be used to
render it.

description -- tooltip
label       -- textual label
visible     -- visible[default] | invisible | hidden
condition   -- TALES expression to control the widget display

Definition at line 30 of file widget.py.


Constructor & Destructor Documentation

def Archetypes.generator.widget.widget.__init__ (   self,
  kwargs 
)

Definition at line 55 of file widget.py.

00055 
00056     def __init__(self, **kwargs):
00057         self._process_args(**kwargs)

Here is the call graph for this function:

Here is the caller graph for this function:


Member Function Documentation

def Archetypes.generator.widget.widget.__call__ (   self,
  mode,
  instance,
  context = None 
)
Not implemented.

Reimplemented in Archetypes.generator.widget.macrowidget.

Definition at line 62 of file widget.py.

00062 
00063     def __call__(self, mode, instance, context=None):
00064         """Not implemented."""
00065         return ''

Here is the caller graph for this function:

def Archetypes.generator.widget.widget._process_args (   self,
  kwargs 
) [private]

Definition at line 58 of file widget.py.

00058 
00059     def _process_args(self, **kwargs):
00060         self.__dict__.update(self._properties)
00061         self.__dict__.update(kwargs)

Here is the caller graph for this function:

def Archetypes.generator.widget.widget._translate_attribute (   self,
  instance,
  name 
) [private]

Definition at line 70 of file widget.py.

00070 
00071     def _translate_attribute(self, instance, name):
00072         value = getattr(self, name, '')
00073         msgid = getattr(self, name+'_msgid', None) or value
00074 
00075         if not value and not msgid:
00076             return ''
00077 
00078         if isinstance(value, Message):
00079             return value
00080 
00081         domain = (getattr(self, 'i18n_domain', None) or
00082                   getattr(instance, 'i18n_domain', None))
00083 
00084         if domain is None:
00085             return value
00086 
00087         return getGTS().translate(domain, msgid, mapping=instance.REQUEST,
00088                                   context=instance, default=value)

Here is the caller graph for this function:

def Archetypes.generator.widget.widget.Description (   self,
  instance,
  kwargs 
)
Returns the description, possibly translated.

Definition at line 100 of file widget.py.

00100 
00101     def Description(self, instance, **kwargs):
00102         """Returns the description, possibly translated."""
00103         value = self.description
00104         method = value and getattr(aq_inner(instance), value, None)
00105         if method and callable(method):
00106             # Description methods can be called with kwargs and should
00107             # return the i18n version of the description
00108             value = method(**kwargs)
00109             return value
00110         target_language = kwargs.get('target_language', None)
00111         return self._translate_attribute(instance, 'description')
00112 

Here is the call graph for this function:

Here is the caller graph for this function:

def Archetypes.generator.widget.widget.getContext (   self,
  instance 
)
Returns a prepared context or an empty {}.

Definition at line 66 of file widget.py.

00066 
00067     def getContext(self, instance):
00068         """Returns a prepared context or an empty {}."""
00069         return {}

Here is the caller graph for this function:

def Archetypes.generator.widget.widget.Label (   self,
  instance,
  kwargs 
)
Returns the label, possibly translated.

Definition at line 89 of file widget.py.

00089 
00090     def Label(self, instance, **kwargs):
00091         """Returns the label, possibly translated."""
00092         value = getattr(self, 'label_method', None)
00093         method = value and getattr(aq_inner(instance), value, None)
00094         if method and callable(method):
00095             # Label methods can be called with kwargs and should
00096             # return the i18n version of the description
00097             value = method(**kwargs)
00098             return value
00099         return self._translate_attribute(instance, 'label')

Here is the call graph for this function:


Member Data Documentation

Base class for widgets.

A dynamic widget with a reference to a macro that can be used to
render it.

description -- tooltip
label       -- textual label
visible     -- visible[default] | invisible | hidden
condition   -- TALES expression to control the widget display

Definition at line 42 of file widget.py.

dictionary Archetypes.generator.widget.widget._properties [static, private]
Initial value:
{
        'description' : '',
        'label' : '',
        'visible' : {'edit':'visible', 'view':'visible'},
        'condition': '',
    }

Reimplemented in Archetypes.generator.widget.macrowidget.

Definition at line 48 of file widget.py.

tuple Archetypes.generator.widget.widget.security = ClassSecurityInfo() [static]

Definition at line 44 of file widget.py.


The documentation for this class was generated from the following file: