Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

06 October 2016

Python 3.5.2 on XP

Got another request for PyGI AIO on Python 3.5 (and 3.6), with my previous attempt using MinGW-W64 to target UCRT failed. I'm considering to switch entirely to VS2015 for PyGI 3.22 (thanks to Fan for keep  VS project files up-to-date). However the idea of using VS2015 while online put me off.. instead I want to use EnterpriseWDK which I can confirm by compiling libintl that it does linked to vcruntime140.dll (which only contain basic support functions) with the rest probably static linked instead using those API-MS-WIN-CRT*.dll forwarder like python 3.5 do. Even if thats okay, PyGI with VS2015 will be no more that half of current packages as many still gcc oriented.

While tinkering on that I got Python 3.5.2 running on XP :-) with the help from Wine I put the fake kernel32.dll between python35.dll and the real kernel. I put it on github here https://github.com/tumagonx/xompie/

Two problem though:

0. Unlike Python 3.5.0rc which "allow" installation, 3.5.2 wont do this XP. so I use preinstalled files from Win10.

1. Apparently Python using incomplete manifest for its executables:
    
trustinfo

    supposedly:
   
trustinfo xmlns="urn:schemas-microsoft-com:asm.v3"

    while this is ignored safely in later Windows, XP do choked-up saying "application configuration is incorrect"

2. Then, there is path issue where tcl unable to find its libraries in the usual "tcl" subdirectory and I have to move them to "lib" subdirectory (mixed with python). Might had to do with transplanted Wine's GetFinalPathNameByHandleW? dunno


20 April 2014

PyGI AIO 3.12.x for Win32

With the new GObject-Introspection 1.40, gir generation now works with MinGW-W64 CRT and most docstrings issues seems been squashed too. GTK is not on Windows side though, version 3.12.1 looks buggier where an app (in this case gtk3-demo) will lose toplevel window (the one that is native and directed by OS), wish I have screenshot to show (I will). All 3.10  bugs also persist in 3.12, so despite of lots of new features it's really no good at the moment.

GTK 3.12.1 has lots of fixes in the Win32 theme (FYI, it's controlled by compiled-in css files namely gtk-win32*.css) which I tried to backport to 3.8.9 and 3.10.8 with some success, I also made correction on Windows XP specific part. But realized that perfect "theming emulation" is not possible yet with current css feature and event handling.

Overall there are new lots of libraries joined the AIO packages, with over 100 introspected libraries. The 64 bit port is not convincing... In some of my tests GI fail to resolve to existed exported functions of a dll, possibly getting skipped/mangled in the process. At C level, the libraries/apps behave just as good as 32 bit ones, so the problem is pygobject specific here.

Download for Python 32bit at:
http://sourceforge.net/projects/pygobjectwin32/files/

PyGObject homepage:
https://wiki.gnome.org/PyGObject

20 October 2013

PyGI 3.10 Windows

In my attempt to update MyPaint I need to update PyGI as well as GTK. During compiling there is worrying result the glib 2.38.1 failed on 7 tests! The tests a bit different from previous versions though (in he past usually it passed all tests). GTK 3.10.2 seems missing def files and the new one isn't look any stabler than 3.6, the usual crashes still there despite major win32 fixes in cairo 1.12.16. Lastly I can't use new bindings (gir/typelib) as it always throw gmem.c overflow error during initialize in addition to that I need to comment PollFD override chunk in gi\overrides\GLib.py. Anyhow the new generated girs will still need diff/merge from those linux version...

So here is the new binaries using older typelibs (from pygi aio 3.4.2). This means no new features at python level, plus bugfixes and probably new bugs in the runtime. Currently only bare gtk included if new typelibs become usable I will add others.

pygi-aio-3.10_win32.7z (python 2.6 unsupported)

EDIT: rev2 and further revisions goes here https://sourceforge.net/p/pygobjectwin32/files

29 January 2013

MyPaint and PyGI

Got several emails from mypaint users who want to know the progress of windows version. I have tidying up what I left last weekend. I hope you could participate as I lack of time nowadays.

Several days ago a user of gramps (gramps-project.org) put his interest on my PyGI build which motivated me to look at it again after I failed to get it work with mypaint. Last sunday I put new PyGI build which better than previous one (read the comments here), in short it's "somewhat" working but I still find many non-crashing errors and warnings when run Gramps 4.0a3 though. Later I tried it on mypaint and it started! but gave me loads of fatal error messages and crashes. This make me unmotivated again :(

The important thing with GTK 3.6.4 is pressure-sensitive tablet apparently working.

Downloads:
So what we got here?
GTK 3.14.8 = OK
GTK 3.10.x - 3.14.7 = completely broken (no pressure, no lag, just mouse-like) errr
GTK 3.8.x = laggy and imprecise  please compare with gtk 3.6?
GTK 3.6.x = somewhat OK
Reported working tablets = Mostly wacom tablets, Samsung ATIV SmartPC SPen, P-Active XPC-1910A LCD Tablet, Genius Mousepen, Monoprice (need latest driver, see Aroidzap's comment), LE1700 Motion Tablet
Known incompatible = Genius G-Pen

For those who want to use UC-Logic drivers see https://gna.org/bugs/?21864

note: use 7zip 9.x with lzma2 support to extract the archive

MyPaint 1.2.0 released https://github.com/mypaint/mypaint/releases/

mypaint-1.2.0b.7z (GTK 3.14.15 + Anti-Art's experimental brush settings + brushpack + dothiko enhancement, Dec 28, 2015)
mypaint-1.2.0a.7z (GTK 3.14.13 + Anti-Art's experimental brush settings + brushpack , July 3, 2015)
mypaint-1.1.1a.7z (GTK 3.14.9 + Anti-Art's experimental brush settings + brushpack , April 1, 2015)
mypaint-1.1.1a-debug_win32.7z  (GTK 3.14.8 debug, February 11, 2015)
mypaint-1.1.0+git-823aa882.7z (GTK 3.8.9, October 8, 2014)
mypaint-1.1.0+git-e06d414_rev2.7z (GTK 3.8.9, March 25, 2014)
mypaint-1.1.0+git-e06d414.7z (GTK 3.8.9, March 21, 2014)
mypaint.exe (GTK 3.6.4, December 14, 2013) Single exe, Can be manually associated wih ora, Missing icon fxed, Try tahoma font (unicode compatibility?), Enable lot more file formats to import (gdk-pixbuf testing)
mypaint-171113_3.7z (GTK 3.6.4, December 05, 2013) Try to optimize more
mypaint-171113_2.7z (GTK 3.10.4, November 17, 2013) Confirm that tablet doesn't work?
mypaint-171113.7z (GTK 3.8.6, November 17, 2013) MRU and lag workaround
mypaint-161113.7z (GTK 3.8.6, November 16, 2013)
mypaint-121013.7z (GTK 3.6.4, October 12, 2013)
mypaint_270113git_dbg_rev2.7z (old)

Please give comments at http://forum.intilinux.com/mypaint-general-discussion/mypaint-1-1-for-windows/

Some info that might be useful when reporting bugs:

blockers:
lag+break bugreport (if you find something new please post at the bugtracker to let mypaint devs know)
zoom bug, currently unreported as this is a packaging issue (will be irrelevant)

specs:
mypaint 1.1.0+git
python 2.7.5
pygtk 2.24.0
pygobject 2.28.6
pycairo 1.10.0
psyco 2.0
numpy 1.8.0rc2
pygi/pygobject 3.4.2
gobject introspection 1.34.2
gtk+ 2.24.14
gtk+ 3.6.4
atk 2.6.0
cairo 1.12.10
pango 1.32.6
glib 2.38.1
gdk-pixbuf 2.26.4

Inside the 7zip file contains:
mypaint_gtk2.bat -> run mypaint in GTK2/PyGTK mode
mypaint_gtk2_debug.bat -> run mypaint in GTK2/PyGTK mode under GDB session
mypaint_gtk3.bat -> run mypaint in GTK3/PyGI mode
mypaint_gtk3_debug.bat -> run mypaint in GTK3/PyGI mode  under GDB session

How to help?
- Report your tablet name, pressure sensitivity status, not just "it works" or "it doesn't work" or "it slow". Read comments below here, someone may give direction which driver to download.
- If you're user who use both Linux and Windows, try GTK2 and GTK3 and tells mypaint's devs if you spot a misbehaving of Windows' version.
- Tell mypaint's devs your suggestion to make Windows' version better.

Enjoy and Thank You!
More info about participating MyPaint development can be found at http://mypaint.intilinux.com/?page_id=18

02 April 2012

It's Just Wrong: MSYS Python

I thought it would be helpful to have python which understand both posix path and windows path: MSYS version of python that is. In my old review about MinGW python, this kind of build already hampered with incompatibilities especially due to python heavily rely on inconsistent "defines" across modules sometime use uname() then sys.platform then posix or not (os.name).. meh.. this make workaround also inconsistent.

What did I tried is even worse:
- with uname = msys it's unknown system to python fine lets change it to cygwin, well this will create another problem since msys is not cygwin (different runtime unlike MinGW vs MSVC) its c modules should have different suffix to avoid python try to load native win32 module by accident (I set it to .myd meh...). Note: "msys" or "cygwin" or "mingw" is a hardcoded value that returned by sys.platform it can be only changed via hex editing once python.exe compiled
- distutils which used when building extension then would call uname (unlike mingw or msvc) to decide platform / compiler flags etc and what you get is insane name: MINGW32_NT-5.1-1.0.17(0.48/3/2) <- yes there even slashes there :-)
- unlike mingw build which can be changed to win32 (hardcodedly) to provide more compatibility thats not the case for msys which the only possible option is cygwin with above quirks.
- many c-extension tests failed! not really a problem if we just want barebone or purelibs though

In the end I decide to edit ntpath.py and site.py of native msvc python to make it use "/" under msys, this again have its own quirks too: win32 python need to use ";" as path separator which ":" already used as driveletter and because it doesn't know root "/". Meh...

Anyway here is the msys binaries of python 2.6.7: python-2.6.7_msys.7z (sources and patches from cygwin repo)

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

Changelog:
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!

notes:
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.

30 December 2011

How to make PyGimp Portable

There are become more and more plugins being implemented in python right?
This was explained two years ago in my older post here
Here is the small patch (applicable for gimp-2.7.4 too)

After build Gimp, we need to adjust the following files
lib\gimp\2.0\environ\default.env :
add the following line and remove any existing PATH declaration
#add binpath in non hardecoded way
PATH=${gimp_plug_in_dir}/../../../bin
PATH=${gimp_plug_in_dir}/../../../python

lib\gimp\2.0\environ\pygimp.env (there should be a blank line in the end) :
; PYTHONPATH=${gimp_plug_in_dir}/python

12 March 2011

PMing Python binding for libMing

Ming, a free open source SWF (Flash) creation library.

This is win32 binary of mingc (PMing) python binding (using ming-0.4.4dev). See shape.py for example, path creation is similar to cairo.

mingc-0.4.4.win32-py2.7.exe
mingc-0.4.4.win32-py2.6.exe
mingc-0.4.4.win32-py2.5.exe
License: LGPL 2.1

shape.py:

from ming import *

Ming_setScale(1.0)

s = SWFShape()
s.setLine(40, 0x7f, 0, 0)
s.setRightFill(s.addFill(0xff, 0, 0))
s.movePenTo(200, 200)
s.drawLineTo(6200, 200)
s.drawLineTo(6200, 4600)
s.drawCurveTo(200, 4600, 200, 200)

m = SWFMovie()
m.setDimension(6400, 4800)
m.setRate(12.0)
m.add(s)
m.nextFrame()

m.save("test.swf")

28 January 2011

VipsCC Python, an Alternative to PIL

Taken from their wiki:
libvips is a fully demand-driven, threaded image processing library with no image size limits and with good support for colour. It is mature and documented.

Comparison with other imaging package also available

Though not so pythonic their binding is fully featured and comparable with C command-line version. Personally I use it to manipulate HDR image (exr) and NASA Blue Marble Imagery but unfortunately whenever I build it with direct OpenEXR support, vips become broken. Though other HDR format available (radiance) the later is more widely used in scientific field than in multimedia world. As a workaround vips can utilize ImageMagick (as image import) which recent version support OpenEXR though arguably limited to 16bit whereas exr theoretically could support up to 32bit.

27 January 2011

Conservative All in One PyGTK Installer

!!OBSOLETE WARNING!! This one looks very promising instead, I might update this pack or maybe not... since it would be pointless. Anyone who like to build pygtk python bindings may read my post here. It's for mypaint but relevant

BIG PyGTK Packages to keep you busy before migrating to GTK-3, PyGI and Python 3. Or are you want to try PyGI PyGobject try my experimental build 13 February 2013 here

22 April 2012
pygtkaio.7z
Alternate download for people who hate installer :-)
no changes except it doesn't include extras and have updated libcairo

22 July 2011
headers.7z (7.86 MB)
Just in case you're C developer and interested to use this runtime... (note that I build all from scratch even things like zlib, so it's completely unofficial)
headers only  (may contain unnecessary headers), import lib and static lib are too huge for me to upload
I'll assume you can use dlltool to make implib

27 December 2010

Making a self contained PyGTK installation

Tired of figuring out dependencies? Me too
PyGTK *could* be easier to install if they adopted the way WxPython or PySide installed, which sadly this is inherently impossible. However I think there is a trick for this!

Look at pygtk.pth under [Python]\lib\site-packages folder, a pth (stand for path?) is read by python interpreter as initialization before user start importing stuff. The idea is inject PATH insertion in pygtk.pth. Note that unlike py file pth file accept only oneliner script like in "python -c" command.

Here is my modified pygtk.pth:
for python 2.7:

gtk-2.0
import sysconfig; pygtkpath=sysconfig.get_path('platlib')
import os; os.putenv("PATH", os.path.join(pygtkpath,"
gtk-2.17.2") + ";" + os.environ["PATH"])
gtk-2.0
import distutils.sysconfig, os; os.putenv('PATH', os.path.join(distutils.sysconfig.get_python_lib(),'gtk-2.17.2;') + os.getenv('PATH'))




Now put GTK runtime in [Python]\lib\site-packages\gtk-2.17.2 and you're done!
note that if you keep bin folder of GTK (not put it outside) then use "gtk-2.17.2/bin" instead of "gtk-2.17.2"

Therefor a true all-in-one installer is possible by put GTK runtime (just the dlls without redundant C devel files) together, maybe one day I'll make one...

20 November 2010

Good experience with GooCanvas

Today I just finished my client software to design a t-shirt and the likes. Not sure why she don't just buy legal but cheaper general-purpose graphics software rather than hiring me. Anyway I'm back on pygoocanvas to deal with this basically compositing image software, previously I ever tempted to make usable 2D CAD software that way beyond my ability that time.

Pygoocanvas is really a time safer library should you ever make graphics application based on Python and GTK. With basic animation support (not as robust as clutter though) I can imaged a presentation software would benefit from it. And cairo canvas also make PDF generation a snap. Really like this library!

15 November 2010

Django-1.2.3 Docs in CHM

Meet Django

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

Developed four years ago by a fast-moving online-news operation, Django was designed to handle two challenges: the intensive deadlines of a newsroom and the stringent requirements of the experienced Web developers who wrote it. It lets you build high-performing, elegant Web applications quickly.

Django focuses on automating as much as possible and adhering to the DRY principle.

They will prepared for version 1.3, right now 1.2.3 is the last stable version. Ning in this site has made a bookmarked and clean chm version (download). Great for windows user!
I decided to made it myself it's plain easy actually: "make htmlhelp" and let Html Help Workshop do the rest!
For Django 1.3:
Djangodoc.chm

14 August 2010

PyGTK-2.21.0 Unofficial Win32 Binaries

This page is obsolete!  updated here (complete installer)

I finally able to test GTK 2.90.5 which has windows-theme fixed since 2.90.3. This version is actually unstable GTK 3.x but the rundown is Windows native theme is back! As with PyGTK 2.21 unstable released, I try to apply the patch onto GTK 2.21.5 which seems to be working also there is a windows-specific issue with GDK Pixbuf 2.21 (now separated) that pixbuf apparently not using HModule to find its basepath instead rely on hardcoded compile-prefix path. I try to fix this issue and seems going fine too. I don't know whether they will release version 2.22 and fix these or go straight to 3.0 but it seems the previous.

WARNING: These are unofficial yet UNSTABLE VERSION binaries. No installer will ever provided.
read this page for installation and general notes

PyGTK-2.21.0.win32-py26 compiled with Glade and Numpy support (463KB no docs)
PyGObject-2.21.5.win32-py26 compiled with ffi support (192KB no docs)
PyCairo-1.8.8.win32-py26 (19KB no docs)

WARNING: If you mix dlls, you're on your own way.
GTK-2.21.5-Runtime (5.18MB no docs) contains:
gtk+-2.21.5
gdk-pixbuf-2.21.6
glib-2.25.13
libglade-2.6.4
glade3-3.7.0
cairo-1.8.10
atk-1.30.0
pango-1.28.0
freetype-2.4.1
fontconfig-2.8.0
libxml2-2.7.7
libffi-3.0.9
librsvg-2.26.3
libcroco-0.6.2
libgsf-1.14.18
libwmf-0.2.8.4
jpeg-8a
jasper-1.900.1
libpng-1.4.2
tiff-3.9.2

Localisation (3.54MB)

Update:
Now this is sucks for Windows platform!, GTK-2.21 while get theming back is still has many bugs in UI area, tablet and other possibly lurkings

Notes:
- I decided to move bin\*.* outside to root as it seems more Windowish-way
- PyGObject 2.21 actually a bit too old for current PyGTK 2.21 or Glib 2.25.x but seems to work (compatible) anyway
- Be advised that some dll are quite common (zlib, bzip, etc) and often available and used by other software. If you ever experienced "missing procedure error" try to test it with M$ Depends, it might just another same name but different dll file gets on your way instead of mine. Generally you can fix it by re-arrange PATH environment.
- If your have problem with py2exe when building package, you might want to see here for some common pitfalls and example.
- There are missing icons in glade (spinner) see here

19 July 2010

Thoughts about wikipedia xml dump

They are the BIGGEST single plain text file that I've ever seen in my life! and I'm talking about the 27GB english version.
So they choose bzip2 why? OK they recently move to 7z anyway (but I still got the bz2 one)... 7zip decompression is far faster than bzip2.

They provide a python library called mwlib to work with the dump. This is where I getting interested with. For my country Indonesia, I think this is a great asset for education. People here are mostly (even in Java island) are still alien to the internet. Worse, when recent videotape scandal of local artist boasted over the media, most people set a negative feeling about the internet. Even our minister are outspoken about his plan to censor the internet! LOL talk about China. Anyway with a little mindset changes, for example: instead of forcing to buy secondary bike which mostly for show off, people should better invest on computer even the cheapest one they can get. At least it doesn't eat gas. With the idea of making portable wiki in flashdrive like wikitaxi. People get access to one of the best knowledge source legally for free. Youngster can be forced to "read" more than foolishly chatting on facebook and playing oxymoron games.

27 April 2010

Python in MinGW, a "FREE" purist attempt?

Ever since Python 2.5 bring msvcrt71.dll along its installer things are kind of inside M$ territory because that dll used to not bundled with Windows and distributing it means you (who compile) must legally own the product where that file came from aka MSVC++ 2003. With M$ releasing Express Edition (2005, 2008 and 2010) for free without particular restriction on its compiler (generally free compiler is restricted to provide Non-Commercial application only), this edition have rocketing MSVC as a build tool and has gaining more attention than MinGW (the open source alternative) for many open source project.

I have seen Python 2.6 being cross-compiled by opensuse in their repositories, the build system is fully automated (source is feed alongside patches) and updated at least every a couple of day (yes that's true). Though they don't provide static libraries and they also build the packages in more Linux-style in absolutely dynamic linking way of DLL. Which soon I realized will confused many Windows user who prefer more compact and portable binaries (by statically linking everything that possible). Directory structure also look ridiculous to Windows which never have the bin-etc-lib-share structure.

19 March 2010

PyPoppler, PDF rendering in Pythonic way

PyPoppler viewing Blender Wiki Manual PDF

Poppler Library has been used by Inkscape and GIMP to render PDF document nicely. PyPoppler is a bindings to Python using PyGTK for its user interface. It's analogue to PyWebkitGTK.

In this PDF reader screenshot, pypoppler demonstrate simple page and zoom control. In my test, rendering speed is quite responsive compared to Acrobat for pdf document with light graphics and rich text. But when handling pdf with rich layered graphics (that contain transparency), it starts to choked up though. Also it seems the demo fail to recognize page width & height (clip box?) correctly in some case, that's it drawn a smaller white rectangle like shown in 2nd shot and notice how scrollbars are missing there while inkscape correctly import the page with the same poppler.

Nonetheless this is probably the fastest way to integrate a PDF previewer or reader in your python apps rather than calling acrobat that might not installed, especially if you also using PyGTK. Or it could become a neat internal help/manual viewer (alternative to CHM eh?), hmm.. as long as it searchable :-).

11 January 2010

Clutter, a robust animation libraries

After given review to Chrome OS, I read more that Google use clutter in some of its window manager part. Generally google always carefully choose open source component in their projects, I guess clutter is no exception. Previously, I just heard a bit about clutter from cairo website so why don't give it a try! I'm so pleased by the demos, the script is clean and the animation is smooth and sleek. Clutter and PyClutter is like GTKGLExt and PyGtkGlExt, but more general purpose (I think) with expanded animation capabilities (no wonder goggle choose it). It could use cairo too in some operation.

Overall, Clutter is one of the best OpenGL framework with python binding (the other is PyGame2) that do more than most available libraries. With good documentation this should appealing for many developer, though few project that seems use them. I wonder where do clutter implemented outside Chrome OS, from goggle I just get moblin (mobile linux) that sounds popular. Given me impression that Clutter will be more spread in embedded platform (using OpenGLES).

Visit Clutter Site

20 December 2009

PyWebkitGTK Windows Binary

Python armed with webkitgtk? pywebkitgtk
See the demo:

This tabbed browser use 15KB of python code. Small eh?
But as you see we might need to impersonate the userAgent string into something like Safari (also using webkit) to shut facebook up... lol

Personally I didn't like its performance, it's nothing compared to safari (original implementator) not to mention Chrome! But talk about integration, WebkitGTK probably a bit ahead of QTWebkit by using Gstreamer (for multimedia backend) which I think still better than QT's phonon in Windows.

When both binded, HTML 5 will be a snap rather than what Opera 10 tries to do with their own way..