[GRASS-SVN] r55715 - in grass/branches/develbranch_6/gui/wxpython: gui_core psmap
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Apr 12 05:21:02 PDT 2013
Author: annakrat
Date: 2013-04-12 05:21:02 -0700 (Fri, 12 Apr 2013)
New Revision: 55715
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_core/dialogs.py
grass/branches/develbranch_6/gui/wxpython/psmap/frame.py
Log:
wxGUI/psmap: show more useful message when preview fails (merge from trunk, r55713)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_core/dialogs.py 2013-04-12 12:09:58 UTC (rev 55714)
+++ grass/branches/develbranch_6/gui/wxpython/gui_core/dialogs.py 2013-04-12 12:21:02 UTC (rev 55715)
@@ -2437,3 +2437,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/branches/develbranch_6/gui/wxpython/psmap/frame.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/psmap/frame.py 2013-04-12 12:09:58 UTC (rev 55714)
+++ grass/branches/develbranch_6/gui/wxpython/psmap/frame.py 2013-04-12 12:21:02 UTC (rev 55715)
@@ -39,6 +39,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 PsMapData
from psmap.dialogs import *
@@ -320,8 +321,13 @@
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