Skip to content
Open
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
10 changes: 4 additions & 6 deletions Orange/widgets/data/utils/preprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)

from AnyQt.QtGui import (
QCursor, QIcon, QPainter, QPixmap, QStandardItemModel,
QIcon, QPainter, QPixmap, QStandardItemModel,
QDrag, QKeySequence
)

Expand Down Expand Up @@ -291,7 +291,7 @@ def dragMoveEvent(self, event):
if event.mimeData().hasFormat(self.MimeType) and \
self.model() is not None:
event.accept()
self._setDropIndicatorAt(event.pos())
self._setDropIndicatorAt(event.position())
return True
else:
return False
Expand Down Expand Up @@ -646,8 +646,7 @@ def setIcon(self, index, icon):
def dropEvent(self, event):
"""Reimplemented."""
layout = self.__flowlayout
index = self.__insertIndexAt(self.mapFromGlobal(QCursor.pos()))

index = self.__insertIndexAt(event.position())
if event.mimeData().hasFormat("application/x-internal-move") and \
event.source() is self:
# Complete the internal move
Expand Down Expand Up @@ -677,8 +676,7 @@ def dragEnterEvent(self, event):

def dragMoveEvent(self, event):
"""Reimplemented."""
pos = self.mapFromGlobal(QCursor.pos())
self.__setDropIndicatorAt(pos)
self.__setDropIndicatorAt(event.position())

def dragLeaveEvent(self, event):
"""Reimplemented."""
Expand Down
4 changes: 2 additions & 2 deletions Orange/widgets/evaluate/owrocanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ def _on_mouse_moved(self, pos):
curr_thresh = np.compress(mask, cache_thresh).tolist()
curr_clf = np.compress(mask, cache_clf).tolist()
else:
QToolTip.showText(QCursor.pos(), "")
QToolTip.showText(QCursor.pos(), "", self.plotview)
self._tooltip_cache = None

if curr_thresh:
Expand All @@ -721,7 +721,7 @@ def _on_mouse_moved(self, pos):
clf_names = self.classifier_names
msg = "Thresholds:\n" + "\n".join(["({:s}) {:.3f}".format(clf_names[i], thresh)
for i, thresh in zip(valid_clf, valid_thresh)])
QToolTip.showText(QCursor.pos(), msg)
QToolTip.showText(QCursor.pos(), msg, self.plotview)
self._tooltip_cache = (pt, valid_thresh, valid_clf, ave_mode)

def _on_target_changed(self):
Expand Down
8 changes: 4 additions & 4 deletions Orange/widgets/evaluate/tests/test_owrocanalysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,29 +234,29 @@ def test_tooltips(self):
pos = item.mapToScene(0, 0.1)
pos = view.mapFromScene(pos)
mouseMove(view.viewport(), pos)
(_, text), _ = show_text.call_args
(_, text, *_), _ = show_text.call_args
self.assertIn("(#1) 0.900", text)
self.assertNotIn("#2", text)

# test overlapping points
pos = item.mapToScene(0.0, 0.0)
pos = view.mapFromScene(pos)
mouseMove(view.viewport(), pos)
(_, text), _ = show_text.call_args
(_, text, *_), _ = show_text.call_args
self.assertIn("(#1) 1.000\n(#2) 1.000", text)

pos = item.mapToScene(0.1, 0.3)
pos = view.mapFromScene(pos)
mouseMove(view.viewport(), pos)
(_, text), _ = show_text.call_args
(_, text, *_), _ = show_text.call_args
self.assertIn("(#1) 0.600\n(#2) 0.590", text)
show_text.reset_mock()

# test that cache is invalidated when changing averaging mode
self.widget.roc_averaging = OWROCAnalysis.Threshold
self.widget._replot()
mouseMove(view.viewport(), pos)
(_, text), _ = show_text.call_args
(_, text, *_), _ = show_text.call_args
self.assertIn("(#1) 0.600\n(#2) 0.590", text)
show_text.reset_mock()

Expand Down
Loading