Package bar :: Module base :: Class barStructureLabel
[hide private]
[frames] | no frames]

Class barStructureLabel


Parental class for all classes representing slide labels.


Note: The class should not be used itself but rather its customized subclasses (barRegularLabel, barSpotLabel, barCommentLabel) as there are three basic types of labels.

Nested Classes [hide private]
Instance Methods [hide private]
 
__init__(self, labelLocation, labelCaption, labelID, properties=None, growlevel=0)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
xml.dom.minidom.Node
getXMLelement(self)
Generate XML DOM representation of the object.
str
_validateCaption(self, caption)
Validate given caption.
(float, float)
__getLocation(self)
Returns: location (x, y) of the label in SVG (slide) coordinates
 
__setLocation(self, newLocation)
Assign the location of the label.
 
__affineTransform(self, M)
Transform the location of the label.
 
affineTransform(self, M)
An alias for self.__affineTransform(M).
str
__getCaption(self)
Returns: the label caption
 
__setCaption(self, newCaption)
Assign the label caption if is a valid structure name.
str
__getID(self)
Returns: the label identifier
 
__setID(self, newID)
Assign the label identifier.
 
__setGrowlevel(self, newGrowlevel)
Assign the label grow level.
int
__getGrowlevel(self)
Returns: grow level of the label

Inherited from barAtlasSlideElement (private): _getTextNodeXMLelement

Inherited from barObject: __str__, getElementById, writeXMLtoFile

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Class Methods [hide private]
barStructureLabel
fromXML(cls, svgTextElement)
Create label object from its XML representation.
 
castToCommentLabel(cls, sourceLabel)
An alias for castLabelType(sourceLabel, barCommentLabel).
 
castToSpotLabel(cls, sourceLabel)
An alias for castLabelType(sourceLabel, barSpotLabel).
targetLabelType
castLabelType(cls, sourceLabel, targetLabelType)
Converts label type from one to another.
Static Methods [hide private]

Inherited from barObject (private): _getAttributesDict

Class Variables [hide private]
str _color = None
color of label
str _prefix = None
prefix that is added to the label when XML element is generated
str _elementName = 'text'
name of the represented XML element

Inherited from barAtlasSlideElement (private): _attributes, _attributesNS

Properties [hide private]
(float, float) Location
Location of the label.
str Caption
Caption of the label.
str ID
Identifier of the label.
int growlevel
Grow level of the label.

Inherited from object: __class__

Method Details [hide private]

__init__(self, labelLocation, labelCaption, labelID, properties=None, growlevel=0)
(Constructor)

 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Parameters:
  • labelLocation ((int, int)) - point in which label is anchored
  • labelCaption (str) - text (name of the structure)
  • labelID (str) - uniqe ID assigned to this label
  • properties ({str : ?, ...}) - custom XML attributes overriding default XML text element settings
Overrides: object.__init__

fromXML(cls, svgTextElement)
Class Method

 

Create label object from its XML representation.

Parameters:
  • svgTextElement (xml.dom.node) - XML representation of the object
Returns: barStructureLabel
created label object
Overrides: barAtlasSlideElement.fromXML

Note: The method returns object of the proper class (according to the type of the given label representation).

castLabelType(cls, sourceLabel, targetLabelType)
Class Method

 

Converts label type from one to another.

Parameters:
  • sourceLabel (barStructureLabel) - label to be converted
  • targetLabelType (class) - class of the resulting label.
Returns: targetLabelType
converted label

getXMLelement(self)

 

Generate XML DOM representation of the object.

Parameters:
  • useBarNS - determines, if element uses 3dBAR XML namespace
Returns: xml.dom.minidom.Node
XML representation of the object
Overrides: barObject.getXMLelement
(inherited documentation)

_validateCaption(self, caption)

 

Validate given caption. Raise ValueError if invalid.

Parameters:
  • caption (str) - text to be validated
Returns: str
caption

__getLocation(self)

 
Returns: (float, float)
location (x, y) of the label in SVG (slide) coordinates

__setLocation(self, newLocation)

 

Assign the location of the label.

Parameters:
  • newLocation ((float, float)) - new location (x, y) of the label

__affineTransform(self, M)

 

Transform the location of the label.

Parameters:
  • M (numpy 3x3 array) - transformation matrix

affineTransform(self, M)

 

An alias for self.__affineTransform(M).

Parameters:
  • M - transformation matrix
Overrides: barAtlasSlideElement.affineTransform

__getCaption(self)

 
Returns: str
the label caption

__setCaption(self, newCaption)

 

Assign the label caption if is a valid structure name. Otherwise raise ValueError.

Parameters:
  • newCaption (str) - new caption value

__getID(self)

 
Returns: str
the label identifier

__setID(self, newID)

 

Assign the label identifier.

Parameters:
  • newID (str) - new label identifier

__setGrowlevel(self, newGrowlevel)

 

Assign the label grow level.

Parameters:
  • newGrowlevel (convertable to int) - new grow level

__getGrowlevel(self)

 
Returns: int
grow level of the label

Property Details [hide private]

Location

Location of the label.

Get Method:
__getLocation(self) - Returns: location (x, y) of the label in SVG (slide) coordinates
Set Method:
__setLocation(self, newLocation) - Assign the location of the label.
Type:
(float, float)

Caption

Caption of the label.

Get Method:
__getCaption(self) - Returns: the label caption
Set Method:
__setCaption(self, newCaption) - Assign the label caption if is a valid structure name.
Type:
str

ID

Identifier of the label.

Get Method:
__getID(self) - Returns: the label identifier
Set Method:
__setID(self, newID) - Assign the label identifier.
Type:
str

growlevel

Grow level of the label.

Get Method:
__getGrowlevel(self) - Returns: grow level of the label
Set Method:
__setGrowlevel(self, newGrowlevel) - Assign the label grow level.
Type:
int