Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Replace listViews with searchable listViews #4924

Merged
merged 2 commits into from
Sep 18, 2020
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
3 changes: 2 additions & 1 deletion Orange/widgets/data/owdiscretize.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
)
from AnyQt.QtGui import QValidator, QPalette
from AnyQt.QtCore import Qt, QTimer, QPoint
from orangewidget.utils.listview import ListViewSearch

import Orange.data
import Orange.preprocess.discretize as disc
Expand Down Expand Up @@ -406,7 +407,7 @@ def set_manual_default_cuts():
)

# List view with all attributes
self.varview = QListView(
self.varview = ListViewSearch(
selectionMode=QListView.ExtendedSelection,
uniformItemSizes=True,
)
Expand Down
4 changes: 2 additions & 2 deletions Orange/widgets/data/owimpute.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
)
from AnyQt.QtCore import Qt, QThread, QModelIndex
from AnyQt.QtCore import pyqtSlot as Slot
from orangewidget.utils.listview import ListViewSearch

import Orange.data
from Orange.preprocess import impute
Expand All @@ -28,7 +29,6 @@
from Orange.widgets.widget import OWWidget, Msg, Input, Output
from Orange.classification import SimpleTreeLearner


DisplayMethodRole = Qt.UserRole
StateRole = DisplayMethodRole + 0xf4

Expand Down Expand Up @@ -195,7 +195,7 @@ def __init__(self):
horizontal_layout = QHBoxLayout(box)
main_layout.addWidget(box)

self.varview = QListView(
self.varview = ListViewSearch(
selectionMode=QListView.ExtendedSelection,
uniformItemSizes=True
)
Expand Down
3 changes: 2 additions & 1 deletion Orange/widgets/unsupervised/owcorrespondence.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from AnyQt.QtWidgets import QListView, QApplication
from AnyQt.QtGui import QBrush, QColor, QPainter
from AnyQt.QtCore import QEvent
from orangewidget.utils.listview import ListViewSearch

import pyqtgraph as pg
from Orange.data import Table, Domain, ContinuousVariable, StringVariable
Expand Down Expand Up @@ -62,7 +63,7 @@ def __init__(self):

box = gui.vBox(self.controlArea, "Variables")
self.varlist = itemmodels.VariableListModel()
self.varview = view = QListView(
self.varview = view = ListViewSearch(
selectionMode=QListView.MultiSelection,
uniformItemSizes=True
)
Expand Down
9 changes: 5 additions & 4 deletions Orange/widgets/visualize/owboxplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
from AnyQt.QtWidgets import (
QGraphicsView, QGraphicsScene, QGraphicsItem, QGraphicsSimpleTextItem,
QGraphicsTextItem, QGraphicsItemGroup, QGraphicsLineItem,
QGraphicsPathItem, QGraphicsRectItem, QSizePolicy,
QListView)
QGraphicsPathItem, QGraphicsRectItem, QSizePolicy
)
from AnyQt.QtGui import QPen, QColor, QBrush, QPainterPath, QPainter, QFont
from AnyQt.QtCore import Qt, QEvent, QRectF, QSize, QSortFilterProxyModel
from orangewidget.utils.listview import ListViewSearch

import scipy.special
from scipy.stats import f_oneway, chi2_contingency
Expand Down Expand Up @@ -201,7 +202,7 @@ def __init__(self):
sorted_model.setSourceModel(self.attrs)
sorted_model.sort(0)
box = gui.vBox(self.controlArea, "Variable")
view = self.attr_list = QListView()
view = self.attr_list = ListViewSearch()
view.setModel(sorted_model)
view.setSelectionMode(view.SingleSelection)
view.selectionModel().selectionChanged.connect(self.attr_changed)
Expand All @@ -223,7 +224,7 @@ def __init__(self):
sorted_model.sort(0)

box = gui.vBox(self.controlArea, "Subgroups")
view = self.group_list = QListView()
view = self.group_list = ListViewSearch()
view.setModel(sorted_model)
view.selectionModel().selectionChanged.connect(self.grouping_changed)
view.setMinimumSize(QSize(30, 30))
Expand Down
5 changes: 4 additions & 1 deletion Orange/widgets/visualize/owdistributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from AnyQt.QtWidgets import QGraphicsRectItem
from AnyQt.QtGui import QColor, QPen, QBrush, QPainter, QPalette, QPolygonF
from AnyQt.QtCore import Qt, QRectF, QPointF, pyqtSignal as Signal
from orangewidget.utils.listview import ListViewSearch
import pyqtgraph as pg

from Orange.data import Table, DiscreteVariable, ContinuousVariable, Domain
Expand Down Expand Up @@ -319,7 +320,9 @@ def __init__(self):
self.controlArea, self, "var", box="Variable",
model=DomainModel(valid_types=DomainModel.PRIMITIVE,
separators=False),
callback=self._on_var_changed)
callback=self._on_var_changed,
viewType=ListViewSearch
)
gui.checkBox(
varview.box, self, "sort_by_freq", "Sort categories by frequency",
callback=self._on_sort_by_freq, stateWhenDisabled=False)
Expand Down
8 changes: 5 additions & 3 deletions Orange/widgets/visualize/owlineplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

from AnyQt.QtCore import Qt, QSize, QLineF, pyqtSignal as Signal
from AnyQt.QtGui import QPainter, QPen, QColor
from AnyQt.QtWidgets import QApplication, QGraphicsLineItem
from AnyQt.QtWidgets import QApplication, QGraphicsLineItem, QSizePolicy

import pyqtgraph as pg
from pyqtgraph.functions import mkPen
from pyqtgraph.graphicsItems.ViewBox import ViewBox

from orangewidget.utils.listview import ListViewSearch
from orangewidget.utils.visual_settings_dlg import VisualSettingsDialog

from Orange.data import Table, DiscreteVariable
Expand Down Expand Up @@ -676,13 +677,14 @@ def _add_controls(self):
self.group_view = gui.listView(
self.controlArea, self, "group_var", box="Group by",
model=self.group_vars, callback=self.__group_var_changed,
sizeHint=QSize(30, 100))
sizeHint=QSize(30, 100), viewType=ListViewSearch,
sizePolicy=(QSizePolicy.Minimum, QSizePolicy.Expanding)
)
self.group_view.setEnabled(False)

plot_gui = OWPlotGUI(self)
plot_gui.box_zoom_select(self.controlArea)

gui.rubber(self.controlArea)
gui.auto_send(self.controlArea, self, "auto_commit")

self.info.set_input_summary(self.info.NoInput)
Expand Down