[Qgis-developer] PyQGIS standalone without x server

2014-10-28 Thread Ziegler Stefan
Hi 

Since I do not have access to a server w/o x server I cannot test it by myself. 
Does anybody know if a running x server is required to run pyqgis standalone 
apps? E.g. something like this:

app = QApplication(sys.argv)
QgsApplication.setPrefixPath(/home/stefan/Apps/qgis_master, True)
QgsApplication.initQgis()

QgsProject.instance().setFileName(os.path.join(current_dir,  bpav5000sw.qgs))
QgsProject.instance().read():

QgsApplication.exitQgis()

Best regards
Stefan 


Freundliche Grüsse 
Stefan Ziegler 
Kantonsgeometer 

Amt für Geoinformation
Amtliche Vermessung 
Rötistrasse 4 
4500 Solothurn 

Telefon +41 32 627 75 96
Telefax +41 32 627 75 98 
stefan.zieg...@bd.so.ch
http://www.so.ch 

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] PyQGIS standalone without x server

2014-10-28 Thread Alessandro Pasotti
2014-10-28 11:47 GMT+01:00 Ziegler Stefan stefan.zieg...@bd.so.ch:
 Hi

 Since I do not have access to a server w/o x server I cannot test it by 
 myself. Does anybody know if a running x server is required to run pyqgis 
 standalone apps? E.g. something like this:

 app = QApplication(sys.argv)
 QgsApplication.setPrefixPath(/home/stefan/Apps/qgis_master, True)
 QgsApplication.initQgis()

 QgsProject.instance().setFileName(os.path.join(current_dir,  
 bpav5000sw.qgs))
 QgsProject.instance().read():

 QgsApplication.exitQgis()

 Best regards
 Stefan



I'm not sure if an X server is *always* required, what I know for sure
is that if you are going to use any SVG symbol or HTML formatted text
in a widget, then your script will crash with an ugly segfault if X
(or fake X) is not running.

-- 
Alessandro Pasotti
w3:   www.itopen.it
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] PyQGIS standalone without x server

2014-10-28 Thread Martin Dobias
Hi Stefan

On Tue, Oct 28, 2014 at 5:47 PM, Ziegler Stefan stefan.zieg...@bd.so.ch wrote:

 Since I do not have access to a server w/o x server I cannot test it by 
 myself. Does anybody know if a running x server is required to run pyqgis 
 standalone apps? E.g. something like this:

 app = QApplication(sys.argv)

The X server is required here. QApplication will try to make a
connection to it. QCoreApplication does not - but it brings other
limitations.

Actually there is an easy way to try it out - just set DISPLAY env
variable to nothing:

martin@zenbook:~$ DISPLAY= python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type help, copyright, credits or license for more information.
 from PyQt4 import QtGui
 app = QtGui.QApplication([])
: cannot connect to X server

(the process is aborted)

Cheers
Martin
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] PyQGIS standalone without x server

2014-10-28 Thread Ziegler Stefan
Thanks!

Regards
Stefan 

 -Ursprüngliche Nachricht-
 Von: Martin Dobias [mailto:wonder...@gmail.com]
 Gesendet: Dienstag, 28. Oktober 2014 11:56
 An: Ziegler Stefan
 Cc: qgis-developer@lists.osgeo.org
 Betreff: Re: [Qgis-developer] PyQGIS standalone without x server
 
 Hi Stefan
 
 On Tue, Oct 28, 2014 at 5:47 PM, Ziegler Stefan stefan.zieg...@bd.so.ch 
 wrote:
 
  Since I do not have access to a server w/o x server I cannot test it by 
  myself. Does
 anybody know if a running x server is required to run pyqgis standalone apps? 
 E.g.
 something like this:
 
  app = QApplication(sys.argv)
 
 The X server is required here. QApplication will try to make a connection to 
 it.
 QCoreApplication does not - but it brings other limitations.
 
 Actually there is an easy way to try it out - just set DISPLAY env variable 
 to nothing:
 
 martin@zenbook:~$ DISPLAY= python
 Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type 
 help,
 copyright, credits or license for more information.
  from PyQt4 import QtGui
  app = QtGui.QApplication([])
 : cannot connect to X server
 
 (the process is aborted)
 
 Cheers
 Martin
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer