Commit c683b67ca512f86788d54113b7c45ea65c648aed

Authored by tatiana
1 parent eed3a27c

FIX: Text actor with 0 being show under win32

invesalius/constants.py
... ... @@ -26,7 +26,7 @@ from project import Project
26 26 #---------------
27 27  
28 28 # VTK text
29   -TEXT_SIZE = 12
  29 +TEXT_SIZE = 14
30 30 TEXT_SIZE_LARGE = 18
31 31 TEXT_COLOUR = (1,1,1)
32 32 (X,Y) = (0.03, 0.97)
... ...
invesalius/data/slice_data.py
... ... @@ -34,6 +34,7 @@ class SliceData(object):
34 34 colour = const.ORIENTATION_COLOUR[self.orientation]
35 35  
36 36 text = vu.Text()
  37 + text.BoldOn()
37 38 text.SetColour(colour)
38 39 text.SetPosition(const.TEXT_POS_LEFT_DOWN_SLC)
39 40 text.SetSize(const.TEXT_SIZE_LARGE)
... ...
invesalius/data/vtk_utils.py
... ... @@ -92,31 +92,43 @@ class Text(object):
92 92 property.SetFontFamilyToArial()
93 93 property.BoldOff()
94 94 property.ItalicOff()
95   - property.ShadowOn()
  95 + property.ShadowOff()
96 96 property.SetJustificationToLeft()
97 97 property.SetVerticalJustificationToTop()
98 98 property.SetColor(const.TEXT_COLOUR)
99 99 self.property = property
100 100  
101   - mapper = vtk.vtkTextMapper()
102   - mapper.SetTextProperty(property)
103   - self.mapper = mapper
  101 + #mapper = vtk.vtkTextMapper()
  102 + #mapper.SetTextProperty(property)
  103 + #self.mapper = mapper
104 104  
105 105 x, y = const.TEXT_POSITION
106   - actor = vtk.vtkActor2D()
107   - actor.SetMapper(mapper)
  106 + #actor = vtk.vtkActor2D()
  107 + #actor.SetMapper(mapper)
  108 + #actor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
  109 + #actor.GetPositionCoordinate().SetValue(x,y)
  110 + #self.actor = actor
  111 +
  112 + actor = vtk.vtkTextActor()
108 113 actor.GetPositionCoordinate().SetCoordinateSystemToNormalizedDisplay()
109   - actor.GetPositionCoordinate().SetValue(x,y)
  114 + actor.GetPositionCoordinate().SetValue(x,y)
  115 + actor.GetTextProperty().ShallowCopy(property)
110 116 self.actor = actor
111 117  
  118 + def BoldOn(self):
  119 + self.property.BoldOn()
  120 + self.actor.GetTextProperty().ShallowCopy(self.property)
  121 +
112 122 def SetColour(self, colour):
113 123 self.property.SetColor(colour)
  124 + self.actor.GetTextProperty().ShallowCopy(self.property)
114 125  
115 126 def SetSize(self, size):
116 127 self.property.SetFontSize(size)
  128 + self.actor.GetTextProperty().ShallowCopy(self.property)
117 129  
118 130 def SetValue(self, value):
119   - self.mapper.SetInput(str(value))
  131 + self.actor.SetInput(str(value))
120 132  
121 133 def SetPosition(self, position):
122 134 self.actor.GetPositionCoordinate().SetValue(position[0],
... ... @@ -127,10 +139,11 @@ class Text(object):
127 139  
128 140 def SetJustificationToRight(self):
129 141 self.property.SetJustificationToRight()
  142 + self.actor.GetTextProperty().ShallowCopy(self.property)
130 143  
131 144 def SetVerticalJustificationToBottom(self):
132 145 self.property.SetVerticalJustificationToBottom()
133   -
  146 + self.actor.GetTextProperty().ShallowCopy(self.property)
134 147  
135 148 def Show(self, value=1):
136 149 if value:
... ...