Skip to content

Commit

Permalink
Issue #100 created a luminance change setting in place of the anatomy…
Browse files Browse the repository at this point in the history
… toggle event
  • Loading branch information
thompson318 committed Jul 6, 2022
1 parent 1c05ef6 commit 4b7fe14
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sksurgerybard/interaction/interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def __call__(self, event, _event_type_not_used):
mouse_y /= window_y

if mouse_x > self.screen_interaction_layout.get('x_right_edge'):
self._visualisation_control.visibility_toggle(mouse_y)
self._visualisation_control.luminance_change(mouse_y)

if mouse_x < self.screen_interaction_layout.get('x_left_edge'):
self._visualisation_control.change_opacity(mouse_y)
9 changes: 9 additions & 0 deletions sksurgerybard/visualisation/bard_visualisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,15 @@ def visibility_toggle(self, y_pos):
if not actor.GetVisibility():
actor.SetVisibility(True)
return

def luminance_change(self, y_pos):
"""
Changes the luminance of one of the actors
"""
print("Got signal to change luminance of actor, ", y_pos)
for actor in self._target_actors:
print("Changing luminance for actor ", actor)


def next_target(self):
"""
Expand Down
8 changes: 5 additions & 3 deletions tests/interaction/test_interaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ class TurnOnAllEvent(Exception):#pylint: disable=missing-class-docstring
pass
class VisibilityToggleEvent(Exception):#pylint: disable=missing-class-docstring
pass
class LuminanceChangeEvent(Exception):#pylint: disable=missing-class-docstring
pass
class ChangeOpacityEvent(Exception):#pylint: disable=missing-class-docstring
pass
class PositionModelEvent(Exception):#pylint: disable=missing-class-docstring
Expand Down Expand Up @@ -70,9 +72,9 @@ def turn_on_all_targets(self): # pylint: disable=no-self-use
"""Raises an error so we know when it's run"""
raise TurnOnAllEvent

def visibility_toggle(self, _): # pylint: disable=no-self-use
def luminance_change(self, _): # pylint: disable=no-self-use
"""Raises an error so we know when it's run"""
raise VisibilityToggleEvent
raise LuminanceChangeEvent

def change_opacity(self, _): # pylint: disable=no-self-use
"""Raises an error so we know when it's run"""
Expand Down Expand Up @@ -313,7 +315,7 @@ def test_mouse_event():

fake_mouse_event = _FakeMouseEvent([100, 100], [90, 10])

with pytest.raises(VisibilityToggleEvent):
with pytest.raises(LuminanceChangeEvent):
mouse_event(fake_mouse_event, None)

fake_mouse_event = _FakeMouseEvent([100, 100], [17, 90])
Expand Down

0 comments on commit 4b7fe14

Please sign in to comment.