Skip to content

Option to execute repl commands in a non-GUI thread#3130

Merged
j9ac9k merged 9 commits intopyqtgraph:masterfrom
outofculture:repl-thread
Oct 13, 2024
Merged

Option to execute repl commands in a non-GUI thread#3130
j9ac9k merged 9 commits intopyqtgraph:masterfrom
outofculture:repl-thread

Conversation

@outofculture
Copy link
Copy Markdown
Contributor

This allows application designers to offer their users command execution in either the GUI thread (the current default) or a non-GUI thread. Users may want this if their command is expected to run a long time, does not interact directly with any GUI elements, and they don't want the entire application to freeze for the duration. GUI execution is still the default, and the checkbox to control this isn't even shown without being explicitly configured, so all existing applications will be unchanged. I regret that this wasn't built very testably, The example henceforth uses it, so it will at least get instatiated during a test run.

- init arg to enable checkbox
- checkbox to enable non-gui execution
- keep improved signal structure either way, just do not use the thread unless requested
@jack-mil
Copy link
Copy Markdown
Contributor

This seems like a nice addition, and will prevent friction that users encounter when typing the help() command into the console widget, and immediatly the GUI freezes up (I assume because help() is an interactive method that waits for user input).

I encounter this issue often when testing (the first thing I think of is to try help()). Was also mentioned way back in #404.

@j9ac9k j9ac9k merged commit fa24e23 into pyqtgraph:master Oct 13, 2024
j9ac9k added a commit to j9ac9k/pyqtgraph that referenced this pull request Mar 25, 2025
* first pass: implement threaded exec

* disable input until the command is done executing

* make non-gui behavior optional

- init arg to enable checkbox
- checkbox to enable non-gui execution
- keep improved signal structure either way, just do not use the thread unless requested

* add tooltip

* import cleanup

* unfreeze input after handling an exception

* set focus, too

* handle more exceptions; do the multiline thing

---------

Co-authored-by: Ogi Moore <ognyan.moore@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants