Skip to content

Commit

Permalink
wxGUI/psmap: remove unnecessary HyperlinkDialog widget (OSGeo#2421)
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi committed Jun 10, 2022
1 parent 85ae4d5 commit 939ae8d
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions gui/wxpython/psmap/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
from core.utils import PilImageToWxImage
from gui_core.forms import GUI
from gui_core.widgets import GNotebook
from gui_core.dialogs import HyperlinkDialog
from gui_core.ghelp import ShowAboutDialog
from gui_core.wrap import ClientDC, PseudoDC, Rect, StockCursor, EmptyBitmap
from psmap.menudata import PsMapMenuData
Expand Down Expand Up @@ -462,29 +461,13 @@ def OnCmdDone(self, event):
# wx.BusyInfo does not display the message
busy = wx.BusyInfo(_("Generating preview, wait please"), parent=self)
wx.GetApp().Yield()
try:
im = PILImage.open(event.userData["filename"])
if self.instruction[self.pageId]["Orientation"] == "Landscape":
import numpy as np

im_array = np.array(im)
im = PILImage.fromarray(np.rot90(im_array, 3))
im.save(self.imgName, format="PNG")
except (IOError, OSError) as e:
del busy
dlg = HyperlinkDialog(
self,
title=_("Preview not available"),
message=_(
"Preview is not available probably because Ghostscript is not installed or not on PATH."
),
hyperlink="http://trac.osgeo.org/grass/wiki/CompileOnWindows#Ghostscript",
hyperlinkLabel=_("Please follow instructions on GRASS Trac Wiki."),
)
dlg.ShowModal()
dlg.Destroy()
return
im = PILImage.open(event.userData["filename"])
if self.instruction[self.pageId]["Orientation"] == "Landscape":
import numpy as np

im_array = np.array(im)
im = PILImage.fromarray(np.rot90(im_array, 3))
im.save(self.imgName, format="PNG")
rect = self.previewCanvas.ImageRect()
self.previewCanvas.image = wx.Image(self.imgName, wx.BITMAP_TYPE_PNG)
self.previewCanvas.DrawImage(rect=rect)
Expand Down

0 comments on commit 939ae8d

Please sign in to comment.