[GRASS-SVN] r71311 - in grass/trunk/gui/wxpython: datacatalog gui_core lmgr location_wizard mapwin
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jul 23 21:08:20 PDT 2017
Author: annakrat
Date: 2017-07-23 21:08:20 -0700 (Sun, 23 Jul 2017)
New Revision: 71311
Modified:
grass/trunk/gui/wxpython/datacatalog/tree.py
grass/trunk/gui/wxpython/gui_core/dialogs.py
grass/trunk/gui/wxpython/gui_core/gselect.py
grass/trunk/gui/wxpython/gui_core/menu.py
grass/trunk/gui/wxpython/gui_core/toolbars.py
grass/trunk/gui/wxpython/gui_core/widgets.py
grass/trunk/gui/wxpython/gui_core/wrap.py
grass/trunk/gui/wxpython/lmgr/layertree.py
grass/trunk/gui/wxpython/location_wizard/wizard.py
grass/trunk/gui/wxpython/mapwin/buffered.py
Log:
wxGUI: continue making gui compatible with Phoenix
Modified: grass/trunk/gui/wxpython/datacatalog/tree.py
===================================================================
--- grass/trunk/gui/wxpython/datacatalog/tree.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/datacatalog/tree.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -30,6 +30,7 @@
from core.giface import StandaloneGrassInterface
from core.treemodel import TreeModel, DictNode
from gui_core.treeview import TreeView
+from gui_core.wrap import Menu
from datacatalog.dialogs import CatalogReprojectionDialog
from grass.pydispatch.signal import Signal
@@ -941,7 +942,7 @@
def _popupMenuLayer(self):
"""Create popup menu for layers"""
- menu = wx.Menu()
+ menu = Menu()
genv = gisenv()
currentLocation, currentMapset = self._isCurrent(genv)
Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -47,7 +47,7 @@
from core.utils import _
from core.settings import UserSettings
from core.debug import Debug
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, TextCtrl
class SimpleDialog(wx.Dialog):
@@ -1495,16 +1495,16 @@
flag=wx.ALIGN_CENTER_VERTICAL,
pos=(2, 0))
- self.filter = wx.TextCtrl(parent=self, id=wx.ID_ANY,
- value="",
- size=(250, -1))
+ self.filter = TextCtrl(parent=self, id=wx.ID_ANY,
+ value="",
+ size=(250, -1))
bodySizer.Add(self.filter,
flag=wx.EXPAND,
pos=(2, 1), span=(1, 2))
self.filter.SetFocus()
# TODO same text in GroupDialog
- self.filter.SetToolTipString(
+ self.filter.SetToolTip(
_(
"Put here a regular expression."
" Characters '.*' stand for anything,"
Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -702,7 +702,7 @@
self.Dismiss()
elif event.GetKeyCode() == wx.WXK_RETURN:
- if self.seltree.GetPyData(item)['node']:
+ if self.seltree.GetItemData(item)['node']:
self.value = []
else:
self._selectTreeItem(item)
@@ -716,7 +716,7 @@
if item and flags & wx.TREE_HITTEST_ONITEMLABEL:
self.curitem = item
- if self.seltree.GetPyData(item)['node']:
+ if self.seltree.GetItemData(item)['node']:
evt.Skip()
return
@@ -727,8 +727,8 @@
def _selectTreeItem(self, item):
fullName = self.seltree.GetItemText(item)
- if self.fullyQualified and self.seltree.GetPyData(item)['mapset']:
- fullName += '@' + self.seltree.GetPyData(item)['mapset']
+ if self.fullyQualified and self.seltree.GetItemData(item)['mapset']:
+ fullName += '@' + self.seltree.GetItemData(item)['mapset']
if self.multiple:
self.value.append(fullName)
@@ -743,7 +743,7 @@
def _onItemConfirmed(self, event):
item = event.GetItem()
- if self.seltree.GetPyData(item)['node']:
+ if self.seltree.GetItemData(item)['node']:
self.value = []
else:
self._selectTreeItem(item)
Modified: grass/trunk/gui/wxpython/gui_core/menu.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/menu.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/gui_core/menu.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -217,7 +217,7 @@
sizer.Add(self._search, proportion=0,
flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
- sizer.Add(item=btnSizer, proportion=0,
+ sizer.Add(btnSizer, proportion=0,
flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5)
sizer.Add(self._helpText,
Modified: grass/trunk/gui/wxpython/gui_core/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/toolbars.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/gui_core/toolbars.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -27,7 +27,7 @@
from icons.icon import MetaIcon
from collections import defaultdict
from core.globalvar import IMGDIR
-from gui_core.wrap import ToolBar
+from gui_core.wrap import ToolBar, Menu
from grass.pydispatch.signal import Signal
@@ -246,7 +246,7 @@
def _onMenu(self, data):
"""Toolbar pop-up menu"""
- menu = wx.Menu()
+ menu = Menu()
for icon, handler in data:
item = wx.MenuItem(menu, wx.ID_ANY, icon.GetLabel())
Modified: grass/trunk/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/widgets.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/gui_core/widgets.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -89,7 +89,7 @@
from core.utils import _
from core.gcmd import GMessage, GError
from core.debug import Debug
-from gui_core.wrap import Button
+from gui_core.wrap import Button, SearchCtrl
class NotebookController:
@@ -1076,11 +1076,11 @@
parent=self, id=wx.ID_ANY, size=(-1, 25),
style=wx.TE_PROCESS_ENTER)
else:
- self._search = wx.SearchCtrl(
+ self._search = SearchCtrl(
parent=self, id=wx.ID_ANY, size=(-1, 25),
style=wx.TE_PROCESS_ENTER)
self._search.SetDescriptiveText(_('Fulltext search'))
- self._search.SetToolTipString(
+ self._search.SetToolTip(
_("Type to search in all modules. Press Enter for next match."))
self._search.Bind(wx.EVT_TEXT, self.OnSearchModule)
Modified: grass/trunk/gui/wxpython/gui_core/wrap.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/wrap.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/gui_core/wrap.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -16,6 +16,7 @@
"""
import wx
+import wx.lib.buttons as buttons
from core.globalvar import gtk3, wxPythonPhoenix
if wxPythonPhoenix:
@@ -50,6 +51,25 @@
return wx.StockCursor(cursorId)
+class Window(wx.Window):
+ """Wrapper around wx.Window to have more control
+ over the widget on different platforms/wxpython versions"""
+ def __init__(self, *args, **kwargs):
+ wx.Window.__init__(self, *args, **kwargs)
+
+ def SetToolTip(self, tip):
+ if wxPythonPhoenix:
+ if tip is None:
+ wx.Window.UnsetToolTip(self)
+ else:
+ wx.Window.SetToolTip(self, tipString=tip)
+ else:
+ if tip is None:
+ wx.Window.SetToolTip(self, tip)
+ else:
+ wx.Window.SetToolTipString(self, tip)
+
+
class SpinCtrl(wx.SpinCtrl):
"""Wrapper around wx.SpinCtrl to have more control
over the widget on different platforms"""
@@ -79,6 +99,19 @@
wx.Button.SetToolTipString(self, tip)
+class GenBitmapButton(buttons.GenBitmapButton):
+ """Wrapper around GenBitmapButton to have more control
+ over the widget on different platforms/wxpython versions"""
+ def __init__(self, *args, **kwargs):
+ buttons.GenBitmapButton.__init__(self, *args, **kwargs)
+
+ def SetToolTip(self, tip):
+ if wxPythonPhoenix:
+ buttons.GenBitmapButton.SetToolTip(self, tipString=tip)
+ else:
+ buttons.GenBitmapButton.SetToolTipString(self, tip)
+
+
class ToggleButton(wx.ToggleButton):
"""Wrapper around wx.ToggleButton to have more control
over the widget on different platforms/wxpython versions"""
@@ -131,6 +164,19 @@
wx.TextCtrl.SetToolTipString(self, tip)
+class SearchCtrl(wx.SearchCtrl):
+ """Wrapper around wx.SearchCtrl to have more control
+ over the widget on different platforms/wxpython versions"""
+ def __init__(self, *args, **kwargs):
+ wx.SearchCtrl.__init__(self, *args, **kwargs)
+
+ def SetToolTip(self, tip):
+ if wxPythonPhoenix:
+ wx.SearchCtrl.SetToolTip(self, tipString=tip)
+ else:
+ wx.SearchCtrl.SetToolTipString(self, tip)
+
+
class ListCtrl(wx.ListCtrl):
"""Wrapper around wx.ListCtrl to have more control
over the widget on different platforms/wxpython versions"""
@@ -162,7 +208,13 @@
else:
return wx.TreeCtrl.AppendItem(self, parent, text, image, selImage, wx.TreeItemData(data))
+ def GetItemData(self, item):
+ if wxPythonPhoenix:
+ return wx.TreeCtrl.GetItemData(self, item)
+ else:
+ return wx.TreeCtrl.GetPyData(self, item)
+
class ToolBar(wx.ToolBar):
"""Wrapper around wx.ToolBar to have more control
over the widget on different platforms/wxpython versions"""
Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -22,7 +22,7 @@
import wx.lib.agw.customtreectrl as CT
except ImportError:
import wx.lib.customtreectrl as CT
-import wx.lib.buttons as buttons
+
try:
import treemixin
except ImportError:
@@ -47,7 +47,7 @@
from icons.icon import MetaIcon
from web_services.dialogs import SaveWMSLayerDialog
from gui_core.widgets import MapValidator
-from gui_core.wrap import Menu
+from gui_core.wrap import Menu, GenBitmapButton
from lmgr.giface import LayerManagerGrassInterfaceForMapDisplay
from core.giface import Notification
@@ -1349,9 +1349,9 @@
self.groupnode += 1
else:
btnbmp = LMIcons["layerOptions"].GetBitmap((16, 16))
- ctrl = buttons.GenBitmapButton(
+ ctrl = GenBitmapButton(
self, id=wx.ID_ANY, bitmap=btnbmp, size=(24, 24))
- ctrl.SetToolTipString(_("Click to edit layer settings"))
+ ctrl.SetToolTip(_("Click to edit layer settings"))
self.Bind(wx.EVT_BUTTON, self.OnLayerContextMenuButton, ctrl)
# add layer to the layer tree
if loadWorkspace:
@@ -1898,9 +1898,9 @@
elif self.GetLayerInfo(dragItem, key='ctrl'):
# recreate data layer
btnbmp = LMIcons["layerOptions"].GetBitmap((16, 16))
- newctrl = buttons.GenBitmapButton(
+ newctrl = GenBitmapButton(
self, id=wx.ID_ANY, bitmap=btnbmp, size=(24, 24))
- newctrl.SetToolTipString(_("Click to edit layer settings"))
+ newctrl.SetToolTip(_("Click to edit layer settings"))
self.Bind(wx.EVT_BUTTON, self.OnLayerContextMenuButton, newctrl)
data = self.GetPyData(dragItem)
Modified: grass/trunk/gui/wxpython/location_wizard/wizard.py
===================================================================
--- grass/trunk/gui/wxpython/location_wizard/wizard.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/location_wizard/wizard.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -53,7 +53,7 @@
from core.utils import _
from core.gcmd import RunCommand, GError, GMessage, GWarning
from gui_core.widgets import GenericValidator
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, SearchCtrl
from location_wizard.base import BaseClass
from location_wizard.dialogs import SelectTransformDialog
@@ -475,8 +475,8 @@
self.tproj = self.MakeTextCtrl("", size=(200, -1))
# search box
- self.searchb = wx.SearchCtrl(self, size=(200, -1),
- style=wx.TE_PROCESS_ENTER)
+ self.searchb = SearchCtrl(self, size=(200, -1),
+ style=wx.TE_PROCESS_ENTER)
# projection list
self.projlist = ItemList(self, data=self.parent.projdesc.items(),
@@ -997,8 +997,8 @@
self.tdatum = self.MakeTextCtrl("", size=(200, -1))
# search box
- self.searchb = wx.SearchCtrl(self, size=(200, -1),
- style=wx.TE_PROCESS_ENTER)
+ self.searchb = SearchCtrl(self, size=(200, -1),
+ style=wx.TE_PROCESS_ENTER)
# create list control for datum/elipsoid list
data = []
@@ -1172,8 +1172,8 @@
self.tellipse = self.MakeTextCtrl("", size=(200, -1))
# search box
- self.searchb = wx.SearchCtrl(self, size=(200, -1),
- style=wx.TE_PROCESS_ENTER)
+ self.searchb = SearchCtrl(self, size=(200, -1),
+ style=wx.TE_PROCESS_ENTER)
# radio buttons
self.radio1 = wx.RadioButton(parent=self, id=wx.ID_ANY,
label=_("Earth based"),
@@ -1511,8 +1511,8 @@
self.bbrowse = self.MakeButton(_("Browse"))
# search box
- self.searchb = wx.SearchCtrl(self, size=(200, -1),
- style=wx.TE_PROCESS_ENTER)
+ self.searchb = SearchCtrl(self, size=(200, -1),
+ style=wx.TE_PROCESS_ENTER)
self.epsglist = ItemList(
self,
@@ -1739,8 +1739,8 @@
self.bbrowse = self.MakeButton(_("Browse"))
# search box
- self.searchb = wx.SearchCtrl(self, size=(200, -1),
- style=wx.TE_PROCESS_ENTER)
+ self.searchb = SearchCtrl(self, size=(200, -1),
+ style=wx.TE_PROCESS_ENTER)
self.epsglist = ItemList(
self,
Modified: grass/trunk/gui/wxpython/mapwin/buffered.py
===================================================================
--- grass/trunk/gui/wxpython/mapwin/buffered.py 2017-07-24 02:44:12 UTC (rev 71310)
+++ grass/trunk/gui/wxpython/mapwin/buffered.py 2017-07-24 04:08:20 UTC (rev 71311)
@@ -35,7 +35,7 @@
import grass.script as grass
from gui_core.dialogs import SavedRegion
-from gui_core.wrap import DragImage, PseudoDC, EmptyBitmap, BitmapFromImage
+from gui_core.wrap import DragImage, PseudoDC, EmptyBitmap, BitmapFromImage, Window
from core.gcmd import RunCommand, GException, GError, GMessage
from core.debug import Debug
from core.settings import UserSettings
@@ -52,7 +52,7 @@
haveCtypes = False
-class BufferedMapWindow(MapWindowBase, wx.Window):
+class BufferedMapWindow(MapWindowBase, Window):
"""A Buffered window class (2D view mode)
Superclass for VDigitWindow (vector digitizer).
@@ -1695,8 +1695,8 @@
pos = event.GetPosition()
idlist = self.pdc.FindObjects(pos[0], pos[1], self.hitradius)
if self.overlays and idlist and [i for i in idlist if i in self.overlays.keys()]: # legend, scale bar, north arrow, dtext
- self.SetToolTipString("Double click in Pointer mode to set object"
- " properties,\nright click to remove")
+ self.SetToolTip("Double click in Pointer mode to set object"
+ " properties,\nright click to remove")
else:
self.SetToolTip(None)
event.Skip()
More information about the grass-commit
mailing list