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 db503b06e3e5829268f9a75bbb38ceedf15e86c8 (commit) from 568fac5397101c3c4e2a4895ec9dc2375761909a (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/db503b06e3e5829268f9a75bbb38ceedf15e8...
commit db503b06e3e5829268f9a75bbb38ceedf15e86c8 Author: Cyril Hrubis metan@ucw.cz Date: Sat Apr 6 17:27:21 2013 +0200
pywrap: backends: Add rest of the function to backend class.
Signed-off-by: Cyril Hrubis metan@ucw.cz
diff --git a/demos/py_simple/x11_windows.py b/demos/py_simple/x11_windows.py new file mode 100755 index 0000000..ec72e02 --- /dev/null +++ b/demos/py_simple/x11_windows.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python + +import sys + +import gfxprim.core as core +import gfxprim.gfx as gfx +import gfxprim.backends as backends +import gfxprim.input as input + +def redraw(bk): + bk.context.gfx.Fill(bk.context.RGBToPixel(0, 0, 0)) + bk.Flip() + +def parse_events(bk, id): + + print("------ Window {} -------".format(id)) + + while True: + ev = bk.GetEvent() + + if (ev == None): + print("--------------------------") + return + + input.EventDump(ev) + + if (ev.type == input.EV_KEY and ev.val.val == input.KEY_ESC): + sys.exit(0) + elif (ev.type == input.EV_SYS): + if (ev.code == input.EV_SYS_QUIT): + sys.exit(0) + +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) + assert(win1) + assert(win2) + + redraw(win1) + redraw(win2) + + # Event loop + while True: + win1.Wait() + + if (win1.EventsQueued()): + parse_events(win1, "win1") + + if (win2.EventsQueued()): + parse_events(win2, "win2") + +if __name__ == '__main__': + main() diff --git a/pylib/gfxprim/backends/_extend_backend.py b/pylib/gfxprim/backends/_extend_backend.py index b1fab72..adaf96a 100644 --- a/pylib/gfxprim/backends/_extend_backend.py +++ b/pylib/gfxprim/backends/_extend_backend.py @@ -32,14 +32,13 @@ def extend_backend(_backend): @extend(_backend) def PollEvent(self): "Poll the backend for events." - ev = c_input.GP_Event(); + ev = c_input.GP_Event()
if c_backends.GP_BackendPollEvent(self, ev) != 0: return ev
return None
- @extend(_backend) def Wait(self): "Waits for backend." @@ -48,13 +47,28 @@ def extend_backend(_backend): @extend(_backend) def WaitEvent(self): "Waits for backend event." - ev = c_input.GP_Event(); + ev = c_input.GP_Event()
c_backends.GP_BackendWaitEvent(self, ev)
return ev
@extend(_backend) + def GetEvent(self): + "Removes event from the top of the backend event queue." + ev = c_input.GP_Event() + + if c_backends.GP_BackendGetEvent(self, ev) != 0: + return ev + + return None + + @extend(_backend) + def EventsQueued(self): + "Returns the number of events queued in the backend event queue." + return c_backends.GP_BackendEventsQueued(self) + + @extend(_backend) def SetCaption(self, caption): "Set backend window caption (if possible)" return c_backends.GP_BackendSetCaption(self, caption) @@ -63,3 +77,8 @@ def extend_backend(_backend): def Resize(self, w, h): "Resize backend window (if possible)" return c_backends.GP_BackendResize(self, w, h) + + @extend(_backend) + def ResizeAck(self): + "Acknowledge backend resize." + return c_backends.GP_BackendResizeAck(self)
-----------------------------------------------------------------------
Summary of changes: demos/py_simple/x11_windows.py | 54 +++++++++++++++++++++++++++++ pylib/gfxprim/backends/_extend_backend.py | 25 ++++++++++++-- 2 files changed, 76 insertions(+), 3 deletions(-) create mode 100755 demos/py_simple/x11_windows.py
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.