From 931490c3691c00c94b4388e3cfa81440ba342a08 Mon Sep 17 00:00:00 2001 From: Anna Petrasova Date: Fri, 6 Dec 2019 14:50:22 +0100 Subject: [PATCH] wxGUI: fix GCP manager for py3 --- gui/wxpython/gcp/manager.py | 9 ++++---- gui/wxpython/image2target/ii2t_manager.py | 4 ++-- gui/wxpython/mapwin/buffered.py | 25 +++++++++++------------ gui/wxpython/photo2image/ip2i_manager.py | 4 ++-- gui/wxpython/vnet/widgets.py | 4 ++-- 5 files changed, 22 insertions(+), 24 deletions(-) diff --git a/gui/wxpython/gcp/manager.py b/gui/wxpython/gcp/manager.py index f3465ef308a..627ec74c0ab 100644 --- a/gui/wxpython/gcp/manager.py +++ b/gui/wxpython/gcp/manager.py @@ -79,7 +79,7 @@ def getSmallUpArrowImage(): stream = open(os.path.join(globalvar.IMGDIR, 'small_up_arrow.png'), 'rb') try: - img = wx.ImageFromStream(stream) + img = wx.Image(stream) finally: stream.close() return img @@ -88,7 +88,7 @@ def getSmallUpArrowImage(): def getSmallDnArrowImage(): stream = open(os.path.join(globalvar.IMGDIR, 'small_down_arrow.png'), 'rb') try: - img = wx.ImageFromStream(stream) + img = wx.Image(stream) finally: stream.close() stream.close() @@ -2174,7 +2174,7 @@ def _Create(self): _('Forward error'), _('Backward error')): info.SetText(lbl) - self.InsertColumnInfo(idx_col, info) + self.InsertColumn(idx_col, info) idx_col += 1 def LoadData(self): @@ -2682,11 +2682,10 @@ def __CreateSymbologyPage(self, notebook): parent=panel, id=wx.ID_ANY, label=_("Highlight RMS error > M + SD * factor:")) rmslabel.SetToolTip( - wx.ToolTip( _( "Highlight GCPs with an RMS error larger than \n" "mean + standard deviation * given factor. \n" - "Recommended values for this factor are between 1 and 2."))) + "Recommended values for this factor are between 1 and 2.")) rmsgridSizer.Add( rmslabel, flag=wx.ALIGN_CENTER_VERTICAL, diff --git a/gui/wxpython/image2target/ii2t_manager.py b/gui/wxpython/image2target/ii2t_manager.py index ae081ad3554..877afe18058 100644 --- a/gui/wxpython/image2target/ii2t_manager.py +++ b/gui/wxpython/image2target/ii2t_manager.py @@ -82,7 +82,7 @@ def getSmallUpArrowImage(): stream = open(os.path.join(globalvar.IMGDIR, 'small_up_arrow.png'), 'rb') try: - img = wx.ImageFromStream(stream) + img = wx.Image(stream) finally: stream.close() return img @@ -91,7 +91,7 @@ def getSmallUpArrowImage(): def getSmallDnArrowImage(): stream = open(os.path.join(globalvar.IMGDIR, 'small_down_arrow.png'), 'rb') try: - img = wx.ImageFromStream(stream) + img = wx.Image(stream) finally: stream.close() stream.close() diff --git a/gui/wxpython/mapwin/buffered.py b/gui/wxpython/mapwin/buffered.py index dce950deba5..b7d73eccfd7 100644 --- a/gui/wxpython/mapwin/buffered.py +++ b/gui/wxpython/mapwin/buffered.py @@ -1557,19 +1557,18 @@ def OnLeftUp(self, event): self.digit: self._onLeftUp(event) - elif (self.mouse['use'] == 'pointer' and - self.dragid and int(self.dragid) >= 0): - # end drag of overlay decoration - - if self.overlays and self.dragid in self.overlays: - self.overlays[ - self.dragid].coords = self.pdc.GetIdBounds( - self.dragid) - elif self.dragid in self.textdict: - self.textdict[self.dragid]['bbox'] = self.pdc.GetIdBounds(self.dragid) - else: - pass - self.dragid = None + elif self.mouse['use'] == 'pointer': + if self.dragid and int(self.dragid) >= 0: + # end drag of overlay decoration + if self.overlays and self.dragid in self.overlays: + self.overlays[ + self.dragid].coords = self.pdc.GetIdBounds( + self.dragid) + elif self.dragid in self.textdict: + self.textdict[self.dragid]['bbox'] = self.pdc.GetIdBounds(self.dragid) + else: + pass + self.dragid = None self.mouseLeftUpPointer.emit(x=coordinates[0], y=coordinates[1]) diff --git a/gui/wxpython/photo2image/ip2i_manager.py b/gui/wxpython/photo2image/ip2i_manager.py index 4c7fe1c8299..6c6ccb80012 100644 --- a/gui/wxpython/photo2image/ip2i_manager.py +++ b/gui/wxpython/photo2image/ip2i_manager.py @@ -73,7 +73,7 @@ def getSmallUpArrowImage(): stream = open(os.path.join(globalvar.IMGDIR, 'small_up_arrow.png'), 'rb') try: - img = wx.ImageFromStream(stream) + img = wx.Image(stream) finally: stream.close() return img @@ -82,7 +82,7 @@ def getSmallUpArrowImage(): def getSmallDnArrowImage(): stream = open(os.path.join(globalvar.IMGDIR, 'small_down_arrow.png'), 'rb') try: - img = wx.ImageFromStream(stream) + img = wx.Image(stream) finally: stream.close() stream.close() diff --git a/gui/wxpython/vnet/widgets.py b/gui/wxpython/vnet/widgets.py index 80133471ec1..6a0ec6d1222 100644 --- a/gui/wxpython/vnet/widgets.py +++ b/gui/wxpython/vnet/widgets.py @@ -436,7 +436,7 @@ def getSmallUpArrowImage(self): 'small_up_arrow.png'), 'rb') try: - img = wx.ImageFromStream(stream) + img = wx.Image(stream) finally: stream.close() return img @@ -449,7 +449,7 @@ def getSmallDnArrowImage(self): 'small_down_arrow.png'), 'rb') try: - img = wx.ImageFromStream(stream) + img = wx.Image(stream) finally: stream.close() return img