Re: [Qgis-user] qgis python plugins / bindings on windows

2007-08-21 Thread Aaron Racicot
Richard,
Using 0.9 trunk and QT4.2 on Linux and Win I don't seem to have the same
issues that you are.  I am building everything myself and here is the
output:

 import PyQt4.QtGui
(works fine)
 PyQt4.QtGui.QApplication.aboutQt()
(About box appears)
 print PyQt4.QtGui.QApplication.instance()
PyQt4.QtGui.QApplication object at 0xb3dafd6c

Can you give some more details on what versions of things you are using
(where you got the win binaries) and how they were built...

A

++
 Aaron Racicot - GIS Programmer   
 360.221.2441 - [EMAIL PROTECTED]  
++
 z - p u l l e y
 pobox 1614
 langley wa 98260
 www.reprojected.com   
++

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Richard Duivenvoorde
Sent: Tuesday, August 21, 2007 1:57 AM
To: Martin Dobias
Cc: [EMAIL PROTECTED]
Subject: Re: [Qgis-user] qgis python plugins / bindings on windows


It seems to me that there is no QApplication constructed/available yet?

Python console in qgis is working:
  import PyQt4.QtGui
  PyQt4.QtGui.QApplication.beep()
  print iface
qgis.gui.QgisInterface object at 0x0495E660
works,

but calling
  PyQt4.QtGui.QApplication.aboutQt()
makes qgis crash with message:
QWidget: Must construct a QApplication before a QPaintDevice

aksing for the instancepointer:
  print PyQt4.QtGui.QApplication.instance()
None

Who/What is responsible for constructing/initialising QApplication?

Can there be a (configuration) reason that it's not there (yet)?

TIA

Richard Duivenvoorde




___
Qgis-user mailing list
Qgis-user@lists.qgis.org
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user


Re: [Qgis-user] qgis python plugins / bindings on windows

2007-08-21 Thread Richard Duivenvoorde
Hi Aaron,

I'm using a plain vanilla python 2.5 (Python 2.5 (r25:51908, Sep 19 
2006, 09:52:17)) msi-install (in c:\Program Files\, could that be a 
problem?)
I installed the binary QT4 (PyQt-Py2.5-gpl-4.3.0-b1.exe) from:
http://www.riverbankcomputing.co.uk/pyqt/download.php

And a qgis preview build qgis_setup0.9.0preview1.16.08.2007.exe from 
... some link of the list
I've also tried a build from Martin from the list
http://www.mapserver.sk/~wonder/qgis/qgis-trunk-070619-grass.zip

All with the same errors.

What are the qgis- python- qt- related environment variables you have? 
And exactly what PATH-constructs do you use?

 From the thread about the QgsApplication.setPrefixPath() there are 
some incompatible lib/version issues? I hope this can be worked 
out/documented later.

I will try a clean install later, or I've got a debian work station too, 
maby I've to switch to that and use stuff from:
http://debian.gfoss.it

Another option is building stuff myself, like you propose, do you think 
that's doable for a lightweight script person :-)

Thanks,

Richard Duivenvoorde


