Skip to content

Commit 440aec9

Browse files
committed
Fixes #8: contrast panel / min/max selection tools
1 parent 92e3d1c commit 440aec9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* [Issue #5](https://github.com/PlotPyStack/PlotPy/issues/5) - Contrast panel: levels histogram is sometimes not updated
1010
* [Issue #6](https://github.com/PlotPyStack/PlotPy/issues/6) - 1D Histogram items are not properly drawn
1111
* [Issue #7](https://github.com/PlotPyStack/PlotPy/issues/7) - Contrast panel: histogram may contains zeros periodically due to improper bin sizes
12+
* [Issue #8](https://github.com/PlotPyStack/PlotPy/issues/8) - Contrast panel: switch back to default tool after selecting min/max
1213

1314
## Version 2.0.1 ##
1415

plotpy/panels/contrastadjustment.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@ def configure_panel(self) -> None:
475475
tip=_("Select minimum level on image"),
476476
toolbar_id="contrast",
477477
end_callback=self.apply_min_selection,
478+
switch_to_default_tool=True,
478479
)
479480
self.max_select_tool = self.manager.add_tool(
480481
SelectPointTool,
@@ -484,6 +485,7 @@ def configure_panel(self) -> None:
484485
tip=_("Select maximum level on image"),
485486
toolbar_id="contrast",
486487
end_callback=self.apply_max_selection,
488+
switch_to_default_tool=True,
487489
)
488490

489491
def get_plot(self) -> BasePlot:
@@ -544,6 +546,7 @@ def apply_min_selection(self, tool: SelectPointTool) -> None:
544546
point = self.min_select_tool.get_coordinates()
545547
z = item.get_data(*point)
546548
self.histogram.set_min(z)
549+
tool.SIG_TOOL_JOB_FINISHED.emit()
547550

548551
def apply_max_selection(self, tool: SelectPointTool) -> None:
549552
"""Apply maximum selection
@@ -555,6 +558,7 @@ def apply_max_selection(self, tool: SelectPointTool) -> None:
555558
point = self.max_select_tool.get_coordinates()
556559
z = item.get_data(*point)
557560
self.histogram.set_max(z)
561+
tool.SIG_TOOL_JOB_FINISHED.emit()
558562

559563
def set_range(self, _min: float, _max: float) -> None:
560564
"""Set contrast panel's histogram range

0 commit comments

Comments
 (0)