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
28 changes: 19 additions & 9 deletions Orange/widgets/unsupervised/owhierarchicalclustering.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@
from AnyQt.QtWidgets import (
QGraphicsWidget, QGraphicsObject, QGraphicsLinearLayout, QGraphicsPathItem,
QGraphicsScene, QGraphicsView, QGridLayout, QFormLayout, QSizePolicy,
QGraphicsSimpleTextItem,
QGraphicsLayoutItem, QAction,
QGraphicsSimpleTextItem, QGraphicsLayoutItem, QAction, QComboBox
)
from AnyQt.QtGui import (
QTransform, QPainterPath, QPainterPathStroker, QColor, QBrush, QPen,
Expand All @@ -32,7 +31,7 @@
leaves, prune, top_clusters

from Orange.widgets import widget, gui, settings
from Orange.widgets.utils import colorpalette, itemmodels
from Orange.widgets.utils import colorpalette, itemmodels, combobox
from Orange.widgets.utils.annotated_data import (create_annotated_table,
ANNOTATED_DATA_SIGNAL_NAME)
from Orange.widgets.widget import Input, Output, Msg
Expand Down Expand Up @@ -825,9 +824,18 @@ def __init__(self):

model = itemmodels.VariableListModel()
model[:] = self.basic_annotations
self.label_cb = gui.comboBox(
self.controlArea, self, "annotation", box="Annotation",
model=model, callback=self._update_labels, contentsLength=12)

box = gui.widgetBox(self.controlArea, "Annotations")
self.label_cb = combobox.ComboBoxSearch(
minimumContentsLength=14,
sizeAdjustPolicy=QComboBox.AdjustToMinimumContentsLengthWithIcon
)
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 @@ -1052,6 +1060,7 @@ 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 Expand Up @@ -1711,7 +1720,7 @@ def clusters_at_height(root, height):
return cluster_list


def main(argv=None):
def main(argv=None): # pragma: no cover
from AnyQt.QtWidgets import QApplication
import sip
import Orange.distance as distance
Expand All @@ -1737,12 +1746,13 @@ def main(argv=None):
rval = app.exec_()
w.set_distances(None)
w.handleNewSignals()

w.saveSettings()
w.onDeleteWidget()
sip.delete(w)
del w
app.processEvents()
return rval

if __name__ == "__main__":

if __name__ == "__main__": # pragma: no cover
sys.exit(main())
Loading