[GRASS-SVN] r58517 - grass/trunk/gui/wxpython/gmodeler
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Dec 24 03:13:20 PST 2013
Author: martinl
Date: 2013-12-24 03:13:20 -0800 (Tue, 24 Dec 2013)
New Revision: 58517
Modified:
grass/trunk/gui/wxpython/gmodeler/dialogs.py
grass/trunk/gui/wxpython/gmodeler/frame.py
Log:
wxGUI/gmodeler: fix ModelListCtrl editable mode (variables)
Modified: grass/trunk/gui/wxpython/gmodeler/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/dialogs.py 2013-12-23 16:38:56 UTC (rev 58516)
+++ grass/trunk/gui/wxpython/gmodeler/dialogs.py 2013-12-24 11:13:20 UTC (rev 58517)
@@ -581,9 +581,9 @@
class ModelListCtrl(wx.ListCtrl,
listmix.ListCtrlAutoWidthMixin,
-# listmix.TextEditMixin,
+ listmix.TextEditMixin,
listmix.ColumnSorterMixin):
- def __init__(self, parent, columns, frame, id = wx.ID_ANY,
+ def __init__(self, parent, columns, frame, id = wx.ID_ANY, columnsNotEditable = [],
style = wx.LC_REPORT | wx.BORDER_NONE |
wx.LC_SORT_ASCENDING |wx.LC_HRULES |
wx.LC_VRULES, **kwargs):
@@ -592,10 +592,11 @@
self.columns = columns
self.shape = None
self.frame = frame
-
+ self.columnNotEditable = columnsNotEditable
+
wx.ListCtrl.__init__(self, parent, id = id, style = style, **kwargs)
listmix.ListCtrlAutoWidthMixin.__init__(self)
-# listmix.TextEditMixin.__init__(self)
+ listmix.TextEditMixin.__init__(self)
listmix.ColumnSorterMixin.__init__(self, 4)
i = 0
@@ -615,7 +616,12 @@
def OnBeginEdit(self, event):
"""!Editing of item started"""
- event.Allow()
+ if self.columnNotEditable and event.m_col in self.columnNotEditable:
+ event.Veto()
+ self.SetItemState(event.m_itemIndex,
+ wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED | wx.LIST_STATE_FOCUSED)
+ else:
+ event.Allow()
def OnEndEdit(self, event):
"""!Finish editing of item"""
Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py 2013-12-23 16:38:56 UTC (rev 58516)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py 2013-12-24 11:13:20 UTC (rev 58517)
@@ -1475,6 +1475,7 @@
self.list = ItemListCtrl(parent = self,
columns = [_("Name"), _("In loop"),
_("Command")],
+ columnsNotEditable = [1, 2],
frame = self.parent)
self.btnMoveUp = wx.Button(parent=self, id=wx.ID_UP)
More information about the grass-commit
mailing list