Back to index

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

List of all members.

Public Member Functions

def process_form
def preview_tag
def getName
def getType
def bootstrap
def populateProps
def isVisible
def setCondition
def getCondition
def testCondition
def copy

Public Attributes

 label
 condition

Static Public Attributes

tuple security = ClassSecurityInfo()

Static Private Attributes

tuple _properties = FileWidget._properties.copy()

Detailed Description

Definition at line 658 of file Widget.py.


Member Function Documentation

def Archetypes.Widget.TypesWidget.bootstrap (   self,
  instance 
) [inherited]
Override if your widget needs data from the instance.

Definition at line 49 of file Widget.py.

00049 
00050     def bootstrap(self, instance):
00051         """Override if your widget needs data from the instance."""
00052         return

def Archetypes.Widget.TypesWidget.copy (   self) [inherited]
Return a copy of widget instance, consisting of field name and
properties dictionary.

Definition at line 130 of file Widget.py.

00130 
00131     def copy(self):
00132         """
00133         Return a copy of widget instance, consisting of field name and
00134         properties dictionary.
00135         """
00136         cdict = dict(vars(self))
00137         properties = deepcopy(cdict)
00138         return self.__class__(**properties)
00139 
00140 InitializeClass(TypesWidget)

Here is the call graph for this function:

def Archetypes.Widget.TypesWidget.getCondition (   self) [inherited]
Return the widget text condition.

Definition at line 101 of file Widget.py.

00101 
00102     def getCondition(self):
00103         """Return the widget text condition."""
00104         return self.condition

def Archetypes.Widget.TypesWidget.getName (   self) [inherited]

Definition at line 40 of file Widget.py.

00040 
00041     def getName(self):
00042         return self.__class__.__name__

Here is the caller graph for this function:

def Archetypes.Widget.TypesWidget.getType (   self) [inherited]
Return the type of this field as a string

Definition at line 44 of file Widget.py.

00044 
00045     def getType(self):
00046         """Return the type of this field as a string"""
00047         return className(self)

Here is the call graph for this function:

def Archetypes.Widget.TypesWidget.isVisible (   self,
  instance,
  mode = 'view' 
) [inherited]
decide if a field is visible in a given mode -> 'state'

Return values are visible, hidden, invisible

The value for the attribute on the field may either be a dict with a
mapping for edit and view::

    visible = { 'edit' :'hidden', 'view' : 'invisible' }

Or a single value for all modes::

    True/1:  'visible'
    False/0: 'invisible'
    -1:      'hidden'
    
visible: The field is shown in the view/edit screen
invisible: The field is skipped when rendering the view/edit screen
hidden: The field is added as <input type="hidden" />

The default state is 'visible'.

Definition at line 61 of file Widget.py.

00061 
00062     def isVisible(self, instance, mode='view'):
00063         """decide if a field is visible in a given mode -> 'state'
00064 
00065         Return values are visible, hidden, invisible
00066 
00067         The value for the attribute on the field may either be a dict with a
00068         mapping for edit and view::
00069 
00070             visible = { 'edit' :'hidden', 'view' : 'invisible' }
00071 
00072         Or a single value for all modes::
00073 
00074             True/1:  'visible'
00075             False/0: 'invisible'
00076             -1:      'hidden'
00077             
00078         visible: The field is shown in the view/edit screen
00079         invisible: The field is skipped when rendering the view/edit screen
00080         hidden: The field is added as <input type="hidden" />
00081 
00082         The default state is 'visible'.
00083         """
00084         vis_dic = getattr(aq_base(self), 'visible', _marker)
00085         state = 'visible'
00086         if vis_dic is _marker:
00087             return state
00088         if type(vis_dic) is DictType:
00089             state = vis_dic.get(mode, state)
00090         elif not vis_dic:
00091             state = 'invisible'
00092         elif vis_dic < 0:
00093             state = 'hidden'
00094         return state

def Archetypes.Widget.TypesWidget.populateProps (   self,
  field 
) [inherited]
This is called when the field is created.

Definition at line 54 of file Widget.py.

00054 
00055     def populateProps(self, field):
00056         """This is called when the field is created."""
00057         name = field.getName()
00058         if not self.label:
00059             self.label = capitalize(name)

def Archetypes.Widget.ImageWidget.preview_tag (   self,
  instance,
  field 
)
Return a tag for a preview image, or None if no preview is found.

Definition at line 697 of file Widget.py.

00697 
00698     def preview_tag(self, instance, field):
00699         """Return a tag for a preview image, or None if no preview is found."""
00700         img=field.get(instance)
00701         if not img:
00702             return None
00703 
00704         if self.preview_scale in field.sizes:
00705             return field.tag(instance, scale=self.preview_scale)
00706 
00707         if img.getSize()<=self.display_threshold:
00708             return field.tag(instance)
00709 
00710         return None
00711 
00712 # LabelWidgets are used to display instructions on a form.  The widget only
# displays the label for a value -- no values and no form elements.
def Archetypes.Widget.ImageWidget.process_form (   self,
  instance,
  field,
  form,
  empty_marker = None,
  emptyReturnsMarker = False,
  validating = True 
)
form processing that deals with image data (and its delete case)

Reimplemented from Archetypes.Widget.FileWidget.

Definition at line 673 of file Widget.py.

00673 
00674                      emptyReturnsMarker=False, validating=True):
00675         """form processing that deals with image data (and its delete case)"""
00676         value = None
00677         ## check to see if the delete hidden was selected
00678         delete = form.get('%s_delete' % field.getName(), empty_marker)
00679         if delete=='delete': return "DELETE_IMAGE", {}
00680         if delete=='nochange' : return empty_marker
00681         
00682 
00683         fileobj = form.get('%s_file' % field.getName(), empty_marker)
00684 
00685         if fileobj is empty_marker: return empty_marker
00686 
00687         filename = getattr(fileobj, 'filename', '') or \
00688                    (isinstance(fileobj, FileType) and \
00689                     getattr(fileobj, 'name', ''))
00690 
00691         if filename:
00692             value = fileobj
00693 
00694         if not value: return None
00695         return value, {}

def Archetypes.Widget.TypesWidget.setCondition (   self,
  condition 
) [inherited]
Set the widget expression condition.

Definition at line 96 of file Widget.py.

00096 
00097     def setCondition(self, condition):
00098         """Set the widget expression condition."""
00099         self.condition = condition

def Archetypes.Widget.TypesWidget.testCondition (   self,
  folder,
  portal,
  object 
) [inherited]
Test the widget condition.

Definition at line 106 of file Widget.py.

00106 
00107     def testCondition(self, folder, portal, object):
00108         """Test the widget condition."""
00109         try:
00110             if self.condition:
00111                 __traceback_info__ = (folder, portal, object, self.condition)
00112                 ec = createExprContext(folder, portal, object)
00113                 return Expression(self.condition)(ec)
00114             else:
00115                 return True
00116         except AttributeError:
00117             return True

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

tuple Archetypes.Widget.ImageWidget._properties = FileWidget._properties.copy() [static, private]

Reimplemented from Archetypes.Widget.FileWidget.

Definition at line 659 of file Widget.py.

Definition at line 98 of file Widget.py.

Definition at line 58 of file Widget.py.

tuple Archetypes.Widget.ImageWidget.security = ClassSecurityInfo() [static]

Reimplemented from Archetypes.Widget.FileWidget.

Definition at line 669 of file Widget.py.


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