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, master has been updated via 33fd79bc8b7affb6ba6c72092670f4821ea29979 (commit) via 6985e59261da38f230870a3b036c2dd9d8f0413b (commit) from db503b06e3e5829268f9a75bbb38ceedf15e86c8 (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/33fd79bc8b7affb6ba6c72092670f4821ea29...
commit 33fd79bc8b7affb6ba6c72092670f4821ea29979 Author: Cyril Hrubis metan@ucw.cz Date: Sat Apr 6 20:22:26 2013 +0200
demos: py_simple: Add X11 multiple windows example.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/py_simple/x11_windows.py b/demos/py_simple/x11_windows.py index ec72e02..04cfee2 100755 --- a/demos/py_simple/x11_windows.py +++ b/demos/py_simple/x11_windows.py @@ -6,9 +6,20 @@ import gfxprim.core as core import gfxprim.gfx as gfx import gfxprim.backends as backends import gfxprim.input as input +import gfxprim.text as text
-def redraw(bk): - bk.context.gfx.Fill(bk.context.RGBToPixel(0, 0, 0)) +def redraw(bk, id): + c = bk.context + + black = c.RGBToPixel(0, 0, 0) + white = c.RGBToPixel(0xff, 0xff, 0xff) + + c.gfx.Fill(black) + + align = text.C.ALIGN_CENTER | text.C.VALIGN_CENTER + + c.text.Text(None, c.w//2, c.h//2, align, white, black, "{} - {}x{}".format(id, c.w, c.h)) + bk.Flip()
def parse_events(bk, id): @@ -29,16 +40,19 @@ def parse_events(bk, id): elif (ev.type == input.EV_SYS): if (ev.code == input.EV_SYS_QUIT): sys.exit(0) + if (ev.code == input.EV_SYS_RESIZE): + bk.ResizeAck() + redraw(bk, id)
def main(): # Create X11 windows - win1 = backends.BackendX11Init(None, 0, 0, 100, 100, "Win 1", 0) - win2 = backends.BackendX11Init(None, 0, 0, 100, 100, "Win 2", 0) + win1 = backends.BackendX11Init(None, 0, 0, 200, 100, "Win 1", 0) + win2 = backends.BackendX11Init(None, 0, 0, 200, 100, "Win 2", 0) assert(win1) assert(win2)
- redraw(win1) - redraw(win2) + redraw(win1, "win1") + redraw(win2, "win2")
# Event loop while True:
http://repo.or.cz/w/gfxprim.git/commit/6985e59261da38f230870a3b036c2dd9d8f04...
commit 6985e59261da38f230870a3b036c2dd9d8f0413b Author: Cyril Hrubis metan@ucw.cz Date: Sat Apr 6 20:21:42 2013 +0200
pywrap: Fix text module wrappers.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/pylib/gfxprim/gfx/__init__.py b/pylib/gfxprim/gfx/__init__.py index f7fe741..2b8d310 100644 --- a/pylib/gfxprim/gfx/__init__.py +++ b/pylib/gfxprim/gfx/__init__.py @@ -5,15 +5,11 @@ Use as in "import gfxprim.gfx; context_foo.gfx.Line(...)" """
# Import the SWIG wrapper - from . import c_gfx
- # Constants module - from . import C
- def _init(module): "Extend Context with gfx submodule"
@@ -21,7 +17,6 @@ def _init(module): from ..core import Context as _context
# New Context submodule - class GfxSubmodule(object): def __init__(self, ctx): self.ctx = ctx diff --git a/pylib/gfxprim/text/__init__.py b/pylib/gfxprim/text/__init__.py index a24cb69..85b149a 100644 --- a/pylib/gfxprim/text/__init__.py +++ b/pylib/gfxprim/text/__init__.py @@ -1,27 +1,42 @@ -from . import text_c +""" +Module extending the Context class with .text submodule and its text drawing functions.
+Use as in "import gfxprim.text; context_foo.text.Text(...)" +""" + +# Import the SWIG wrapper +from . import c_text + +# Constants module from . import C
def _init(module): + "Extend context with text submodule" + + from ..utils import extend, add_swig_getmethod, add_swig_setmethod + from ..core import Context as _context + + # New Context submodule + class TextSubmodule(object): + def __init__(self, ctx): + self.ctx = ctx + self.C = C + + _context._submodules['text'] = TextSubmodule
# Imports from the SWIG module + from ..utils import import_members, extend_submodule 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+$']) + const_regexes = [ + '^GP_[A-Z0-9_]*$', + ] + import_members(c_text, C, include=const_regexes, sub=strip_GP) + + for name in ['Text']: + extend_submodule(TextSubmodule, name, c_text.__getattribute__('GP_' + name))
_init(locals()) del _init diff --git a/pylib/gfxprim/text/text.i b/pylib/gfxprim/text/text.i index fe40996..49335bc 100644 --- a/pylib/gfxprim/text/text.i +++ b/pylib/gfxprim/text/text.i @@ -1,5 +1,5 @@ %include "../common.i" -%module(package="gfxprim.text") text_c +%module(package="gfxprim.text") c_text
%{ #include "text/GP_Text.h"
-----------------------------------------------------------------------
Summary of changes: demos/py_simple/x11_windows.py | 26 ++++++++++++++++++----- pylib/gfxprim/gfx/__init__.py | 5 ---- pylib/gfxprim/text/__init__.py | 43 +++++++++++++++++++++++++++------------- pylib/gfxprim/text/text.i | 2 +- 4 files changed, 50 insertions(+), 26 deletions(-)
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.