Richard Duivenvoorde wrote:
 It seems to me that there is no QApplication constructed/available yet?
 
 Python console in qgis is working:
   import PyQt4.QtGui
   PyQt4.QtGui.QApplication.beep()
   print iface
 qgis.gui.QgisInterface object at 0x0495E660
 works,
 
 but calling
   PyQt4.QtGui.QApplication.aboutQt()
 makes qgis crash with message:
 QWidget: Must construct a QApplication before a QPaintDevice
 
 aksing for the instancepointer:
   print PyQt4.QtGui.QApplication.instance()
 None
 
 Who/What is responsible for constructing/initialising QApplication?
 
 Can there be a (configuration) reason that it's not there (yet)?
 
 TIA
 
 Richard Duivenvoorde
 
 
 Richard Duivenvoorde wrote:
 I've installed the binary PyQt. And it seems that qgis is accepting 
 this. One note: you have to install Python/PyQt BEFORE installing qgis 
 (off course, but I didn't, gqis starts complaining then that 'couldn't 
 load qgis bindings' :-0  ).

 First I donwloaded your to python ported 'copyright plugin' from 
 http://blog.qgis.org/?q=node/59
 I can see it in the 'Plugin Manager' as 'CopyrightLabel' and it's 
 library name: 'python:copyright_plugin'.
 But tring to enable it by clicking the checkbox and clicking OK crashes 
 qgis with the following message in the commandbox:

 QPixmap: Must construct a QApplication before a QPaintDevice
 
 ___
 Qgis-user mailing list
 Qgis-user@lists.qgis.org
 http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user
 
 

___
Qgis-user mailing list
Qgis-user@lists.qgis.org
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user


[Qgis-user] qgis python plugins / bindings on windows

2007-08-20 Thread Richard Duivenvoorde
Hi List,

after reading the python plugin wiki pages I became excited and wanted 
to try to build my first python plugin (using the 0.9.0 preview binary 
on windows). And failed because of some complexities (for me :-( )

I downloaded SIP and PyQt4.3, but failed to install them because I don't 
have '(c)make' installed etc etc. Because SIP and PyQT are not fully 
installed (python configure ok, but make not possible...), Qgis gives a 
warning about not being able to use the python bindings.

My questions (hopefully this will be a quickstart the for all c-noobs 
like me):

- will you need a c-build environment (including make) to make python 
plugins? Now or after the 'real' 0.9 release?

- or is (will be) there another way to start hacking python plugins (eg. 
some huge qgis install including sip, python and pyqt or so??).

- if c-make etc is needed, what is the easiest way to start on windows: 
mingw, eclipse, visual studio, cygwin?

- how 'portable' will a python plugin be? If I develop a plugin on my 
debian box, can this plugin be used on 'vanilla qgis install' on windows 
also then (given the user installed python)?

I fear that I underestemated the python story, but will try anyway. 
There are so much nice free arcview3 scripts available to 'port' to 
qgis, and python seems a ideal language for this.

TIA

Richard Duivenvoorde
___
Qgis-user mailing list
Qgis-user@lists.qgis.org
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user


Re: [Qgis-user] qgis python plugins / bindings on windows

2007-08-20 Thread Martin Dobias
On 8/20/07, Richard Duivenvoorde [EMAIL PROTECTED] wrote:

 My questions (hopefully this will be a quickstart the for all c-noobs
 like me):

 - will you need a c-build environment (including make) to make python
 plugins? Now or after the 'real' 0.9 release?

Hi Richard!

When using binaries (i.e. you don't build qgis by yourself), you can
avoid installation of the build environment. On PyQt download page,
there's a binary package for windows with all stuff that you might
need: http://www.riverbankcomputing.co.uk/pyqt/download.php

So, in your case you would need to install only Python 2.5 and PyQt
binary package. QGIS python bindings then should load correctly. I'll
add a note about this on wiki...


 - or is (will be) there another way to start hacking python plugins (eg.
 some huge qgis install including sip, python and pyqt or so??).

I hope this question is answered with the answer above.

 - if c-make etc is needed, what is the easiest way to start on windows:
 mingw, eclipse, visual studio, cygwin?

MinGW is the best option here (and also only one officially supported)
- cygwin or msvc might or might not work for you. Btw. Eclipse doesn't
include a compiler by itself, but it can handle mingw and cygwin.

 - how 'portable' will a python plugin be? If I develop a plugin on my
 debian box, can this plugin be used on 'vanilla qgis install' on windows
 also then (given the user installed python)?

If you won't use any OS-dependent python modules, it will be portable
- everything will just work :)


 I fear that I underestemated the python story, but will try anyway.
 There are so much nice free arcview3 scripts available to 'port' to
 qgis, and python seems a ideal language for this.

I hope that getting python bindings to work won't be a headache. If
you encounter any problems, don't hesitate to contact us.

Regards
Martin
___
Qgis-user mailing list
Qgis-user@lists.qgis.org
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user


Re: [Qgis-user] qgis python plugins / bindings on windows

2007-08-20 Thread Richard Duivenvoorde
Hi Martin,
Ok thanks, I'm running now.

I've installed the binary PyQt. And it seems that qgis is accepting 
this. One note: you have to install Python/PyQt BEFORE installing qgis 
(off course, but I didn't, gqis starts complaining then that 'couldn't 
load qgis bindings' :-0  ).

First I donwloaded your to python ported 'copyright plugin' from 
http://blog.qgis.org/?q=node/59
I can see it in the 'Plugin Manager' as 'CopyrightLabel' and it's 
library name: 'python:copyright_plugin'.
But tring to enable it by clicking the checkbox and clicking OK crashes 
qgis with the following message in the commandbox:

QPixmap: Must construct a QApplication before a QPaintDevice

I thought it had something to do with the collision of the other 
copyrightlabel plugin, so thought to try out the 'minimal python plugin' 
from: http://wiki.qgis.org/qgiswiki/DevelopingPluginsWithPython first.

using the ../qgis/python/plugins/testplug as building dir I'm able to 
build everything like you describe in the wiki, but trying to load it 
makes my qgis(preview) crash with the same error:

C:\programs\QGIS090previewqgis
Loaded C:/programs/QGIS090preview/plugins/libcopyrightlabelplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libdelimitedtextplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libdelimitedtextprovider.dll
Loaded C:/programs/QGIS090preview/plugins/libgeorefplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libgpsimporterplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libgrassplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libgrassprovider.dll
Loaded C:/programs/QGIS090preview/plugins/libgridmakerplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libnortharrowplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libogrprovider.dll
Loaded C:/programs/QGIS090preview/plugins/libpggeoprocessingplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libpostgresprovider.dll
Loaded C:/programs/QGIS090preview/plugins/libscalebarplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libspitplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libwfsplugin.dll
Loaded C:/programs/QGIS090preview/plugins/libwmsprovider.dll
module 'copyright_plugin' from 
'C:/programs/QGIS090preview/python/plugins\copyright_plugin\__init__.pyc'
module 'testplug' from 
'C:/programs/QGIS090preview/python/plugins\testplug\__init__.pyc'
module 'copyright_plugin' from 
'C:/programs/QGIS090preview/python/plugins\copyright_plugin\__init__.pyc'
module 'testplug' from 
'C:/programs/QGIS090preview/python/plugins\testplug\__init__.pyc'
module 'copyright_plugin' from 
'C:/programs/QGIS090preview/python/plugins\copyright_plugin\__init__.pyc'
module 'testplug' from 
'C:/programs/QGIS090preview/python/plugins\testplug\__init__.pyc'
module 'testplug' from 
'C:/programs/QGIS090preview/python/plugins\testplug\__init__.pyc'
QPixmap: Must construct a QApplication before a QPaintDevice

Am I doing something wrong? Missing resources (I took the icon.xpm from 
the copyrightplugin to build the resources.py)?
Missing environment variables (seems to me nothing is needed?)

Grtz

Richard Duivenvoorde

Martin Dobias wrote:
  On 8/20/07, Richard Duivenvoorde [EMAIL PROTECTED] wrote:
  My questions (hopefully this will be a quickstart the for all c-noobs
  like me):
 
  - will you need a c-build environment (including make) to make python
  plugins? Now or after the 'real' 0.9 release?
 
  Hi Richard!
 
  When using binaries (i.e. you don't build qgis by yourself), you can
  avoid installation of the build environment. On PyQt download page,
  there's a binary package for windows with all stuff that you might
  need: http://www.riverbankcomputing.co.uk/pyqt/download.php
 
  So, in your case you would need to install only Python 2.5 and PyQt
  binary package. QGIS python bindings then should load correctly. I'll
  add a note about this on wiki...
 
 
  - or is (will be) there another way to start hacking python plugins (eg.
  some huge qgis install including sip, python and pyqt or so??).
 
  I hope this question is answered with the answer above.
 
  - if c-make etc is needed, what is the easiest way to start on windows:
  mingw, eclipse, visual studio, cygwin?
 
  MinGW is the best option here (and also only one officially supported)
  - cygwin or msvc might or might not work for you. Btw. Eclipse doesn't
  include a compiler by itself, but it can handle mingw and cygwin.
 
  - how 'portable' will a python plugin be? If I develop a plugin on my
  debian box, can this plugin be used on 'vanilla qgis install' on windows
  also then (given the user installed python)?
 
  If you won't use any OS-dependent python modules, it will be portable
  - everything will just work :)
 
 
  I fear that I underestemated the python story, but will try anyway.
  There are so much nice free arcview3 scripts available to 'port' to
  qgis, and python seems a ideal language for this.
 
  I hope that getting python bindings to work won't be a headache. If
  you encounter any problems,