PyGObject (PyGI)

April 20, 2014
New builds version 3.12 started.
Go to http://sourceforge.net/projects/pygobjectwin32/files/


October 25, 2013
New builds version 3.10 started.
Go to http://sourceforge.net/projects/pygobjectwin32/files/
Mar 9: Switched to gcc 4.8.3 mingw-w64 and no longer use mingw.org winapi due to misc compiling issues.
Feb 9: Rev18!, 64bit port started!
Nov 22: Rev7. See SF page. LFS disabled by default, use separate runtime dll for each python, more libraries added, added GTK 3.8 dll as alternative for those who have problem with GDK 3.10
Nov 5: Found out that -msse2 can be nasty one. Rev3 uploaded with tuned down optimization, fix gtk's bidi icon not displayed bug and fix fontconfig's APPSHAREFONTDIR.
Thanks to G.M. Tagliaretti for the encouragement to continue this and linked my build to PyGobject homepage. I'll consider the upcoming guide as an alternative to https://live.gnome.org/GTK%2B/Win32/MSVCCompilationOfGTKStack.

April 5, 2013
pygi-aio-3.4.2rev11.7z (binary only, for python 2.6, 2.7 and 3.3)
pygi-aio-3.4.2rev10_opt.7z (locales, docs, gi, devel files, other data)
Warning: I just realize that python 3.3 is using msvc 2010 (msvcr100.dll), while my build is using msvcr90.dll, A more proper build will need complete recompile. Oops.
Content:
gobject-introspection-1.34.2
*gtk 3.6.4 + adwaita theme [comment out gtk\etc\gtk-3.0\settings.ini to enable]
*glib 2.34.3 + networking (libproxy 0.4.11)
*pango 1.32.6 (harfbuzz 0.9.12, graphite2 1.2.0)
*cairo 1.12.10 (pixman 0.28.2) + GL (glew) + xml
fontconfig 2.10.91
freetype 2.4.10
*gdk-pixbuf 2.26.4 (jasper) + tiff + svg + wmf + psd + webp, alternative version with gdiplus available
*champlain 0.12.3 + *memphis 0.2.3
libxml2 2.9.0
dbus 1.6.8 + dbus-glib 0.100
enchant 1.6.0 + aspell English + hunspell [no dict] + voikko
geoclue 0.12.99
*geocode-glib 0.99.0
*telepathy-glib 0.20.1
*gdl 3.6.2
*clutter/cogl 1.12.2
*clutter-gst 2.0.0
*clutter-gtk 1.4.2
*glade 3.14.2
devhelp 3.6.1
*gtksourceview 3.6.3
*gtkspell3 3.0
*libpeas 1.6.2
*webkitgtk 1.10.2 (libxslt 1.1.28, sqlite 3.7.13)
*librsvg 2.36.4 (libcroco 0.6.8)
*libgda 5.03 (postgres 9 client, mdbtool) + jdbc + sqlite + bdb
*poppler 0.22.1 (openjpeg, lcms2)
*gstreamer 1.0.5 + *base + good + libav + ugly + bad
*gegl 0.2.0 + *babl 0.1.6 + *gegl-gtk3
gnutls 2.12.22 + gcrypt 1.5 + gpgerror
*libsoup-2.40.3, libsoup-gnome
*json-glib 0.14.2
*Gtranslator 2.91.6
*Gedit 3.6.2
*Gucharmap 3.6.1
*GooCanvas 2.0.1
*libGoffice 0.10.0
*libLasem 0.4.1
*osm-gps-map 0.8git
*Vips 7.30
*GVnc 0.5.1, *GtkVnc
* GExiv2

January 27, 2013
pygi-3.4.2_gtk+-3.6.4.7z

September 15, 2012
Experimental builds:
PyGI 3.3.91 for python 2.6, 2.7, 3.3 for Windows 32bit/64bit
GIRepo and typelibs
Runtime win32 Bundle
Runtime win64 bundle (GTK2/3 only)
Gobject Introspection 1.33.10 (static build) for python 2.6/2.7

