1
0
Fork 0
mirror of synced 2024-06-26 18:20:50 +12:00

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()`
This commit is contained in:
loathingKernel 2023-09-13 21:20:02 +03:00
parent 3b0c25e241
commit ef07243677
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD

View file

@ -165,6 +165,8 @@ class IndicatorLineEdit(QWidget):
self.is_valid = False self.is_valid = False
self.edit_func = edit_func self.edit_func = edit_func
self.save_func = save_func self.save_func = save_func
if text:
self.line_edit.setText(text)
self.line_edit.textChanged.connect(self.__edit) self.line_edit.textChanged.connect(self.__edit)
if self.edit_func is None: if self.edit_func is None:
self.line_edit.textChanged.connect(self.__save) 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: 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: 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 # lk: it is also going to trigger this widget's textChanged signal but that gets lost
if text: # if text:
self.line_edit.setText(text) # self.line_edit.setText(text)
def deleteLater(self) -> None: def deleteLater(self) -> None:
if self.__thread is not None: if self.__thread is not None: