diff options
Diffstat (limited to 'python-cursedspace.spec')
-rw-r--r-- | python-cursedspace.spec | 270 |
1 files changed, 270 insertions, 0 deletions
diff --git a/python-cursedspace.spec b/python-cursedspace.spec new file mode 100644 index 0000000..bae8eec --- /dev/null +++ b/python-cursedspace.spec @@ -0,0 +1,270 @@ +%global _empty_manifest_terminate_build 0 +Name: python-cursedspace +Version: 1.5.2 +Release: 1 +Summary: Library for TUI programs on basis of curses +License: MIT License +URL: https://vonshednob.cc/cursedspace +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/cd/3b/72657c9e867dd5034814dcea21b1128a70a1b8427e48c7de8b3b9ea3dd93/cursedspace-1.5.2.tar.gz +BuildArch: noarch + + +%description +# cursedspace + +A python library/framework for TUI application on the basis of the curses +package. + + +## Example use + +Here’s a very simple example of how to use the cursedspace package: + + #!/usr/bin/env python3 + + import curses + from cursedspace import Application, Key, Panel, colors + + + class DemoApplication(Application): + def __init__(self): + super().__init__() + self.panel = None + + def main(self): + self.panel = Panel(self) + self.resize() + + self.screen.addstr(0, 0, "Just some color example", colors.attr(colors.RED)) + + while True: + curses.doupdate() + + key = self.read_key() + + if key == Key.RESIZE: + self.resize() + elif key in [Key.ESCAPE, "q", "^C"]: + break + + def resize(self): + height, width = self.size() + self.panel.resize(height, width) + self.panel.paint() + + + # run the application + DemoApplication().run() + +For more examples see the `examples` folder. + +## Components + + * `Application` is the main application class and provides boilerplate + initialisations + * `Panel` is a basic panel with support for borders and key handling in the + context of an `Application` + * `InputLine` is a panel with very basic editing support. + * `Key` provides a convenient wrapper around curses’ key system. It can be + used standalone even when you don’t want to use `Application` or `Panel`. + * `ShellContext` is a convenient wrapper to execute external processes (e.g. + through subprocess) and returning to the curses context afterwards again. + * `colors` is a generic way to define colors in pairs (foreground and + background) and have them automatically registerd for use in curses. You + only have to call `colors.attr(ColorPair(...))` to use a new color + combination (limited by the terminal, of course). + + + + + +%package -n python3-cursedspace +Summary: Library for TUI programs on basis of curses +Provides: python-cursedspace +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-cursedspace +# cursedspace + +A python library/framework for TUI application on the basis of the curses +package. + + +## Example use + +Here’s a very simple example of how to use the cursedspace package: + + #!/usr/bin/env python3 + + import curses + from cursedspace import Application, Key, Panel, colors + + + class DemoApplication(Application): + def __init__(self): + super().__init__() + self.panel = None + + def main(self): + self.panel = Panel(self) + self.resize() + + self.screen.addstr(0, 0, "Just some color example", colors.attr(colors.RED)) + + while True: + curses.doupdate() + + key = self.read_key() + + if key == Key.RESIZE: + self.resize() + elif key in [Key.ESCAPE, "q", "^C"]: + break + + def resize(self): + height, width = self.size() + self.panel.resize(height, width) + self.panel.paint() + + + # run the application + DemoApplication().run() + +For more examples see the `examples` folder. + +## Components + + * `Application` is the main application class and provides boilerplate + initialisations + * `Panel` is a basic panel with support for borders and key handling in the + context of an `Application` + * `InputLine` is a panel with very basic editing support. + * `Key` provides a convenient wrapper around curses’ key system. It can be + used standalone even when you don’t want to use `Application` or `Panel`. + * `ShellContext` is a convenient wrapper to execute external processes (e.g. + through subprocess) and returning to the curses context afterwards again. + * `colors` is a generic way to define colors in pairs (foreground and + background) and have them automatically registerd for use in curses. You + only have to call `colors.attr(ColorPair(...))` to use a new color + combination (limited by the terminal, of course). + + + + + +%package help +Summary: Development documents and examples for cursedspace +Provides: python3-cursedspace-doc +%description help +# cursedspace + +A python library/framework for TUI application on the basis of the curses +package. + + +## Example use + +Here’s a very simple example of how to use the cursedspace package: + + #!/usr/bin/env python3 + + import curses + from cursedspace import Application, Key, Panel, colors + + + class DemoApplication(Application): + def __init__(self): + super().__init__() + self.panel = None + + def main(self): + self.panel = Panel(self) + self.resize() + + self.screen.addstr(0, 0, "Just some color example", colors.attr(colors.RED)) + + while True: + curses.doupdate() + + key = self.read_key() + + if key == Key.RESIZE: + self.resize() + elif key in [Key.ESCAPE, "q", "^C"]: + break + + def resize(self): + height, width = self.size() + self.panel.resize(height, width) + self.panel.paint() + + + # run the application + DemoApplication().run() + +For more examples see the `examples` folder. + +## Components + + * `Application` is the main application class and provides boilerplate + initialisations + * `Panel` is a basic panel with support for borders and key handling in the + context of an `Application` + * `InputLine` is a panel with very basic editing support. + * `Key` provides a convenient wrapper around curses’ key system. It can be + used standalone even when you don’t want to use `Application` or `Panel`. + * `ShellContext` is a convenient wrapper to execute external processes (e.g. + through subprocess) and returning to the curses context afterwards again. + * `colors` is a generic way to define colors in pairs (foreground and + background) and have them automatically registerd for use in curses. You + only have to call `colors.attr(ColorPair(...))` to use a new color + combination (limited by the terminal, of course). + + + + + +%prep +%autosetup -n cursedspace-1.5.2 + +%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-cursedspace -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 1.5.2-1 +- Package Spec generated |