/[escript]/trunk/pyvisi/py_src/style.py
ViewVC logotype

Diff of /trunk/pyvisi/py_src/style.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 859 by jongui, Wed Sep 20 03:23:16 2006 UTC revision 860 by jongui, Thu Sep 28 08:17:29 2006 UTC
# Line 1  Line 1 
1    """
2    @author: John Ngui
3    @author: Lutz Gross
4    """
5    
6  import vtk  import vtk
7  from constants import *  from constants import *
8    
9  class Style:  class Style:
10        """
11        Class that define the style of text.
12        """
13    
14      def __init__(self):      def __init__(self):
15          self.vtk_text_property = vtk.vtkTextProperty()          self.vtk_text_property = vtk.vtkTextProperty()
16    
17      def setFontFamily(self, family):      def setFontFamily(self, family):
18            """
19            Set the font family (i.e. Times, Arial).
20            @type family: String
21            @param family: Type of font
22            """
23          eval("self.vtk_text_property.SetFontFamilyTo%s()" % family)          eval("self.vtk_text_property.SetFontFamilyTo%s()" % family)
24    
25      def setBold(self):      def boldOn(self):
26            """
27            Bold the text.
28            """
29    
30          self.vtk_text_property.BoldOn()          self.vtk_text_property.BoldOn()
31    
32      def setItalic(self):      def italicOn(self):
33            """
34            Italize the text.
35            """
36    
37          self.vtk_text_property.ItalicOn()          self.vtk_text_property.ItalicOn()
38    
39      def setShadow(self):      def shadowOn(self):
40            """
41            Apply shadows on the text.
42            """
43    
44          self.vtk_text_property.ShadowOn()          self.vtk_text_property.ShadowOn()
45    
46      def setColor(self, color):      def setColor(self, color):
47            """
48            Set the text color.
49            @type color: RGB list
50            @param color: Color of the text
51            """
52    
53          self.vtk_text_property.SetColor(color[0], color[1],          self.vtk_text_property.SetColor(color[0], color[1],
54              color[2])              color[2])
55    
56      def getStyle(self):      def getStyle(self):
57            """
58            Return the style object.
59            @rtype: vtkTextProperty
60            @return: VTK text property that is used to specify text style
61            """
62    
63          return self.vtk_text_property          return self.vtk_text_property
64    

Legend:
Removed from v.859  
changed lines
  Added in v.860

  ViewVC Help
Powered by ViewVC 1.1.26