Browse Source

Show track-editor entries in the correct order

master
Nils 4 years ago
parent
commit
c91cde9dbf
  1. 9
      qtgui/trackEditor.py

9
qtgui/trackEditor.py

@ -347,6 +347,7 @@ class TrackEditor(QtWidgets.QWidget):
A track widget persists until the track gets deleted. No re-creation on every change. """
leftOver = list(self.tracks.keys())
visibleTracks = []
trackWidgetsInOrder = []
nameLineEditsInOrder = []
upbeatSpinBoxsInOrder = []
for trackExportObject in listOfStaticTrackRepresentations:
@ -366,6 +367,7 @@ class TrackEditor(QtWidgets.QWidget):
self.tracks[trackExportObject["id"]].blockSignals(False)
nameLineEditsInOrder.append(self.tracks[trackExportObject["id"]].ui.nameLineEdit)
trackWidgetsInOrder.append(self.tracks[trackExportObject["id"]])
if trackExportObject["hiddenPosition"] is None:
visibleTracks.append(trackExportObject)
@ -375,6 +377,13 @@ class TrackEditor(QtWidgets.QWidget):
w.setParent(None)
w.close()
#Sort tracks as they are in the backend/score-view
for widget in trackWidgetsInOrder: #visibleTracks is sorted and does not have empty tracks.
self.layout.removeWidget(widget)
for widget in trackWidgetsInOrder:
#Re-Insert all, this time in order.
self.layout.insertWidget(-1, widget)
#Create tab order. Those work in pairs, linked list. a before b. And multiple of those pairs need to be in order itself.
if len(nameLineEditsInOrder) > 1:
for pair in pairwise(nameLineEditsInOrder):

Loading…
Cancel
Save