Skip to content

ENH: indicate when a PyDMShellCommand's cmd is currently running by changing the button's appearance and disabling the button. #1249

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nstelter-slac
Copy link
Collaborator

@nstelter-slac nstelter-slac commented May 2, 2025

this adds the following:

  • if allowMultipleExecutions is enabled, nothing different should happen.
  • but if not, then while cmd is running:
    • update button text to signify running, disable button, and switch to 'hour-glass' icon.
    • if multiple-cmd button, update top-button text (but keep enabled so can still use drop-down menu),
      disable all submenu items, and update icon and text of current running submenu item.
    • return button to previous state when cmd done running.
  • add long-running cmd as button and multiple-cmd drop-down so can try out new behavior.

also make warning icon red color so more noticeable.

@nstelter-slac nstelter-slac marked this pull request as draft May 3, 2025 09:45
@nstelter-slac nstelter-slac force-pushed the shell_cmd_update branch 3 times, most recently from 9ebb8d5 to 6548ed1 Compare May 5, 2025 08:33
@nstelter-slac nstelter-slac changed the title WIP: make it clear when PyDMShellCommand cmd is running by changing the button's appearance. ENH: indicate when a PyDMShellCommand's cmd is currently running by changing the button's appearance and disabling the button. May 5, 2025
@nstelter-slac nstelter-slac force-pushed the shell_cmd_update branch 3 times, most recently from 2c28f19 to 2af0e43 Compare May 5, 2025 08:40
@nstelter-slac nstelter-slac marked this pull request as ready for review May 5, 2025 20:34
@nstelter-slac
Copy link
Collaborator Author

can demo this by runningexamples/shell_command/shell_command.ui
and trying the button "Run Long-running Command" and the drop-down option of the same name under the "Multiple Shell Command Menu"

@nstelter-slac
Copy link
Collaborator Author

nstelter-slac commented May 5, 2025

one side-effect of this change is that now all shellcmd-buttons with even fast running cmds will flash the "(Running...)" text and other indicators for a brief moment.

maybe the button should only indicate its running after a few seconds have passed?

@nstelter-slac nstelter-slac requested review from YektaY, jbellister-slac and craftablescience and removed request for YektaY May 5, 2025 20:40
@nstelter-slac
Copy link
Collaborator Author

also seems the tests are failing b/c pyqt is cleaning up underlying C++ objects to soon??

Traceback (most recent call last):
  File "/home/runner/work/pydm/pydm/pydm/widgets/shell_command.py", line 807, in <lambda>
    lambda: self._check_process_done(action, original_button_text, original_action_text)
  File "/home/runner/work/pydm/pydm/pydm/widgets/shell_command.py", line 852, in _check_process_done
    self.set_object_font_italic(self, False)
  File "/home/runner/work/pydm/pydm/pydm/widgets/shell_command.py", line 877, in set_object_font_italic
    font = object.font()
RuntimeError: wrapped C/C++ object of type PyDMShellCommand has been deleted

not sure how to prevent this yet, looking into it

…hanging the

button's appearance and disabling the button.

this adds the following:
- if allowMultipleExecutions is enabled, nothing different should happen.
- but if not, then while cmd is running:
    - update button text to signify running, disable button, and switch to 'hour-glass' icon.
    - if multiple-cmd button, update top-button text (but keep enabled so can still use drop-down menu),
      disable all submenu items, and update icon and text of current running submenu item.
    - return button to previous state when cmd done running.
- add long-running cmd as button and multiple-cmd drop-down so can try out new behavior.

also make warning icon red color so more noticeable.
object deletion.

error is: 'RuntimeError: wrapped C/C++ object of type PyDMShellCommand
has been deleted', only when running tests all together.

caused by the 2nd 'wait_until' and nothing seems prevent it. (pytest-qt
issue maybe?)
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.

Feedback for PyDMShellCommand allowMultipleExecutions option
1 participant