summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--python-curses-utils.spec312
-rw-r--r--sources1
3 files changed, 314 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..4a4f603 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/curses_utils-0.0.13.tar.gz
diff --git a/python-curses-utils.spec b/python-curses-utils.spec
new file mode 100644
index 0000000..a88f444
--- /dev/null
+++ b/python-curses-utils.spec
@@ -0,0 +1,312 @@
+%global _empty_manifest_terminate_build 0
+Name: python-curses-utils
+Version: 0.0.13
+Release: 1
+Summary: Simple curses utilities
+License: Freely Distributable
+URL: https://github.com/KinuTheDragon/CursesUtils
+Source0: https://mirrors.aliyun.com/pypi/web/packages/5a/0f/a9129e55a5b32c4b5765d051f3ec6218750cb4488f152025d23851c5dd92/curses_utils-0.0.13.tar.gz
+BuildArch: noarch
+
+
+%description
+# CursesUtils
+## Functions
+`menu.menu(stdscr, title, options)`
+
+Pulls up a select menu.
+
+* `stdscr`: The screen to write to.
+* `title`: The title of the menu.
+* `options`: A collection of strings to choose from.
+
+Returns the index of the selected item, or None if the user chooses to quit.
+
+`number_select.number_select(stdscr, title, num_range, start = None)`
+
+Pulls up a number selection menu.
+
+* `stdscr`: The screen to write to.
+* `title`: The title of the selection.
+* `num_range`: A range object for valid numbers.
+* `start`: The starting selected number. Defaults to `num_range`'s min value.
+
+Returns the number selected, or None if the user chooses to quit.
+
+`keys.set_key_codes(key_name, key_codes)`
+
+Sets a key's function by name.
+
+* `key_name`: The key name to set.
+* `key_codes`: A collection of key codes (as returned by `stdscr.getkey()`) to use.
+
+Make sure to set keys before using them!
+Internally, CursesUtils uses the following keys:
+* `menu_up` (for navigating UP through menus)
+* `menu_down` (for navigating DOWN through menus)
+* `menu_confirm` (for CONFIRMING on menus)
+* `menu_cancel` (for QUITTING on menus)
+
+`keys.get_key_codes(key_name)`
+
+Gets a key's codes by name.
+
+* `key_name`: The key name to get the codes of.
+
+Returns the key codes of the given key, or None if it doesn't exist. See set_key_codes for more information.
+
+`keys.get_next_key(stdscr)`
+
+Gets the next key and saves it.
+
+* `stdscr`: The screen to write to.
+
+`keys.get_current_key()`
+
+Gets the current pressed key.
+
+`keys.get_key_with_timeout(stdscr, timeout)`
+
+Waits for a timeout, returning immediately on a key. Saves the key, saving None if no key was pressed.
+
+* `stdscr`: The screen to write to.
+* `timeout`: The timeout in milliseconds.
+
+`keys.wait_for_key(stdscr)`
+
+Waits for a key, but doesn't consume it.
+
+* `stdscr`: The screen to write to.
+
+`keys.is_pressed(key_name)`
+
+Checks if the given key is the current pressed key by name.
+
+* `key_name`: The key name to check.
+
+`wrapper.wrapper(func)`
+
+Wraps a function to set up and shut down, also wrapping using `curses.wrapper`.
+
+* `func`: The function to wrap.
+
+
+
+%package -n python3-curses-utils
+Summary: Simple curses utilities
+Provides: python-curses-utils
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-curses-utils
+# CursesUtils
+## Functions
+`menu.menu(stdscr, title, options)`
+
+Pulls up a select menu.
+
+* `stdscr`: The screen to write to.
+* `title`: The title of the menu.
+* `options`: A collection of strings to choose from.
+
+Returns the index of the selected item, or None if the user chooses to quit.
+
+`number_select.number_select(stdscr, title, num_range, start = None)`
+
+Pulls up a number selection menu.
+
+* `stdscr`: The screen to write to.
+* `title`: The title of the selection.
+* `num_range`: A range object for valid numbers.
+* `start`: The starting selected number. Defaults to `num_range`'s min value.
+
+Returns the number selected, or None if the user chooses to quit.
+
+`keys.set_key_codes(key_name, key_codes)`
+
+Sets a key's function by name.
+
+* `key_name`: The key name to set.
+* `key_codes`: A collection of key codes (as returned by `stdscr.getkey()`) to use.
+
+Make sure to set keys before using them!
+Internally, CursesUtils uses the following keys:
+* `menu_up` (for navigating UP through menus)
+* `menu_down` (for navigating DOWN through menus)
+* `menu_confirm` (for CONFIRMING on menus)
+* `menu_cancel` (for QUITTING on menus)
+
+`keys.get_key_codes(key_name)`
+
+Gets a key's codes by name.
+
+* `key_name`: The key name to get the codes of.
+
+Returns the key codes of the given key, or None if it doesn't exist. See set_key_codes for more information.
+
+`keys.get_next_key(stdscr)`
+
+Gets the next key and saves it.
+
+* `stdscr`: The screen to write to.
+
+`keys.get_current_key()`
+
+Gets the current pressed key.
+
+`keys.get_key_with_timeout(stdscr, timeout)`
+
+Waits for a timeout, returning immediately on a key. Saves the key, saving None if no key was pressed.
+
+* `stdscr`: The screen to write to.
+* `timeout`: The timeout in milliseconds.
+
+`keys.wait_for_key(stdscr)`
+
+Waits for a key, but doesn't consume it.
+
+* `stdscr`: The screen to write to.
+
+`keys.is_pressed(key_name)`
+
+Checks if the given key is the current pressed key by name.
+
+* `key_name`: The key name to check.
+
+`wrapper.wrapper(func)`
+
+Wraps a function to set up and shut down, also wrapping using `curses.wrapper`.
+
+* `func`: The function to wrap.
+
+
+
+%package help
+Summary: Development documents and examples for curses-utils
+Provides: python3-curses-utils-doc
+%description help
+# CursesUtils
+## Functions
+`menu.menu(stdscr, title, options)`
+
+Pulls up a select menu.
+
+* `stdscr`: The screen to write to.
+* `title`: The title of the menu.
+* `options`: A collection of strings to choose from.
+
+Returns the index of the selected item, or None if the user chooses to quit.
+
+`number_select.number_select(stdscr, title, num_range, start = None)`
+
+Pulls up a number selection menu.
+
+* `stdscr`: The screen to write to.
+* `title`: The title of the selection.
+* `num_range`: A range object for valid numbers.
+* `start`: The starting selected number. Defaults to `num_range`'s min value.
+
+Returns the number selected, or None if the user chooses to quit.
+
+`keys.set_key_codes(key_name, key_codes)`
+
+Sets a key's function by name.
+
+* `key_name`: The key name to set.
+* `key_codes`: A collection of key codes (as returned by `stdscr.getkey()`) to use.
+
+Make sure to set keys before using them!
+Internally, CursesUtils uses the following keys:
+* `menu_up` (for navigating UP through menus)
+* `menu_down` (for navigating DOWN through menus)
+* `menu_confirm` (for CONFIRMING on menus)
+* `menu_cancel` (for QUITTING on menus)
+
+`keys.get_key_codes(key_name)`
+
+Gets a key's codes by name.
+
+* `key_name`: The key name to get the codes of.
+
+Returns the key codes of the given key, or None if it doesn't exist. See set_key_codes for more information.
+
+`keys.get_next_key(stdscr)`
+
+Gets the next key and saves it.
+
+* `stdscr`: The screen to write to.
+
+`keys.get_current_key()`
+
+Gets the current pressed key.
+
+`keys.get_key_with_timeout(stdscr, timeout)`
+
+Waits for a timeout, returning immediately on a key. Saves the key, saving None if no key was pressed.
+
+* `stdscr`: The screen to write to.
+* `timeout`: The timeout in milliseconds.
+
+`keys.wait_for_key(stdscr)`
+
+Waits for a key, but doesn't consume it.
+
+* `stdscr`: The screen to write to.
+
+`keys.is_pressed(key_name)`
+
+Checks if the given key is the current pressed key by name.
+
+* `key_name`: The key name to check.
+
+`wrapper.wrapper(func)`
+
+Wraps a function to set up and shut down, also wrapping using `curses.wrapper`.
+
+* `func`: The function to wrap.
+
+
+
+%prep
+%autosetup -n curses_utils-0.0.13
+
+%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-curses-utils -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Thu Jun 08 2023 Python_Bot <Python_Bot@openeuler.org> - 0.0.13-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..c93caf7
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+6044baa51e109caffd9421a292504f6f curses_utils-0.0.13.tar.gz