1
0
Fork 0
mirror of synced 2024-06-02 02:34:40 +12:00

Wrapper: Fix wrapper reordering not being saved.

The order was determined by the order of the container dictionary entries.
Re-order them before returning the list by their index in the container
widget.

Fixes #304
This commit is contained in:
loathingKernel 2023-08-13 16:35:22 +03:00
parent eb48a506d2
commit 21141e43ea
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD

View file

@ -30,6 +30,10 @@ extra_wrapper_regex = {
}
class Wrapper:
pass
class WrapperWidget(QFrame):
delete_wrapper = pyqtSignal(str)
@ -135,14 +139,9 @@ class WrapperSettings(QWidget, Ui_WrapperSettings):
return " ".join(self.get_wrapper_list())
def get_wrapper_list(self):
data: List[str] = []
for w in self.wrappers.values():
# Get the widget at each index in turn.
try:
data.append(w.text)
except AttributeError:
pass
return data
wrappers = list(self.wrappers.values())
wrappers.sort(key=lambda x: self.scroll_content.layout().indexOf(x))
return [w.text for w in wrappers]
def add_button_pressed(self):
header = self.tr("Add wrapper")