Explorar o código

wxGUI: replace obsolete wx.BitmapFromImage

Anna Petrasova %!s(int64=5) %!d(string=hai) anos
pai
achega
d121f7f3fe

+ 3 - 3
gui/wxpython/animation/mapwindow.py

@@ -17,7 +17,7 @@ This program is free software under the GNU General Public License
 
 
 import wx
 import wx
 from core.debug import Debug
 from core.debug import Debug
-from gui_core.wrap import PseudoDC, EmptyBitmap, Rect
+from gui_core.wrap import PseudoDC, EmptyBitmap, Rect, BitmapFromImage
 from .utils import ComputeScaledRect
 from .utils import ComputeScaledRect
 
 
 
 
@@ -145,7 +145,7 @@ class AnimationWindow(BufferedWindow):
             im.Rescale(params['width'], params['height'])
             im.Rescale(params['width'], params['height'])
             self.x = params['x']
             self.x = params['x']
             self.y = params['y']
             self.y = params['y']
-            bitmap = wx.BitmapFromImage(im)
+            bitmap = BitmapFromImage(im)
             if self._overlay:
             if self._overlay:
                 im = wx.ImageFromBitmap(self.bitmap_overlay)
                 im = wx.ImageFromBitmap(self.bitmap_overlay)
                 im.Rescale(
                 im.Rescale(
@@ -154,7 +154,7 @@ class AnimationWindow(BufferedWindow):
                     im.GetHeight() *
                     im.GetHeight() *
                     params['scale'])
                     params['scale'])
                 self._setOverlay(
                 self._setOverlay(
-                    wx.BitmapFromImage(im),
+                    BitmapFromImage(im),
                     xperc=self.perc[0],
                     xperc=self.perc[0],
                     yperc=self.perc[1])
                     yperc=self.perc[1])
         else:
         else:

+ 3 - 3
gui/wxpython/gcp/manager.py

@@ -59,7 +59,7 @@ from core.settings import UserSettings
 from gcp.mapdisplay import MapFrame
 from gcp.mapdisplay import MapFrame
 from core.giface import Notification
 from core.giface import Notification
 from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
 from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
-    CheckListBox, TextCtrl, Menu, ListCtrl
+    CheckListBox, TextCtrl, Menu, ListCtrl, BitmapFromImage
 
 
 from location_wizard.wizard import TitledPage as TitledPage
 from location_wizard.wizard import TitledPage as TitledPage
 
 
@@ -1065,8 +1065,8 @@ class GCP(MapFrame, ColumnSorterMixin):
         # CheckListCtrlMixin must set an ImageList first
         # CheckListCtrlMixin must set an ImageList first
         self.il = self.list.GetImageList(wx.IMAGE_LIST_SMALL)
         self.il = self.list.GetImageList(wx.IMAGE_LIST_SMALL)
 
 
-        SmallUpArrow = wx.BitmapFromImage(getSmallUpArrowImage())
-        SmallDnArrow = wx.BitmapFromImage(getSmallDnArrowImage())
+        SmallUpArrow = BitmapFromImage(getSmallUpArrowImage())
+        SmallDnArrow = BitmapFromImage(getSmallDnArrowImage())
         self.sm_dn = self.il.Add(SmallDnArrow)
         self.sm_dn = self.il.Add(SmallDnArrow)
         self.sm_up = self.il.Add(SmallUpArrow)
         self.sm_up = self.il.Add(SmallUpArrow)
 
 

+ 2 - 2
gui/wxpython/gis_set.py

@@ -46,7 +46,7 @@ from location_wizard.dialogs import RegionDef
 from gui_core.dialogs import TextEntryDialog
 from gui_core.dialogs import TextEntryDialog
 from gui_core.widgets import GenericValidator, StaticWrapText
 from gui_core.widgets import GenericValidator, StaticWrapText
 from gui_core.wrap import Button, ListCtrl, StaticText, StaticBox, \
 from gui_core.wrap import Button, ListCtrl, StaticText, StaticBox, \
-    TextCtrl
+    TextCtrl, BitmapFromImage
 
 
 
 
 class GRASSStartup(wx.Frame):
 class GRASSStartup(wx.Frame):
@@ -101,7 +101,7 @@ class GRASSStartup(wx.Frame):
                                                      type=wx.BITMAP_TYPE_PNG))
                                                      type=wx.BITMAP_TYPE_PNG))
         except:
         except:
             self.hbitmap = wx.StaticBitmap(
             self.hbitmap = wx.StaticBitmap(
-                self.panel, wx.ID_ANY, wx.BitmapFromImage(
+                self.panel, wx.ID_ANY, BitmapFromImage(
                     wx.EmptyImage(530, 150)))
                     wx.EmptyImage(530, 150)))
 
 
         # labels
         # labels

+ 2 - 2
gui/wxpython/image2target/ii2t_gis_set.py

@@ -40,7 +40,7 @@ from location_wizard.dialogs import RegionDef
 from gui_core.dialogs import TextEntryDialog
 from gui_core.dialogs import TextEntryDialog
 from gui_core.widgets import GenericValidator, StaticWrapText
 from gui_core.widgets import GenericValidator, StaticWrapText
 from gui_core.wrap import Button, ListCtrl, StaticText, \
 from gui_core.wrap import Button, ListCtrl, StaticText, \
-    StaticBox, TextCtrl
+    StaticBox, TextCtrl, BitmapFromImage
 
 
 
 
 class GRASSStartup(wx.Frame):
 class GRASSStartup(wx.Frame):
@@ -95,7 +95,7 @@ class GRASSStartup(wx.Frame):
                                                      type=wx.BITMAP_TYPE_PNG))
                                                      type=wx.BITMAP_TYPE_PNG))
         except:
         except:
             self.hbitmap = wx.StaticBitmap(
             self.hbitmap = wx.StaticBitmap(
-                self.panel, wx.ID_ANY, wx.BitmapFromImage(
+                self.panel, wx.ID_ANY, BitmapFromImage(
                     wx.EmptyImage(530, 150)))
                     wx.EmptyImage(530, 150)))
 
 
         # labels
         # labels

+ 3 - 3
gui/wxpython/image2target/ii2t_manager.py

@@ -62,7 +62,7 @@ from core.settings import UserSettings
 from gcp.mapdisplay import MapFrame
 from gcp.mapdisplay import MapFrame
 from core.giface import Notification
 from core.giface import Notification
 from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
 from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
-    CheckListBox, TextCtrl, Menu, ListCtrl
+    CheckListBox, TextCtrl, Menu, ListCtrl, BitmapFromImage
 
 
 from location_wizard.wizard import TitledPage as TitledPage
 from location_wizard.wizard import TitledPage as TitledPage
 
 
@@ -1094,8 +1094,8 @@ class GCP(MapFrame, ColumnSorterMixin):
         # CheckListCtrlMixin must set an ImageList first
         # CheckListCtrlMixin must set an ImageList first
         self.il = self.list.GetImageList(wx.IMAGE_LIST_SMALL)
         self.il = self.list.GetImageList(wx.IMAGE_LIST_SMALL)
 
 
-        SmallUpArrow = wx.BitmapFromImage(getSmallUpArrowImage())
-        SmallDnArrow = wx.BitmapFromImage(getSmallDnArrowImage())
+        SmallUpArrow = BitmapFromImage(getSmallUpArrowImage())
+        SmallDnArrow = BitmapFromImage(getSmallDnArrowImage())
         self.sm_dn = self.il.Add(SmallDnArrow)
         self.sm_dn = self.il.Add(SmallDnArrow)
         self.sm_up = self.il.Add(SmallUpArrow)
         self.sm_up = self.il.Add(SmallUpArrow)
 
 

+ 2 - 2
gui/wxpython/modules/colorrules.py

@@ -46,7 +46,7 @@ from core.debug import Debug as Debug
 from core.settings import UserSettings
 from core.settings import UserSettings
 from gui_core.widgets import ColorTablesComboBox
 from gui_core.widgets import ColorTablesComboBox
 from gui_core.wrap import SpinCtrl, PseudoDC, TextCtrl, Button, StaticText, \
 from gui_core.wrap import SpinCtrl, PseudoDC, TextCtrl, Button, StaticText, \
-    StaticBox, EmptyBitmap
+    StaticBox, EmptyBitmap, BitmapFromImage
 
 
 
 
 class RulesPanel:
 class RulesPanel:
