Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions Orange/widgets/unsupervised/owhierarchicalclustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,20 @@ def _rescale(self):
else:
drect = QSizeF(leaf_count, self._root.value.height)

transform = QTransform().scale(
crect.width() / drect.width(),
crect.height() / drect.height()
)
eps = numpy.finfo(numpy.float64).eps

if abs(drect.width()) < eps:
sx = 1.0
else:
sx = crect.width() / drect.width()

if abs(drect.height()) < eps:
sy = 1.0
else:
sy = crect.height() / drect.height()

transform = QTransform().scale(sx, sy)

self._itemgroup.setPos(crect.topLeft())
self._itemgroup.setTransform(transform)
self._selection_items = None
Expand Down Expand Up @@ -817,7 +827,6 @@ def __init__(self):
self.top_n_spin = gui.spin(self.selection_box, self, "top_n", 1, 20,
callback=self._selection_method_changed)
grid.addWidget(self.top_n_spin, 2, 1)
self.selection_box.layout().addLayout(grid)

self.zoom_slider = gui.hSlider(
self.controlArea, self, "zoom_factor", box="Zoom",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Test methods with long descriptive names can omit docstrings
# pylint: disable=missing-docstring
import numpy
import Orange.misc
from Orange.distance import Euclidean
from Orange.widgets.tests.base import WidgetTest, WidgetOutputsTestMixin
from Orange.widgets.unsupervised.owhierarchicalclustering import \
Expand Down Expand Up @@ -50,3 +52,7 @@ def test_selection_box_output(self):
self.widget.selection_box.buttons[2].click()
self.assertIsNotNone(self.get_output("Selected Data"))
self.assertIsNone(self.get_output(ANNOTATED_DATA_SIGNAL_NAME))

def test_all_zero_inputs(self):
d = Orange.misc.DistMatrix(numpy.zeros((10, 10)))
self.widget.set_distances(d)