[Ocemp-CVS] ocempgui/ocempgui/widgets Label.py,1.28.2.2,1.28.2.3
Status: Beta
Brought to you by:
marcusva
From: Marcus v. A. <mar...@us...> - 2007-02-19 17:43:30
|
Update of /cvsroot/ocemp/ocempgui/ocempgui/widgets In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv4935/ocempgui/widgets Modified Files: Tag: rel_0_2 Label.py Log Message: Added linespace and alignment patches from Christophe and Ludovic. Index: Label.py =================================================================== RCS file: /cvsroot/ocemp/ocempgui/ocempgui/widgets/Label.py,v retrieving revision 1.28.2.2 retrieving revision 1.28.2.3 diff -u -d -r1.28.2.2 -r1.28.2.3 --- Label.py 27 Jan 2007 22:58:57 -0000 1.28.2.2 +++ Label.py 19 Feb 2007 17:43:28 -0000 1.28.2.3 @@ -104,6 +104,7 @@ mnemonic - A tuple with index location character of the mnemonic. multiline - Indicates, whether the text spans over multiple lines. Default is False. + linespace - The line space in multiline mode. align - The alignment of the text on the Label. lines - A list containing the single text lines. """ @@ -116,6 +117,7 @@ self.__active = False # Internal mnemonic handler. self._multiline = False + self._linespace = 0 self._text = None self._padding = 2 self._align = ALIGN_NONE @@ -216,6 +218,21 @@ self._multiline = multiline self.dirty = True + def set_linespace (self, linespace): + """L.set_linespace (...) -> None + + Sets the line space between each line in multiline mode. + + The line space is defined in pixels. + + Raises a TypeError, if the passed argument is not a positive + integer. + """ + if (linespace != None) and (type (linespace) != int): + raise TypeError ("linespace must be an integer") + self._linespace = linespace + self.dirty = True + def activate (self): """L.activate () -> None @@ -315,6 +332,9 @@ lambda self, var: self.set_multiline (var), doc = "Indicates, whether the text spans over " \ "multiple lines.") + linespace = property (lambda self: self._linespace, + lambda self, var: self.set_linespace (var), + doc = "The line space in multiline mode.") lines = property (lambda self: self.get_lines (), doc = "A list containing the single text lines.") align = property (lambda self: self._align, |