Package osaf :: Package views :: Package detail :: Module detailblocks
[hide private]
[frames] | no frames]

Module detailblocks

source code

Detail Blocks - detail view parcel initialization

Includes a few public utilities: any detail view client can use these to help assure consistent alignment.

More docs to come, but the key points: I've created functions (makeSubtree, makeArea, makeSpacer, makeEditor) to simplify the process for the common case; there are lots of examples below in the basic pim Kinds' subtrees.

Functions [hide private]
String
uniqueName(parcel, prefix='')
Return an item name unique in this parcel.
source code
 
makeArea(parcel, name, stretchFactor=<Locale: en_US>, border=<Locale: en_US>, minimumSize=<Locale: en_US>, baseClass=<class 'osaf.framework.blocks.ControlBlocks.ContentItemDetail'>, **kwds)
Make a block template that'll contain one horizontal slice of the detail view.
source code
 
makeLabel(parcel, label=u'', borderTop=5, border=<Locale: en_US>, width=60, baseClass=<class 'osaf.framework.blocks.ControlBlocks.StaticText'>, textAlignmentEnum=<Locale: en_US>, **kwds)
Make a StaticText label template for use in the detail view.
source code
 
makeSpacer(parcel, size=<Locale: en_US>, width=-1, height=-1, name=<Locale: en_US>, baseClass=<class 'osaf.framework.blocks.ControlBlocks.StaticText'>, **kwds)
Make a spacer block template for use in the detail view.
source code
 
makeEditor(parcel, name, viewAttribute, border=<Locale: en_US>, baseClass=<class 'osaf.views.detail.detail.DetailSynchronizedAttributeEd..., characterStyle=<Locale: en_US>, presentationStyle=<Locale: en_US>, **kwds)
Make an Attribute Editor block template for the detail view.
source code
 
makeSubtree(parcel, kindOrClass, rootBlocks)
Make a BranchSubtree annotation for this Kind, containing these top-level blocks.
source code
 
installParcel(parcel, oldVersion=<Locale: en_US>)
Instantiate all the blocks, events, etc for the detail view.
source code
 
registerAttributeEditors(parcel, oldVersion) source code
 
makeRootStuff(parcel, oldVersion) source code
 
makeCalendarArea(parcel, oldVersion) source code
 
makeMailArea(parcel, oldVersion) source code
 
makeConflictBar(parcel, oldVersion) source code
 
makeMarkupBar(parcel, oldVersion)
Build the markup bar.
source code
 
makeNoteSubtree(parcel, oldVersion)
Build the subtree (and related stuff) for Note.
source code
 
makeEmptySubtree(parcel, oldVersion) source code
Variables [hide private]
  _uniqueNameIndicies = {u'': 109}
Function Details [hide private]

uniqueName(parcel, prefix='')

source code 

Return an item name unique in this parcel. Used when we don't need to refer to an item by name.

Note: @@@ pje pointed out that this may still be perilous.
Parameters:
  • parcel (Parcel) - The parcel we'll create the item in
  • prefix (String) - A base for the name, to which this method will add a number to make it unique
Returns: String
A name that doesn't currently exist in this parcel's namespace

makeArea(parcel, name, stretchFactor=<Locale: en_US>, border=<Locale: en_US>, minimumSize=<Locale: en_US>, baseClass=<class 'osaf.framework.blocks.ControlBlocks.ContentItemDetail'>, **kwds)

source code 

Make a block template that'll contain one horizontal slice of the detail view.

Call .install(parcel) on the resulting template, either directly or after building up a list of templates, to actually instantiate the item in the parcel.
Parameters:
  • parcel (Parcel) - The parcel that the block will go into
  • name (String) - A unique name for this block
  • stretchFactor (float) - Optionally, override the default stretchFactor on the new block
  • border (Rect) - Optionally, override the default border on the new block
  • minimumSize (Size) - Optionally, override the default minimumSize of the new block
  • baseClass (class) - Optionally, specify the base class of the new block; defaults to ContentItemDetail.
Returns:
The new block template.

makeLabel(parcel, label=u'', borderTop=5, border=<Locale: en_US>, width=60, baseClass=<class 'osaf.framework.blocks.ControlBlocks.StaticText'>, textAlignmentEnum=<Locale: en_US>, **kwds)

source code 

Make a StaticText label template for use in the detail view.

Call .install(parcel) on the resulting template, either directly or after building up a list of templates, to actually instantiate the item in the parcel.
Parameters:
  • parcel (Parcel) - The parcel that the label block will go into
  • label (Unicode) - The label to be displayed (usually specified as "_(u'something')" to allow internationalization)
  • borderTop (Integer) - Optionally, specify a top border of 5, with 0 border on the other sides
  • border (Rect) - Optionally, specify all four sides of the border on the new label block.
  • width (Integer) - Optionally, override the default width (60) (eventually, this'll be ignored and the label will measure itself).
Returns:
The new label block template.

makeSpacer(parcel, size=<Locale: en_US>, width=-1, height=-1, name=<Locale: en_US>, baseClass=<class 'osaf.framework.blocks.ControlBlocks.StaticText'>, **kwds)

source code 

Make a spacer block template for use in the detail view.

Call .install(parcel) on the resulting template, either directly or after building up a list of templates, to actually instantiate the item in the parcel.
Parameters:
  • parcel (Parcel) - The parcel that the spacer block will go into
  • size (Size) - The size of the spacer block (handy if you want to specify both dimensions)
  • width (Integer) - The width of the spacer block (handy if you want the default height)
  • height (Integer) - The height of the spacer block (handy if you want the default width)
  • name (String) - A unique name within this parcel for the spacer block. One will be automatically generated if you don't specify one.
  • baseClass (class) - Optionally, specify the base class of the new block; defaults to StaticText, but a subclass of SynchronizedSpacerBlock can be used if the spacer's visibility needs to be conditioned on data in the item being displayed.
Returns:
The new spacer block template.

makeEditor(parcel, name, viewAttribute, border=<Locale: en_US>, baseClass=<class 'osaf.views.detail.detail.DetailSynchronizedAttributeEd..., characterStyle=<Locale: en_US>, presentationStyle=<Locale: en_US>, **kwds)

source code 

Make an Attribute Editor block template for the detail view.

Call .install(parcel) on the resulting template, either directly or after building up a list of templates, to actually instantiate the item in the parcel.
Parameters:
  • parcel (Parcel) - The parcel that the AEBlock will go into
  • name (String) - A unique name within this parcel for the AEBlock.
  • viewAttribute (String) - The name of the attribute to be edited by this editor.
  • border (Rect) - Optionally, override the default border on the new block
  • baseClass (class) - Optionally, specify the base class of the new block; defaults to DetailSynchronizedAttributeEditorBlock.
  • characterStyle (CharacterStyle) - Override the default CharacterStyle on the new block.
  • presentationStyle (dict) - Optional dictionary for customizing the selection of this block's attribute editor, or for customizing the behavior of that editor. This dictionary is processed into a new PresentationStyle instance.
  • kwds (dict) - Other keyword arguments to be passed in creation of the new block.
Returns:
The new attribute editor block template.