Skip to content

Commit

Permalink
VizRank: fix iterate_states, other small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
janezd committed Jul 1, 2016
1 parent 20a860c commit d29cf14
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Orange/widgets/visualize/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from bisect import bisect_left
from operator import attrgetter

from PyQt4.QtCore import Qt, pyqtSignal as Signal, QSize
from PyQt4.QtGui import (
Expand Down Expand Up @@ -188,7 +189,7 @@ def run(self):
pos, self.row_for_state(score, state))
self.scores.insert(pos, score)
progress.advance()
self._select_first_if_none()
self._select_first_if_none()
self.button.setText("Finished")
self.button.setEnabled(False)

Expand All @@ -199,6 +200,7 @@ def toggle(self):
self.button.setText("Pause")
self.run()
else:
self._select_first_if_none()
self.button.setText("Continue")


Expand Down Expand Up @@ -250,11 +252,12 @@ def iterate_states(self, initial_state):
for i in range(si, len(self.attrs)):
for j in range(sj, i):
yield i, j
sj = 0

def row_for_state(self, score, state):
items = []
for x in state:
attr = self.attrs[x]
attrs = sorted((self.attrs[x] for x in state), key=attrgetter("name"))
for attr in attrs:
item = QStandardItem(attr.name)
item.setData(attr, self._AttrRole)
items.append(item)
Expand Down

0 comments on commit d29cf14

Please sign in to comment.