From c91cde9dbf5cba760ff798f8acd32fc40754f8a6 Mon Sep 17 00:00:00 2001 From: Nils <> Date: Sun, 13 Dec 2020 22:26:27 +0100 Subject: [PATCH] Show track-editor entries in the correct order --- qtgui/trackEditor.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/qtgui/trackEditor.py b/qtgui/trackEditor.py index aa3102f..cce9c49 100644 --- a/qtgui/trackEditor.py +++ b/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):