-
Notifications
You must be signed in to change notification settings - Fork 55
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
Timed messages in StatusBar #522
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
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.
@@ -126,4 +129,5 @@ def _show_messages(self): | |||
# decide to put all but the first message into separate widgets. We | |||
# probably also need to extend the API to allow a "message" to be a | |||
# 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think duration in seconds would be better. That is what pyface.timer
uses.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
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.StatusBar
doesn'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.