From ef07243677e03658fba1e30aa54321a4b19a8f2f Mon Sep 17 00:00:00 2001 From: loathingKernel <142770+loathingKernel@users.noreply.github.com> Date: Wed, 13 Sep 2023 21:20:02 +0300 Subject: [PATCH] IndicatorEdit: Set contents before connecting signals Previously a lot of things would start running concurrently at startup as we were setting up the UI. This removes a considerable amount of perceived delay. Note: there are better ways to make sure forms are populated when they are viewed, such as each widget's `showEvent()` --- rare/widgets/indicator_edit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rare/widgets/indicator_edit.py b/rare/widgets/indicator_edit.py index bcf18d52..e68414d1 100644 --- a/rare/widgets/indicator_edit.py +++ b/rare/widgets/indicator_edit.py @@ -165,6 +165,8 @@ class IndicatorLineEdit(QWidget): self.is_valid = False self.edit_func = edit_func self.save_func = save_func + if text: + self.line_edit.setText(text) self.line_edit.textChanged.connect(self.__edit) if self.edit_func is None: self.line_edit.textChanged.connect(self.__save) @@ -175,8 +177,8 @@ class IndicatorLineEdit(QWidget): # lk: however it is going to edit any "understood" bad input to good input # lk: and we might not want that (but the validity check reports on the edited string) # lk: it is also going to trigger this widget's textChanged signal but that gets lost - if text: - self.line_edit.setText(text) + # if text: + # self.line_edit.setText(text) def deleteLater(self) -> None: if self.__thread is not None: