[GRASS-SVN] r45989 - grass-addons/gui/wxpython/wx.psmap/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Apr 15 10:42:47 EDT 2011
Author: annakrat
Date: 2011-04-15 07:42:47 -0700 (Fri, 15 Apr 2011)
New Revision: 45989
Modified:
grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py
Log:
wx.psmap: availability of ps2pdf tested earlier
Modified: grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py
===================================================================
--- grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py 2011-04-15 14:42:30 UTC (rev 45988)
+++ grass-addons/gui/wxpython/wx.psmap/gui_modules/psmap.py 2011-04-15 14:42:47 UTC (rev 45989)
@@ -352,6 +352,15 @@
def OnPDFFile(self, event):
"""!Generate PDF from PS with ps2pdf if available"""
+ try:
+ p = subprocess.Popen(["ps2pdf"], stderr = subprocess.PIPE)
+ p.stderr.close()
+
+ except OSError:
+ GMessage(parent = self,
+ message = _("Program ps2pdf is not available. Please install it first to create PDF."))
+ return
+
filename = self.getFile(wildcard = "PDF (*.pdf)|*.pdf")
if filename:
self.PSFile(filename, pdf = True)
@@ -359,8 +368,6 @@
def OnPreview(self, event):
"""!Run ps.map and show result"""
self.PSFile()
-
-
def PSFile(self, filename = None, pdf = False):
"""!Create temporary instructions file and run ps.map with output = filename"""
@@ -418,11 +425,14 @@
if event.userData['pdfname']:
try:
- ret = subprocess.call(['ps2pdf', '-dPDFSETTINGS=/prepress', '-r1200', event.userData['filename'], event.userData['pdfname']])
+ proc = subprocess.Popen(['ps2pdf', '-dPDFSETTINGS=/prepress', '-r1200',
+ event.userData['filename'], event.userData['pdfname']])
+
+ ret = proc.wait()
if ret > 0:
GMessage(parent = self,
message = _("ps2pdf exited with return code %s") % ret)
-
+
except OSError, e:
GError(parent = self,
message = _("Program ps2pdf is not available. Please install it to create PDF.\n\n %s") % e)
More information about the grass-commit
mailing list