Skip to content

Commit d29cf14

Browse files
committed
VizRank: fix iterate_states, other small fixes
1 parent 20a860c commit d29cf14

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Orange/widgets/visualize/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from bisect import bisect_left
2+
from operator import attrgetter
23

34
from PyQt4.QtCore import Qt, pyqtSignal as Signal, QSize
45
from PyQt4.QtGui import (
@@ -188,7 +189,7 @@ def run(self):
188189
pos, self.row_for_state(score, state))
189190
self.scores.insert(pos, score)
190191
progress.advance()
191-
self._select_first_if_none()
192+
self._select_first_if_none()
192193
self.button.setText("Finished")
193194
self.button.setEnabled(False)
194195

@@ -199,6 +200,7 @@ def toggle(self):
199200
self.button.setText("Pause")
200201
self.run()
201202
else:
203+
self._select_first_if_none()
202204
self.button.setText("Continue")
203205

204206

@@ -250,11 +252,12 @@ def iterate_states(self, initial_state):
250252
for i in range(si, len(self.attrs)):
251253
for j in range(sj, i):
252254
yield i, j
255+
sj = 0
253256

254257
def row_for_state(self, score, state):
255258
items = []
256-
for x in state:
257-
attr = self.attrs[x]
259+
attrs = sorted((self.attrs[x] for x in state), key=attrgetter("name"))
260+
for attr in attrs:
258261
item = QStandardItem(attr.name)
259262
item.setData(attr, self._AttrRole)
260263
items.append(item)

0 commit comments

Comments
 (0)