Conversation
corranwebster
left a comment
There was a problem hiding this comment.
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.
| # widget - depends on what wx is capable of. | ||
| self.status_bar.showMessage(" ".join(self.messages)) | ||
| self.status_bar.showMessage(" ".join(self.messages), | ||
| msecs=self.message_duration) |
There was a problem hiding this comment.
I think duration in seconds would be better. That is what pyface.timer uses.
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
|
This is ready for a second look. WX support added, implementation redone for Qt, unit test added. |
|
Test failure only happens with 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 |
|
Thanks for the suggestion @kitchoi . Didn't help with the test failure, but good suggestion anyway, so added. |
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.