Skip to content

Commit f18f6a6

Browse files
authored
Merge pull request #1421 from kernc/fixups
[FIX] OWTestLearners: Fix reporting results table
2 parents b77c021 + 2b8cad3 commit f18f6a6

File tree

6 files changed

+12
-12
lines changed

6 files changed

+12
-12
lines changed

Orange/canvas/report/report.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from collections import OrderedDict, Iterable
44
from itertools import chain
55
from PyQt4.QtCore import Qt, QAbstractItemModel, QByteArray, QBuffer, QIODevice, QLocale
6-
from PyQt4.QtGui import QGraphicsScene, QAbstractItemView, QColor
6+
from PyQt4.QtGui import QGraphicsScene, QTableView, QColor
77

88
from Orange.util import try_
99
from Orange.widgets.io import PngFormat
@@ -286,7 +286,7 @@ def report_list(data,
286286
) for rowi, row in enumerate(data))
287287

288288
self.report_name(name)
289-
if isinstance(table, QAbstractItemView):
289+
if isinstance(table, QTableView):
290290
body = report_abstract_model(table.model(), table)
291291
elif isinstance(table, QAbstractItemModel):
292292
body = report_abstract_model(table)

Orange/data/variable.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -852,6 +852,8 @@ class TimeVariable(ContinuousVariable):
852852

853853
(1, 0, '%Y-%m-%d'),
854854

855+
(1, 1, '%Y-%m-%d %H:%M:%S.%f'),
856+
(1, 1, '%Y-%m-%dT%H:%M:%S.%f'),
855857
(1, 1, '%Y-%m-%d %H:%M:%S.%f%z'),
856858
(1, 1, '%Y-%m-%dT%H:%M:%S.%f%z'),
857859

Orange/statistics/util.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ def bincount(X, max_val=None, weights=None, minlength=None):
2323
if weights is not None:
2424
weights = weights[nonnan]
2525
else:
26-
nans = 0 if X.ndim == 1 else np.zeros(X.shape[1])
26+
nans = 0. if X.ndim == 1 else np.zeros(X.shape[1], dtype=float)
2727
if minlength is None and max_val is not None:
2828
minlength = max_val + 1
2929
return (np.bincount(X.astype(np.int32, copy=False),
3030
weights=weights,
31-
minlength=minlength),
31+
minlength=minlength).astype(float),
3232
nans)
3333

3434

Orange/tests/test_variable.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,8 @@ class TestTimeVariable(VariableTest):
290290
# in str, UTC timestamp, out str (in UTC)
291291
('2015-10-12 14:13:11.01+0200', 1444651991.01, '2015-10-12 14:13:11.010000+0200'),
292292
('2015-10-12T14:13:11.81+0200', 1444651991.81, '2015-10-12 14:13:11.810000+0200'),
293+
('2015-10-12 14:13:11.81', 1444659191.81, '2015-10-12 14:13:11.810000'),
294+
('2015-10-12T14:13:11.81', 1444659191.81, '2015-10-12 14:13:11.810000'),
293295
('2015-10-12 14:13:11+0200', 1444651991, '2015-10-12 14:13:11+0200'),
294296
('2015-10-12T14:13:11+0200', 1444651991, '2015-10-12 14:13:11+0200'),
295297
('20151012T141311+0200', 1444651991, '2015-10-12 14:13:11+0200'),

Orange/widgets/classify/owclassificationtreegraph.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ def split_condition(self):
279279
:return: split condition to reach a particular node.
280280
"""
281281
if self.i > 0:
282-
attribute = self.domain.attributes[self.attribute()]
283282
parent_attr = self.domain.attributes[self.parent.attribute()]
284283
parent_attr_cv = parent_attr.compute_value
285284
is_left_child = self.tree.children_left[self.parent.i] == self.i
@@ -292,7 +291,7 @@ def split_condition(self):
292291
else:
293292
thresh = self.tree.threshold[self.parent.i]
294293
return "%s %s" % ([">", "≤"][is_left_child],
295-
attribute.str_val(thresh))
294+
parent_attr.str_val(thresh))
296295
else:
297296
return ""
298297

Orange/widgets/evaluate/owtestlearners.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
from PyQt4 import QtGui
1010
from PyQt4.QtGui import (
11-
QTreeView, QStandardItemModel, QStandardItem, QHeaderView,
11+
QStandardItemModel, QStandardItem, QHeaderView,
1212
QStyledItemDelegate
1313
)
1414
from PyQt4.QtCore import Qt, QSize
@@ -221,13 +221,10 @@ def __init__(self):
221221

222222
gui.rubber(self.controlArea)
223223

224-
self.view = QTreeView(
225-
rootIsDecorated=False,
226-
uniformRowHeights=True,
224+
self.view = gui.TableView(
227225
wordWrap=True,
228-
editTriggers=QTreeView.NoEditTriggers
229226
)
230-
header = self.view.header()
227+
header = self.view.horizontalHeader()
231228
header.setResizeMode(QHeaderView.ResizeToContents)
232229
header.setDefaultAlignment(Qt.AlignCenter)
233230
header.setStretchLastSection(False)

0 commit comments

Comments
 (0)