def trackDelete(self): tt = self.tableimport rows = tt.model().getSelection(tt.selectedIndexes()) rowsranges = utils.re_rangebyone(sorted(rows), count=True) # delete tracks from bottom to keep the right indices for s, e in reversed(rowsranges): tt.model().removeRows(s,e) self.statusUpdate()
def trackDelete(self): tt = self.trackstable dbmodel = tt.model().dbmodel rows = tt.model().getSelection(tt.selectedIndexes()) rowsranges = utils.re_rangebyone(sorted(rows), count=True) if tt.model().dbmodel.gtmode: result = QtGui.QMessageBox.question(self, "Delete grouptracks", \ "Delete just the selected group tracks (yes) or also the tracks (all)?", \ buttons=QtGui.QMessageBox.Yes | QtGui.QMessageBox.No | QtGui.QMessageBox.YesAll , \ defaultButton=QtGui.QMessageBox.No) else: result = QtGui.QMessageBox.question(self, "Delete tracks", \ "PERMAMENTLY delete the selected tracks?", \ buttons=QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, \ defaultButton=QtGui.QMessageBox.No) if result != QtGui.QMessageBox.Yes and result != QtGui.QMessageBox.YesAll: return # delete tracks from bottom to keep the right indices for s, e in reversed(rowsranges): tt.model().removeRows(s,e, trackstoo=(result == QtGui.QMessageBox.YesAll))