16 January 2012

PyGObject 3.0.3 MinGW

About a year ago I made a big but messy conservative PyGTK AIO now it's time for experimental stuff :-)
After testing GTK-3.3.6, I think they are much closer to a "usable" stage in win32 port. So why don't we try that in python...

Technically this pygobject-3.0.3 is more like pygi in the inside and IMO "PyGI" sounds cooler too ah well..

Here is win32 binary pygobject and pycairo for python 3.2
Downloads: http://opensourcepack.blogspot.com/p/pygobject-pygi-aio.html

24-01-12 Added WebkitGTK3 1.7.4 very unstable due to unstable Glib
20-01-12 Added WebkitGTK3 1.6.1 very unstable due to unstable Glib, added Clutter-1.8.2 and MX-1.4.1
17-01-12 Added GTK3 3.3.6 with broadway and Glade. to use broadway set environment variables: GDK_BACKEND=broadway and BROADWAY_DISPLAY=[some port number]

AIO runtimes for GI, GTK, Clutter/MX, Webkit, Gstreamer, GDA and Telepathy are planned later as well as supplementary apps like Glade-3 and Gtranslator.  And if I in mood maybe a win64 binary too, however installer are not planned (I'm tired of NSIS)

I already played with MX and whooah you should try this OpenGL (bitmap/css skinnable) GUI library! it's very cool, as sleek as QtQuick!

be warned that this is mingw binaries, I'll assume you know the potential issues. Last weekend I've tried to compile python 3.2 with WDK (the infamous msvcrt.dll linking trick) the whole night but given up after several unreferenced functions. OTOH tried to compile the whole GTK3 with mingw against msvcr90 but also failed.


  1. It might be totally obvious to everyone except me, but this doesn't work on x86-64 Python builds. I wasn't entirely sure why it didn't want to run under my main PC, but now I understand and I can do testing and coding on my Windows too, when I have to boot to that.
    Thank you very much for your hard work!

  2. Of course it doesn't :) it's currently 32bit binary as this blog dedicated for.
    I just said "if I have the mood I might make 64-bit version"

  3. could you explain me how did you build it?
    I need pygobject for python 2.x + gtk3 and clutter, maybe I can use your gtk3 and clutter and just recompile pygobject. tanks in advance ;)

    1. Good idea, not sure why i'm ending up with python 3.x that time :( My new mingw toolchain also ready for msvcr90 targeting, time to give it a test too. I'll let you know the progress this weekend

    2. Hi Marcus, apologize that I cant upload it at the moment

      I pick the latest GTK/Glib/pygobject but found a lot of issues, the gtk3 demo even crashed during startup. I was able to compile pygi for python 2.6,2.7 and 3.3 though and all C runtimes was build against msvcr90.dll same as python.

    3. It is possible to use opensuse mingw builds here: http://download.opensuse.org/repositories/windows:/mingw:/win32/openSUSE_Factory/noarch/ ?

    4. I checked pygobject-3.3.91 requierement and it need glib-2.31.x so I think it's possible to use with my old GTK3/clutter runtime here. not tested though

      here is the REPACK:

      next time I will try latest stable instead
      feel free to experiment with 3rd-party GTK builds too ;)
      note: default is python 2.6, you'll need to replace with supplied pyd for other version

      just a thought I think 64bit is also as easy as adding 64bit pygobject/pycairo (opensuse has 64bit gtk build) since bindings were done via neutral typelib blobs?!


    5. Thank you!!
      Working with python 2.6, I've also added GtkClutter from opensuse builds and its typelib from ubuntu and it works!
      In python 2.7 it doesn't work because cairo is for 2.6 (I think), but it's perfect the same :)

    6. I think the cairo file is ok, have you replace the pyd with the one from py27 folder?

      If yes, are you using my pygtk aio by any chance? cause the pygtk.pth won't work together with pygi.pth since python will initialize pygi first (alphabetically) thus will be overridden by pygtk and pygi will get the wrong dlls.

      By the way about the gtkclutter's typelib from ubuntu was it a cross compiled or from linux repo? I think I recall there is dll filename mentioned inside the blob, so I wonder whether it's also OS neutral?

    7. You are right, it works with python 2.7, I hadn't copied all the files before. I think it'll work also with python 3.3, but I haven't tried it.

      You are right again it doesn't work, just import. I have looked for another build but I've just found a cygwin version, but it was linked with other cygxxxxx library.

    8. I tried building clutter-gtk from this source: http://ftp.acc.umu.se/pub/GNOME/sources/clutter-gtk/1.2/clutter-gtk-1.2.0.tar.xz but it gave me a lot of error :(
      Can you help me?

    9. I found out that the crasher of last weeked build is cairo-1.12.x. Downgrading to version 1.10.x fixed it. I'll upload the whole things in the weekend including clutter-gtk

    10. bad news... cluttergtk 1.2.0 (including 1.3.2) apparently only works in X11 at the momment.. there is MX which is native widget for Clutter though, I think it has gtk2 integration.

      I have uploaded most of packages in the main page but win64 binaries is not tested and only gtk. In case you want to test, it would be great

    11. according to this: http://git.gnome.org/browse/clutter-gtk/tree/NEWS (under clutter-gtk 1.1.2), at least clutter integration in gtk should work on windows, but it doesn't too.

      I'm sorry but I only have a 32bit XP.

    12. You're right

      my mistake, I'm messed the headers files when compiling MX which need Clutter < 1.10 (there is 2 clutter in the package) and then accidentally rebuild clutter-gtk which need 1.10. then I get the wrong impression from this msg: "Embedding GtkWidget inside ClutterActor through GtkClutterActor does not yet work on non-X11 platforms."

      I've rebuild it, should work now :)

    13. It crashes if I initialize an Embed, like the old build. I think it's still too unstable...

    14. May i know the use case? what you're embed in?

    15. I just create a GtkClutterEmbed object (http://developer.gnome.org/clutter-gtk/0.91/GtkClutterEmbed.html).These lines if you want to test:
      from gi.repository import GtkClutter

    16. That's weird, I did test something more complex than yours after the rebuild and it works. But your oneliner did crash python but not if run as a file.

      Moreover *.init() thingy sometime can play tricks on you, consider the following example http://stackoverflow.com/questions/9148557/gtkclutter-actor-signals-not-firing

    17. By the way I did test 64bit version and it works :) albeit just a hello world window

      So it's true that the typelib is bitness neutral

  4. This comment has been removed by the author.

  5. Replies
    1. you need the python binding and a matched pair of typelib and runtime.
      binding file is PyGI-, pick for which python version you have, extract to python site-packages folder.
      for example: if you have python 2.6 32bit, then extract both cairo and gi folders inside py26_32 folder into C:\python26\lib\site-packages

      typelibs (GIRepo.7z) and runtime dll need to be installed somewhere (usually a folder already in PATH environmetn), there are many possibilities. But if you want to use my gtk runtime (gtk3_runtime_win32.7z):

      - download gtk3_runtime_win32.7z first and extract the entire content to C:\python26\lib\site-packages
      - download GIRepo.7z extract to C:\python26\lib\site-packages\gtk3
      - rename C:\python26\lib\site-packages\gtk3\libgirepository-1.0-1.dll32 to libgirepository-1.0-1.dll

      that's all

      - webkit typelib in the package is incorrect, even so it's still a crasher
      - mx also incorrectly referenced
      - libfontconfig-1.dll has an issue, but shouldn't affect gtk though

  6. Just to say it again first: Great job. Currently this is the only web page I found to provide running binary stuff for pyGI on Windows.
    I try to use this package to run the next version of Gramps - Gramps 4.0 (see http://www.gramps-project.org/wiki/index.php?title=Main_Page).

    During may trials I've found that the PyGI-3.3.9-AOI and the PyGI-3.3.9 have differences in gi: PyGI-3.3.9-AOI is without gi.version_info - what I didn't understand.

    My trials to use PyGI-3.3.9 and the other stuff with Python 2.7(32 Bit) on Win7 came to the end, because the new Gramps version uses newer versions of pygobject than currently provided by the package (as one of the linux based core developer told: "the underlying gdk is toold"; e. g. a code line pixbuf = GdkPixbuf.Pixbuf.new_from_file (ICON) runs into an error AttributeError: type object 'Pixbuf' has no attribute 'new_from_file'). Sorry, I'm more focused on trial than in writing code so I'm not sure if I did describe all details in the best way.

    At the end my question: Do you plan to rebuild all packages using newer versions of the underlying software?

    Thanks a lot

    1. Yes there is a packaging mess during AIO repack, I think I use pygi 3.0.3 py files with 3.3.91 pyd files.

      My initial intention of this page is to get prepared for MyPaint 1.1 (mypaint.intilinux.com) migration to PyGI, but this eventually failed (http://opensourcepack.blogspot.com/2012/12/a-peek-at-mypaint-on-windows.html).

      Since the error on gtkbuilder is without messsage or warning I'm afraid it was build issue rather than pygi's bug (similar to fontconfig dll crash) so checked my gcc for issues but dunno what to do.

      I will give it a try again when the last stable point release of GTK+ become available, maybe 3.6.5 or 3.6.6?

      glad that this could help other OSS package

    2. my understanding of gi, it is like:
      1. parse C headers for all functions (at this stage Win64, Win32 or linux may have different result)
      2. turn that info into xml (gir files) which is intermediate file for the final typelib file
      3. compile to a typelib which is a binary format

      That way if you encounter errors (attribute error or mismatched thingy) you could check the corresponding gir files first (download GI-, fix it and recompile its typelib (no need for gcc).

    3. Thank you very much for your quick reply.
      My additional and basic problem: I'm really not familiar with recompiling a typelib.
      But I try what ever is possible.
      I looked into "GI-" and have found in "GdkPixbuf-2.0.gir" --> "... constructor name="new_from_file_utf8 ...". So I did change the function calls in the xxx.py from new_from_file to ew_from_file_utf8 and wow: that runs better (until the next error but in an other module!). Do you know more details about such name conventions? Could this be a hint for you which version of this package I have to use in the future?
      Sorry for consuming your time with all these questions. As told before I'm really a beginner doing this.

    4. correct, I remember did that too. For that case the py files is at blame because the gdk-pixbuf C header's macro does intruct Windows version to use redefined function name (but still refer to same function).

      So my guess is that py file is not aware of Windows version :D and you'll face a bit more of these as no official pygi released yet.

      Gir files need to be matched with dll file (as they're created together at compile-time), though this not strictly true.

      to recompile gir you can use: g-ir-compiler --includedir [gir folder] -o [typelib file] [input gir]

      only use g-ir-compiler if the mistake is in gir files, for example to fix webkit's gir which has thw wrong dll filename.

  7. I hope I did understood right: the gir files contain the information of the interfaces of underlying dll and the gir-compiler builds the pythgon typelib based on the gir file.
    If so, is there a tool to transfer these information from a dll to the gir file? Than I could try an higher version of GTK+.
    Or do you know a web page having more details facing this topic.

    I found GTK+ 3.6.1 on http://www.tarnyko.net/en/?q=node/20. May be it isn't also final - but I hope it matches the requirements for the above referenced Gramps project on Windows.

    1. No, not the other way around. With dll you only get function names a.k.a "pexports [dll file]", thats not enough. C headers needed for return type of functions, variable type etc. From headers to gir the process is a bit complicated (g-ir-scanner + gcc) and under windows it's very ugly, though it's possible to replicate manually without the process (using linux' gir for reference).

      You mean "next error but in an other module!"? That's natural for windows you'll need to fix the python files, unless you're sure there is a missing functions.

      BTW what's GRAMPS minimum requirement for GTK+? why you're guessing which GTK+ needed?

  8. It's like expected but not like I hoped: it's just complicated.

    Here are the Gramps minimum requirements:
    + Python 2.7 or greater, Python 3.2 or greater (python version cannot be mixed)
    + GTK 3.0 or greater
    + pygobject 3.3.2 or greater
    + cairo, pango, pangocairo with instrospection bindings (the gi packages)
    + librsvg2 (svg icon view)
    + xdg-utils

    I use Python 2.7 because for 3.x there are some other windows binary packages (e.g. cairo) are not available yet. (May be I didn't find it on the web).
    For the packages like cairo etc. there are no more version information available.
    I assume that a gtk+ 9.6.x meets all requirements also for Windows because I know from an an other user that he runs Gramps version 4.0.0 using gtk++ 3.6.0 on Unbuntu.

  9. Just a comment to your main page for pyGI (http://opensourcepack.blogspot.de/p/pygobject-pygi-aio.html): the link to gtk3_runtime_win32.7z doesn't any more link to a gtk+ 3.3.9! Now there is a GTK+ 3.4.4.
    So the AOI package has to be used instead to run pyGI.

    1. ah yes, I decide to abandon AIO because I think users need to understand how each packages related. And I've updated to GTK 3.4.4 months ago (see marcus comments)

      You should install the newer (non AIO) individual packages as explained to Samuel Taylor above. For cairo/pycairo, it's already included with PyGI- too (also for python 3.3)

      don't use the aio there is a packaging mess as you noticed before.

    2. Ah, now I see my mistake: GIRepo.7z has to be extracted to ...\lib\site-packages\gtk3. I did use ...\lib\site-packages instead.
      I've to repeat my trials.

    3. OK, I switched over to the GTK 3.4.4 AOI package.
      But now I get a crash during start up. I tried to find the region of the crash:
      in gi.types.py line 44:
      def Function(info):

      def function(*args, **kwargs):
      return info.invoke(*args, **kwargs)
      with info "FunctionInfo: " (information from pydev)
      the crash appears with the return.

      Do you have any idea what's to do now? There are no further information.
      Thank you.

    4. I just did quick test with gramps 4.0a3, I got the same pixbuf issue but not encounter your new error. Gramps crashed with several: Pango-CRITICAL **: pango_font_description_better_match: assertion `new_match != NULL' failed @ gramplet/welcomegramplet.py

      Dunno if I have entered the gui or not but I saw gtk already loaded.

  10. Oh, I removed to load the Gramplets at start up following a suggestion of the devs (because I got also a crash by this Welcome Gramplet).

    If you are interested in helping this project there is a mailing list for devs. I think they would be happy to have one in the group having more knowledge for this stuff than I.

    1. the pixbuf stuff I did prevent in pluginmanager.py by:
      if (GdkPixbuf.PIXBUF_MAJOR, GdkPixbuf.PIXBUF_MINOR) > (2, 26):
      pixbuf = GdkPixbuf.Pixbuf.new_from_file (....)
      pixbuf = GdkPixbuf.Pixbuf.new_from_file_utf8 (....)

      to prevent to load the Gramplets I did insert in grampletpane.py:

      after line 1012 a break
      for name_opts in user_gramplets:
      #next break was inserted
      if name_opts is None:

    2. Hi again,

      using Eclipse to debug into the Gramps code I can run it a little bit more but a again there total Python crashes: It looks like the main event loop. Do you have a GTK version including debug symbols? I could try to find out what's going on.

    3. No, I didn't made one

      I'll try debug build for gtk 3.6.4, hopefully this weekend. Do you have suggestion what editor that

    4. ^that could debug python+gtk beside eclipse-based? my choice pyscripter isn't working well with pygi (don't understand typelib)

  11. Beside Eclipse I didn't use any tool to debug Python code, sorry. But Eclipse + pydev runs well for me to debug Python code (breakpoints, step ...).
    For C-like code I have free version of MS Visual Studio installed. The windows crash dump file xxx.mdmp forces the start of this tool. Than one need .pdb files...

    Great to hear that you will investigate more time for this issue.

    1. Hi Helge,

      this time i use 3.6.4 in quite vanilla mode (no LFS no Y3K no msvcr90 linking). And I can run gramps now in my second attempt, but those PANGO CRITICAL msgs are thrown all the time. Since I dunno how to use gramps i just clicking around the left pane menus.

      My first attempt however have gramps crashed, according to gdb it's pixman's sse2 instruction (part of cairo), i have to disable it with "--disable-sse2". But i'm not sure if this is the same error as the previous build which occured @gtk.dll.

      Sorry that I can't upload it at the moment, dwarf-2 debug is very huge, 300MB for just gtk.

    2. oh i forgot, those PANGO CRITICAL can be fixed by using pango 1.32.6 (without freetype/harfbuzz). I can create simple family tree now

    3. Wow, sounds really good. Thank you for your work.
      If I understood right I've to wait until the new binaries available. It would be great if there could be a stable place for this binaries (with and without debug information) because I would like to give the Gramps developer team and also other Gramps users the link to this location (to your working results). I think there are some programmer having a better understanding for the details of your comments than me - I'm not more then the intermediary.

      - Helge

    4. Oh, I forgot to tell you: if you would like to have direct contact to the developer team there is a mailing list "gramps-devel" available: http://www.gramps-project.org/wiki/index.php?title=Mailing_lists#Mailing_lists.

      - Helge

    5. umm sorry, ain't mailing list type guy... I'd rather use irc, but when visit #gramps it's a bit quiet there :D

      the new build AIO

  12. Thank you again very much, Great job!!
    I just did a first run of Gramps using the new binaries without having any issue during start up.
    I'll have to test more next few days...

    - Helge

    1. Hi, I'm back again, because I did found further issues I assume concerning gtk/gdk:
      first I did change all GdkPixbuf.Pixbuf.new_from_file into GdkPixbuf.Pixbuf.new_from_file_utf8 (in ..\gramps\gui\pluginmanager.py and ..\gramps\gui\thumbnails.py). Looking into details of the graphics part it runs mostly good but there are still issues:
      To reproduce using Gramps: goto to the "media" view and use the ADD button on top:
      ** (python.exe:5916): CRITICAL **: pyglib_gil_state_ensure: assertion `_PyGLib_API != NULL' failed

      If I import an old data base (without problems) I didn't see any icon for mime format images (e.g. .jpg) as expected and get: "37845: WARNING: thumbnails.py: line 225: Error scaling image down: 'Pixbuf' object has no attribute 'savev'" occurs.
      I did rename savev into savev_utf8: But only in one or two cases (using a debugger) an icon was created. Mostly I get a Python crash:
      (python.exe:5988): GdkPixbuf-WARNING **: Unrecognized parameter (^\x98\u000b[et) passed to PNG saver.
      (python.exe:5988): GdkPixbuf-WARNING **: Unrecognized parameter () passed to PNG saver.

      That's my Python environment:
      python : 2.7.2
      gramps : 4.0.0-alpha4-r21247M
      gtk++ : 3.6.4
      pygobject : 3.4.2
      pango : 1.32.6
      Not using bsddb3
      bsddb :
      bsddb.db : 4.7.25
      cairo : 1.12.10
      pycairo : 1.10.0
      osmgpsmap : not found
      pyexiv2 : 0.3.0
      o.s. : win32

      It would be great if you again would have time for our problems.
      If it would be helpful I could send you a small data base to import into Gramps.
      - Helge

    2. I got PyGLib assertion error too with mypaint, in the meantime you might want to try my debug environment http://opensourcepack.blogspot.com/2013/01/mypaint-and-pygi.html

      you could adjust it's batch files for gramps

    3. oops gramps need python 2.7 didn't read your post :D.

      well i've some clue about the pyglib issue and about gdkpixbuf i think it's messy to do renaming like that, lets just fix the gir file and recompile the typelib. maybe this weekend i'll make revised version

  13. Following you example for MayPaint I did use gdb (for Python2.7) for Gramps 4.0 and get these results (I don't know if it's helpful for you):
    calling "Add Media" inside the media view
    ** (python.exe:5244): CRITICAL **: pyglib_gil_state_ensure: assertion `_PyGLib_API != NULL' failed

    ** (python.exe:5244): CRITICAL **: pyglib_gil_state_ensure: assertion `_PyGLib_API != NULL' failed

    Program received signal SIGSEGV, Segmentation fault.
    0x6241057f in init_gi ()
    from C:\ProgrammeNeutral\GrampsAIO32_Gramps4\lib\site-packages\gi\_gi.pyd
    (gdb) where
    #0 0x6241057f in init_gi ()
    from C:\ProgrammeNeutral\GrampsAIO32_Gramps4\lib\site-packages\gi\_gi.pyd
    #1 0x62410704 in init_gi ()
    from C:\ProgrammeNeutral\GrampsAIO32_Gramps4\lib\site-packages\gi\_gi.pyd
    #2 0x6240b11c in init_gi ()
    from C:\ProgrammeNeutral\GrampsAIO32_Gramps4\lib\site-packages\gi\_gi.pyd
    #3 0x6240b19f in init_gi ()
    from C:\ProgrammeNeutral\GrampsAIO32_Gramps4\lib\site-packages\gi\_gi.pyd
    #4 0x1e0887c7 in python27!PyCFunction_Call ()
    from C:\ProgrammeNeutral\GrampsAIO32_Gramps4\bin\python27.dll
    #5 0x1e0bfece in python27!PyEval_GetFuncDesc ()
    from C:\ProgrammeNeutral\GrampsAIO32_Gramps4\bin\python27.dll
    #6 0x04a70760 in ?? ()
    #7 0x1e1d9ae0 in python27!PyExc_IOError ()
    from C:\ProgrammeNeutral\GrampsAIO32_Gramps4\bin\python27.dll
    #8 0x624131f4 in init_gi ()
    from C:\ProgrammeNeutral\GrampsAIO32_Gramps4\lib\site-packages\gi\_gi.pyd
    Backtrace stopped: previous frame inner to this frame (corrupt stack?)

    If I try to open the dialogue for an existing media without having an icon yet.
    Program received signal SIGSEGV, Segmentation fault.
    0x74576b0d in strncmp ()
    from C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll
    (gdb) where
    #0 0x74576b0d in strncmp ()
    from C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll
    #1 0x653528c7 in libgdk_pixbuf-2!gdk_pixbuf_rotation_get_type ()
    from C:\Gramps4\lib\site-packages\gtk3\bin\libgdk_pixbuf-2.0-0.dll
    #2 0xababab00 in ?? ()
    #3 0x65364c5c in libgdk_pixbuf-2!gdk_pixbuf_version ()
    from C:\Gramps4\lib\site-packages\gtk3\bin\libgdk_pixbuf-2.0-0.dll
    #4 0x00000006 in ?? ()
    #5 0x08fd6020 in ?? ()
    #6 0x65345d19 in libgdk_pixbuf-2!gdk_pixbuf_savev_utf8 ()
    from C:\Gramps4\lib\site-packages\gtk3\bin\libgdk_pixbuf-2.0-0.dll
    #7 0x65edbab5 in libgirepository-1!g_vfunc_info_invoke ()
    from C:\Gramps4\lib\site-packages\gtk3\bin\libgirepository-1.0-1.dll
    #8 0x65ed9c07 in libgirepository-1!g_vfunc_info_invoke ()
    from C:\Gramps4\lib\site-packages\gtk3\bin\libgirepository-1.0-1.dll
    #9 0x65ec33a5 in libgirepository-1!g_callable_info_invoke ()
    from C:\Gramps4\lib\site-packages\gtk3\bin\libgirepository-1.0-1.dll
    #10 0x65ec43d7 in libgirepository-1!g_function_info_invoke ()
    from C:\Gramps4\lib\site-packages\gtk3\bin\libgirepository-1.0-1.dll
    #11 0x6240ad8f in init_gi ()
    from C:\Gramps4\lib\site-packages\gi\_gi.pyd
    #12 0x6240b19f in init_gi ()
    from C:\Gramps4\lib\site-packages\gi\_gi.pyd
    #13 0x1e0887c7 in python27!PyCFunction_Call ()
    from C:\Gramps4\bin\python27.dll
    #14 0x1e0bfece in python27!PyEval_GetFuncDesc ()
    from C:\Gramps4\bin\python27.dll
    #15 0x04a73788 in ?? ()
    #16 0x1e1d9ae0 in python27!PyExc_IOError ()
    from C:\Gramps4\bin\python27.dll
    #17 0x624131f4 in init_gi ()
    from C:\Gramps4\lib\site-packages\gi\_gi.pyd
    Backtrace stopped: previous frame inner to this frame (corrupt stack?)

    1. One of the Gramps developer give further hints:
      "... but lots of function need "_utf8" sufix like:


      btw. something like:
      where "foobar" not exist badly crashed python.
      Instead of trowing error like:
      gi._glib.GError: Failed to open file 'foobar': No such file or directory
      so most probably GLib typelib is also wrongly made as that also need lots of function and types renaming..." inside the package or later on outside within the Python code

    2. About pyglib i can confirm the one in the mypaint rev2 doesn't have this error, it's mistake, i force pyglib as static lib previously instead of dll.

      for utf8 those are backward compatibility macro (for older gtk2), these missing in gtk3 but since gdk-pixbuf and glib are used/shared by both gtk2 and gtk3, windows' version get inconsistency compared to linux. I have made changes to all those redefined functions in Glib,GModule and GdkPixbuf girs. But i don't have time to upload it right now. While this is against upstream, I think it's justified since python functions/methods basically also a renamed version of C identifier.

    3. Those are just #define name name2 (no change in parameter/type), why with utf8 suffix? maybe because windows doesn't use it internally (maybe there is internal string conversion for windows version). Basically If C apps works, then binding usually works too.

    4. Hi,
      thanks for your work!
      I downloaded pygi-3.4.2_gtk- and GI-
      Is there another package with dev-files for that (headers, libs etc.)?

  14. I tried the new package pygi-aio- and have trouble:
    Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from gi.repository import gtk
    ERROR:root:Could not find any typelib for gtk
    Traceback (most recent call last):
    File "", line 1, in
    ImportError: cannot import name gtk

    comments: all gtk binaries are also inside ..\site-packages\gtk
    and PATH from environment includes now this directory

  15. Try with:
    from gi.repository import Gtk

    Look for names of available bindings in lib\girepository-1.0 minus version number and typelib extension

    1. Sorry, of course Gtk is the right keyword, thank you.

  16. I found strange crash when enabling broadway in gtk, i've rebuild gtk without broadway as rev2 package.

    README file updated

    1. I was just on the way to tell you about a crash and the details I have found. Your new version prevents this issue. Thank you again for your work, good job.

      I'll come back after further trials using Gramps 4.0

    2. Well I have fund a first issue:
      Gtg.py line 1599:
      self.popup_for_device(None, parent_menu_shell, parent_menu_item, func, data, button, activate_time)

      forces a TypeError: cb_menu_position() takes exactly 2 arguments (5 given)

      after that gbd tells by moving the mouse a lot of this message:
      (python.exe:2984): Gtk-CRITICAL **: _gtk_widget_captured_event: assertion `WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
      I've still crashes if I add media. But at the moment it's to early to give you the information about the near conditions. It seems to me it's related to the generation of icons - but I'm not sure

    3. after adding an image in the media view often / mostly I have crash (later the media and the image is available without any issue):
      Program received signal SIGSEGV, Segmentation fault.
      0x72596b0d in strncmp ()
      from C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161_none_50934f2ebcb7eb57\msvcr90.dll
      (gdb) where
      #0 0x72596b0d in strncmp ()
      from C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.6161
      #1 0x6535a0df in libgdk_pixbuf-2!gdk_pixbuf_rotation_get_type ()
      from C:\Python27\Lib\site-packages\gtk\libgdk_pixbuf-2.0-0.dll
      #2 0xababab00 in ?? ()
      #3 0x65372023 in libgdk_pixbuf-2!gdk_pixbuf_version ()
      from C:\Python27\Lib\site-packages\gtk\libgdk_pixbuf-2.0-0.dll
      #4 0x00000006 in ?? ()
      #5 0x772771d5 in ntdll!AlpcMaxAllowedMessageLength ()
      from C:\Windows\system32\ntdll.dll
      #6 0x08ed9568 in ?? ()
      #7 0x6535a997 in libgdk_pixbuf-2!gdk_pixbuf_rotation_get_type ()
      from C:\Python27\Lib\site-packages\gtk\libgdk_pixbuf-2.0-0.dll
      #8 0x09ed0560 in ?? ()
      #9 0x653460dd in libgdk_pixbuf-2!gdk_pixbuf_savev_utf8 ()
      from C:\Python27\Lib\site-packages\gtk\libgdk_pixbuf-2.0-0.dll
      #10 0x65edbab5 in libgirepository-1!g_vfunc_info_invoke ()
      from C:\Python27\Lib\site-packages\gtk\libgirepository-1.0-1.dll
      #11 0x65ed9c07 in libgirepository-1!g_vfunc_info_invoke ()
      from C:\Python27\Lib\site-packages\gtk\libgirepository-1.0-1.dll
      #12 0x65ec33a5 in libgirepository-1!g_callable_info_invoke ()
      from C:\Python27\Lib\site-packages\gtk\libgirepository-1.0-1.dll
      #13 0x65ec43d7 in libgirepository-1!g_function_info_invoke ()
      from C:\Python27\Lib\site-packages\gtk\libgirepository-1.0-1.dll
      #14 0x6240ad8f in init_gi () from C:\Python27\lib\site-packages\gi\_gi.pyd
      #15 0x6240b19f in init_gi () from C:\Python27\lib\site-packages\gi\_gi.pyd
      #16 0x1e015d18 in python27!PyCFunction_Call () from C:\Python27\python27.dll
      #17 0x08b9d030 in ?? ()
      #18 0x1e1f98f8 in python27!PyReversed_Type () from C:\Python27\python27.dll
      #19 0x00000000 in ?? ()

      I'll try to catch more from the Python side but this takes more time...

    4. I have detected one location of crashes from the Python side:
      thumnails.py, line 190
      pixbuf = GdkPixbuf.Pixbuf.new_from_file(src_file)
      pixbuf.savev(filename, "png", "", "")
      ==> crash
      example values:
      (python.exe:1456): GdkPixbuf-WARNING **: Unrecognized parameter (e) passed to PNG saver.
      (python.exe:1456): GdkPixbuf-WARNING **: Unrecognized parameter (\u0001) passed to PNG saver.

      But this doesn't happen for all images (I always use .jpg). I can't see the differences between crash and no crash. In the most cases after the crash I have an .png file having a size of 0 kb.

  17. Oh, I forgot: filename is a unicode string like this:
    E:\\GRAMPS40\\DOK\\DuB\\B00107 Amalie 1910.jpg

  18. I see, so gir file is wrong, it's supposed to be array for savev parameter ( icompare it to linux version) try this patched typelib http://osspack32.googlecode.com/files/gdk-pixbuf.7z

  19. it seems that redefined function name (by c macro) has been borked during gir generation. What a mess

  20. Thanks a lot, the icon issue seems to be solved now,great!

    Sorry for not coming to an end, but I have still the "TypeError: cb_menu_position() takes exactly 2 arguments (5 given)" as written above. Is this also based on this package?
    It's to force in Gramps by going to the People view and activating the black down arrow on the top right side (right to tab "Filter")

    1. I have found a major crash within GtkTreeView if I select multi page TIF images (of course using the Gramps Media list view)

    2. no problem :), that's what it needs, rigor test. Thanks for keep testing!

      I've no idea about the tiff loader, mypaint works fine. Could you point where the python code is?

      I don't about understand cb_menu_position problem, which right to Filter tab? i see only Filter tab in People View did you mean dropdown menu?

    3. the tiff (and other pixbuf formats) is quite transparent (i doubt if it was binding issue) and handled by lower C level i think

  21. Concerning the cb_menu_position problem I've more information:
    Yes there should be a drop down menu containing all possible so called Gramplets (just extensions for the current context).
    I did find also the stack after the mouse click onto this drop down arrow and before the crash:
    1. GRAMPS40\gramps\gui\widgets\grampletbar.py, line 480:
    menu.popup(None, None, cb_menu_position, button, 0, 0)

    2. Python7\lib\site-packages\gi\overrides\Gtk.py, line 1599:
    self.popup_for_device(None, parent_menu_shell, parent_menu_item, func, data, button, activate_time)

    3. Python7\lib\site-packages\gi\types.py, line 47:
    return info.invoke(*args, **kwargs)

    4. and finally GRAMPS40\gramps\gui\widgets\grampletbar.py, line 719:
    def cb_menu_position(menu, button):

    ==> TypeError: cb_menu_position() takes exactly 2 arguments (5 given)

    if I change GRAMPS40\gramps\gui\widgets\grampletbar.py, line 719 to this:
    def cb_menu_position(menu,x,y,z, button):
    ==> I prevent the type error.

    I'm not sure if this is an issue of the Gtk package.

    The multi page tiff is issue is quite more difficult, because I have 'never come back' error. Also gdb doen't run after this crash. I'll see how point out more details next time.

    1. More information concerning the tiff issue:
      Having a multi page tiff this line causes a crash without any come back or information
      pixbuf = GdkPixbuf.Pixbuf.new_from_file(src_file)
      with src_file equals a legal existing multi page tiff image file.

      The final crash is in python27\lib\site-packages\gi\types.py, line 76: return info.invoke(cls, *args, **kwargs)

      PS: The MyPaint version for Gtk3 I've downloaded a few days ago doesn't allow to open tiff images.

    2. yes mypaint doesn't allow it by default, it need little adjustment in filehandling.py nad document.py (replicating jpeg load as tiff)

      may be you send me the tiff file?

    3. Well, I did further trials and it's more simple than I thought before: I can't handle any tif image!
      Just try this in Gramps:
      1. start Gramps
      2. activate the media view by a click on the media button on the left side
      3. on the top menu bar click on 'add media' --> a file browser occurs
      4. select a tif image --> crash without any response
      it seems to be always in "pixbuf = GdkPixbuf.Pixbuf.new_from_file(src_file)" (on the way to generate a thumbnail


      Do you have any idea concerning the "TypeError: cb_menu_position() takes exactly 2 arguments (5 given)"?

    4. Oops, you're right while mypaint could load tiff it doesn't generate thumbnail! but since it doesn't hang/crash I didn't pay attention of it. I try vanilla build of libtiff here http://osspack32.googlecode.com/files/libtiff-5.dll

      it should work now

      about cb_menu_position(), that's should be confirmed in linux version first (ask linux user?), since that 5 arguments is ruled in pygi's override files which apply to all platform

    5. about cb_menu_position(): you are right, that's a global issue in Gramps not in your package

  22. I'm sorry, but the new dll doesn't solve the issue. If one walk in Gramps (after media view --> add media, see description above) through the file selector to add a file and touch a tiff file there is a function scale_image(path, size) in ..\gramps\gui\editors\addmedia.py. This function calls in line 229:
    to generate the thumbnail for file browser. The crash occurs then in python27\lib\site-packages\gi\types.py line 76:
    return info.invoke(cls, *args, **kwargs)

    Do we need a new typelib also?

    1. Ok now this is weird, i test gtk2 mypaint and it works, so i think gtk3 should too, but it's not. when i tried older tiff (3.x) it works with both gtk3 and gtk2 mypaint, so i'm puzzled now :(. i think new_from_file is Ok as all supported format read transparently the same at higher level.

      I will try to dig this later with gramps

    2. Hmm, with tiff 4 gramps is hang while tiff 3 crashed. Odd how this different to mypaint and it's hard to trace the error. I made alternative build of gdk-pixbuf which use windows gdi+ backend, consequently loading all but png, jp2000 and svg will be slower. But it works with gramps


    3. Thank you, that looks very good: thumbnail generation for all my single and multiple page tiff images did just come to the end without trouble. Also the media add runs well.

      I'll go ahead for further trials.

  23. Tuma, just a question: Do you know how to get any language-pack-gnome-xx (e.g. language-pack-gnome-de) for this Gtk package?

    1. What's that?
      Google only show ubuntu thingy... I don't think ever heard/used that before, sorry

    2. Well I found it: the contend of the so called linux package will be provide with your pygi-aio-3.4.2rev4-opt.7z in gtk\share\locale\
      I stored a copy in C:\Python27\Lib\site-packages\gtk\share\locale and have e.g. all default labels for any button also translated now.
      I think it would be a good idea to be complete to put this folder also to the binary package next time.

      And again I have a new question: What kind of spell checker does the package support and where to place the spell files? Also the Gedit doesn't provide any language for the spell checker even the spell select dialogue is available.

  24. Again concerning about cb_menu_position(): There was an misunderstanding on my side. It's really an issue of your Win package only. One of our programmers did provide an typlib and gir file preventing this issue. See the files as part of this

    It would be nice to have this integrated some one into your package.

    1. Ah that's a bad news, GtkMenuPositionFunc isn't part redefined function names, that means lot of these kind of gir defects are waiting to be found. I will try to find out why this is incorrectly generated at compile time. I include this fix in the next rev. Thank You

      About the uploads, well at the moment 25MB-30MB is the max limit that my home connection could afford. so I splitt it based which could barely run and which optional(locales,docs etc). Spells is english for aspell (included in *opt file under lib\aspell-0,60) and for myspell/hunspell dict you've to get it somewhere and put it under share\enchant\myspell (i think)

    2. OK, if you are limited for the upload there will be the need of such splittings.

      Having the spell object without any spell dictonary results in warnings/errors:
      C:\ProgrammeNeutral\eclipse\plugins\org.python.pydev.debug_2.5.0.2012040618\pysrc\pydevd_resolver.py:164: Warning: static type `GtkSpellChecker' unreferenced too often
      names = dir(var)

      ** (python.exe:6632): CRITICAL **: check_range: assertion `spell->speller != NULL' failed

      It seems to me there is no default fall back without having any spell check dictionary. To force that in Gramps one has to activate the Note view and add any note and use the right mouse button context menu to activate 'spell checker ON'

      I tried to reuse share\enchant\myspell from the Gtk2 of the former Grams package (GrampsAOI3.4.2 32bit) without any effort / with the same result. Also Gedit doesn't provide any document internal language at the same time. But Gedit having no spell dictionary seems to run without any further issue.

    3. In ...\gtk\lib\enchant I did find several libenchant_xxx.dll (e.g. libenchant_myspell.dll) but non of them can be used in ...\gtk as libenchant.dll to run Gedit using a spell checker.

  25. I've found a new issue concerning Gtk.TreeStore.set_value(self, treeiter, column, value):
    In the past (Gtk2) did the former used function accept "value equals None". In such cases it seems the value was handled like: value = ''. Doing some thing like this would prevent this error:

    File "C:\Python27\lib\site-packages\gi\overrides\Gtk.py", line 1298, in set_value
    Gtk.TreeStore.set_value(self, treeiter, column, value)
    File "C:\Python27\lib\site-packages\gi\types.py", line 47, in function
    return info.invoke(*args, **kwargs)
    TypeError: Argument 3 does not allow None as a value

  26. And here I'm again having a new issue:
    For Reports --> Text Reports and also for Reports --> Graphical Reports using output format PDF I get this:
    (python.exe:5560): Pango-CRITICAL **: pango_win32_font_map_get_font_cache: assertion `font_map != NULL' failed
    Pango:ERROR:pangowin32.c:831:pango_win32_font_finalize: assertion failed: (win32
    font->fontmap != NULL)

    This application has requested the Runtime to terminate it in an unusual way.
    Please contact the application's support team for more information.

  27. I've found an other naming mismatch:
    The known packages here uses "GdkPixbuf.Pixbuf.pixbuf(start_x, start_y, end_x-start_x, end_y-start_y)"

    your package provides "GdkPixbuf.Pixbuf.new_pixbuf(start_x, start_y, end_x-start_x, end_y-start_y)"

  28. - treestore set_value: at gir level, linux is no different. Can you confirm this with linux?

    - font cache: normally fontconfig automatically pre-scanning your fonts and create cache during initialization, this seems not the case here and something wrong, try run gtk\fc-cache manually.

    - gdk-pixbuf: i don't find new_pixbuf at the gir, which one you're talkin about?

    - spell: oops i build it the wrong way, it use hardcoded path (work for me not for anyone else), try this one http://osspack32.googlecode.com/files/libenchant.dll

    1. Let me answer backward:
      - spell check: I did use the new dll and C:\Python27\Lib\site-packages\gtk\share\enchant\myspell and the dictionaries will be found. Great!
      But there are still two issues in Gramps I have to catch in detail:
      1. in some cases I switch the checker on/off Gramps crashes
      2. I can select a new language for the checker but this won't be stored. And there is a warning:
      (python.exe:7624): Gdk-WARNING **: gdkwindow-win32.c:1833: SetWindowLongPtr failed: Ungültiges Fensterhandle [=dirty? window handle]
      Could there be too a path issue?

      - GdkPixbuf.Pixbuf.pixbuf: see GdkPixbuf-2.0.gir method name="new_subpixbuf" c:identifier="gdk_pixbuf_new_subpixbuf"

      - font cache: gtk\fc-cache doesn't matter. You may try this at your pc
      1. start Gramps
      2. activate the person view
      3. add one person
      4. select the person
      5. run the report: Reports --> Graphical Reports --> Ancestor Tree..

      I found wrong pathes in pygi-aio-3.4.2rev5.7z\gtk\share\libwmf\fonts\fondmap, e.g.:
      ...format="type1" metrics="/c/Programs/GTK16/share/libwmf/fonts/n019003l.afm" glyphs="/c/Programs/GTK16/share/libwmf/fonts/n019003l.pfb" name="Helvetica" fullname="Helvetica Regular" familyname="Helvetica" weight="Regular" version="0.1"...
      Does this matter? Where are the fonts stored?

      - Gtk.TreeStore.set_value: I'll still on the way to ask for the linux state

    2. No its not related to pango and i think that file can't be helped :). btw the issue was win32 module and not fontconfig/freetype module of pango, but I don't know why it has invalid fontmap. Look like windows only issue.

      on the other hand, i think gedit remember enchant language selection setting so it maybe gramps' issue?

    3. I switched over to the new packages (February 20, 2013).
      I think you should also change the link for pygi-aio-3.4.2rev4_opt.7z to it's new version.
      It looks good to go ahead.
      One question to the new package: You didn't use Gtk-3.0.typelib as suggested by our developers to prevent the "cb_menu_position in grampletbar.py: takes exactly 2 arguments (5 given)" error. From our side it looks lie a general issue. What's your suggestion, will you change this as provided by us (see downloads on http://www.gramps-project.org/bugs/view.php?id=6429) or will stay with your version?

      For the spell checker issue I'll do more trials with Gramps and see what I can catch.

      The same for the font issue.

      Gtk.TreeStore.set_value: We have decided to fix this in the Gramps code because it happens also in linux.

      I got a new error if I tried to use goocanvas:
      ** (python.exe:7972): WARNING **: Failed to load shared library 'goocanvas-2.0.dll' referenced by the typelib: `goocanvas-2.0.ddll': The module wasn't found (or some thing like this).
      ==> There seems to be a typelib error 'ddll' instead 'dll'

    4. Oops you're right, fixed with rev7, i forgot to recompile it after editing gtk's gir. sorry

      more about font issue, i did little debugging here and found the fontmap part was never skipped but it said to be NULL, so i'm a bit lost there. Maybe i should filed pango bugreport...

    5. I got the new binaries - looks good for the first quick shot. (It's to late to do more today.
      The link behind pygi-aio-3.4.2rev7_opt.7z doesn't match any legal address.

      New topic: For our project we will use (currently on the linux side only) GExiv2 as addon for the gi.repository.
      Are you interested to add this staff too. So far I found the project page is here: http://redmine.yorba.org/projects/gexiv2/wiki and the sources are there: http://www.yorba.org/download/gexiv2/ libgexiv2-0.5.0.tar.xz

    6. sure, and if you found other gi-based packages please let me know too. thanks

      the *opt link should work now

    7. Tuma, I really won't generate any pressure to you. It's only to know how it is: Do you see a chance to include Exiv2 into the package in the near future?
      Thank you.

    8. please test

    9. Thank you, first trial looks good. I get the version info after import. I'll go on to check the functionality inside Gramps where I don't have the expected result at the moment. But this may a Gramps issue too. I'll come back if I have more information.

      Question: I did place the gir file into the new folder C:\Python27\Lib\site-packages\gtk\share\GExiv2-0.4
      Is this OK?

    10. about GExiv2:
      I use
      metadata = GExiv2.Metadata.new()

      than I try

      I see get_exif_tags in the gir file but in this case I get the error 'Metadata' object has no attribute 'get_exif_tags'

      metadata.get_exif_tag_interpreted_string runs well

      How is this to understand?

    11. yes, another incorrectly introspected :( marked as unitrospectable

      I have observe how it generated, but still can't find the pattern why/when it goes wrong. To me it almost random, I mean even when the comment block (annotation) look the same one may fail and other may works... puzzled

      I'm thinkin of using all girs except the main four (glib, pango, gtk, gdk-pixbuf where there is some difference between linux and windows) from linux distro of the same version and change only the header section (dependencies and dll filename) for the next rev, even if there is linux thingy in the gir, it shouldn't matter as long as not actually/accidentally used/called... i think.

    12. Well I've found a way to use GEXiv2 as it is for Gramps using some thing like this
      metadata = GExiv2.Metadata.new()
      get_human = metadata.get_exif_tag_interpreted_string
      human_value = get_human(key)
      label = metadata.get_exif_tag_label(key)

      The only special thing is, it's just used for read-only actions only. The add-on to write Exif data is not available yet. SO I don't know when I go ahead to validate write actions.
      So finally for the first part of trials: Good job and thank you.

  29. It works with my really complex app but i have always a freeze when i try to resize or move windows. webkit crashes but the old one its almost fine. Thanks

  30. ( sorry for the OT ) Hege, can i contact you about to make OSX bynari of a python gtk, complex app like your gramps ?

    1. This comment has been removed by the author.

    2. Sorry, I did delete the wrong reply.
      As I told before: I'm sorry but I whether know to build the binaries nor do I know OSX. There is larger core developer team to support Gramps and I more focused on trials using Gramps on Windows.

  31. I just play around the web kit: self.renderer.open(url) with an url pointing to an file on my pc runs well.
    If I try any address on web for url I get python crash.
    Do you have any idea?

    1. try using the old one that is in the pack, the default crash with me too

    2. Thanks for the hint. The old one means?

    3. see readme.txt file (i already mention about that issue)

    4. I did try pygi-aio-3.4.2rev7-opt\dev\lib\libwebkitgtk-3.0-0.dll.b
      But here I get a crash during the init:
      self.window = webkit.WebView()
      TypeError: could not get a reference to type class

      ==> do I need other stuff to change too?

      BTW could it be that the hint in the readme is lost?

    5. @m3nt0r3 you resizing windows crash issue, could it related to this (see my comment) http://opensourcepack.blogspot.com/2012/06/rsvg-convert-svg-image-conversion-tool.html

      while in most case resizing is fine, in particular case it crashed.

      the crash of webkit-1.10.2 seems related to JIT as fedora maintainer mnetion, and I rebuild that so 1.8.3 will removed in the next rev.

      @Helge: your osm-gps-map link, seems to be gtk2 thingy ans hold your webkit trials :) i will update the package tonight using mostly refreshed typelibs and proper webkit-1.10.2

    6. Tuma, I tried pygi-aio-3.4.2rev8.7z but got this:

      Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win 32
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from gi.repository import GObject
      Traceback (most recent call last):
      File "", line 1, in
      File "C:\Python27\lib\site-packages\gi\__init__.py", line 27, in
      from ._gi import _API, Repository
      ImportError: could not import gobject (error was: 'DLL load failed: Die angegebene Prozedur wurde nicht gefunden.') [the procedure wasn't found]

      Gedit runs well.

    7. pygi-aio-3.4.2rev8.7z misses some dll against pygi-aio-3.4.2rev7.7z, e.g.: libgstapp-0.10-0.dll
      Does this matter?

    8. No, I have removed old webkit, spice and old gstreamer in rev8

      try run it under depends.exe http://www.dependencywalker.com/ it will spot which dll failed (marked as red), you could pass argument to python.exe before profiling (F7).

    9. depends:
      LoadLibraryExA("c:\python27\lib\site-packages\gi\_gobject\_gobject.pyd", 0x00000000, LOAD_WITH_ALTERED_SEARCH_PATH) returned NULL. Error: Die angegebene Prozedur wurde nicht gefunden (127).

      LIBINTL-8.DLL is marked red
      __mingw_vsprintf Ordinal: N/A Hint: 15 (0x000F)

      I hope that's helpful.

    10. You're right, that pyd should not call libintl, fixed

    11. Thank you, it runs now behind this issue.
      So far I see during the first short actions the external web page will be loaded now but crashes immediately. May be it's related to your comments to OsmGpsMap.

      I'll try it more this evening. Than I'll also have look at all the OsmGpsMap related stuff. Thank you again.

  32. Tuma, there is an other add-on for gi.repository we are looking for: OsmGpsMap

    best link I have is: http://nzjrs.github.com/osm-gps-map/

    It would be great to have this too (after having a running HTMLrender / webkit)

    1. Well, in the discussion forum regarding osm-gps-map there is an older thread where some Gramps developers (last one: S.Noiraud) worked on this package for GTK3 on linux.

      I'm hopeful that John Stowers would also support the package for Win.

    2. ahh I see, will give it a try, btw there is map widget called champlain in this aio package, dunno if it can be used by gramps.. may be considering if osm-gps-map not finished yet.

    3. http://code.google.com/p/osspack32/downloads/detail?name=osm-gps-map-git.7z&can=2&q=

      but crashed when window resized, seems related to what m3nt0r3 mentioned

    4. https://mail.gnome.org/archives/gtk-list/2012-July/msg00002.html

    5. wow, I couldn't force any crash for osm-gps-map!!! It seems to me I have smooth soltuion.

      I get a lot of such messages:
      (python.exe:10676): OsmGpsMap-WARNING **: Error getting missing tile

      But it doesn't matter.


      But the crash for the webkit is still available. So it's based on other issues?

    6. Not sure.. there might be 3 different symptoms: between XP or Vista/7 threading, between enabled "show window content" or disabled desktop setting, and for webkit it's probably binding level error because the C level is OK (excluding window resize issue), you could try test\gtklauncher.exe

    7. gtklauncher runs well and without any issue. In Gramps it doesn't work.
      osm-gps-map: In gramps I get some warnings if I use the map:
      (python.exe:2816): OsmGpsMap-WARNING **: Error getting missing tile
      I assume it's an timing issue. If we could prevent this it would be a great solution for me: I did chage zoom, maps etc. What ever I did: no issue!

      Also champlain-gtk.exe runs well. But regarding this I got the answer from the Gramps developer they didn't provide any interface for this package up today.

    8. This comment has been removed by the author.

    9. This comment has been removed by the author.

    10. It was a wrong idea to post all error details into this blog. I provide the details by a dropbox link now.

      about webkit I have (may be helpful) additional information using gdb (sorry there some unexpected newline character because of the limits of the Win console):
      Because I'm not so familiar with gdb I don't know all parameter to optimize the output. If you have any hint to improve the output information you are welcome.

  33. I solved the windows freeze and crash.
    I commented the threads part in the main launch function in my code:
    and now the app works smooth!.

    thanks TumaGonx.
    I read in the PyGtk ML a post about your and Helge work to bring some help to you.

    1. Looking in the osm-gps-map i think you can solve changing the if in related to the threads too like in mine app.

      line 227 :
      if __name__ == "__main__":
      u = UI()
      if os.name == "nt": Gdk.threads_enter()
      if os.name == "nt": Gdk.threads_leave()

    2. Thank you for your support. Do I assume right that's a hint for the binaries?
      Within the Gramps Python code I find none of this lines:

      Is there an implicit way to start threading by a config file?

  34. They are of the osm-gps-map code like TumaGonx compiled/packed and deprecated. windows daesnt like threads :)

  35. Hi Tuma,
    we have this code crashing at the end with: "unknown signal name: expose_event":
    self.gtklayout = Gtk.Layout()
    # Required for drag-scroll events and popup menus

    self.gtklayout.add_events(Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK | Gdk.EventMask.BUTTON1_MOTION_MASK)
    self.gtklayout.connect("expose_event", self.gtklayout_expose)

    Does your code use an other name for this event or is there a miss?
    Thank you.

    PS: About the suggestion from M3nt0r3 - Is this a way for you to go ahead?

    1. Sorry I'm a bit focused on my mingw toolchain lately :D so i can't give help about webkit... did you meant 'draw' instead of 'expose_event' ?
      see cairo-demo.py in the main page it's a little different

    2. Oops I've accidentally removed the pygi example code... sorry

      you could see them in PythonGTK3Tutorial via devhelp

    3. Duh it's not even explained in the tutorial too. I add the example code again now

  36. About 'draw' instead of 'expose_event':
    the code runs a few lines behind this and than I get this before I can really check if it runs using 'draw'

    'gi.repository.Gdk' object has no attribute 'ACTION_COPY'

    the python line looks as this:
    [t.target() for t in DdTargets._all_text_types],

    Do you have any idea?
    Thank you.

    PS: Of course you are focused meanwhile on other topics. I'm thankful for any help and all your support. Without you I wouldn't have any results. And so you are the master of schedules. It would be nice if you could give me an idea how long I have to wait and of course I'll do that.

    1. It seems to me that you're running a chunk of pygtk remnant code? it's supposed to be Gdk.DragAction.COPY

      I suggest you read "The Python GTK+ 3 Tutorial" from devhelp above, it also cover many things that changed from pygtk to pygi.

      For, webkit basically I'm confident that at C level it works fine, so the workaround may be at python level. I don't know if it was threading issue for webkit though

    2. Oh, I see this part of Gramps (it's an third party addon) is still coded for GTK2. Thank you for the hint regarding the tutorial.

  37. Tuma, I hope I have found some thing regarding the pango_win32_font_map_get_font_cache issue:

  38. BTW: Would it be a good idea for you to put the link to your binaries also there:
    I assume there is a larger group looking for gtk+ 3.6.4 for Win there.

  39. Spot on Helge! that's the issue. but I can't test it anytime soon, maybe by weekend. Thanks

    I've add shameless self-promotion in the SO page :))

  40. Tuma, I still fighting the webkit error without any success. I try the same Gramps python code on Ubuntu 12.10 using the same python version as for Win (2.7.3). No crash using ubuntu. Within the python code I don't find any line to place a 'if win(): ...' to resolve.
    For Ubuntu it looks in this way:
    python : 2.7.3
    gramps : 4.0.0alpha5
    gtk++ : 3.6.0
    pygobject : 3.4.0
    pango : 1.30.1
    Not using bsddb3
    bsddb : 5.1.2
    bsddb.db : 5.1.29
    cairo : 1.12.2
    pycairo : 1.8.8
    osmgpsmap : not found
    GExiv2 : 0.4
    ICU :
    PyICU : 1.4
    o.s. : linux2
    kernel : 3.5.0-26-generic

    Please, could you spend some few minutes for a short trial using Gramps (last svn) on Win and using your debug environment in parallel:
    1. On left side push 'Web' (last entry)
    2. then on the upper right of the web widget push the 'apply' button

    Or may be it's also a way ahead: May I have a libwebkitgtk-3.0-0.pdb file? I'm not so familiar to that, but I can use the MS crash dump to jump into the MS Visio Studio to see more.

  41. Helge, the people at SO seems don't like blogger, lol. I got thumbed down already :(, dunno why maybe because mine is not installer? oh my

    BTW there is no pdb in mingw binaries (or I misunderstand you?), sadly I can't create debug dll too, it's way too big to fit my RAM. Hopefully I will test pango and gramps today

    1. I take my word back, I feel really unappreciated and humiliated at SO.

      It kill my mood instantly, maybe it's just me. Sorry Helge, I believe Dieter will come to save eventually.

    2. Tuma, after the all comments of the admin Emissary I really understand your feeling and I'm more than unhappy that I did give you the idea to put a link to your very good work there. I did post a comment regarding equal treatment into this thread.

      I don't understand the meaning of "I believe Dieter will come to save eventually."

    3. Helge, I put rev11 for the pango issue. just in case

    4. Tuma, that looks good! Thanks a lot.
      I still have to do some trials. But, during I printed some reports I didn't get any pango crashes!
      I'll come back if I finished.

    5. Well no more Issues found today. Gramps 4.0 starts its beta now using your package for Win!

      BTW: The link behind "pygi-aio-3.4.2rev11.7z (binary only)" points still to pygi-aio-3.4.2rev10.7z

    6. Glad to hear that, it can't be done without your persistent tests and hints too :)

      link fixed

  42. Hi Tuma,

    it's some weeks ago having contact. I hope you are well.
    Facing Gramps it looks good, because I still run it using your binaries! And I know that also other users started to run the same code. So again thank you for all your work done in the past.

    Nevertheless I have to commit a new error ->
    Using libgoocanvas causes an crash in this case:
    The GraphView of an ancestry will be displayed nice and smooth for any first(!) time after starting Gramps. But than after on the way to any changes (scale up or down, redraw after change the view to an other graph type and back, trying to change the content) the crash occurs. Using the debugger I always get this:
    Program received signal SIGSEGV, Segmentation fault.
    0x6e39d3ad in libgoocanvas-2!goo_canvas_get_type ()
    from C:\Python27\Lib\site-packages\gtk\libgoocanvas-2.0-9.dll
    (gdb) where
    #0 0x6e39d3ad in libgoocanvas-2!goo_canvas_get_type ()
    from C:\Python27\Lib\site-packages\gtk\libgoocanvas-2.0-9.dll
    #1 0x6e39fa2d in libgoocanvas-2!goo_canvas_scroll_to ()
    from C:\Python27\Lib\site-packages\gtk\libgoocanvas-2.0-9.dll
    #2 0x65edbab5 in libgirepository-1!g_vfunc_info_invoke ()
    from C:\Python27\Lib\site-packages\gtk\libgirepository-1.0-1.dll
    #3 0x65ed9c07 in libgirepository-1!g_vfunc_info_invoke ()
    from C:\Python27\Lib\site-packages\gtk\libgirepository-1.0-1.dll
    #4 0x65ec33a5 in libgirepository-1!g_callable_info_invoke ()
    from C:\Python27\Lib\site-packages\gtk\libgirepository-1.0-1.dll
    #5 0x65ec43d7 in libgirepository-1!g_function_info_invoke ()
    from C:\Python27\Lib\site-packages\gtk\libgirepository-1.0-1.dll
    #6 0x6240acbe in init_gi () from C:\Python27\lib\site-packages\gi\_gi.pyd
    #7 0x6240b0e3 in init_gi () from C:\Python27\lib\site-packages\gi\_gi.pyd
    #8 0x1e015d18 in python27!PyCFunction_Call () from C:\Python27\python27.dll
    #9 0x07d5bae0 in ?? ()
    #10 0x1e1f98f8 in python27!PyReversed_Type () from C:\Python27\python27.dll
    #11 0x00000000 in ?? ()

    (Trying the same using the linux version of Gramps doesn't cause the crash)
    Do you have any idea?
    Thank you.

    1. Welcome back Helge

      I've migrated to Win7 (at home) finally! (oops I have to change the blog title). I still have fairly "clean" system at the moment, so could you provide a zip of your running gramps? the last time I tried gramps I'm a bit loss :p with the setup.

  43. Here is the link to the description 'How to install Gramps 4.0 on Win' (btw: any comment to the description is welcome too): http://www.gramps-project.org/wiki/index.php?title=Gramps_4.0_from_source_for_Windows_using_Python_2.7.3

    We don't have an All-In-One installer for Win up to now. It's still before a final user version.
    I'll try to put all parts together into one main folder in the next few weeks to prepare such an installation for the next phase.
    I still get the python code by svn so there is a lot of svn stuff in between therefore I couldn't provide the code by a simple action.
    The GraphView is an addon what should be available by 'Gramps --> Edit --> Preferences --> General' with 'What to check' equals 'New and updated addons' and using the Check-Now button. But I think we should look for this addon after you have a running Gramps.
    If there is any question - please ask.
    - Helge

  44. Hi Tuma,
    I was faster than thought to have an All-in-One package (no installer) for Gramps 4.0.1.
    May be it's helpful for you:

    See the included readmeFirst.txt for the necessary step to adapt to your system.

    1. Hi Helge, it started fine
      I crated a family tree, a spouse and a child. Installed GrampsView addons. Restart.

      Now how to test it? is it a gramplet?

    2. How to:
      On the left side activate Charts.
      In the menu bar on top there are now several new buttons.
      Push the Graph View button to activate the view we want to test.

      btw: Did you use the AiO package or the stepe by step way? It's just to know if the package is helpful.

      Question: I tried to run the GTK having the binaries in the same folder as Python to have a better sorted package.
      But even if I start Gramps having the base in this folder (the python folder) the gtk binaries were not found.
      With the former gtk2 this was possible. Do you have any idea?

    3. Hmm If I recall I have used gir from linux already for goocanvas the autogenerated one also fail me, however the C demo program looks good. The case is similar to webkit, I will have a look at grampview python code more.

      About the aio, to put gtk in root is bad cause you will mix two "lib" folders. You can put gtk like graphviz though, just add its path to %PATH%. However there is posible runtime clashes since graphviz bring its own gtk runtime you need to put gtk path before graphviz's since gtk's is newer. Or you may consider using my single exe dot build http://osspack32.googlecode.com/files/dot.exe to prevent clashes.

      The batch file will looks like:

      set LANG=en_GB
      rem set LANG=de_DE

      set GRAMPSHOME=%~dp0

      set path=%path%;%~dp0gtk;%~dp0graphviz

      python -O gramps.py -v
      rem python -O gramps.py -l
      python -O gramps.py

      Note the use of %~dp0, this way users don't need to change anything in the batch file.

      One more note, I think LANG should be autodetected inside gramps, somethin like locale.getdefaultlocale()[0]

    4. As I told before using linux and Gramps there is no goocanvas issue known.

      I know the problem with dot.exe and gtk3. My first idea was too to use such a batch like your suggestion. But for the final solution and an installer I would prefer a solution without batch. So I'll have too a look at your single dot.exe. If this works for us I can leave the gtk binaries where they are and after having the auto detection for language we are ready for an installer!
      I already placed the auto detection issue into the bug tracker as pre-condition for an installer. The issue is already accepted.

      Meanwhile an improved batch would help other users.

    5. yes I knew, I was thinking threading issue which win32 and linux behave differently as mentioned m3ntor3 previously.

      I see, I never tried py2exe or pyinstaller with pygi before, but usually those will try make the way you originally want though.

    6. I tried your mentioned http://osspack32.googlecode.com/files/dot.exe. But it's an older version (2.16) and used with Gramps 4.0.1 I get empty sheets.

      BTW: Using version 2.30.1 as suggested on my wiki page I get empty pages for LANG=de_DE. Version 2.30.1 works well for LANG=en_GB. I'm not sure if there is an utf8 encoding issue in Gramps 4.0.1

    7. I have to correct myself: the empty sheets seems to be a pure Gramps issue. For LANG not equal en_GB there are by default wrong size values for default paper sizes as letter, A0, A1.... As work around the user has to select the the user defined size with correct values.
      I have to file an issue and to repeat my trials...

  45. Hi Tuma, I still hope you see a chance to solve the libgoocanvas issue.(Don't worry about my question I know it's summer time and it's a difficult issue too).

    Today I have also a question regarding your gtk package: There is a libxml2 as part of gi. There are gramplets in and also test modules for Gramps using libxml2. As I tried to change the "import libxml2" to "from gi.repository import libxml2" (this works so far) I learned there was also a libxlt in use before. I didn't find the typelib or the dll for libxslt within your package. Do you know any thing regarding this new issue?
    Thanks Helge

    1. Yes, there are some libxml/libxslt bindings:
      The popular lxml (which unrelated), the one come from the original libxml2/lixslt C library (which has no official binaries) and libxml2 gir shim that bundled with GI (which preceded by "from gi.repository")

      There is no bundled libxslt gir AFAIK neither the original libxslt provide GI binding, though some DLLs do depend on it (in this case I have it linked statically). So it could mean the original libxslt binding (aka libxsltmod). I could provided that one if that's the case.

    2. I have to spent more time on it.
      I tried to run setup.py test.
      If I try "from gi.repository import libxml2" instead "import libxml2" and without libxslt I get this error:
      ERROR: test_place_merge (gramps.gen.merge.test.merge_ref_test.PersonCheck)
      Merge two places
      Traceback (most recent call last):
      File "D:\EclipseWorkspace\Gramps4.0nativPy2.7.3\gramps\gen\merge\test\merge_ref_test.py", line 200, in setUp
      File "D:\EclipseWorkspace\Gramps4.0nativPy2.7.3\gramps\gen\merge\test\merge_ref_test.py", line 81, in base_setup
      File "C:\Python27\lib\site-packages\gi\module.py", line 269, in __getattr__
      return getattr(self._introspection_module, name)
      File "C:\Python27\lib\site-packages\gi\module.py", line 115, in __getattr__
      self.__name__, name))
      AttributeError: 'gi.repository.libxml2' object has no attribute 'keepBlanksDefault'

      But than I found a this: libxslt package including libxml2 from: http://users.skynet.be/sbi/libxml-python/
      This seems to run well with my python 2.7.5 but I'm not sure because I didn't check all.

    3. Yes, that's the binding that I talking about.

    4. I tried to change the code to use libxml2 from gi. But I didn't found the right functions. Doing this I found this issue information about the help function of gi:
      I think we have the same issue:
      python -c "from gi.repository import MyModule; help(MyModule)"
      doesn't provide all attribute information (see also http://comments.gmane.org/gmane.comp.gnome.python.devel/198)
      On the bugzilla page there is a patch provided reagarding this issue.

    5. Alas, in windows case docstrings are the one with serious problem, too many missing/mangled docs when diffing with linux version's gir so I don't bother to fix them (also because they're not compiled in typelib).

    6. OK, that's to understand.
      But I need a hint.
      I try using pure python 2.7.5:
      from gi.repository import libxml2
      that's OK
      Than there should be available some thing like this:
      >>> libxml2.xmlKeepBlanksDefault(0)
      But I get an error:
      Traceback (most recent call last):
      File "", line 1, in
      File "C:\Python27\lib\site-packages\gi\module.py", line 269, in __getattr__
      return getattr(self._introspection_module, name)
      File "C:\Python27\lib\site-packages\gi\module.py", line 115, in __getattr__
      self.__name__, name))
      AttributeError: 'gi.repository.libxml2' object has no attribute 'xmlKeepBlanksDefault'

      Do you know what's to do?

    7. Sorry for the confusion, in my previous comment I was meant that the one from http://users.skynet.be/sbi/libxml-python/ should fix your xmlKeepBlanksDefault problem (you need both then, libxslt & libxml2), that is just import libxml2 or import libxslt. The one from GI is minimalist and possibly for internal use only.

    8. Also sorry for the confusion by me: xmlKeepBlanksDefault isn't a part of the package from http://users.skynet.be/sbi/libxml-python/. There is KeepBlanksDefault (without xml prefix).

      So far I understood from the documentation xmlKeepBlanksDefault should/could be a part of the newer libxml2 as part of gi.
      But I see and understand I have to use still the package from http://users.skynet.be/sbi/libxml-python/.

    9. Hi Tuma, do you think you may have a solution for this special crash?
      It's just to rate my issue in the Gramps bug tracker.
      Thank you.

    10. No, I don't understand what's the actual problem is. Sorry

    11. Sorry for my bad description. I did ask regarding the libgoocanvas issue as this sub-thread did start.

  46. I install the pygi-aio-3.4.2rev11.7z(py32 version).But any time I run the Gst.init(None) the system hang and crashed, I could do this from gi.repository import Gst well, and run Gst.init.
    The shell shows .function at 0x00DA9780>.Any ideas about this?

    1. This usually caused by crashed plugins during init, the package contain all compilable plugins from base to bad packs. try remove the dll till you reach base state

      That is, in gtk\lib\gstreamer-1.0 should contains no more than:
      libgstapp-1.0-0.dll libgstpbutils-1.0-0.dll libgstrtsp-1.0-0.dll libgstvideo-1.0-0.dll
      libgstaudio-1.0-0.dll libgstriff-1.0-0.dll libgstsdp-1.0-0.dll
      libgstfft-1.0-0.dll libgstrtp-1.0-0.dll libgsttag-1.0-0.dll

      then if you need more plugins, add the dll(s) manually.

      In the meantime I'll try to find the crashed plugins


    2. doh sorry I posted the wrong dir, ok at least I found the crashers:

      - libgstaudioresample.dll (I'm familiar with this error, I'll figure it out)
      - libgsttcp.dll (don't know why)
      - libgstclutter.dll (will crash if you don't have proper opengl)

  47. Hi, thanks for building PyGObject for windows. I'm using pygi-aio-3.4.2rev11.7z to run a python3/glade/gtk3 program on windows. On newer machines it runs well, but on older (athlon single core) it throws an exception. Even starting one of the gtk binaries(e.g. gurcharmap.exe) results in an exception.
    Any idea, why this might happen? Did you optimize your build for certain cpu types/flags?


    1. Ouch really sorry about that, yes all binaries are compiled with sse2 optimized (-msse2 -mfpmath=sse).

    2. Never mind, sse2 is around for a long while now after all (but our lab computers are even older).
      Could you give me a few lines instruction, how to build it? Mainly which source files and compiler you used. So I can try to compile it without sse2 (guessing thats the culprit).


    3. As I mentioned before, the build procedure really sketchy one (also need unfinished Dieter's patch) and that the way I choose is different than the upstream planned (to use MinGW instead of MSVS) make me reluctant to consider this more than just experiment.

      Basic overview how I build GTK stuff is here:

    4. BTW I use sources from Gnome's ftp and have my own build environment (see Moluccas).

  48. New pygi http://sourceforge.net/projects/pygobjectwin32/files/pygi-aio-3.10.2-win32_rev7.7z/download

    1. Great job Tuma! Also my libgoocanvas issue is resolved now using your newest pygi. So far I see I've the webkit issue only last remaining. But this is an optional and minor feature of Gramps. So it's not really a problem in this case.
      Thank you again for all your time.

    2. Hi Helge
      I'm curious about the webkit issue? at least I can now browse the internet in python mode.

    3. Well it's better than before. But under using it I got again crashes.
      I don't know why. Sorry, I didn't found time to check for more dependencies. BTW: I'm still using python 2.7.5.

      I tried to use the gtk3.8 dlls in your package. But using these I get a crash of missing entry points. It's the same if I try to use Gedit from your package.

      Do you know about some GUI issues in gtk 3.10.2?
      I think they are also available in the gtk-demo:
      - missing horizontal sliders in some controls
      - wrong (to less hight) of some controls

    4. Oh, I see there is meanwhile a new version (pygi-aio-3.10.2-win32_rev8).
      All my results based on pygi-aio-3.10.2-win32_rev7.
      I hope I didn't force any confusion.

    5. I switched to python 2.7.6 and using still pygi-aio-3.10.2-win32_rev7:
      What ever I do I can't reproduce any webkit crash now. So please don't focus on this issue.

    6. I'm still using pygi-aio-3.10.2-win32_rev7 having much success. Now I got one issue: The handling of any TIFF file (during first access there will be generated the icon by Gramps) causes a non-response of our Gramps system. It's not crash. It's a never come back within a acceptable time (I always used a kill process). Do you have any idea or a reference program using the the same gtk?

    7. TIFF issue is a bit hairy, first there seems two kind of Tiff4 available for windows one with generic (posix) file IO and one with native Win32 IO (the default setting). Using posix version with pygi cause file descriptor crashes (despite the build itself pass all tests), my only option is Win32 IO for pygi.

      I believe the issue still related with your report on February. I can confirm using mypaint that it can't render thumbnail but it will open anyway. And as usual if I switch to gdiplus tiff, thumbnail will rendered.

      I have tried other build from OpenSUSE but it behave the same, no thumbnail but will open. I will consider to use gdiplus for tiff in the next rev.

      The reference usage for TIFF is anything that related to OSGEO.

      BTW you're right, gedit not running under GTK 3.8

    8. Sorry Tuma, I didn't understand how to switch from pygi-aio-3.10.2-win32_rev7.7z to pygi-aio-3.10.2-win32_rev10-setup.exe.
      Do I have to patch all files only?

      I hope to find a solution for my tiff issue. Or have I to wait for the next revision?

    9. Nevermind, you just need a file: http://sourceforge.net/projects/tumagcc/files/libgdk_pixbuf-2.0-0.dll/download

    10. Thanks, as simple as it could be and it works well for me!