@@ -1983,7 +1983,7 @@ class BufferedWindow(wx.Window):
         if pdctype == 'image' and img:
         if pdctype == 'image' and img:
             bg = wx.TRANSPARENT_BRUSH
             bg = wx.TRANSPARENT_BRUSH
             pdc.SetBackground(bg)
             pdc.SetBackground(bg)
-            bitmap = wx.BitmapFromImage(img)
+            bitmap = BitmapFromImage(img)
             w, h = bitmap.GetSize()
             w, h = bitmap.GetSize()
             pdc.DrawBitmap(bitmap, 0, 0, True)  # draw the composite map
             pdc.DrawBitmap(bitmap, 0, 0, True)  # draw the composite map
 
 

+ 2 - 2
gui/wxpython/modules/histogram.py

@@ -32,7 +32,7 @@ from gui_core.preferences import DefaultFontDialog
 from core.debug import Debug
 from core.debug import Debug
 from core.gcmd import GError
 from core.gcmd import GError
 from gui_core.toolbars import BaseToolbar, BaseIcons
 from gui_core.toolbars import BaseToolbar, BaseIcons
-from gui_core.wrap import PseudoDC, Menu, EmptyBitmap, NewId
+from gui_core.wrap import PseudoDC, Menu, EmptyBitmap, NewId, BitmapFromImage
 
 
 
 
 class BufferedWindow(wx.Window):
 class BufferedWindow(wx.Window):
@@ -121,7 +121,7 @@ class BufferedWindow(wx.Window):
         if pdctype == 'image':
         if pdctype == 'image':
             bg = wx.TRANSPARENT_BRUSH
             bg = wx.TRANSPARENT_BRUSH
             pdc.SetBackground(bg)
             pdc.SetBackground(bg)
-            bitmap = wx.BitmapFromImage(img)
+            bitmap = BitmapFromImage(img)
             w, h = bitmap.GetSize()
             w, h = bitmap.GetSize()
             pdc.DrawBitmap(
             pdc.DrawBitmap(
                 bitmap, coords[0],
                 bitmap, coords[0],

+ 3 - 3
gui/wxpython/photo2image/ip2i_manager.py

@@ -54,7 +54,7 @@ from core.settings import UserSettings
 from photo2image.ip2i_mapdisplay import MapFrame
 from photo2image.ip2i_mapdisplay import MapFrame
 from core.giface import Notification
 from core.giface import Notification
 from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
 from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
-    TextCtrl, Menu, ListCtrl
+    TextCtrl, Menu, ListCtrl, BitmapFromImage
 
 
 from location_wizard.wizard import TitledPage as TitledPage
 from location_wizard.wizard import TitledPage as TitledPage
 
 
@@ -487,8 +487,8 @@ class GCP(MapFrame, ColumnSorterMixin):
         # CheckListCtrlMixin must set an ImageList first
         # CheckListCtrlMixin must set an ImageList first
         self.il = self.list.GetImageList(wx.IMAGE_LIST_SMALL)
         self.il = self.list.GetImageList(wx.IMAGE_LIST_SMALL)
 
 
-        SmallUpArrow = wx.BitmapFromImage(getSmallUpArrowImage())
-        SmallDnArrow = wx.BitmapFromImage(getSmallDnArrowImage())
+        SmallUpArrow = BitmapFromImage(getSmallUpArrowImage())
+        SmallDnArrow = BitmapFromImage(getSmallDnArrowImage())
         self.sm_dn = self.il.Add(SmallDnArrow)
         self.sm_dn = self.il.Add(SmallDnArrow)
         self.sm_up = self.il.Add(SmallUpArrow)
         self.sm_up = self.il.Add(SmallUpArrow)
 
 

+ 3 - 2
gui/wxpython/psmap/dialogs.py

@@ -73,7 +73,8 @@ from gui_core.gselect import Select
 from core.gcmd import RunCommand, GError, GMessage
 from core.gcmd import RunCommand, GError, GMessage
 from gui_core.dialogs import SymbolDialog
 from gui_core.dialogs import SymbolDialog
 from gui_core.wrap import SpinCtrl, Button, TextCtrl, BitmapButton, \
 from gui_core.wrap import SpinCtrl, Button, TextCtrl, BitmapButton, \
-    StaticText, StaticBox, Rect, EmptyBitmap, TextEntryDialog, ListCtrl, NewId
+    StaticText, StaticBox, Rect, EmptyBitmap, TextEntryDialog, ListCtrl, NewId, \
+    BitmapFromImage
 from psmap.utils import *
 from psmap.utils import *
 from psmap.instructions import *
 from psmap.instructions import *
 
 
@@ -5821,7 +5822,7 @@ class ImageDialog(PsmapDialog):
         self.previewSize = (150, 150)
         self.previewSize = (150, 150)
         img = wx.EmptyImage(*self.previewSize)
         img = wx.EmptyImage(*self.previewSize)
         panel.image['preview'] = wx.StaticBitmap(
         panel.image['preview'] = wx.StaticBitmap(
-            panel, wx.ID_ANY, wx.BitmapFromImage(img))
+            panel, wx.ID_ANY, BitmapFromImage(img))
         vSizer.Add(
         vSizer.Add(
             panel.image['preview'],
             panel.image['preview'],
             proportion=0,
             proportion=0,

+ 2 - 2
gui/wxpython/vnet/dialogs.py

@@ -56,7 +56,7 @@ from gui_core.widgets import GNotebook
 from gui_core.goutput import GConsoleWindow
 from gui_core.goutput import GConsoleWindow
 from gui_core.gselect import Select, LayerSelect, ColumnSelect
 from gui_core.gselect import Select, LayerSelect, ColumnSelect
 from gui_core.wrap import SpinCtrl, Button, BitmapButton, StaticText, \
 from gui_core.wrap import SpinCtrl, Button, BitmapButton, StaticText, \
-    StaticBox, TextCtrl, ListCtrl
+    StaticBox, TextCtrl, ListCtrl, BitmapFromImage
 
 
 from vnet.widgets import PointsList
 from vnet.widgets import PointsList
 from vnet.toolbars import MainToolbar, PointListToolbar, AnalysisToolbar
 from vnet.toolbars import MainToolbar, PointListToolbar, AnalysisToolbar
@@ -403,7 +403,7 @@ class VNETDialog(wx.Dialog):
                         "grass",
                         "grass",
                         "layer-vector-add.png"))
                         "layer-vector-add.png"))
                 icon.Rescale(18, 18)
                 icon.Rescale(18, 18)