These are PyGI, do not confused it with PyGTK see http://live.gnome.org/PyGObject/IntrospectionPorting

Example available at http://python-gtk-3-tutorial.readthedocs.org/en/latest/index.html

Minimal debug environment available (with mypaint as test-case): http://opensourcepack.blogspot.com/2013/01/mypaint-and-pygi.html

Still running gtk2? try:
Conservative PyGTK AIO or PyGTK 64bit

cairo-demo.py:

#!/usr/bin/env python
"""
Based on cairo-demo/X11/cairo-demo.c
"""

import cairo
from gi.repository import Gtk

SIZE = 30


def triangle(ctx):
    ctx.move_to(SIZE, 0)
    ctx.rel_line_to(SIZE, 2 * SIZE)
    ctx.rel_line_to(-2 * SIZE, 0)
    ctx.close_path()


def square(ctx):
    ctx.move_to(0, 0)
    ctx.rel_line_to(2 * SIZE, 0)
    ctx.rel_line_to(0, 2 * SIZE)
    ctx.rel_line_to(-2 * SIZE, 0)
    ctx.close_path()


def bowtie(ctx):
    ctx.move_to(0, 0)
    ctx.rel_line_to(2 * SIZE, 2 * SIZE)
    ctx.rel_line_to(-2 * SIZE, 0)
    ctx.rel_line_to(2 * SIZE, -2 * SIZE)
    ctx.close_path()


def inf(ctx):
    ctx.move_to(0, SIZE)
    ctx.rel_curve_to(0, SIZE, SIZE, SIZE, 2 * SIZE, 0)
    ctx.rel_curve_to(SIZE, -SIZE, 2 * SIZE, -SIZE, 2 * SIZE, 0)
    ctx.rel_curve_to(0, SIZE, -SIZE, SIZE, - 2 * SIZE, 0)
    ctx.rel_curve_to(-SIZE, -SIZE, - 2 * SIZE, -SIZE, - 2 * SIZE, 0)
    ctx.close_path()


def draw_shapes(ctx, x, y, fill):
    ctx.save()

    ctx.new_path()
    ctx.translate(x + SIZE, y + SIZE)
    bowtie(ctx)
    if fill:
        ctx.fill()
    else:
        ctx.stroke()

    ctx.new_path()
    ctx.translate(3 * SIZE, 0)
    square(ctx)
    if fill:
        ctx.fill()
    else:
        ctx.stroke()

    ctx.new_path()
    ctx.translate(3 * SIZE, 0)
    triangle(ctx)
    if fill:
        ctx.fill()
    else:
        ctx.stroke()

    ctx.new_path()
    ctx.translate(3 * SIZE, 0)
    inf(ctx)
    if fill:
        ctx.fill()
    else:
        ctx.stroke()

    ctx.restore()


def fill_shapes(ctx, x, y):
    draw_shapes(ctx, x, y, True)


def stroke_shapes(ctx, x, y):
    draw_shapes(ctx, x, y, False)


def draw(da, ctx):
    ctx.set_source_rgb(0, 0, 0)

    ctx.set_line_width(SIZE / 4)
    ctx.set_tolerance(0.1)

    ctx.set_line_join(cairo.LINE_JOIN_ROUND)
    ctx.set_dash([SIZE / 4.0, SIZE / 4.0], 0)
    stroke_shapes(ctx, 0, 0)

    ctx.set_dash([], 0)
    stroke_shapes(ctx, 0, 3 * SIZE)

    ctx.set_line_join(cairo.LINE_JOIN_BEVEL)
    stroke_shapes(ctx, 0, 6 * SIZE)

    ctx.set_line_join(cairo.LINE_JOIN_MITER)
    stroke_shapes(ctx, 0, 9 * SIZE)

    fill_shapes(ctx, 0, 12 * SIZE)

    ctx.set_line_join(cairo.LINE_JOIN_BEVEL)
    fill_shapes(ctx, 0, 15 * SIZE)
    ctx.set_source_rgb(1, 0, 0)
    stroke_shapes(ctx, 0, 15 * SIZE)


