Bug fix: Turn on/off individual quirks on pressing OK

This commit is contained in:
Kiooeht 2011-05-19 01:44:15 -07:00
parent 641673fb6c
commit 5b3d6e2570
2 changed files with 3 additions and 8 deletions

View file

@ -39,8 +39,6 @@ class PesterQuirkList(QtGui.QListWidget):
self.setDragDropMode(QtGui.QAbstractItemView.InternalMove)
def addItem(self, item):
self.connect(self, QtCore.SIGNAL('itemChanged(QListWidgetItem *)'),
self, QtCore.SLOT('changeCheckState()'))
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled)
if item.quirk.on:
item.setCheckState(2)
@ -48,12 +46,6 @@ class PesterQuirkList(QtGui.QListWidget):
item.setCheckState(0)
QtGui.QListWidget.addItem(self, item)
@QtCore.pyqtSlot()
def changeCheckState(self):
item = self.currentItem()
if not item: return
item.quirk.quirk["on"] = item.quirk.on = (item.checkState() == QtCore.Qt.Checked)
def currentQuirk(self):
return self.item(self.currentRow())

View file

@ -2290,6 +2290,9 @@ class PesterWindow(MovingWindow):
self.quirkmenu.activateWindow()
@QtCore.pyqtSlot()
def updateQuirks(self):
for i in range(self.quirkmenu.quirkList.count()):
item = self.quirkmenu.quirkList.item(i)
item.quirk.quirk["on"] = item.quirk.on = (item.checkState() == QtCore.Qt.Checked)
quirks = pesterQuirks(self.quirkmenu.quirks())
self.userprofile.setQuirks(quirks)
self.quirkmenu = None