Hello!
> 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.
I would like to come up with something in the same direction:
In both apps presented in this thread everything seems to be relying on
the path that is hardcoded into qgislite.py and mainwindow.py
repectivly. The variable used is qgis_prefix = "/usr/local/qgis_svn"
(line 55).
I do not use a svn version of qgis. Instead I use the Ubuntu packages:
whereis qgis
qgis: /usr/bin/qgis /usr/lib/qgis /usr/share/qgis
Due to some to me unknown reason, the standalone apps and python
tutorials only work on my Ubuntu box when I set the path as follows:
qgis_prefix = "/usr"
I would recommend to use the where command for linux systems to get the
install folder.
Some pseudocode:
test if on linux
execute in bash `whereis qgis`
whereis_output = read output from that command
qgis_prefix = whereis_output
if on windows
use the approach Martin pointed out:
(${PROGRAM_FILES}/Quantum GIS"
note that some users like to change the default install folder
to something like c:\programms\qgis
else (installation folder can't be found
open a gui folder selection dialog and let the user select it.
As a workaround we could use a configuration.py file. There we set the
paths and the parameters for the app:
cat configuration.py
qgis_prefix = "/usr"
startup_project = "./data/mycustomproject.qgs"
So if you deliver the app and your users have problems to start the
program they'd only need to modify this configuration file and wouldn't
need to mess up with the rest.
> 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.
I think what the maximum would be to achieve real stand alone apps: ship
a directory with these resources in the app.
|-- LICENSE.TXT
|-- Makefile
|-- README.TXT
|-- core
|-- data
|-- qgis_common
|-- qgislite.py
`-- tools
Then every needed file could be put into the common directory
(qgis_common). And we are totally independant of a QGIS install.
In case of using many stand alone apps one would put the qgis_common
somewhere else and refernce it with the qgis_prefix variable.
Well, this are just some ideas. They only based on brainstorming and
didn't undergo testing here ;-) Hope you like them.
Regards,
Timmie
_______________________________________________
Qgis-user mailing list
[email protected]
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-user