Commit c683b67ca512f86788d54113b7c45ea65c648aed
1 parent
eed3a27c
Exists in
master
and in
68 other branches
FIX: Text actor with 0 being show under win32
Showing
3 changed files
with
24 additions
and
10 deletions
Show diff stats
invesalius/constants.py
invesalius/data/slice_data.py
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: | ... | ... |