Skip to content

Commit

Permalink
wxGUI: replace obsolete wx.BitmapFromImage
Browse files Browse the repository at this point in the history
  • Loading branch information
petrasovaa committed Dec 3, 2019
1 parent 7618b63 commit d121f7f
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 27 deletions.
6 changes: 3 additions & 3 deletions gui/wxpython/animation/mapwindow.py
Expand Up @@ -17,7 +17,7 @@

import wx
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


Expand Down Expand Up @@ -145,7 +145,7 @@ def _rescaleIfNeeded(self, bitmap):
im.Rescale(params['width'], params['height'])
self.x = params['x']
self.y = params['y']
bitmap = wx.BitmapFromImage(im)
bitmap = BitmapFromImage(im)
if self._overlay:
im = wx.ImageFromBitmap(self.bitmap_overlay)
im.Rescale(
Expand All @@ -154,7 +154,7 @@ def _rescaleIfNeeded(self, bitmap):
im.GetHeight() *
params['scale'])
self._setOverlay(
wx.BitmapFromImage(im),
BitmapFromImage(im),
xperc=self.perc[0],
yperc=self.perc[1])
else:
Expand Down
6 changes: 3 additions & 3 deletions gui/wxpython/gcp/manager.py
Expand Up @@ -59,7 +59,7 @@
from gcp.mapdisplay import MapFrame
from core.giface import Notification
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

