Skip to content

Commit

Permalink
Merge pull request #4214 from ales-erjavec/fixes/owhierclust-annotati…
Browse files Browse the repository at this point in the history
…on-bind

[FIX] Hierarchical Clustering: Fix Annotations selection
  • Loading branch information
lanzagar authored Nov 22, 2019
2 parents 23750ad + 25f5c39 commit 747beb7
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions Orange/widgets/unsupervised/owhierarchicalclustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -894,16 +894,23 @@ def __init__(self):
model[:] = self.basic_annotations

box = gui.widgetBox(self.controlArea, "Annotations")
self.label_cb = combobox.ComboBoxSearch(
self.label_cb = cb = combobox.ComboBoxSearch(
minimumContentsLength=14,
sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLengthWithIcon
)
cb.setModel(model)
cb.setCurrentIndex(cb.findData(self.annotation, Qt.EditRole))

def on_annotation_activated():
self.annotation = cb.currentData(Qt.EditRole)
self._update_labels()
cb.activated.connect(on_annotation_activated)

def on_annotation_changed(value):
cb.setCurrentIndex(cb.findData(value, Qt.EditRole))
self.connect_control("annotation", on_annotation_changed)

box.layout().addWidget(self.label_cb)
self.label_cb.activated[int].connect(
lambda idx: setattr(self, "annotation", model[idx])
)
self.label_cb.activated.connect(self._update_labels)
self.label_cb.setModel(model)

box = gui.radioButtons(
self.controlArea, self, "pruning", box="Pruning",
Expand Down Expand Up @@ -1101,7 +1108,6 @@ def _set_items(self, items, axis=1):
else:
self.annotation = "Enumeration"
self.openContext(items.domain)
self.label_cb.setCurrentIndex(model.indexOf(self.annotation))
else:
name_option = bool(
items is not None and (
Expand Down

0 comments on commit 747beb7

Please sign in to comment.