diff options
author | CoprDistGit <infra@openeuler.org> | 2023-06-20 06:39:38 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-06-20 06:39:38 +0000 |
commit | bc34b781244ea08ddf6de35e9a7e2596aa6b40a8 (patch) | |
tree | 97c16fcb94c299b92b0d073edaed99c0f2fbb559 | |
parent | 886e060b26953729d085f98ed6959fb284b8a279 (diff) |
automatic import of python-pygame-popupopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-pygame-popup.spec | 379 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 381 insertions, 0 deletions
@@ -0,0 +1 @@ +/pygame-popup-0.7.0.tar.gz diff --git a/python-pygame-popup.spec b/python-pygame-popup.spec new file mode 100644 index 0000000..2d7c94c --- /dev/null +++ b/python-pygame-popup.spec @@ -0,0 +1,379 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pygame-popup +Version: 0.7.0 +Release: 1 +Summary: A popup manager for pygame +License: GNU General Public License (GPL) +URL: https://github.com/Grimmys/pygame_popup_manager +Source0: https://mirrors.aliyun.com/pypi/web/packages/9e/6b/082a051624819247c67ade77b50da1c90a8cba88c8e38bede8435242c23e/pygame-popup-0.7.0.tar.gz +BuildArch: noarch + +Requires: python3-pygame + +%description +# Pygame Popup Manager + +[](https://www.python.org/) +[](https://pypi.org/project/pygame-popup/) +[](https://github.com/Grimmys/pygame_popup_manager/blob/main/LICENSE) +[](https://pypi.org/project/pygame-popup/) + +Docs are now available at: https://pygame-popup-manager.readthedocs.io/en/latest/ + +Pygame Popup Manager is a very small engine permitting to easily build all kind of popup in a pygame project. + +Here is an example of basic menus that could be created with this manager: + + +# Installation + +The easiest way to install this package is to do it with `pip`: + +`pip install pygame-popup` + +# Use + +First, don't forget to call `pygamepopup.init` function right after +calling `pygame.init` function. + +The whole system is working around the `MenuManager` class that is +the controller of all the popups in background and in foreground. + +An unique instance per scene/window has to be created and the pygame screen +on which the popups will appear should be provided, like this: + +```py +from pygamepopup.menu_manager import MenuManager + +menu_manager = MenuManager(screen) +``` + +The `display`, `motion` and `click` methods of this class should be called in the application main loop +in order to notify the manager of any pygame event. + +To open a new popup menu, you should first create it by instantiate the `InfoBox` class. +The components that should be in the menu should be provided. +Next, don't forget to call the `open_menu` method of the menu manager to notify it about the new menu. + +For example, the following code will open a popup with a "do-nothing" button and a close button (added by default by the `InfoBox`) + +```py +from pygamepopup.components import Button, InfoBox + +my_custom_menu = InfoBox( + "Title of the Menu", + [ + Button( + title="Hello World!", + callback=lambda: None + ) + ] +) + +menu_manager.open_menu(my_custom_menu) +``` +If you want more code illustrations, check the `examples/minimal_main_menu.py` module. + +# Customization + +The default graphics resources can be easily changed by your own by simply calling certain methods of the `configuration` module, wherever you want, as can be seen below. + +```py +import pygamepopup + +pygamepopup.configuration.set_button_background("sprites/inactive_button.png", + "sprites/active_button.png") +pygamepopup.configuration.set_dynamic_button_background("sprites/inactive_button.png", + "sprites/active_button.png") +pygamepopup.configuration.set_info_box_background("sprites/menu_box.png") +``` + +It is also possible to directly provide an asset to a specific component, if you want a button to be different from others for example. + +```py +Button( + title="Hello World!", + callback=lambda: None, + sprite=pygame.image.load("sprites/different_button.png"), + sprite_hover=pygame.image.load("sprites/different_button_hover.png") +) + ``` + +With this kind of configuration you can made an interface similar to this one: + + + +# Contact + +You can contact me directly by [e-mail](mailto:grimmys.programming@gmail.com?subject=[GitHub]%20Pygame%20Popup%20Manager) if you have any question regarding the package. +Also, I will be really happy to know you are using this package, so don't hesitate to share me the link to your project if you tried something! + +For suggestions or bugs, please create an issue in the GitHub repository: https://github.com/Grimmys/pygame_popup_manager/issues + +Thanks! + + + + +%package -n python3-pygame-popup +Summary: A popup manager for pygame +Provides: python-pygame-popup +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pygame-popup +# Pygame Popup Manager + +[](https://www.python.org/) +[](https://pypi.org/project/pygame-popup/) +[](https://github.com/Grimmys/pygame_popup_manager/blob/main/LICENSE) +[](https://pypi.org/project/pygame-popup/) + +Docs are now available at: https://pygame-popup-manager.readthedocs.io/en/latest/ + +Pygame Popup Manager is a very small engine permitting to easily build all kind of popup in a pygame project. + +Here is an example of basic menus that could be created with this manager: + + +# Installation + +The easiest way to install this package is to do it with `pip`: + +`pip install pygame-popup` + +# Use + +First, don't forget to call `pygamepopup.init` function right after +calling `pygame.init` function. + +The whole system is working around the `MenuManager` class that is +the controller of all the popups in background and in foreground. + +An unique instance per scene/window has to be created and the pygame screen +on which the popups will appear should be provided, like this: + +```py +from pygamepopup.menu_manager import MenuManager + +menu_manager = MenuManager(screen) +``` + +The `display`, `motion` and `click` methods of this class should be called in the application main loop +in order to notify the manager of any pygame event. + +To open a new popup menu, you should first create it by instantiate the `InfoBox` class. +The components that should be in the menu should be provided. +Next, don't forget to call the `open_menu` method of the menu manager to notify it about the new menu. + +For example, the following code will open a popup with a "do-nothing" button and a close button (added by default by the `InfoBox`) + +```py +from pygamepopup.components import Button, InfoBox + +my_custom_menu = InfoBox( + "Title of the Menu", + [ + Button( + title="Hello World!", + callback=lambda: None + ) + ] +) + +menu_manager.open_menu(my_custom_menu) +``` +If you want more code illustrations, check the `examples/minimal_main_menu.py` module. + +# Customization + +The default graphics resources can be easily changed by your own by simply calling certain methods of the `configuration` module, wherever you want, as can be seen below. + +```py +import pygamepopup + +pygamepopup.configuration.set_button_background("sprites/inactive_button.png", + "sprites/active_button.png") +pygamepopup.configuration.set_dynamic_button_background("sprites/inactive_button.png", + "sprites/active_button.png") +pygamepopup.configuration.set_info_box_background("sprites/menu_box.png") +``` + +It is also possible to directly provide an asset to a specific component, if you want a button to be different from others for example. + +```py +Button( + title="Hello World!", + callback=lambda: None, + sprite=pygame.image.load("sprites/different_button.png"), + sprite_hover=pygame.image.load("sprites/different_button_hover.png") +) + ``` + +With this kind of configuration you can made an interface similar to this one: + + + +# Contact + +You can contact me directly by [e-mail](mailto:grimmys.programming@gmail.com?subject=[GitHub]%20Pygame%20Popup%20Manager) if you have any question regarding the package. +Also, I will be really happy to know you are using this package, so don't hesitate to share me the link to your project if you tried something! + +For suggestions or bugs, please create an issue in the GitHub repository: https://github.com/Grimmys/pygame_popup_manager/issues + +Thanks! + + + + +%package help +Summary: Development documents and examples for pygame-popup +Provides: python3-pygame-popup-doc +%description help +# Pygame Popup Manager + +[](https://www.python.org/) +[](https://pypi.org/project/pygame-popup/) +[](https://github.com/Grimmys/pygame_popup_manager/blob/main/LICENSE) +[](https://pypi.org/project/pygame-popup/) + +Docs are now available at: https://pygame-popup-manager.readthedocs.io/en/latest/ + +Pygame Popup Manager is a very small engine permitting to easily build all kind of popup in a pygame project. + +Here is an example of basic menus that could be created with this manager: + + +# Installation + +The easiest way to install this package is to do it with `pip`: + +`pip install pygame-popup` + +# Use + +First, don't forget to call `pygamepopup.init` function right after +calling `pygame.init` function. + +The whole system is working around the `MenuManager` class that is +the controller of all the popups in background and in foreground. + +An unique instance per scene/window has to be created and the pygame screen +on which the popups will appear should be provided, like this: + +```py +from pygamepopup.menu_manager import MenuManager + +menu_manager = MenuManager(screen) +``` + +The `display`, `motion` and `click` methods of this class should be called in the application main loop +in order to notify the manager of any pygame event. + +To open a new popup menu, you should first create it by instantiate the `InfoBox` class. +The components that should be in the menu should be provided. +Next, don't forget to call the `open_menu` method of the menu manager to notify it about the new menu. + +For example, the following code will open a popup with a "do-nothing" button and a close button (added by default by the `InfoBox`) + +```py +from pygamepopup.components import Button, InfoBox + +my_custom_menu = InfoBox( + "Title of the Menu", + [ + Button( + title="Hello World!", + callback=lambda: None + ) + ] +) + +menu_manager.open_menu(my_custom_menu) +``` +If you want more code illustrations, check the `examples/minimal_main_menu.py` module. + +# Customization + +The default graphics resources can be easily changed by your own by simply calling certain methods of the `configuration` module, wherever you want, as can be seen below. + +```py +import pygamepopup + +pygamepopup.configuration.set_button_background("sprites/inactive_button.png", + "sprites/active_button.png") +pygamepopup.configuration.set_dynamic_button_background("sprites/inactive_button.png", + "sprites/active_button.png") +pygamepopup.configuration.set_info_box_background("sprites/menu_box.png") +``` + +It is also possible to directly provide an asset to a specific component, if you want a button to be different from others for example. + +```py +Button( + title="Hello World!", + callback=lambda: None, + sprite=pygame.image.load("sprites/different_button.png"), + sprite_hover=pygame.image.load("sprites/different_button_hover.png") +) + ``` + +With this kind of configuration you can made an interface similar to this one: + + + +# Contact + +You can contact me directly by [e-mail](mailto:grimmys.programming@gmail.com?subject=[GitHub]%20Pygame%20Popup%20Manager) if you have any question regarding the package. +Also, I will be really happy to know you are using this package, so don't hesitate to share me the link to your project if you tried something! + +For suggestions or bugs, please create an issue in the GitHub repository: https://github.com/Grimmys/pygame_popup_manager/issues + +Thanks! + + + + +%prep +%autosetup -n pygame-popup-0.7.0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pygame-popup -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.7.0-1 +- Package Spec generated @@ -0,0 +1 @@ +24f7a7d1b43cdbf0dc9cda91c8aed6b8 pygame-popup-0.7.0.tar.gz |