Commit 43cf6236 authored by Matt Clarkson's avatar Matt Clarkson

Merge branch '78-improve-corner-annotator' into 'master'

Issue #78: Add functions to set text on each corner of screen.

Closes #78

See merge request !30
parents ff140a85 8aedc1f3
Pipeline #2971 passed with stages
in 13 minutes and 2 seconds
...@@ -28,7 +28,8 @@ class VTKCornerAnnotation: ...@@ -28,7 +28,8 @@ class VTKCornerAnnotation:
def set_text(self, text_list): def set_text(self, text_list):
"""Set the text in each of the four corners """Set the text in each of the four corners
:param text_list: Text to display, clockwise from top-left. :param text_list: Text to display.
[bottom-left, bottom-right, top-left, top-right].
:type text_list: List of 4 strings. :type text_list: List of 4 strings.
""" """
...@@ -37,6 +38,38 @@ class VTKCornerAnnotation: ...@@ -37,6 +38,38 @@ class VTKCornerAnnotation:
for idx, item in enumerate(text_list): for idx, item in enumerate(text_list):
self.text_actor.SetText(idx, item) self.text_actor.SetText(idx, item)
def set_text_on_top_left(self, text):
"""
Set the text on the top-left corner.
:param text: Text to display.
"""
self.text_actor.SetText(2, text)
def set_text_on_top_right(self, text):
"""
Set the text on the top-right corner.
:param text: Text to display.
"""
self.text_actor.SetText(3, text)
def set_text_on_bottom_left(self, text):
"""
Set the text on the bottom-left corner.
:param text: Text to display.
"""
self.text_actor.SetText(0, text)
def set_text_on_bottom_right(self, text):
"""
Set the text on the bottom-right corner.
:param text: Text to display.
"""
self.text_actor.SetText(1, text)
def validate_input(self, text_list): def validate_input(self, text_list):
"""Check that the text_list input is a list of four strings. """Check that the text_list input is a list of four strings.
...@@ -229,7 +262,6 @@ class VTKLargeTextCentreOfScreen(VTKTextBase): ...@@ -229,7 +262,6 @@ class VTKLargeTextCentreOfScreen(VTKTextBase):
self.set_text_string(text) self.set_text_string(text)
def set_parent_window(self, parent_window): def set_parent_window(self, parent_window):
""" """
Attach text to a particular window. Attach text to a particular window.
...@@ -242,8 +274,6 @@ class VTKLargeTextCentreOfScreen(VTKTextBase): ...@@ -242,8 +274,6 @@ class VTKLargeTextCentreOfScreen(VTKTextBase):
self.calculate_text_size) self.calculate_text_size)
self.calculate_text_size(None, None) self.calculate_text_size(None, None)
def calculate_text_size(self, _obj_unused, _ev_unused): def calculate_text_size(self, _obj_unused, _ev_unused):
""" """
Calculate the position and size of the text. Calculate the position and size of the text.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment