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