[GRASS-SVN] r55713 - in grass/trunk/gui/wxpython: gui_core psmap
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Apr 12 04:48:31 PDT 2013
Author: annakrat
Date: 2013-04-12 04:48:31 -0700 (Fri, 12 Apr 2013)
New Revision: 55713
Modified:
grass/trunk/gui/wxpython/gui_core/dialogs.py
grass/trunk/gui/wxpython/psmap/frame.py
Log:
wxGUI/psmap: show more useful message when preview fails
Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py 2013-04-12 08:21:42 UTC (rev 55712)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py 2013-04-12 11:48:31 UTC (rev 55713)
@@ -2550,3 +2550,36 @@
def SetValue(self, value):
self._textCtrl.SetValue(value)
+
+
+class HyperlinkDialog(wx.Dialog):
+ """!Dialog for displaying message with hyperlink."""
+ def __init__(self, parent, title, message, hyperlink,
+ hyperlinkLabel=None, style=wx.OK):
+ """!Constructor
+
+ @param parent gui parent
+ @param title dialog title
+ @param message message
+ @param hyperlink url
+ @param hyperlinkLabel label shown instead of url
+ @param style button style
+ """
+ wx.Dialog.__init__(self, parent=parent, id=wx.ID_ANY, title=title,
+ style=wx.DEFAULT_DIALOG_STYLE)
+
+ sizer = wx.BoxSizer(wx.VERTICAL)
+
+ label = wx.StaticText(self, label=message)
+ sizer.Add(item=label, proportion=0, flag=wx.ALIGN_CENTRE|wx.ALL, border=10)
+ hyperlinkLabel = hyperlinkLabel if hyperlinkLabel else hyperlink
+ hyperlinkCtrl = wx.HyperlinkCtrl(self, id=wx.ID_ANY,
+ label=hyperlinkLabel, url=hyperlink,
+ style=wx.HL_ALIGN_LEFT|wx.HL_CONTEXTMENU)
+ sizer.Add(item=hyperlinkCtrl, proportion=0, flag=wx.EXPAND|wx.ALL, border=10)
+
+ btnsizer = self.CreateSeparatedButtonSizer(style)
+ sizer.Add(item=btnsizer, proportion=1, flag=wx.EXPAND | wx.ALL, border=10)
+
+ self.SetSizer(sizer)
+ sizer.Fit(self)
Modified: grass/trunk/gui/wxpython/psmap/frame.py
===================================================================
--- grass/trunk/gui/wxpython/psmap/frame.py 2013-04-12 08:21:42 UTC (rev 55712)
+++ grass/trunk/gui/wxpython/psmap/frame.py 2013-04-12 11:48:31 UTC (rev 55713)
@@ -37,6 +37,7 @@
from core.gcmd import RunCommand, GError, GMessage
from core.settings import UserSettings
from gui_core.forms import GUI
+from gui_core.dialogs import HyperlinkDialog
from psmap.menudata import PsMapMenuData
from psmap.dialogs import *
@@ -320,11 +321,14 @@
import types
im.load = types.MethodType(loadPSForWindows, im)
im.save(self.imgName, format = 'PNG')
-
except IOError, e:
- GError(parent = self,
- message = _("Unable to generate preview. %s") % e)
del busy
+ dlg = HyperlinkDialog(self, title=_("Preview not available"),
+ message=_("Preview is not available probably due to missing Ghostscript."),
+ hyperlink='http://trac.osgeo.org/grass/wiki/CompileOnWindows#Ghostscript',
+ hyperlinkLabel=_("Please follow instructions on GRASS Trac Wiki."))
+ dlg.ShowModal()
+ dlg.Destroy()
return
More information about the grass-commit
mailing list