Skip to content
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

Show hide feature #136

Merged
merged 20 commits into from
Jun 10, 2020
Merged

Show hide feature #136

merged 20 commits into from
Jun 10, 2020

Conversation

ylenard
Copy link

@ylenard ylenard commented Jun 10, 2020

'show()' / 'hide()' methods and 'visible' argument of init() has been implemented for all UIElements and UIContainer.

I also implemented several tests and wrote some docstrings.

flayed1 added 20 commits June 2, 2020 11:48
…mplemented show()/hide() methods in UIContainer. Implemented a new class UILayeredUpdates inheriting from pygame.sprite. LayeredUpdates that omits UIElements with is_visible flag == False when drawing. Made UIManager use the new UILayeredUpdates class instead of pygame.sprite. LayeredUpdates. Changed method process_events() in UIManager to ignore UIElements with is_visible flag == False when checking MOUSEBUTTONDOWN events. Changed method update() to ignore UIElements with is_visible flag == False when checking hover events. Added tests for show / hide behaviour of UIElements and UIContainers.
…UIToolTip and various windows that show()/hide() is unsupported for now. Merged new changes from upstream/master.
…ill transition to normal state. Started filling in the comments and docstrings.
@codecov
Copy link

codecov bot commented Jun 10, 2020

Codecov Report

Merging #136 into master will decrease coverage by 0.83%.
The diff coverage is 87.17%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #136      +/-   ##
==========================================
- Coverage   95.12%   94.29%   -0.84%     
==========================================
  Files          56       56              
  Lines        7426     7570     +144     
==========================================
+ Hits         7064     7138      +74     
- Misses        362      432      +70     
Impacted Files Coverage Δ
pygame_gui/elements/ui_image.py 86.95% <ø> (ø)
pygame_gui/elements/ui_label.py 93.89% <ø> (ø)
pygame_gui/elements/ui_screen_space_health_bar.py 100.00% <ø> (ø)
pygame_gui/elements/ui_text_entry_line.py 96.46% <ø> (ø)
pygame_gui/elements/ui_world_space_health_bar.py 100.00% <ø> (ø)
pygame_gui/elements/ui_tool_tip.py 94.73% <33.33%> (-5.27%) ⬇️
pygame_gui/windows/ui_colour_picker_dialog.py 88.39% <33.33%> (-1.89%) ⬇️
pygame_gui/windows/ui_confirmation_dialog.py 88.57% <33.33%> (-11.43%) ⬇️
pygame_gui/windows/ui_file_dialog.py 81.22% <33.33%> (-1.39%) ⬇️
pygame_gui/windows/ui_message_window.py 88.23% <33.33%> (-11.77%) ⬇️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7c9288c...c144b01. Read the comment docs.

@MyreMylar
Copy link
Owner

Amazing!

Huge thanks for the giant contribution. I'll merge this into master and see about adding a button somewhere in the general UI example project that toggles show and hide on and off.

@MyreMylar MyreMylar merged commit f681636 into MyreMylar:master Jun 10, 2020
@MyreMylar MyreMylar linked an issue Jun 10, 2020 that may be closed by this pull request
@ylenard
Copy link
Author

ylenard commented Jun 10, 2020

You're welcome, I hope everything works correctly and that it will be useful.

I'd like to implement a couple more things:

  1. rendering tests for the various UIElements (whether hidden elements rendered == no element rendered and whether element.init() -> hide() -> show() == element.init())
  2. implement the feature for the various windows(color picker, etc.) as well

So expect another pull request shortly.

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.

hide() / show() functionality of GUI elements
2 participants