mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
eine klein python #149
This commit is contained in:
parent
fb336bdde4
commit
92d73fc600
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,6 +1,9 @@
|
||||
debian
|
||||
obj-x86_64-linux-gnu
|
||||
python/.eggs/
|
||||
python/build/
|
||||
python/dist/
|
||||
python/src/notcurses.egg-info/
|
||||
python/src/_notcurses.so
|
||||
rust/target
|
||||
*.pyc
|
||||
|
@ -1,2 +1,8 @@
|
||||
[aliases]
|
||||
test=pytest
|
||||
[nosetests]
|
||||
verbosity=1
|
||||
detailed-errors=1
|
||||
with-coverage=1
|
||||
cover-package=nose
|
||||
debug=nose.loader
|
||||
pdb=1
|
||||
pdb-failures=1
|
||||
|
@ -11,7 +11,7 @@ setup(
|
||||
packages=find_packages('src'),
|
||||
author="Nick Black",
|
||||
author_email="nickblack@linux.com",
|
||||
description="Blingful TUI construction library",
|
||||
description="Blingful TUI construction library (python bindings)",
|
||||
keywords="ncurses curses tui console graphics",
|
||||
license='Apache License, Version 2.0',
|
||||
url='https://github.com/dankamongmen/notcurses',
|
||||
@ -19,8 +19,10 @@ setup(
|
||||
platforms=["any"],
|
||||
long_description=read('README.md'),
|
||||
long_description_content_type="text/markdown",
|
||||
setup_requires=["pytest-runner"],
|
||||
tests_require=["pytest"],
|
||||
setup_requires=["cffi"],
|
||||
cffi_modules=["src/notcurses/build_notcurses.py:ffibuild"],
|
||||
install_requires=["cffi"],
|
||||
py_modules=["notcurses"],
|
||||
# see https://pypi.org/pypi?%3Aaction=list_classifiers
|
||||
classifiers=[
|
||||
'Development Status :: 3 - Alpha',
|
||||
|
17
python/src/notcurses/build_notcurses.py
Normal file
17
python/src/notcurses/build_notcurses.py
Normal file
@ -0,0 +1,17 @@
|
||||
from cffi import FFI
|
||||
ffibuild = FFI()
|
||||
|
||||
ffibuild.set_source(
|
||||
"_notcurses",
|
||||
"""
|
||||
#include <notcurses.h>
|
||||
""",
|
||||
libraries=["notcurses"],
|
||||
)
|
||||
|
||||
ffibuild.cdef("""
|
||||
struct notcurses_options;
|
||||
struct notcurses* notcurses_init(const struct notcurses_options*, FILE*);
|
||||
int notcurses_stop(struct notcurses*);
|
||||
int notcurses_render(struct notcurses*);
|
||||
""")
|
17
python/src/notcurses/notcurses.py
Normal file
17
python/src/notcurses/notcurses.py
Normal file
@ -0,0 +1,17 @@
|
||||
from _notcurses import lib, ffi
|
||||
|
||||
class Notcurses:
|
||||
def __init__(self):
|
||||
self.nc = lib.notcurses_init()
|
||||
|
||||
def __del__(self):
|
||||
lib.notcurses_stop(self.nc)
|
||||
|
||||
def render():
|
||||
return lib.notcurses_render(self.nc)
|
||||
|
||||
def main():
|
||||
print('ohhhh yeah')
|
||||
nc = Notcurses()
|
||||
nc.render()
|
||||
print('ohhhh yeah')
|
Loading…
x
Reference in New Issue
Block a user