Skip to content

Commit

Permalink
table: qt_performance_table: add possibility to lock table items
Browse files Browse the repository at this point in the history
  • Loading branch information
oso committed Nov 11, 2013
1 parent f4f7a86 commit 31fe59d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions table.py
Expand Up @@ -303,11 +303,11 @@ def disable_criterion(self, criterion):
self.setColumnHidden(self.__get_criterion_col(criterion),
criterion.disabled)

def add_pt(self, alternatives, pt):
def add_pt(self, alternatives, pt, editable = True):
for alternative in alternatives:
self.add(alternative, pt[alternative.id])
self.add(alternative, pt[alternative.id], editable)

def add(self, alternative, alt_perfs):
def add(self, alternative, alt_perfs, editable = True):
row = self.rowCount()
self.insertRow(row)

Expand All @@ -325,6 +325,8 @@ def add(self, alternative, alt_perfs):
if performances.has_key(crit.id) and \
performances[crit.id] is not None:
item.setText(str(performances[crit.id]))
if editable is False:
item.setFlags(item.flags() & ~QtCore.Qt.ItemIsEditable)
self.setItem(row, col, item)
self.row_altp.append(alt_perfs)

Expand Down

0 comments on commit 31fe59d

Please sign in to comment.