This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, pywrap has been updated via 1815d235fb569edde9ce1a16bc0df773cbd6e51b (commit) via 045bf5ca3eb9490641721f1fe995da9b2f7995ff (commit) via ae9991521c625c6e992a7f41e776a4df5f26e27c (commit) via 688f686e2af5d8b93644a133b5d78306f75ba33b (commit) via 6e374f36d66099a2b22f2159f8e01f29a5b6e93b (commit) via 292cb728884ef43f466027f5a5b7425db253c844 (commit) via 3b82597d1e2542af499e250d84f34d98721833e7 (commit) via 258d6567abfed2915878ef6464514ab612139120 (commit) via d495753c9dc9129b0511b3dc59e0fff2884c3e2b (commit) via 4ec758f1d45d859fbf84bff6e8a314c1192f3b68 (commit) via ba3602872b1b7c717a0c82d4937380feee6240d0 (commit) via 83704e9f8be3359c9be0b4c2a9569b5aa4aa0812 (commit) via bee9bc07dfddc0a717246842c29b79cbaa26ab24 (commit) via 31d264d14f9777dd0e934fedb2b0af0665a0b3f7 (commit) from 0aed5090e5722d19b06bf91f6652923b1127a2c9 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/1815d235fb569edde9ce1a16bc0df773cbd6e...
commit 1815d235fb569edde9ce1a16bc0df773cbd6e51b Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 20:50:17 2012 +0100
pywrap: make all modules by default
diff --git a/pylib/gfxprim/Makefile b/pylib/gfxprim/Makefile index f5bf693..e668b60 100644 --- a/pylib/gfxprim/Makefile +++ b/pylib/gfxprim/Makefile @@ -1,3 +1,3 @@ TOPDIR=../.. -SUBDIRS=core loaders +SUBDIRS=core loaders backends gfx filters text include $(TOPDIR)/include.mk
http://repo.or.cz/w/gfxprim.git/commit/045bf5ca3eb9490641721f1fe995da9b2f799...
commit 045bf5ca3eb9490641721f1fe995da9b2f7995ff Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 20:49:30 2012 +0100
pywrap: forgotten file
I forgot to commit pywrap.mk with .swig to .i change
diff --git a/pywrap.mk b/pywrap.mk index ab8dcf7..b03ab6d 100644 --- a/pywrap.mk +++ b/pywrap.mk @@ -2,7 +2,7 @@ ifndef LIBNAME $(error LIBNAME not defined, fix your library Makefile) endif
-SWIG_SRC=$(LIBNAME).swig +SWIG_SRC=$(LIBNAME).i SWIG_PY=$(LIBNAME)_c.py SWIG_C=$(LIBNAME)_wrap.c SWIG_LIB=_$(LIBNAME)_c.so
http://repo.or.cz/w/gfxprim.git/commit/ae9991521c625c6e992a7f41e776a4df5f26e...
commit ae9991521c625c6e992a7f41e776a4df5f26e27c Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 20:48:28 2012 +0100
pywrap: and finally ... added text module!
diff --git a/pylib/gfxprim/text/C.py b/pylib/gfxprim/text/C.py new file mode 100644 index 0000000..c8f987f --- /dev/null +++ b/pylib/gfxprim/text/C.py @@ -0,0 +1,3 @@ +""" +Submodule for constants +""" diff --git a/pylib/gfxprim/text/Makefile b/pylib/gfxprim/text/Makefile new file mode 100644 index 0000000..9549bc3 --- /dev/null +++ b/pylib/gfxprim/text/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../../.. +LIBNAME=text +INCLUDE=core +include $(TOPDIR)/pywrap.mk +include $(TOPDIR)/include.mk diff --git a/pylib/gfxprim/text/__init__.py b/pylib/gfxprim/text/__init__.py new file mode 100644 index 0000000..a24cb69 --- /dev/null +++ b/pylib/gfxprim/text/__init__.py @@ -0,0 +1,27 @@ +from . import text_c + +from . import C + +def _init(module): + + # Imports from the SWIG module + import re + def strip_GP(s): + return re.sub('^GP_', '', s) + + # Import constants from the SWIG module + from ..utils import import_members + const_regexes = ['^GP_[A-Z0-9_]*$'] + import_members(text_c, C, include=const_regexes, sub=strip_GP) + + # Import functions from the SWIG module + import_members(text_c, module, sub=strip_GP, + exclude=const_regexes + [ + '.*_Raw', + '^w+_swigregister$', + '^gfxprim$', + '^cvar$', + '^_w+$']) + +_init(locals()) +del _init diff --git a/pylib/gfxprim/text/text.i b/pylib/gfxprim/text/text.i new file mode 100644 index 0000000..94f8baf --- /dev/null +++ b/pylib/gfxprim/text/text.i @@ -0,0 +1,23 @@ +%module(package="gfxprim.text") text_c + +%{ +#include "text/GP_Text.h" +#include "text/GP_Font.h" +%} + +#define __attribute__(X) + +%import ../core/core.i + +%include <stdint.i> + +%nodefaultctor; + +%ignore GP_GlyphBitmap::bitmap; +%ignore GP_FontFace::glyph_offsets; +%include "GP_Text.h" +%include "GP_Font.h" +%include "GP_DefaultFont.h" +%include "GP_TextMetric.h" +%include "GP_TextStyle.h" +
http://repo.or.cz/w/gfxprim.git/commit/688f686e2af5d8b93644a133b5d78306f75ba...
commit 688f686e2af5d8b93644a133b5d78306f75ba33b Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 20:37:24 2012 +0100
pywrap: wrappers for filters, not well-filtered
* More work may be necessary (parameters? any allocations?)
diff --git a/pylib/gfxprim/filters/C.py b/pylib/gfxprim/filters/C.py new file mode 100644 index 0000000..c8f987f --- /dev/null +++ b/pylib/gfxprim/filters/C.py @@ -0,0 +1,3 @@ +""" +Submodule for constants +""" diff --git a/pylib/gfxprim/filters/Makefile b/pylib/gfxprim/filters/Makefile new file mode 100644 index 0000000..6e03032 --- /dev/null +++ b/pylib/gfxprim/filters/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../../.. +LIBNAME=filters +INCLUDE=core +include $(TOPDIR)/pywrap.mk +include $(TOPDIR)/include.mk diff --git a/pylib/gfxprim/filters/__init__.py b/pylib/gfxprim/filters/__init__.py new file mode 100644 index 0000000..96ed8c9 --- /dev/null +++ b/pylib/gfxprim/filters/__init__.py @@ -0,0 +1,26 @@ +from . import filters_c + +from . import C + +def _init(module): + + # Imports from the SWIG module + import re + def strip_GP(s): + return re.sub('^GP_', '', s) + + # Import constants from the SWIG module + from ..utils import import_members + const_regexes = ['^GP_[A-Z0-9_]*$'] + import_members(filters_c, C, include=const_regexes, sub=strip_GP) + + # Import functions from the SWIG module + import_members(filters_c, module, sub=strip_GP, + exclude=const_regexes + [ + '.*_Raw', + '^w+_swigregister$', + '^gfxprim$', + '^_w+$']) + +_init(locals()) +del _init diff --git a/pylib/gfxprim/filters/filters.i b/pylib/gfxprim/filters/filters.i new file mode 100644 index 0000000..34baeb9 --- /dev/null +++ b/pylib/gfxprim/filters/filters.i @@ -0,0 +1,26 @@ +%module(package="gfxprim.filters") filters_c + +%{ +#include "filters/GP_Filters.h" +%} + +#define __attribute__(X) + +%import ../core/core.i + +%include <stdint.i> + +%nodefaultctor; + +%include "GP_Filters.h" + +/* Listed in GP_Filters.h: */ +%include "GP_FilterParam.h" +%include "GP_Point.h" +%include "GP_Arithmetic.h" +%ignore GP_Histogram::hist; +%include "GP_Stats.h" +%include "GP_Rotate.h" +%include "GP_Linear.h" +%include "GP_Resize.h" +/* %include "GP_Dither.h" -- missing symbols */
http://repo.or.cz/w/gfxprim.git/commit/6e374f36d66099a2b22f2159f8e01f29a5b6e...
commit 6e374f36d66099a2b22f2159f8e01f29a5b6e93b Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 20:34:45 2012 +0100
pywrap: fix excluded elements
diff --git a/pylib/gfxprim/backends/__init__.py b/pylib/gfxprim/backends/__init__.py index 9aac820..224e0e5 100644 --- a/pylib/gfxprim/backends/__init__.py +++ b/pylib/gfxprim/backends/__init__.py @@ -39,6 +39,7 @@ def _init(module): import_members(backends_c, module, sub=strip_GP, exclude=const_regexes + [ '^GP_Backend$', + '^gfxprim$', '^w+_swigregister$', '^_w+$'])
diff --git a/pylib/gfxprim/gfx/__init__.py b/pylib/gfxprim/gfx/__init__.py index 6d03923..c80ae6a 100644 --- a/pylib/gfxprim/gfx/__init__.py +++ b/pylib/gfxprim/gfx/__init__.py @@ -12,9 +12,7 @@ def _init(module):
# Import constants from the SWIG module from ..utils import import_members - const_regexes = [ - '^GP_[A-Z0-9_]*$', - '^GP_PIXEL_x[A-Z0-9_]*$'] + const_regexes = ['^GP_[A-Z0-9_]*$'] import_members(gfx_c, C, include=const_regexes, sub=strip_GP)
# Import functions from the SWIG module @@ -22,7 +20,7 @@ def _init(module): exclude=const_regexes + [ '.*_Raw', '^w+_swigregister$', - '^core_c$', + '^gfxprim$', '^_w+$'])
_init(locals()) diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py index ed235bc..c3fe31b 100644 --- a/pylib/gfxprim/loaders/__init__.py +++ b/pylib/gfxprim/loaders/__init__.py @@ -17,7 +17,7 @@ def _init(module): import_members(loaders_c, module, sub=strip_GP, exclude=[ '^w+_swigregister$', - '^core_c$', + '^gfxprim$', '^_w+$'])
_init(locals())
http://repo.or.cz/w/gfxprim.git/commit/292cb728884ef43f466027f5a5b7425db253c...
commit 292cb728884ef43f466027f5a5b7425db253c844 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 20:28:14 2012 +0100
Update .gitignore (include libraries)
diff --git a/.gitignore b/.gitignore index 52f0d89..7d18a2b 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,8 @@ *.gen.c *.gen.h *.swp -libGP.so* -libGP.a +*.so.* +*.so +*.a config.h config.gen.mk
http://repo.or.cz/w/gfxprim.git/commit/3b82597d1e2542af499e250d84f34d9872183...
commit 3b82597d1e2542af499e250d84f34d98721833e7 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 20:23:33 2012 +0100
pywrap: separate constants for gfx
diff --git a/pylib/gfxprim/gfx/C.py b/pylib/gfxprim/gfx/C.py new file mode 100644 index 0000000..c8f987f --- /dev/null +++ b/pylib/gfxprim/gfx/C.py @@ -0,0 +1,3 @@ +""" +Submodule for constants +""" diff --git a/pylib/gfxprim/gfx/__init__.py b/pylib/gfxprim/gfx/__init__.py index 4bbaa40..6d03923 100644 --- a/pylib/gfxprim/gfx/__init__.py +++ b/pylib/gfxprim/gfx/__init__.py @@ -1,16 +1,25 @@ from . import gfx_c
+from . import C + def _init(module):
+ # Imports from the SWIG module import re def strip_GP(s): return re.sub('^GP_', '', s)
- # Import functions from the SWIG module + # Import constants from the SWIG module from ..utils import import_members + const_regexes = [ + '^GP_[A-Z0-9_]*$', + '^GP_PIXEL_x[A-Z0-9_]*$'] + import_members(gfx_c, C, include=const_regexes, sub=strip_GP) + + # Import functions from the SWIG module import_members(gfx_c, module, sub=strip_GP, - exclude=[ + exclude=const_regexes + [ '.*_Raw', '^w+_swigregister$', '^core_c$',
http://repo.or.cz/w/gfxprim.git/commit/258d6567abfed2915878ef6464514ab612139...
commit 258d6567abfed2915878ef6464514ab612139120 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 20:11:09 2012 +0100
pywrap: wrappers for gfx module
diff --git a/pylib/gfxprim/gfx/Makefile b/pylib/gfxprim/gfx/Makefile new file mode 100644 index 0000000..db31c60 --- /dev/null +++ b/pylib/gfxprim/gfx/Makefile @@ -0,0 +1,5 @@ +TOPDIR=../../.. +LIBNAME=gfx +INCLUDE=core +include $(TOPDIR)/pywrap.mk +include $(TOPDIR)/include.mk diff --git a/pylib/gfxprim/gfx/__init__.py b/pylib/gfxprim/gfx/__init__.py new file mode 100644 index 0000000..4bbaa40 --- /dev/null +++ b/pylib/gfxprim/gfx/__init__.py @@ -0,0 +1,20 @@ +from . import gfx_c + +def _init(module): + + # Imports from the SWIG module + import re + def strip_GP(s): + return re.sub('^GP_', '', s) + + # Import functions from the SWIG module + from ..utils import import_members + import_members(gfx_c, module, sub=strip_GP, + exclude=[ + '.*_Raw', + '^w+_swigregister$', + '^core_c$', + '^_w+$']) + +_init(locals()) +del _init diff --git a/pylib/gfxprim/gfx/gfx.i b/pylib/gfxprim/gfx/gfx.i new file mode 100644 index 0000000..1f59443 --- /dev/null +++ b/pylib/gfxprim/gfx/gfx.i @@ -0,0 +1,37 @@ +%module(package="gfxprim.gfx") gfx_c + +%{ +#include "gfx/GP_Gfx.h" +%} + +#define __attribute__(X) + +%import ../core/core.i + +%include <stdint.i> + +%nodefaultctor; + +%include "GP_Gfx.h" + +/* Listed in GP_Gfx.h: */ +%include "GP_Fill.h" +%include "GP_HLine.h" +%include "GP_VLine.h" +%include "GP_Line.h" +%include "GP_Rect.h" +%include "GP_Triangle.h" +%include "GP_Tetragon.h" +%include "GP_Circle.h" +/* %include "GP_CircleSeg.h" -- missing symbols */ +%include "GP_Ellipse.h" +%include "GP_Arc.h" +%include "GP_Polygon.h" +%include "GP_Symbol.h" + +%include "GP_PutPixelAA.h" +%include "GP_VLineAA.h" +%include "GP_HLineAA.h" +%include "GP_LineAA.h" +%include "GP_RectAA.h" +
http://repo.or.cz/w/gfxprim.git/commit/d495753c9dc9129b0511b3dc59e0fff2884c3...
commit d495753c9dc9129b0511b3dc59e0fff2884c3e2b Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 20:10:34 2012 +0100
pywrap: clean old links
diff --git a/pylib/_gfxprim_core_c.so b/pylib/_gfxprim_core_c.so deleted file mode 120000 index b0aff10..0000000 --- a/pylib/_gfxprim_core_c.so +++ /dev/null @@ -1 +0,0 @@ -../build/_gfxprim_core_c.so No newline at end of file diff --git a/pylib/_gfxprim_loaders_c.so b/pylib/_gfxprim_loaders_c.so deleted file mode 120000 index 41a41f9..0000000 --- a/pylib/_gfxprim_loaders_c.so +++ /dev/null @@ -1 +0,0 @@ -../build/_gfxprim_loaders_c.so No newline at end of file
http://repo.or.cz/w/gfxprim.git/commit/4ec758f1d45d859fbf84bff6e8a314c1192f3...
commit 4ec758f1d45d859fbf84bff6e8a314c1192f3b68 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 19:56:34 2012 +0100
pywrap: use .i instead of .pywrap
diff --git a/pylib/gfxprim/backends/backends.swig b/pylib/gfxprim/backends/backends.i similarity index 96% rename from pylib/gfxprim/backends/backends.swig rename to pylib/gfxprim/backends/backends.i index 9c2eea1..5a03736 100644 --- a/pylib/gfxprim/backends/backends.swig +++ b/pylib/gfxprim/backends/backends.i @@ -10,7 +10,7 @@
%feature("autodoc");
-%import ../core/core.swig +%import ../core/core.i
/* diff --git a/pylib/gfxprim/core/core.swig b/pylib/gfxprim/core/core.i similarity index 100% rename from pylib/gfxprim/core/core.swig rename to pylib/gfxprim/core/core.i diff --git a/pylib/gfxprim/loaders/loaders.swig b/pylib/gfxprim/loaders/loaders.i similarity index 95% rename from pylib/gfxprim/loaders/loaders.swig rename to pylib/gfxprim/loaders/loaders.i index aeb5ad2..990b07d 100644 --- a/pylib/gfxprim/loaders/loaders.swig +++ b/pylib/gfxprim/loaders/loaders.i @@ -7,7 +7,7 @@
#define __attribute__(X)
-%import ../core/core.swig +%import ../core/core.i
%include <stdint.i>
http://repo.or.cz/w/gfxprim.git/commit/ba3602872b1b7c717a0c82d4937380feee624...
commit ba3602872b1b7c717a0c82d4937380feee6240d0 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 19:52:24 2012 +0100
pywrap: Clean and simplify backend wrappers
diff --git a/pylib/gfxprim/backends/__init__.py b/pylib/gfxprim/backends/__init__.py index f33aa9b..9aac820 100644 --- a/pylib/gfxprim/backends/__init__.py +++ b/pylib/gfxprim/backends/__init__.py @@ -7,40 +7,25 @@ Accessing a context after its backend has ben freed will probably end your (program's) world """
-# HACK to allow backends_c to find core_c -def import_backends_c_helper(): - from os.path import dirname - import sys - oldpath = sys.path[:] - sys.path.append(dirname(__file__) + '/../core') - from . import backends_c - sys.path = oldpath - return backends_c -backends_c = import_backends_c_helper() -del import_backends_c_helper - -# Extend Context with convenience methods -def extend(): - from . import extend_context - from ..core import Context - extend_context.extend_context_class(Context) -extend() -del extend - +from . import backends_c
# Pull GP_Backend Backend = backends_c.GP_Backend
-# Extend GP_Backend with convenience methods -from . import extend_backend -extend_backend.extend_backend_class(Backend) -del extend_backend - # Constants module from . import C
-# Import some members from the SWIG module -def import_helper(module): +def _init(module): + # Extend Context with convenience methods + from ._extend_context import extend_context + from ..core import Context + extend_context(Context) + + # Extend GP_Backend with convenience methods + from _extend_backend import extend_backend + extend_backend(Backend) + + # Import some members from the SWIG module from ..utils import import_members import re def strip_GP(s): @@ -56,5 +41,6 @@ def import_helper(module): '^GP_Backend$', '^w+_swigregister$', '^_w+$']) -import_helper(locals()) -del import_helper + +_init(locals()) +del _init diff --git a/pylib/gfxprim/backends/extend_backend.py b/pylib/gfxprim/backends/_extend_backend.py similarity index 71% rename from pylib/gfxprim/backends/extend_backend.py rename to pylib/gfxprim/backends/_extend_backend.py index bbd52cd..2f739fc 100644 --- a/pylib/gfxprim/backends/extend_backend.py +++ b/pylib/gfxprim/backends/_extend_backend.py @@ -1,29 +1,29 @@ from ..utils import extend, add_swig_getmethod, add_swig_setmethod from . import backends_c
-def extend_backend_class(_backend_class): +def extend_backend(_backend): """ - Extends _backend_class class with convenience methods. + Extends _backend class with convenience methods. Called once on module inicialization. """
- @extend(_backend_class, name='__str__') - @extend(_backend_class, name='__repr__') + @extend(_backend, name='__str__') + @extend(_backend, name='__repr__') def backend_str(self): return "<Backend "%s", GP_Backend %sowned>" % ( self.name, "" if self.thisown else "not ")
- @extend(_backend_class) + @extend(_backend) def Flip(self): "If display is buffered, this copies content of context onto display." return backends_c.GP_BackendFlip(self)
- @extend(_backend_class) + @extend(_backend) def UpdateRect(self, rect): "Update a rectangle on a buffered backend." return backends_c.GP_BackendUpdateRect(self, rect[0], rect[1], rect[2], rect[3])
- @extend(_backend_class) + @extend(_backend) def Poll(self): "Poll the backend for events." return backends_c.GP_BackendPoll(self) diff --git a/pylib/gfxprim/backends/_extend_context.py b/pylib/gfxprim/backends/_extend_context.py new file mode 100644 index 0000000..f1754a5 --- /dev/null +++ b/pylib/gfxprim/backends/_extend_context.py @@ -0,0 +1,8 @@ +from ..utils import extend, add_swig_getmethod, add_swig_setmethod +from . import backends_c + +def extend_context(_context): + """ + Extends _context class with backend support. + """ + extend(_context, name='backend')(None) diff --git a/pylib/gfxprim/backends/backends.swig b/pylib/gfxprim/backends/backends.swig index 792e789..9c2eea1 100644 --- a/pylib/gfxprim/backends/backends.swig +++ b/pylib/gfxprim/backends/backends.swig @@ -1,4 +1,4 @@ -%module backends_c +%module(package="gfxprim.backends") backends_c
%{ #include "GP_Backend.h" diff --git a/pylib/gfxprim/backends/extend_context.py b/pylib/gfxprim/backends/extend_context.py deleted file mode 100644 index f959547..0000000 --- a/pylib/gfxprim/backends/extend_context.py +++ /dev/null @@ -1,8 +0,0 @@ -from ..utils import extend, add_swig_getmethod, add_swig_setmethod -from . import backends_c - -def extend_context_class(_context_class): - """ - Extends _context_class class with backend support. - """ - extend(_context_class, name='backend')(None)
http://repo.or.cz/w/gfxprim.git/commit/83704e9f8be3359c9be0b4c2a9569b5aa4aa0...
commit 83704e9f8be3359c9be0b4c2a9569b5aa4aa0812 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 19:46:48 2012 +0100
pywrap: Simplify and clean core SWIG imports
diff --git a/pylib/gfxprim/core/__init__.py b/pylib/gfxprim/core/__init__.py index 21699f7..7589d14 100644 --- a/pylib/gfxprim/core/__init__.py +++ b/pylib/gfxprim/core/__init__.py @@ -1,16 +1,17 @@ from . import core_c
-Context = core_c.Context - -# Extend Context with convenience methods -from . import extend_context -extend_context.extend_context_class(Context) -del extend_context +Context = core_c.GP_Context
+# Constants from . import C
-# Import some members from the SWIG module -def import_helper(module): +def _init(module): + + # Extend Context with convenience methods + from ._extend_context import extend_context + extend_context(Context) + + # Import some members from the SWIG module import re from ..utils import import_members
@@ -33,5 +34,6 @@ def import_helper(module): '^w+_swigregister$', '^cvar$', '^_w+$']) -import_helper(locals()) -del import_helper + +_init(locals()) +del _init diff --git a/pylib/gfxprim/core/extend_context.py b/pylib/gfxprim/core/_extend_context.py similarity index 77% rename from pylib/gfxprim/core/extend_context.py rename to pylib/gfxprim/core/_extend_context.py index f8f197d..340e142 100644 --- a/pylib/gfxprim/core/extend_context.py +++ b/pylib/gfxprim/core/_extend_context.py @@ -1,57 +1,57 @@ from ..utils import extend, add_swig_getmethod, add_swig_setmethod from . import core_c
-def extend_context_class(_context_class): +def extend_context(_context): """ - Extends _context_class class with core module methods and properties + Extends _context class with core module methods and properties for object-oriented usage. Called once on module inicialization. """
# Add "parent" attribute - extend(_context_class, name='parent')(None) + extend(_context, name='parent')(None)
- @extend(_context_class, name='__str__') - @extend(_context_class, name='__repr__') + @extend(_context, name='__str__') + @extend(_context, name='__repr__') def context_str(self): return "<Context %dx%d, %dbpp, GP_Context %sowned, %s parent>" % ( self.w, self.h, self._bpp, "" if self.thisown else "not ", "with" if self.parent else "no")
- @add_swig_getmethod(_context_class) + @add_swig_getmethod(_context) def w(self): return core_c.GP_ContextW(self)
- @add_swig_getmethod(_context_class) + @add_swig_getmethod(_context) def h(self): return core_c.GP_ContextH(self)
- @add_swig_getmethod(_context_class) + @add_swig_getmethod(_context) def pixel_type(self): return self._pixel_type
- @extend(_context_class) + @extend(_context) def Subcontext(self, x, y, w, h): "Create a subcontext (rectangular view)." c = core_c.GP_ContextSubContext(self, None, x, y, w, h) c.parent = self return c
- @extend(_context_class) + @extend(_context) def Copy(self, withdata): "Copy the context to a new context. Pixel data are copie optionally." flags = core_c.GP_COPY_WITH_PIXELS if withdata else 0 return core_c.GP_ContextCopy(self, flags)
- @extend(_context_class) + @extend(_context) def Convert(self, target_type): """Converts context to a different pixel type, allocates new context. See GP_ContextConvert() for details.""" pixeltype_no = target_type ## TODO also accept PixelType return core_c.GP_ContextConvert(self, pixeltype_no)
- @extend(_context_class, name='create') + @extend(_context, name='create') @staticmethod def Create(w, h, pixeltype): "Allocate a new w*h bitmap of given type." @@ -61,12 +61,12 @@ def extend_context_class(_context_class): c = core_c.GP_ContextAlloc(w, h, pixeltype_no) return c
- @extend(_context_class) + @extend(_context) def RGBToPixel(self, r, g, b): "Convert RGB888 (values 0-255) to context pixel type." return GP_RGBToPixel(r, g, b, self.pixel_type)
- @extend(_context_class) + @extend(_context) def RGBAToPixel(self, r, g, b): "Convert RGBA8888 (values 0-255) to context pixel type." return GP_RGBToPixel(r, g, b, self.pixel_type) diff --git a/pylib/gfxprim/core/core.swig b/pylib/gfxprim/core/core.swig index 481ab1b..2fb33ca 100644 --- a/pylib/gfxprim/core/core.swig +++ b/pylib/gfxprim/core/core.swig @@ -1,4 +1,4 @@ -%module core_c +%module(package="gfxprim.core") core_c
%{ #include "core/GP_Core.h" @@ -63,7 +63,6 @@ /* This nice batch would work in swig 2.0, sigh: * %rename("_%s", regexmatch$name="^GP_Context::") ""; */
-%rename("Context") "GP_Context";
%feature("autodoc", "Proxy of C GP_Context struct
@@ -72,7 +71,8 @@ All attributes of GP_Context are accessible directly as _attribute (self._w etc.), but it is reccomended to use redefined properties:
self.w: Context width (transformed) -self.h: Context width (transformed) +self.h: Context height (transformed) +self.pixel_type: Context pixel type (number)
Some context-related methods are provided as class members for convenience.
http://repo.or.cz/w/gfxprim.git/commit/bee9bc07dfddc0a717246842c29b79cbaa26a...
commit bee9bc07dfddc0a717246842c29b79cbaa26ab24 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 19:38:32 2012 +0100
pywrap: set SWIG in config.mk
diff --git a/config.mk b/config.mk index 53bcc7c..889944f 100644 --- a/config.mk +++ b/config.mk @@ -13,3 +13,5 @@ PYTHON_INCLUDE=/usr/include/python2.6 PYTHON=PYTHONPATH=$$PYTHONPATH:${PYLIBSDIR} ${PYTHON_BIN} -Werror
SWIGOPTS=-Wextra -w322,314 -I/usr/include/ + +SWIG=swig
http://repo.or.cz/w/gfxprim.git/commit/31d264d14f9777dd0e934fedb2b0af0665a0b...
commit 31d264d14f9777dd0e934fedb2b0af0665a0b3f7 Author: Tomas Gavenciak gavento@ucw.cz Date: Fri Feb 24 19:36:15 2012 +0100
pywrap: simplify, clean loading, proper module names
diff --git a/pylib/gfxprim/loaders/__init__.py b/pylib/gfxprim/loaders/__init__.py index 5c62e9d..ed235bc 100644 --- a/pylib/gfxprim/loaders/__init__.py +++ b/pylib/gfxprim/loaders/__init__.py @@ -1,37 +1,24 @@ +from . import loaders_c
-# HACK to allow loaders_c to find core_c -def import_loaders_c_helper(): - from os.path import dirname - import sys - oldpath = sys.path[:] - sys.path.append(dirname(__file__) + '/../core') - from . import loaders_c - sys.path = oldpath - return loaders_c -loaders_c = import_loaders_c_helper() -del import_loaders_c_helper +def _init(module):
-# Extend Context with convenience methods -def extend(): - from . import extend_context + # Extend Context with convenience methods + from _extend_context import extend_context from ..core import Context - extend_context.extend_context_class(Context) -extend() -del extend + extend_context(Context)
-# Import some members from the SWIG module -def import_helper(module): - from ..utils import import_members + # Imports from the SWIG module import re def strip_GP(s): return re.sub('^GP_', '', s)
- # Functions + # Import functions from the SWIG module + from ..utils import import_members import_members(loaders_c, module, sub=strip_GP, exclude=[ '^w+_swigregister$', '^core_c$', '^_w+$']) -import_helper(locals()) -del import_helper
+_init(locals()) +del _init diff --git a/pylib/gfxprim/loaders/extend_context.py b/pylib/gfxprim/loaders/_extend_context.py similarity index 85% rename from pylib/gfxprim/loaders/extend_context.py rename to pylib/gfxprim/loaders/_extend_context.py index c8334ae..5e0b8c4 100644 --- a/pylib/gfxprim/loaders/extend_context.py +++ b/pylib/gfxprim/loaders/_extend_context.py @@ -1,20 +1,20 @@ from ..utils import extend, add_swig_getmethod, add_swig_setmethod from . import loaders_c
-def extend_context_class(_context_class): +def extend_context(_context): """ - Extends _context_class class with loader module methods for calling convenience. + Extends _context class with loader module methods for calling convenience. Called once on loaders module inicialization. """
- @extend(_context_class, name='load') + @extend(_context, name='load') @staticmethod def Load(filename): "Load image from given file, guess type." c = loaders_c.GP_LoadImage_Wrap(filename) return c
- @extend(_context_class) + @extend(_context) def Save(self, filename, format=None): """Save the image in given format (or guess it from the extension)
diff --git a/pylib/gfxprim/loaders/loaders.swig b/pylib/gfxprim/loaders/loaders.swig index 1f171a3..aeb5ad2 100644 --- a/pylib/gfxprim/loaders/loaders.swig +++ b/pylib/gfxprim/loaders/loaders.swig @@ -1,4 +1,4 @@ -%module loaders_c +%module(package="gfxprim.loaders") loaders_c
%{ #include "core/GP_Core.h"
-----------------------------------------------------------------------
Summary of changes: .gitignore | 5 +- config.mk | 2 + pylib/_gfxprim_core_c.so | 1 - pylib/_gfxprim_loaders_c.so | 1 - pylib/gfxprim/Makefile | 2 +- pylib/gfxprim/backends/__init__.py | 45 +++++++------------- .../{extend_backend.py => _extend_backend.py} | 14 +++--- pylib/gfxprim/backends/_extend_context.py | 8 ++++ .../gfxprim/backends/{backends.swig => backends.i} | 4 +- pylib/gfxprim/backends/extend_context.py | 8 ---- pylib/gfxprim/core/__init__.py | 22 +++++---- .../core/{extend_context.py => _extend_context.py} | 28 ++++++------ pylib/gfxprim/core/{core.swig => core.i} | 6 +- pylib/gfxprim/{backends => filters}/C.py | 0 pylib/gfxprim/{loaders => filters}/Makefile | 2 +- pylib/gfxprim/filters/__init__.py | 26 +++++++++++ pylib/gfxprim/filters/filters.i | 26 +++++++++++ pylib/gfxprim/{backends => gfx}/C.py | 0 pylib/gfxprim/{loaders => gfx}/Makefile | 2 +- pylib/gfxprim/gfx/__init__.py | 27 ++++++++++++ pylib/gfxprim/gfx/gfx.i | 37 ++++++++++++++++ pylib/gfxprim/loaders/__init__.py | 35 +++++---------- .../{extend_context.py => _extend_context.py} | 8 ++-- pylib/gfxprim/loaders/{loaders.swig => loaders.i} | 4 +- pylib/gfxprim/{backends => text}/C.py | 0 pylib/gfxprim/{loaders => text}/Makefile | 2 +- pylib/gfxprim/text/__init__.py | 27 ++++++++++++ pylib/gfxprim/text/text.i | 23 ++++++++++ pywrap.mk | 2 +- 29 files changed, 255 insertions(+), 112 deletions(-) delete mode 120000 pylib/_gfxprim_core_c.so delete mode 120000 pylib/_gfxprim_loaders_c.so rename pylib/gfxprim/backends/{extend_backend.py => _extend_backend.py} (71%) create mode 100644 pylib/gfxprim/backends/_extend_context.py rename pylib/gfxprim/backends/{backends.swig => backends.i} (90%) delete mode 100644 pylib/gfxprim/backends/extend_context.py rename pylib/gfxprim/core/{extend_context.py => _extend_context.py} (77%) rename pylib/gfxprim/core/{core.swig => core.i} (95%) copy pylib/gfxprim/{backends => filters}/C.py (100%) copy pylib/gfxprim/{loaders => filters}/Makefile (84%) create mode 100644 pylib/gfxprim/filters/__init__.py create mode 100644 pylib/gfxprim/filters/filters.i copy pylib/gfxprim/{backends => gfx}/C.py (100%) copy pylib/gfxprim/{loaders => gfx}/Makefile (84%) create mode 100644 pylib/gfxprim/gfx/__init__.py create mode 100644 pylib/gfxprim/gfx/gfx.i rename pylib/gfxprim/loaders/{extend_context.py => _extend_context.py} (85%) rename pylib/gfxprim/loaders/{loaders.swig => loaders.i} (87%) copy pylib/gfxprim/{backends => text}/C.py (100%) copy pylib/gfxprim/{loaders => text}/Makefile (84%) create mode 100644 pylib/gfxprim/text/__init__.py create mode 100644 pylib/gfxprim/text/text.i
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.