Drag and drop ordering for quirks
This commit is contained in:
parent
427eefb383
commit
cd99a85df2
1 changed files with 7 additions and 5 deletions
12
menus.py
12
menus.py
|
@ -27,13 +27,15 @@ class PesterQuirkList(QtGui.QListWidget):
|
||||||
QtGui.QListWidget.__init__(self, parent)
|
QtGui.QListWidget.__init__(self, parent)
|
||||||
self.resize(400, 200)
|
self.resize(400, 200)
|
||||||
# make sure we have access to mainwindow info like profiles
|
# make sure we have access to mainwindow info like profiles
|
||||||
self.mainwindow = mainwindow
|
self.mainwindow = mainwindow
|
||||||
self.setStyleSheet("background:black; color:white;")
|
self.setStyleSheet("background:black; color:white;")
|
||||||
|
|
||||||
for q in mainwindow.userprofile.quirks:
|
for q in mainwindow.userprofile.quirks:
|
||||||
item = PesterQuirkItem(q, self)
|
item = PesterQuirkItem(q, self)
|
||||||
self.addItem(item)
|
self.addItem(item)
|
||||||
#self.sortItems()
|
#self.sortItems()
|
||||||
|
self.setDragEnabled(True)
|
||||||
|
self.setDragDropMode(QtGui.QAbstractItemView.InternalMove)
|
||||||
|
|
||||||
def currentQuirk(self):
|
def currentQuirk(self):
|
||||||
return self.item(self.currentRow())
|
return self.item(self.currentRow())
|
||||||
|
@ -257,16 +259,16 @@ class PesterChooseQuirks(QtGui.QDialog):
|
||||||
def quirks(self):
|
def quirks(self):
|
||||||
return [self.quirkList.item(i).quirk for i in
|
return [self.quirkList.item(i).quirk for i in
|
||||||
range(0,self.quirkList.count())]
|
range(0,self.quirkList.count())]
|
||||||
|
|
||||||
# could probably do away with these and just connect to the relevant methods on the quirk list widget
|
# could probably do away with these and just connect to the relevant methods on the quirk list widget
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def upShiftQuirk(self):
|
def upShiftQuirk(self):
|
||||||
self.quirkList.upShiftQuirk()
|
self.quirkList.upShiftQuirk()
|
||||||
|
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def downShiftQuirk(self):
|
def downShiftQuirk(self):
|
||||||
self.quirkList.downShiftQuirk()
|
self.quirkList.downShiftQuirk()
|
||||||
#!!!
|
#!!!
|
||||||
@QtCore.pyqtSlot()
|
@QtCore.pyqtSlot()
|
||||||
def editSelected(self):
|
def editSelected(self):
|
||||||
q = self.quirkList.currentQuirk()
|
q = self.quirkList.currentQuirk()
|
||||||
|
|
Loading…
Reference in a new issue