Skip to content

Commit

Permalink
get rid of wx.insertStringItem deprecation warnings (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
pesekon2 authored and neteler committed Sep 6, 2019
1 parent 197c9d4 commit 726b55e
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 23 deletions.
6 changes: 3 additions & 3 deletions gui/wxpython/gmodeler/dialogs.py
Expand Up @@ -40,7 +40,7 @@
from gmodeler.model import *
from lmgr.menudata import LayerManagerMenuData
from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \
Menu
Menu, ListCtrl

from grass.script import task as gtask

Expand Down Expand Up @@ -671,7 +671,7 @@ def GetItems(self):
'else': self.itemListElse.GetItems()}


class ModelListCtrl(wx.ListCtrl,
class ModelListCtrl(ListCtrl,
listmix.ListCtrlAutoWidthMixin,
listmix.TextEditMixin):

Expand All @@ -686,7 +686,7 @@ def __init__(
self.frame = frame
self.columnNotEditable = columnsNotEditable

wx.ListCtrl.__init__(self, parent, id=id, style=style, **kwargs)
ListCtrl.__init__(self, parent, id=id, style=style, **kwargs)
listmix.ListCtrlAutoWidthMixin.__init__(self)
listmix.TextEditMixin.__init__(self)

Expand Down
5 changes: 1 addition & 4 deletions gui/wxpython/gui_core/preferences.py
Expand Up @@ -2205,10 +2205,7 @@ def LoadData(self):
for mapset in self.parent.all_mapsets_ordered:
# unclear why this is needed,
# wrap.ListrCtrl should do the job but it doesn't in this case
if wxPythonPhoenix:
index = self.InsertItem(self.GetItemCount(), mapset)
else:
index = self.InsertStringItem(self.GetItemCount(), mapset)
index = self.InsertStringItem(self.GetItemCount(), mapset)
mapsetPath = os.path.join(locationPath,
mapset)
stat_info = os.stat(mapsetPath)
Expand Down
6 changes: 3 additions & 3 deletions gui/wxpython/gui_core/vselect.py
Expand Up @@ -27,18 +27,18 @@

from core.gcmd import GMessage, GError, GWarning
from core.gcmd import RunCommand
from gui_core.wrap import Button
from gui_core.wrap import Button, ListCtrl

import grass.script as grass
from grass.pydispatch.signal import Signal


class VectorSelectList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
class VectorSelectList(ListCtrl, listmix.ListCtrlAutoWidthMixin):
"""Widget for managing vector features selected from map display
"""

def __init__(self, parent):
wx.ListCtrl.__init__(
ListCtrl.__init__(
self,
parent=parent,
id=wx.ID_ANY,
Expand Down
5 changes: 1 addition & 4 deletions gui/wxpython/gui_core/widgets.py
Expand Up @@ -1034,10 +1034,7 @@ def LoadData(self, data=None, selectOne=True):

idx = 0
for item in data:
if wxPythonPhoenix:
index = self.InsertItem(idx, str(item[0]))
else:
index = self.InsertStringItem(idx, str(item[0]))
index = self.InsertStringItem(idx, str(item[0]))
for i in range(1, self.GetColumnCount()):
self.SetStringItem(index, i, item[i])
idx += 1
Expand Down
6 changes: 3 additions & 3 deletions gui/wxpython/psmap/dialogs.py
Expand Up @@ -73,7 +73,7 @@
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
StaticText, StaticBox, Rect, EmptyBitmap, TextEntryDialog, ListCtrl
from psmap.utils import *
from psmap.instructions import *

Expand Down Expand Up @@ -201,11 +201,11 @@ def OnMeasureItemWidth(self, item):
return -1 # default - will be measured from text width


class CheckListCtrl(wx.ListCtrl, CheckListCtrlMixin, ListCtrlAutoWidthMixin):
class CheckListCtrl(ListCtrl, CheckListCtrlMixin, ListCtrlAutoWidthMixin):
"""List control for managing order and labels of vector maps in legend"""

def __init__(self, parent):
wx.ListCtrl.__init__(
ListCtrl.__init__(
self, parent, id=wx.ID_ANY, style=wx.LC_REPORT | wx.LC_SINGLE_SEL |
wx.BORDER_SUNKEN | wx.LC_VRULES | wx.LC_HRULES)
CheckListCtrlMixin.__init__(self)
Expand Down
11 changes: 5 additions & 6 deletions gui/wxpython/vdigit/dialogs.py
Expand Up @@ -29,7 +29,7 @@
from core.debug import Debug
from core.settings import UserSettings
from gui_core.wrap import SpinCtrl, Button, StaticText, \
StaticBox, Menu
StaticBox, Menu, ListCtrl


class VDigitCategoryDialog(wx.Dialog, listmix.ColumnSorterMixin):
Expand Down Expand Up @@ -554,7 +554,7 @@ def UpdateDialog(self, query=None, cats=None):
return True


class CategoryListCtrl(wx.ListCtrl,
class CategoryListCtrl(ListCtrl,
listmix.ListCtrlAutoWidthMixin,
listmix.TextEditMixin):

Expand All @@ -563,7 +563,7 @@ def __init__(self, parent, id, pos=wx.DefaultPosition,
"""List of layers/categories"""
self.parent = parent

wx.ListCtrl.__init__(self, parent, id, pos, size, style)
ListCtrl.__init__(self, parent, id, pos, size, style)

listmix.ListCtrlAutoWidthMixin.__init__(self)
listmix.TextEditMixin.__init__(self)
Expand Down Expand Up @@ -775,7 +775,7 @@ def GetUnSelected(self):


class CheckListFeature(
wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.CheckListCtrlMixin):
ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.CheckListCtrlMixin):

def __init__(self, parent, data,
pos=wx.DefaultPosition, log=None):
Expand All @@ -784,8 +784,7 @@ def __init__(self, parent, data,
self.parent = parent
self.data = data

wx.ListCtrl.__init__(self, parent, wx.ID_ANY,
style=wx.LC_REPORT)
ListCtrl.__init__(self, parent, wx.ID_ANY, style=wx.LC_REPORT)

listmix.CheckListCtrlMixin.__init__(self)

Expand Down

0 comments on commit 726b55e

Please sign in to comment.