summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-06-20 04:44:04 +0000
committerCoprDistGit <infra@openeuler.org>2023-06-20 04:44:04 +0000
commitbc8144d1284f323a971063a79a7197c925ce9522 (patch)
tree91c5be8c41944e6b7967acae7349eff88634bfa7
parent98b49dd5ed077b81f75ada6ab2103561ad30098e (diff)
automatic import of python-ascii-designeropeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-ascii-designer.spec285
-rw-r--r--sources1
3 files changed, 287 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..5fd3e9f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/ascii_designer-0.5.2.tar.gz
diff --git a/python-ascii-designer.spec b/python-ascii-designer.spec
new file mode 100644
index 0000000..7ac4017
--- /dev/null
+++ b/python-ascii-designer.spec
@@ -0,0 +1,285 @@
+%global _empty_manifest_terminate_build 0
+Name: python-ascii-designer
+Version: 0.5.2
+Release: 1
+Summary: Builds dialogs from ASCII art definition.
+License: MIT
+URL: http://github.com/loehnertj/ascii_designer
+Source0: https://mirrors.aliyun.com/pypi/web/packages/8c/74/38ed83dd976d596054ebb25a495d352b50f068e128e071de83610a2c8a73/ascii_designer-0.5.2.tar.gz
+BuildArch: noarch
+
+
+%description
+A library that:
+* creates GUI from ASCII-art (with well-defined syntax)
+* maps widgets to virtual class attributes
+* relieves you from the boring parts of Form building while leaving you in
+ control.
+Did you ever design a form by scribbling something like this in your editor::
+ Text to transform: [ Text_ ]
+ Select transformation:
+ (x) Uppercase
+ ( ) Lowercase
+ ( ) Title-case
+ [ OK ] [ Cancel ]
+ from ascii_designer import AutoFrame
+ class TextTransformer(AutoFrame):
+ f_body='''
+ | <-> |
+ Text to transform: [ Text_ ]
+ Select transformation:
+ (x) Uppercase
+ ( ) Lowercase
+ ( ) Title-case
+ [ OK ] [ Cancel ]~
+ '''
+ def ok(self):
+ text = self.text
+ if self.uppercase:
+ text = text.upper()
+ elif self.lowercase:
+ text = text.lower()
+ elif self.titlecase:
+ text = text.title()
+ print(text)
+ self.close()
+ def cancel(self):
+ self.close()
+ if __name__ == '__main__':
+ TextTransformer().f_show()
+Some comments, incidentally highlighting the features of this library:
+* As you probably guessed, all the magic happens in ``AutoFrame``. The
+ ``f_show`` call triggers rendering of the form. All the reserved attributes
+ are prepended with ``f_`` to get out of your way when subclassing.
+* There is a **well-defined syntax** for how to get the usual widget types. In the
+ example you can find labels (plain text), a text box, radio buttons and normal
+ buttons.
+* The columns are defined by the **header row** with the pipe characters. The
+ minus sign denotes stretching columns. (The ``<`` / ``>`` chars are just
+ decoration.)
+* **Column-span** is easily done by having not-a-space underneath the pipe
+ symbol. **Row-span** can also be done by prepending subsequent cells with a
+ ``{`` character.
+* **Anchoring** is controlled by whether the cell is space-padded or not. For
+ example, the Text box stretches, while the cancel button is centered. The
+ tilde character can be used instead of a fragile trailing space.
+* **Widget IDs** are automatically generated by lowercasing and whitelisting the
+ captions.
+* If a method exists with the same name as a widget id, it is **automatically
+ bound** to the usually-wanted event (click in case of button, value-changed in
+ case of basically anything else). Oh, and ``close`` and ``quit`` are already
+ there for your convenience.
+* Otherwise, you can retrieve and set the widget's value by using its id like
+ a class **attribute**.
+* ``f_show()`` captures all the usual boilerplate and simply f***ing shows
+ the frame. It can be used for both the toplevel and additional frames.
+* Also note how the class name automatically turned into the window title.
+ Override by setting ``.f_title``.
+* The created widgets are **"raw", native widgets**. You can configure the toolkit
+ to use. Currently there is a Qt and a Tkinter implementation. The native
+ widget can accessed using ``form["widget_id"]`` (or
+ ``form.f_controls["widget_id"]``).
+The general philosophy is to not paint everything over with wrappers. Instead,
+the library focuses on specific tasks - building the layout, event-/value
+binding - and lets you do everything else with the API you know and (maybe) love.
+
+%package -n python3-ascii-designer
+Summary: Builds dialogs from ASCII art definition.
+Provides: python-ascii-designer
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-ascii-designer
+A library that:
+* creates GUI from ASCII-art (with well-defined syntax)
+* maps widgets to virtual class attributes
+* relieves you from the boring parts of Form building while leaving you in
+ control.
+Did you ever design a form by scribbling something like this in your editor::
+ Text to transform: [ Text_ ]
+ Select transformation:
+ (x) Uppercase
+ ( ) Lowercase
+ ( ) Title-case
+ [ OK ] [ Cancel ]
+ from ascii_designer import AutoFrame
+ class TextTransformer(AutoFrame):
+ f_body='''
+ | <-> |
+ Text to transform: [ Text_ ]
+ Select transformation:
+ (x) Uppercase
+ ( ) Lowercase
+ ( ) Title-case
+ [ OK ] [ Cancel ]~
+ '''
+ def ok(self):
+ text = self.text
+ if self.uppercase:
+ text = text.upper()
+ elif self.lowercase:
+ text = text.lower()
+ elif self.titlecase:
+ text = text.title()
+ print(text)
+ self.close()
+ def cancel(self):
+ self.close()
+ if __name__ == '__main__':
+ TextTransformer().f_show()
+Some comments, incidentally highlighting the features of this library:
+* As you probably guessed, all the magic happens in ``AutoFrame``. The
+ ``f_show`` call triggers rendering of the form. All the reserved attributes
+ are prepended with ``f_`` to get out of your way when subclassing.
+* There is a **well-defined syntax** for how to get the usual widget types. In the
+ example you can find labels (plain text), a text box, radio buttons and normal
+ buttons.
+* The columns are defined by the **header row** with the pipe characters. The
+ minus sign denotes stretching columns. (The ``<`` / ``>`` chars are just
+ decoration.)
+* **Column-span** is easily done by having not-a-space underneath the pipe
+ symbol. **Row-span** can also be done by prepending subsequent cells with a
+ ``{`` character.
+* **Anchoring** is controlled by whether the cell is space-padded or not. For
+ example, the Text box stretches, while the cancel button is centered. The
+ tilde character can be used instead of a fragile trailing space.
+* **Widget IDs** are automatically generated by lowercasing and whitelisting the
+ captions.
+* If a method exists with the same name as a widget id, it is **automatically
+ bound** to the usually-wanted event (click in case of button, value-changed in
+ case of basically anything else). Oh, and ``close`` and ``quit`` are already
+ there for your convenience.
+* Otherwise, you can retrieve and set the widget's value by using its id like
+ a class **attribute**.
+* ``f_show()`` captures all the usual boilerplate and simply f***ing shows
+ the frame. It can be used for both the toplevel and additional frames.
+* Also note how the class name automatically turned into the window title.
+ Override by setting ``.f_title``.
+* The created widgets are **"raw", native widgets**. You can configure the toolkit
+ to use. Currently there is a Qt and a Tkinter implementation. The native
+ widget can accessed using ``form["widget_id"]`` (or
+ ``form.f_controls["widget_id"]``).
+The general philosophy is to not paint everything over with wrappers. Instead,
+the library focuses on specific tasks - building the layout, event-/value
+binding - and lets you do everything else with the API you know and (maybe) love.
+
+%package help
+Summary: Development documents and examples for ascii-designer
+Provides: python3-ascii-designer-doc
+%description help
+A library that:
+* creates GUI from ASCII-art (with well-defined syntax)
+* maps widgets to virtual class attributes
+* relieves you from the boring parts of Form building while leaving you in
+ control.
+Did you ever design a form by scribbling something like this in your editor::
+ Text to transform: [ Text_ ]
+ Select transformation:
+ (x) Uppercase
+ ( ) Lowercase
+ ( ) Title-case
+ [ OK ] [ Cancel ]
+ from ascii_designer import AutoFrame
+ class TextTransformer(AutoFrame):
+ f_body='''
+ | <-> |
+ Text to transform: [ Text_ ]
+ Select transformation:
+ (x) Uppercase
+ ( ) Lowercase
+ ( ) Title-case
+ [ OK ] [ Cancel ]~
+ '''
+ def ok(self):
+ text = self.text
+ if self.uppercase:
+ text = text.upper()
+ elif self.lowercase:
+ text = text.lower()
+ elif self.titlecase:
+ text = text.title()
+ print(text)
+ self.close()
+ def cancel(self):
+ self.close()
+ if __name__ == '__main__':
+ TextTransformer().f_show()
+Some comments, incidentally highlighting the features of this library:
+* As you probably guessed, all the magic happens in ``AutoFrame``. The
+ ``f_show`` call triggers rendering of the form. All the reserved attributes
+ are prepended with ``f_`` to get out of your way when subclassing.
+* There is a **well-defined syntax** for how to get the usual widget types. In the
+ example you can find labels (plain text), a text box, radio buttons and normal
+ buttons.
+* The columns are defined by the **header row** with the pipe characters. The
+ minus sign denotes stretching columns. (The ``<`` / ``>`` chars are just
+ decoration.)
+* **Column-span** is easily done by having not-a-space underneath the pipe
+ symbol. **Row-span** can also be done by prepending subsequent cells with a
+ ``{`` character.
+* **Anchoring** is controlled by whether the cell is space-padded or not. For
+ example, the Text box stretches, while the cancel button is centered. The
+ tilde character can be used instead of a fragile trailing space.
+* **Widget IDs** are automatically generated by lowercasing and whitelisting the
+ captions.
+* If a method exists with the same name as a widget id, it is **automatically
+ bound** to the usually-wanted event (click in case of button, value-changed in
+ case of basically anything else). Oh, and ``close`` and ``quit`` are already
+ there for your convenience.
+* Otherwise, you can retrieve and set the widget's value by using its id like
+ a class **attribute**.
+* ``f_show()`` captures all the usual boilerplate and simply f***ing shows
+ the frame. It can be used for both the toplevel and additional frames.
+* Also note how the class name automatically turned into the window title.
+ Override by setting ``.f_title``.
+* The created widgets are **"raw", native widgets**. You can configure the toolkit
+ to use. Currently there is a Qt and a Tkinter implementation. The native
+ widget can accessed using ``form["widget_id"]`` (or
+ ``form.f_controls["widget_id"]``).
+The general philosophy is to not paint everything over with wrappers. Instead,
+the library focuses on specific tasks - building the layout, event-/value
+binding - and lets you do everything else with the API you know and (maybe) love.
+
+%prep
+%autosetup -n ascii_designer-0.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-ascii-designer -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.2-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..dc4a0e4
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+28fd9d9e45e3793f3ed3ca9cc4104731 ascii_designer-0.5.2.tar.gz