You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR exposes the ability to control the duration of a StatusBar message (qt only for now). I am creating this PR to start the discussion:
Would others agree that this is desirable?
How to handle Wx since its wx.StatusBar doesn't expose the same ability? What's pyface's policy for exposing toolkit specific capabilities? If that's not acceptable, a similar behavior could be implemented using a wx.Timer: https://stackoverflow.com/questions/23188042/wxpython-statusbar-temporary-text . That feels like a lot of complexity brought into pyface though.
The reason will be displayed to describe this comment to others. Learn more.
This generally looks fine as an addition. I would prefer to measure time in seconds and then convert to integer milliseconds at the toolkit level.
For the wx case, we have timers exposed in a toolkit-independent fashion in pyface.timer, so it should be fairly easy to add the capability to remove after a fixed amount of time with a toolkit-independent timer object.
❌ Patch coverage is 45.71429% with 19 lines in your changes missing coverage. Please review. ⚠️ Please upload report for BASE (main@c98d1d3). Learn more about missing BASE report.
Test failure only happens with pyqt, not pyqt5 and is triggered by the following exception in the listener:
Exception occurred in traits notification handler.
Please check the log file for details.
Exception occurred in traits notification handler for object: <pyface.ui.qt4.action.status_bar_manager.StatusBarManager object at 0x127802888>, trait: messages, old value: ['goodbye world'], new value: []
Traceback (most recent call last):
File "/Users/jrocher/.edm/envs/bootstrap3/lib/python3.6/site-packages/traits/trait_notifiers.py", line 381, in __call__
self.handler(*args)
File "/Users/jrocher/Projects/ETS_source/pyface/pyface/ui/qt4/action/status_bar_manager.py", line 100, in _messages_changed
self._show_messages()
File "/Users/jrocher/Projects/ETS_source/pyface/pyface/ui/qt4/action/status_bar_manager.py", line 142, in _show_messages
self.status_bar.showMessage(" ".join(self.messages))
RuntimeError: wrapped C/C++ object of type QStatusBar has been deleted
If the UI is closed before the timer gets to run its action, then when the timer's action is run, it would be accessing deleted objects. I think in the remove_status_bar method, we should stop and remove the timer if there is one. See if that resolves the error you saw?
Thanks for the suggestion @kitchoi . Didn't help with the test failure, but good suggestion anyway, so added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR exposes the ability to control the duration of a StatusBar message (qt only for now). I am creating this PR to start the discussion:
wx.StatusBardoesn't expose the same ability? What'spyface's policy for exposing toolkit specific capabilities? If that's not acceptable, a similar behavior could be implemented using awx.Timer: https://stackoverflow.com/questions/23188042/wxpython-statusbar-temporary-text . That feels like a lot of complexity brought into pyface though.