def main():
    win = Gtk.Window()
    win.connect('destroy', lambda w: Gtk.main_quit())
    win.set_default_size(450, 550)

    drawingarea = Gtk.DrawingArea()
    win.add(drawingarea)
    drawingarea.connect('draw', draw)

    win.show_all()
    Gtk.main()

if __name__ == '__main__':
    main()

44 comments:

  1. Hi, Thanks for doing this. It seems the installer needs taskkill.exe that is not shipped in Windows XP Home. I downloaded from http://web.archive.org/web/20070125030456/http://home.wanadoo.nl/gigajosh/files/taskkill_en.zip and put in the Windows path.

    ReplyDelete
    Replies
    1. Oops my bad...
      I will bundling taskkill.exe from reactos for rev11. It only used to kill zenity's progress window after setup finished copying.

      Delete
  2. Hi, thanks for this! I'm having trouble using the installer - when I run it, I get an error saying installation requires admin privileges. I do have admin privileges but the UAC pop does not appear. I am not very familiar with Zenity.

    ReplyDelete
    Replies
    1. Hi, in XP it's "normal" that an installer will fail if not run by admin because XP dont recognize manifest (embedded nor paired autoelevate manifest). Yes, it's also possible to auto-elevate (pop up runas dialog) in XP but it require source code change in the 7zipSFX (which setup.exe based on).

      In vista or later it will use heuristic autoelevate since the filename is "setup.exe". Admin privilege needed to install documentation in all users appdata because of its huge size and that's the only recognized shared location by devhelp too.

      btw, sorry for the late reply it was 2:00 here when you post it :D

      Delete
    2. just read your mail, I dont realize that setup.exe already embedded with "asInvoker" manifest so the heuristic elevation ignored. Will fix this in rev11

      Delete
  3. This comment has been removed by the author.

    ReplyDelete
  4. Hi, Thank you for this great work.
    There is a bug i want to feedback.
    I am using python 2.7 with vs2010 installed. When I install the pygobject-aio, it install the vs10.x runtime which version does not support 2.7. I think it's about the setup.exe.

    ReplyDelete
    Replies
    1. Correct, there is typo in setup.bat. will fix that in rev11
      thanks

      Delete
    2. Expecting rev11. :)
      Will it come before Chistmas Day?

      Delete
    3. Yes, I suppose as early as Friday or as late as Sunday. It will have some upstream updates and a fix for annoying "missing icons" issue that plagued win32 platform.

      Tagliaretti plan to make gtk3-demo in python, would be great if it could be included in rev11 though.

      Delete
    4. Merry Chistmas!
      and rev11 is wonderful

      Delete
  5. I installed rev15. the gtk-demo works fine. Then I skip and install rev17, the gtk-demo will not work on gtk3.8 because missing Gtk.Stack (gtk-demo also not in gi folder as shown in the installation GUI). After re-install gtk3.10, then only gtk-demo can run but failed on treemodel_large.py :
    File "C:\Python27\Lib\site-packages\gtkdemo\demos\TreeView\treemodel_large.py", line 117, in main
    view = Gtk.TreeView(fixed_height_mode=True, headers_visible=False)
    TypeError: __init__() got an unexpected keyword argument 'headers_visible'

    ReplyDelete
    Replies
    1. I think both rev15 and rev17 got the same error in that test, the demos is taken from pygobject 3.11.x trunk so it may still in development or designated for 3.12 release but since there is no prior version I guess it's better than nothing. Just to give an updated sample over existing tutorial.

      In rev18 I put the demo alongside the old tutorial, it's bad idea to put it in site-packages anyway.

      Thanks for your report.

      PS: I still strongly recommend to use 3.8 whenever possible though

      Delete
  6. Hi, I'm just doing some research on best platform for my software project, and have some problem with webkit - I put together few lines of code, and it works perfectly, yet... on Windows initialization is slow, as in painfully slow. But not always.
    http://nopaste.info/4d3837610d.html
    This tiny bit of code starts in between 1 and 41 seconds - and I have no idea why. Any tips how to find culprit of this behavior? On my ubuntu it always works instantly, on windows sometimes so, and sometimes it waits and waits and waits. There is simple way to find what is wrong? I've tried python 2.7 and 3.3, and r17 r18.

    ReplyDelete
    Replies
    1. You mean fontconfig initialization?

      Delete
    2. the one in my build is configured with freetype (other option is pango which may skip fontconfig init). However I have unicode problem and text rendering defect under windows with pango,

      Delete
    3. I am not sure - windows is just not responding, and I don't know Python very well - as long as things works it's fine, but no debug experience beyond tracing my own mistakes in idle step by step. Is there something I can do to narrow it down?

      Delete
    4. try this pango version:
      http://sourceforge.net/projects/pygobjectwin32/files/temp/webkitpangodll.7z/download

      copy and overwrite existing dll in [python]\lib\site-packages\gnome

      it should not have fontconfig initialization at the cost of unicode/text rendering issue

      Delete
    5. I know it's late, assuming fontconfig initialization is the problem (it's not really a culprit, linux is faster because it's probably already initialized e.g. by gnome deskop). If your app distributed by installer you could run fc-cache at post-install stage so fontconfig won't initialized again. I will run this in my installer too.

      Delete
  7. Hi,
    Just tried the rev18 installed on 64 bit windows 7. I get a crash during installation, after I have selected which python to install:

    - On this computer I have to use popup and enter an admin user..

    ReactOS Command Processor has stopped working

    Problem signature:
    Problem Event Name: APPCRASH
    Application Name: rcmd.exe
    Application Version: 0.3.15.0
    Application Timestamp: 5197cfd1
    Fault Module Name: msvcrt.dll
    Fault Module Version: 7.0.7601.17744
    Fault Module Timestamp: 4eeaf722
    Exception Code: c0000005
    Exception Offset: 00010959
    OS Version: 6.1.7601.2.1.0.256.4
    Locale ID: 2057
    Additional Information 1: 6059
    Additional Information 2: 605913065dd0009e67123fc05800b5a1
    Additional Information 3: 6258
    Additional Information 4: 62582bdf4ad9d7b231c419c665e685f5

    Read our privacy statement online:
    http://go.microsoft.com/fwlink/?linkid=104288&clcid=0x0409

    If the online privacy statement is not available, please read our privacy statement offline:
    C:\windows\system32\en-US\erofflps.txt

    ReplyDelete
  8. Any idea how I can debug this?

    ReplyDelete
    Replies
    1. Sorry for the late reply, you could open the installer with 7zip and check setup\setup.bat file
      Currently it's not in readable condition (no comment etc..)

      Delete
    2. I tried the latest 32 bit version and it worked. Is there a 64 bit build of the newest version somewhere ?

      Delete
    3. It was not worked properly in more complex test, and will need msys 64bit to generate gir (i think) because of 32bit -> 64bit fork didn't worked. I could provide 64bit build as bulk archive though

      Delete
  9. I have install rev18 on my windows7 64bit box.
    The problem is when my python code runs, it reported as below.
    ---------------------------------------------
    'D:\Python27\Lib\site-packages\gnome\lib/gio/modules\libgiognutls.dll': �Ҳ���ָ����ģ�顣
    Failed to load module: D:\Python27\Lib\site-packages\gnome\lib/gio/modules\libgiognutls.dll
    'D:\Python27\Lib\site-packages\gnome\lib/gio/modules\libgiolibproxy.dll': �Ҳ���ָ����ģ�顣
    Failed to load module: D:\Python27\Lib\site-packages\gnome\lib/gio/modules\libgiolibproxy.dll
    ----------------------------------------------------------
    I'm using 32bit version python2.7, and gtk3.8 as the installer suggested.

    ReplyDelete
    Replies
    1. Thanks Yindong,
      Next time I will make sure the installer to run gio-querymodules at the end

      atm, you need to remove the missing modules from D:\Python27\Lib\site-packages\gnome\lib/gio/modules/giomodule.cache file

      Delete
    2. Unfortunately, it is still there.
      And, I did not find gio-querymodules in gnome dir.

      Delete
    3. sorry gio-querymodules is missing :(
      basically it does the same as I told before, giomodule.cache is just a plain text enlist dlls to be loaded.

      Delete
    4. actually, those two files has already been installed in the same diretory of giomodule.cache.

      Delete
    5. Ohh I misunderstand, may I know what apps you're run? it's not missing dependencies right?

      Delete
    6. It is a custom coded app.
      I found that it shows the notice while a gtkbuider object call its add_from_file method.

      Delete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Hello I'm developping using Pygobject 3.10.2 rev14 and Gtk 3.6.4 and Gst 1.2.3

    I notice that my handler of the signal "message" for GstBus is never called
    even with Gst1.0.10 and Gst1.0.9 is there any solution for that? thanks

    ReplyDelete
  12. This comment has been removed by the author.

    ReplyDelete
  13. Hi ! Thanks for your work on PyGI for Windows !

    I have an issue regarding GStreamer... The following commands make Python.exe crash without any error message (at Gst.init(None)).

    import gi
    gi.require_version('Gst', '1.0')
    from gi.repository import Gst
    Gst.init(None)

    GStreamer in itself seems to ok though, gst-inspect and friends work nicely when called directly from the command-line. Gtk examples do work too. This is with pygi-aio-3.12.2-win32_rev3-setup, installed on Windows 8.1 64 bits, with Python 2.7.6 32 bits from python(x,y). Could you please help me to solve this ? Thanks !!

    ReplyDelete
    Replies
    1. Can't reproduce this with Win2003, don't have Win8.1 :(
      Could you try test it under DependencyWalker which plugin died out using "-C "from gi.repository import Gst;Gst.init(None)" argument to python.exe?

      Delete
  14. Amazing work bundling up these libraries. Unfortunately, there seems to be an issue when working with GtkClutter.

    import sys
    from gi.repository import Gtk, GtkClutter, Clutter, Cogl, GObject

    def main ():
    Clutter.init(sys.argv)

    window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
    vbox = Gtk.VBox(False, 6)
    window.add(vbox)
    vbox.show()

    # Error happens here:
    clutter_widget = GtkClutter.Embed()
    clutter_widget.show()

    window.show()

    Gtk.main()

    return 0

    if __name__ == '__main__':
    sys.exit(main())

    The program crashes with the message:
    "The procedure entry point gtk_widget_get_scale_factor could not be located in the dynamic link library libgtk-3-0.dll."

    There is also some output on the console:
    "** WARNING **: Failed to load shared library 'libclutter-gtk-
    1.0-0.dll' referenced by the typelib: 'libclutter-gtk-1.0-0.dll': The specified
    procedure could not be found."

    Anyway, thanks for the hard work!

    ReplyDelete
    Replies
    1. I should mention that this is with Gtk+ 3.8.9, as recommended during installation. You can get further with Gtk 3.10.9, but eventually the program crashes without error message (possibly due to instability of the latest version of Gtk+ on Windows).

      Delete
    2. Thanks, 1.5.2 need gtk_widget_get_scale_factor(), if I can't backport this I will switch to stable version 1.4.4 in next rev.

      You may use pygi 3.10.2 rev18 if you want to test clutter-gtk 1.4.4

      Delete
    3. correction, while the function is called it is not actually used in win32, 1.6.0 will come soon according to ebassi, will see which one better.

      Delete
  15. Excellent, sounds like there will be a fix in the not too far future. Many thanks again!

    ReplyDelete
  16. Hello.
    Do you plan on releasing x64 binaries for PyGI?

    ReplyDelete
    Replies
    1. maybe a preview for the next pygi 3.14.x and it probably contain minimal libraries

      Delete
    2. I see, thank you.
      They'll come in handy when Windows 9 arrives.

      Delete