pyface
pyface copied to clipboard
Timed messages in StatusBar
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.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.
Codecov Report
Merging #522 into master will increase coverage by
0.95%. The diff coverage is62.93%.
@@ Coverage Diff @@
## master #522 +/- ##
==========================================
+ Coverage 37.08% 38.04% +0.95%
==========================================
Files 470 470
Lines 26027 26184 +157
Branches 3961 3975 +14
==========================================
+ Hits 9652 9961 +309
+ Misses 15948 15788 -160
- Partials 427 435 +8
| Impacted Files | Coverage Δ | |
|---|---|---|
| pyface/__init__.py | 82.60% <ø> (ø) |
|
| pyface/ui/wx/action/status_bar_manager.py | 31.91% <31.25%> (+2.36%) |
:arrow_up: |
| pyface/ui/qt4/init.py | 62.50% <33.33%> (ø) |
|
| pyface/ui/qt4/workbench/split_tab_widget.py | 12.47% <50.00%> (ø) |
|
| pyface/qt/QtNetwork.py | 75.00% <60.00%> (ø) |
|
| pyface/qt/QtOpenGL.py | 75.00% <60.00%> (ø) |
|
| pyface/qt/QtSvg.py | 75.00% <60.00%> (ø) |
|
| pyface/qt/QtTest.py | 75.00% <60.00%> (ø) |
|
| pyface/qt/QtWebKit.py | 68.42% <60.00%> (ø) |
|
| pyface/qt/QtCore.py | 77.77% <62.50%> (ø) |
|
| ... and 36 more |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update c98d1d3...6f0dc56. Read the comment docs.
This is ready for a second look. WX support added, implementation redone for Qt, unit test added.
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
Can't make sense of it. Any suggestions?
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.