On Jan 29, 2008 4:51 PM, Aaron Racicot <[EMAIL PROTECTED]> wrote:
>
> 3) You can play with a new project I am starting to develop called QGISLite.
> It can be found here:
>
>
>
> http://trac.reprojected.com/qgislite/
>
>
>
> The intention of this project is to create a very minimal GIS app based on
> the python bindings to QGIS that stand alone apps can be built against.  I
> just started that one, but look forward to adding to it.  The SVN for that
> one is:
>
>
>
> http://svn.reprojected.com/qgislite/trunk/

Aaron,

QGISLite looks nice :-) What will be the way to build standalone apps
against QGISLite? Are you going to implement QgisInterface so that
regular python plugins for QGIS could be used or use some other way?

Btw. it has been crashing for me when exiting (on linux) - the reason
is that garbage collection first deletes QApplication instance and
later before destruction of something related to QgsMapCanvas (don't
know what so far) wants to paint to QPixmap and that's not possible
anymore. This behaviour was happening also in the tutorials ported to
python. This may be caused by the merge of incremental rendering
support but I'm not sure. Anyway, it's possible to workaround it by
creating application in one function and then doing the rest of
initialization in other fuction so that first python will collect all
gui-related stuff and at last the application, i.e.:

def doInit():
  app = QApplication(sys.argv)
  initApp(app)

def initApp(app):
  # ... stuff ...

At last one thought:
What sucks about custom qgis-based application is the need to find out
the QGIS installation and set the paths to PyQGIS, QGIS libs and QGIS
resources. It comes to my mind that we could possibly do a simple
"bootstrap" python script that application could use. The bootstrap
script could work as follows:
1. check availability of PyQt4. if not available, quit gracefully and
tell the user about the problem in a way that they can understand it
2. try to find QGIS in some default paths (/usr, /usr/local on linux
or "${PROGRAM_FILES}/Quantum GIS" on windows etc.) or try to use a
previously saved path to QGIS installation from QSettings
3. if no installation has been found, fire up a simple UI in PyQt and
let the user select the installation directory. If the user doesn't
have QGIS installed at all, it could guide him to download and install
it for his platform - or even just download the necessary files like
libraries, providers and some resources like SRS database.
4. check whether the QGIS version is compatible (i.e. >= 0.9)
5. if everything is correct, let's set path to the bindings (modify
sys.path), path to the libraries (os.environ['LD_LIBRARY_PATH'] on
linux) and path to the resources (QgsApplication.setPrefixPath)
6. everything is ready :)

What do you think about that? Such script could be included in QGIS
sources so any project could copy it and use for bootstrapping.

Bye
Martin
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user

Reply via email to