-                icon = wx.BitmapFromImage(icon)
+                icon = BitmapFromImage(icon)
                 self.addToTreeBtn = BitmapButton(
                 self.addToTreeBtn = BitmapButton(
                     parent=selPanels[dataSel[0]],
                     parent=selPanels[dataSel[0]],
                     bitmap=icon, size=globalvar.DIALOG_COLOR_SIZE)
                     bitmap=icon, size=globalvar.DIALOG_COLOR_SIZE)

+ 4 - 3
gui/wxpython/vnet/widgets.py

@@ -28,7 +28,8 @@ from wx.lib.mixins.listctrl import CheckListCtrlMixin, ColumnSorterMixin, \
     ListCtrlAutoWidthMixin, TextEditMixin
     ListCtrlAutoWidthMixin, TextEditMixin
 
 
 from core import globalvar
 from core import globalvar
-from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, ListCtrl
+from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, ListCtrl, \
+    BitmapFromImage
 
 
 if sys.version_info.major >= 3:
 if sys.version_info.major >= 3:
     basestring = str
     basestring = str
@@ -113,8 +114,8 @@ class PointsList(ListCtrl,
         self.il = self.GetImageList(wx.IMAGE_LIST_SMALL)
         self.il = self.GetImageList(wx.IMAGE_LIST_SMALL)
 
 
         # images for column sorting
         # images for column sorting
-        SmallUpArrow = wx.BitmapFromImage(self.getSmallUpArrowImage())
-        SmallDnArrow = wx.BitmapFromImage(self.getSmallDnArrowImage())
+        SmallUpArrow = BitmapFromImage(self.getSmallUpArrowImage())
+        SmallDnArrow = BitmapFromImage(self.getSmallDnArrowImage())
         self.sm_dn = self.il.Add(SmallDnArrow)
         self.sm_dn = self.il.Add(SmallDnArrow)
         self.sm_up = self.il.Add(SmallUpArrow)
         self.sm_up = self.il.Add(SmallUpArrow)