[GRASS-SVN] r72625 - in grass/branches/releasebranch_7_4/gui/wxpython: dbmgr gui_core
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 17 07:30:38 PDT 2018
Author: annakrat
Date: 2018-04-17 07:30:38 -0700 (Tue, 17 Apr 2018)
New Revision: 72625
Modified:
grass/branches/releasebranch_7_4/gui/wxpython/dbmgr/base.py
grass/branches/releasebranch_7_4/gui/wxpython/dbmgr/manager.py
grass/branches/releasebranch_7_4/gui/wxpython/gui_core/wrap.py
Log:
wxGUI: patch by sanjeet to fix warnings when using attribute manager with wxpython 4 - #3510, merge from trunk, r72331
Modified: grass/branches/releasebranch_7_4/gui/wxpython/dbmgr/base.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/dbmgr/base.py 2018-04-17 14:24:39 UTC (rev 72624)
+++ grass/branches/releasebranch_7_4/gui/wxpython/dbmgr/base.py 2018-04-17 14:30:38 UTC (rev 72625)
@@ -60,7 +60,7 @@
from core.debug import Debug
from dbmgr.dialogs import ModifyTableRecord, AddColumnDialog
from core.settings import UserSettings
-from gui_core.wrap import SpinCtrl
+from gui_core.wrap import SpinCtrl, Button, TextCtrl, ListCtrl, CheckBox
class Log:
@@ -1184,11 +1184,11 @@
sqlNtb.AddPage(page=simpleSqlPanel,
text=_('Simple'))
- btnApply = wx.Button(
+ btnApply = Button(
parent=simpleSqlPanel,
id=wx.ID_APPLY,
name='btnApply')
- btnApply.SetToolTipString(
+ btnApply.SetToolTip(
_("Apply SELECT statement and reload data records"))
btnApply.Bind(wx.EVT_BUTTON, self.OnApplySqlStatement)
@@ -1206,12 +1206,12 @@
size=(55, -1),
choices=['=', '!=', '<', '<=', '>', '>='])
sqlWhereCond.SetSelection(0)
- sqlWhereValue = wx.TextCtrl(
+ sqlWhereValue = TextCtrl(
parent=whereSimpleSqlPanel,
id=wx.ID_ANY,
value="",
style=wx.TE_PROCESS_ENTER)
- sqlWhereValue.SetToolTipString(
+ sqlWhereValue.SetToolTip(
_("Example: %s") %
"MULTILANE = 'no' AND OBJECTID < 10")
@@ -1231,13 +1231,13 @@
label=_("SQL Builder"))
btnSqlBuilder.Bind(wx.EVT_BUTTON, self.OnBuilder)
- sqlStatement = wx.TextCtrl(
+ sqlStatement = TextCtrl(
parent=advancedSqlPanel,
id=wx.ID_ANY,
value="SELECT * FROM %s" %
self.dbMgrData['mapDBInfo'].layers[layer]['table'],
style=wx.TE_PROCESS_ENTER)
- sqlStatement.SetToolTipString(
+ sqlStatement.SetToolTip(
_("Example: %s") %
"SELECT * FROM roadsmajor WHERE MULTILANE = 'no' AND OBJECTID < 10")
sqlWhereValue.Bind(wx.EVT_TEXT_ENTER, self.OnApplySqlStatement)
@@ -2867,7 +2867,7 @@
pass
-class TableListCtrl(wx.ListCtrl,
+class TableListCtrl(ListCtrl,
listmix.ListCtrlAutoWidthMixin):
# listmix.TextEditMixin):
"""Table description list"""
@@ -2878,9 +2878,9 @@
self.parent = parent
self.table = table
self.columns = columns
- wx.ListCtrl.__init__(self, parent, id, pos, size,
- style=wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES |
- wx.BORDER_NONE)
+ ListCtrl.__init__(self, parent, id, pos, size,
+ style=wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES |
+ wx.BORDER_NONE)
listmix.ListCtrlAutoWidthMixin.__init__(self)
# listmix.TextEditMixin.__init__(self)
@@ -2922,7 +2922,7 @@
return itemData
-class LayerListCtrl(wx.ListCtrl,
+class LayerListCtrl(ListCtrl,
listmix.ListCtrlAutoWidthMixin):
# listmix.ColumnSorterMixin):
# listmix.TextEditMixin):
@@ -2934,9 +2934,9 @@
self.parent = parent
self.layers = layers
- wx.ListCtrl.__init__(self, parent, id, pos, size,
- style=wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES |
- wx.BORDER_NONE)
+ ListCtrl.__init__(self, parent, id, pos, size,
+ style=wx.LC_REPORT | wx.LC_HRULES | wx.LC_VRULES |
+ wx.BORDER_NONE)
listmix.ListCtrlAutoWidthMixin.__init__(self)
# listmix.TextEditMixin.__init__(self)
@@ -3098,8 +3098,8 @@
wx.Choice(parent=self.addPanel, id=wx.ID_ANY, size=(200, -1),
choices=self.defaultColumns)),
'addCat':
- (wx.CheckBox(parent=self.addPanel, id=wx.ID_ANY,
- label=_("Insert record for each category into table")),
+ (CheckBox(parent=self.addPanel, id=wx.ID_ANY,
+ label=_("Insert record for each category into table")),
None),
}
@@ -3120,7 +3120,7 @@
wx.EVT_CHOICE, self.OnTableChanged)
# tooltips
- self.addLayerWidgets['addCat'][0].SetToolTipString(
+ self.addLayerWidgets['addCat'][0].SetToolTip(
_("You need to add categories " "by v.category module."))
# table description
@@ -3277,7 +3277,7 @@
except ValueError:
tableName = ''
- self.deleteTable = wx.CheckBox(
+ self.deleteTable = CheckBox(
parent=self.deletePanel,
id=wx.ID_ANY,
label=_('Drop also linked attribute table (%s)') %
@@ -3789,8 +3789,8 @@
self.text.SetBackgroundColour("white")
# buttons
- self.btnClipboard = wx.Button(parent=self.panel, id=wx.ID_COPY)
- self.btnClipboard.SetToolTipString(
+ self.btnClipboard = Button(parent=self.panel, id=wx.ID_COPY)
+ self.btnClipboard.SetToolTip(
_("Copy statistics the clipboard (Ctrl+C)"))
self.btnCancel = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
self.btnCancel.SetDefault()
Modified: grass/branches/releasebranch_7_4/gui/wxpython/dbmgr/manager.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/dbmgr/manager.py 2018-04-17 14:24:39 UTC (rev 72624)
+++ grass/branches/releasebranch_7_4/gui/wxpython/dbmgr/manager.py 2018-04-17 14:30:38 UTC (rev 72625)
@@ -43,6 +43,7 @@
from core.utils import _
from dbmgr.base import DbMgrBase
from gui_core.widgets import GNotebook
+from gui_core.wrap import Button
class AttributeManager(wx.Frame, DbMgrBase):
@@ -136,13 +137,13 @@
wx.CallAfter(self.notebook.SetSelection, 0) # select browse tab
# buttons
- self.btnClose = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
- self.btnClose.SetToolTipString(_("Close Attribute Table Manager"))
- self.btnReload = wx.Button(parent=self.panel, id=wx.ID_REFRESH)
- self.btnReload.SetToolTipString(
+ self.btnClose = Button(parent=self.panel, id=wx.ID_CLOSE)
+ self.btnClose.SetToolTip(_("Close Attribute Table Manager"))
+ self.btnReload = Button(parent=self.panel, id=wx.ID_REFRESH)
+ self.btnReload.SetToolTip(
_("Reload currently selected attribute data"))
- self.btnReset = wx.Button(parent=self.panel, id=wx.ID_CLEAR)
- self.btnReset.SetToolTipString(
+ self.btnReset = Button(parent=self.panel, id=wx.ID_CLEAR)
+ self.btnReset.SetToolTip(
_("Reload all attribute data (drop current selection)"))
# events
Modified: grass/branches/releasebranch_7_4/gui/wxpython/gui_core/wrap.py
===================================================================
--- grass/branches/releasebranch_7_4/gui/wxpython/gui_core/wrap.py 2018-04-17 14:24:39 UTC (rev 72624)
+++ grass/branches/releasebranch_7_4/gui/wxpython/gui_core/wrap.py 2018-04-17 14:30:38 UTC (rev 72625)
@@ -306,3 +306,16 @@
return wx.Rect.Contains(self, rect=rect)
else:
return wx.Rect.ContainsRect(self, rect)
+
+
+class CheckBox(wx.CheckBox):
+ """Wrapper around wx.CheckBox to have more control
+ over the widget on different platforms/wxpython versions"""
+ def __init__(self, *args, **kwargs):
+ wx.CheckBox.__init__(self, *args, **kwargs)
+
+ def SetToolTip(self, tip):
+ if wxPythonPhoenix:
+ wx.CheckBox.SetToolTip(self, tipString=tip)
+ else:
+ wx.CheckBox.SetToolTipString(self, tip)
More information about the grass-commit
mailing list