Expand Down Expand Up @@ -1065,8 +1065,8 @@ def __init__(self, parent, giface, grwiz=None, id=wx.ID_ANY,
# CheckListCtrlMixin must set an ImageList first
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_up = self.il.Add(SmallUpArrow)

Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/gis_set.py
Expand Up @@ -46,7 +46,7 @@
from gui_core.dialogs import TextEntryDialog
from gui_core.widgets import GenericValidator, StaticWrapText
from gui_core.wrap import Button, ListCtrl, StaticText, StaticBox, \
TextCtrl
TextCtrl, BitmapFromImage


class GRASSStartup(wx.Frame):
Expand Down Expand Up @@ -101,7 +101,7 @@ def __init__(self, parent=None, id=wx.ID_ANY,
type=wx.BITMAP_TYPE_PNG))
except:
self.hbitmap = wx.StaticBitmap(
self.panel, wx.ID_ANY, wx.BitmapFromImage(
self.panel, wx.ID_ANY, BitmapFromImage(
wx.EmptyImage(530, 150)))

# labels
Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/image2target/ii2t_gis_set.py
Expand Up @@ -40,7 +40,7 @@
from gui_core.dialogs import TextEntryDialog
from gui_core.widgets import GenericValidator, StaticWrapText
from gui_core.wrap import Button, ListCtrl, StaticText, \
StaticBox, TextCtrl
StaticBox, TextCtrl, BitmapFromImage


class GRASSStartup(wx.Frame):
Expand Down Expand Up @@ -95,7 +95,7 @@ def __init__(self, parent=None, id=wx.ID_ANY,
type=wx.BITMAP_TYPE_PNG))
except:
self.hbitmap = wx.StaticBitmap(
self.panel, wx.ID_ANY, wx.BitmapFromImage(
self.panel, wx.ID_ANY, BitmapFromImage(
wx.EmptyImage(530, 150)))

# labels
Expand Down
6 changes: 3 additions & 3 deletions gui/wxpython/image2target/ii2t_manager.py
Expand Up @@ -62,7 +62,7 @@
from gcp.mapdisplay import MapFrame
from core.giface import Notification
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

Expand Down Expand Up @@ -1094,8 +1094,8 @@ def __init__(self, parent, giface, grwiz=None, id=wx.ID_ANY,
# CheckListCtrlMixin must set an ImageList first
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_up = self.il.Add(SmallUpArrow)

Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/modules/colorrules.py
Expand Up @@ -46,7 +46,7 @@
from core.settings import UserSettings
from gui_core.widgets import ColorTablesComboBox
from gui_core.wrap import SpinCtrl, PseudoDC, TextCtrl, Button, StaticText, \
StaticBox, EmptyBitmap
StaticBox, EmptyBitmap, BitmapFromImage


class RulesPanel:
Expand Down Expand Up @@ -1983,7 +1983,7 @@ def Draw(self, pdc, img=None, pdctype='image'):
if pdctype == 'image' and img:
bg = wx.TRANSPARENT_BRUSH
pdc.SetBackground(bg)
bitmap = wx.BitmapFromImage(img)
bitmap = BitmapFromImage(img)
w, h = bitmap.GetSize()
pdc.DrawBitmap(bitmap, 0, 0, True) # draw the composite map

Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/modules/histogram.py
Expand Up @@ -32,7 +32,7 @@
from core.debug import Debug
from core.gcmd import GError
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):
Expand Down Expand Up @@ -121,7 +121,7 @@ def Draw(self, pdc, img=None, drawid=None,
if pdctype == 'image':
bg = wx.TRANSPARENT_BRUSH
pdc.SetBackground(bg)
bitmap = wx.BitmapFromImage(img)
bitmap = BitmapFromImage(img)
w, h = bitmap.GetSize()
pdc.DrawBitmap(
bitmap, coords[0],
Expand Down
6 changes: 3 additions & 3 deletions gui/wxpython/photo2image/ip2i_manager.py
Expand Up @@ -54,7 +54,7 @@
from photo2image.ip2i_mapdisplay import MapFrame
from core.giface import Notification
from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \
TextCtrl, Menu, ListCtrl
TextCtrl, Menu, ListCtrl, BitmapFromImage

from location_wizard.wizard import TitledPage as TitledPage

Expand Down Expand Up @@ -487,8 +487,8 @@ def __init__(self, parent, giface, grwiz=None, id=wx.ID_ANY,
# CheckListCtrlMixin must set an ImageList first
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_up = self.il.Add(SmallUpArrow)

Expand Down
5 changes: 3 additions & 2 deletions gui/wxpython/psmap/dialogs.py
Expand Up @@ -73,7 +73,8 @@
from core.gcmd import RunCommand, GError, GMessage
from gui_core.dialogs import SymbolDialog
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.instructions import *

Expand Down Expand Up @@ -5821,7 +5822,7 @@ def _imagePanel(self, notebook):
self.previewSize = (150, 150)
img = wx.EmptyImage(*self.previewSize)
panel.image['preview'] = wx.StaticBitmap(
panel, wx.ID_ANY, wx.BitmapFromImage(img))
panel, wx.ID_ANY, BitmapFromImage(img))
vSizer.Add(
panel.image['preview'],
proportion=0,
Expand Down
4 changes: 2 additions & 2 deletions gui/wxpython/vnet/dialogs.py
Expand Up @@ -56,7 +56,7 @@
from gui_core.goutput import GConsoleWindow
from gui_core.gselect import Select, LayerSelect, ColumnSelect
from gui_core.wrap import SpinCtrl, Button, BitmapButton, StaticText, \
StaticBox, TextCtrl, ListCtrl
StaticBox, TextCtrl, ListCtrl, BitmapFromImage

from vnet.widgets import PointsList
from vnet.toolbars import MainToolbar, PointListToolbar, AnalysisToolbar
Expand Down Expand Up @@ -403,7 +403,7 @@ def _createParametersPage(self):
"grass",
"layer-vector-add.png"))
icon.Rescale(18, 18)
icon = wx.BitmapFromImage(icon)
icon = BitmapFromImage(icon)
self.addToTreeBtn = BitmapButton(
parent=selPanels[dataSel[0]],
bitmap=icon, size=globalvar.DIALOG_COLOR_SIZE)
Expand Down
7 changes: 4 additions & 3 deletions gui/wxpython/vnet/widgets.py
Expand Up @@ -28,7 +28,8 @@
ListCtrlAutoWidthMixin, TextEditMixin

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:
basestring = str
Expand Down Expand Up @@ -113,8 +114,8 @@ def __init__(self, parent, cols, id=wx.ID_ANY,
self.il = self.GetImageList(wx.IMAGE_LIST_SMALL)

# 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_up = self.il.Add(SmallUpArrow)

Expand Down

0 comments on commit d121f7f

Please sign in to comment.