From cd99a85df2f34068516a4332299c6750d364d1d3 Mon Sep 17 00:00:00 2001 From: Kiooeht Date: Sat, 2 Apr 2011 01:45:55 -0700 Subject: [PATCH] Drag and drop ordering for quirks --- menus.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/menus.py b/menus.py index 551caa0..f8cef00 100644 --- a/menus.py +++ b/menus.py @@ -27,13 +27,15 @@ class PesterQuirkList(QtGui.QListWidget): QtGui.QListWidget.__init__(self, parent) self.resize(400, 200) # make sure we have access to mainwindow info like profiles - self.mainwindow = mainwindow + self.mainwindow = mainwindow self.setStyleSheet("background:black; color:white;") - for q in mainwindow.userprofile.quirks: + for q in mainwindow.userprofile.quirks: item = PesterQuirkItem(q, self) self.addItem(item) #self.sortItems() + self.setDragEnabled(True) + self.setDragDropMode(QtGui.QAbstractItemView.InternalMove) def currentQuirk(self): return self.item(self.currentRow()) @@ -257,16 +259,16 @@ class PesterChooseQuirks(QtGui.QDialog): def quirks(self): return [self.quirkList.item(i).quirk for i in range(0,self.quirkList.count())] - + # could probably do away with these and just connect to the relevant methods on the quirk list widget @QtCore.pyqtSlot() - def upShiftQuirk(self): + def upShiftQuirk(self): self.quirkList.upShiftQuirk() @QtCore.pyqtSlot() def downShiftQuirk(self): self.quirkList.downShiftQuirk() - #!!! + #!!! @QtCore.pyqtSlot() def editSelected(self): q = self.quirkList.currentQuirk()