Skip to content

Commit

Permalink
More pythonic patch
Browse files Browse the repository at this point in the history
Trying to please pydantic/validators.py from Github CI
  • Loading branch information
diegoasua committed Mar 1, 2021
1 parent 96385f8 commit c336df7
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions sashimi/gui/camera_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,18 +164,13 @@ def __init__(self, state: State, timer: QTimer, style: str):
self.reset_contrast
)

self.add_scale_bar_units(" um")

def add_scale_bar_units(self, units: str) -> None:
self.viewer.camera.events.zoom.connect(self.add_scale_bar_units)

def add_scale_bar_units(self, event: Event) -> None:
"""Patch to display physical units in scale bar. Overrides _on_zoom_change() method"""
scale_bar = self.viewer.window.qt_viewer.scale_bar
old_on_zoom_change = scale_bar._on_zoom_change

def _on_zoom_change(event: Event):
old_on_zoom_change(event)
scale_bar.text_node.text += units

scale_bar._on_zoom_change = _on_zoom_change
scale_bar._on_zoom_change(event)
scale_bar.text_node.text += " um"

def get_fullframe_size(self):
"""Maximum size of the image at current binning. As stated above, we assume square sensors."""
Expand Down

0 comments on commit c336df7

Please sign in to comment.