Skip to content

feat: show loading spinner on Click Here buttons while app is running#117

Open
Phqen1x wants to merge 2 commits into
mainfrom
inhibit-spam-click
Open

feat: show loading spinner on Click Here buttons while app is running#117
Phqen1x wants to merge 2 commits into
mainfrom
inhibit-spam-click

Conversation

@Phqen1x

@Phqen1x Phqen1x commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

This pull request refactors how external applications are launched from the UI in src/manualtest.py. The main improvement is the introduction of a new method to launch apps with a loading spinner and proper button state management, which enhances user feedback and code maintainability. Several button click handlers are updated to use this new approach.

Refactoring and UI Improvements:

  • Introduced a new _launch_app_with_spinner method that launches external applications in a background thread, displays a Gtk.Spinner on the button, and disables the button until the process completes. This provides clear feedback to the user and prevents duplicate clicks.
  • Updated the on_screentest_clicked, on_webcam_clicked, and on_browser_clicked methods to use _launch_app_with_spinner instead of directly launching apps, ensuring consistent UI behavior across these actions. [1] [2] [3]

Code Cleanup:

  • Removed redundant imports of subprocess and threading from within functions, consolidating them at the top of the file. [1] [2]
  • Improved button state restoration by resetting the label and enabling the button after the launched application exits.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors “Click Here” button handlers in src/manualtest.py to launch external applications asynchronously while providing UI feedback (spinner + disabled button) to prevent duplicate clicks.

Changes:

  • Added _launch_app_with_spinner() helper to run external commands in a background thread and manage button state.
  • Updated ScreenTest, WebCam, and Browser click handlers to use the new helper.
  • Consolidated subprocess/threading imports at the top of the module.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/manualtest.py
Comment on lines +429 to +431
proc = subprocess.Popen(
command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
Comment thread src/manualtest.py Outdated
Comment on lines +433 to +434
except Exception:
pass
Comment thread src/manualtest.py
Comment on lines +437 to +440
def _restore():
button.set_label("Click Here")
button.set_sensitive(True)
return False
Comment thread src/manualtest.py
Comment on lines 493 to 495
if click_button is not None:
click_button.set_label("Click Here")
click_button.set_sensitive(True)
- Use communicate() instead of wait() to drain stdout/stderr pipes and
  prevent potential deadlock when launched apps produce output
- Log exceptions instead of silently swallowing them
- Stop spinner before restoring button label in both _restore and
  _on_touchscreen_test_complete to avoid leaving spinner running

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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.

2 participants