[GRASS-SVN] r54829 - grass/trunk/gui/wxpython/lmgr
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Jan 31 14:00:00 PST 2013
Author: annakrat
Date: 2013-01-31 13:59:59 -0800 (Thu, 31 Jan 2013)
New Revision: 54829
Modified:
grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI/layertree: improve command layer
Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py 2013-01-31 20:35:10 UTC (rev 54828)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py 2013-01-31 21:59:59 UTC (rev 54829)
@@ -16,6 +16,7 @@
@author Martin Landa <landa.martin gmail.com>
"""
+import sys
import wx
try:
import wx.lib.agw.customtreectrl as CT
@@ -855,12 +856,9 @@
if ltype == 'command':
# generic command item
- ctrl = wx.TextCtrl(self, id = wx.ID_ANY, value = '',
- pos = wx.DefaultPosition, size = (self.GetSize()[0]-100,25),
- # style = wx.TE_MULTILINE|wx.TE_WORDWRAP)
- style = wx.TE_PROCESS_ENTER | wx.TE_DONTWRAP)
+ ctrl = self._createCommandCtrl()
ctrl.Bind(wx.EVT_TEXT_ENTER, self.OnCmdChanged)
- # ctrl.Bind(wx.EVT_TEXT, self.OnCmdChanged)
+
elif ltype == 'group':
# group item
ctrl = None
@@ -1077,7 +1075,7 @@
completed = (self.GetOptData,layer,params))
self.SetLayerInfo(layer, key = 'cmd', value = module.GetCmd())
- else:
+ elif self.GetLayerInfo(layer, key = 'type') != 'command':
cmd = [ltype2command[ltype]]
if ltype == 'raster':
if UserSettings.Get(group = 'rasterLayer', key = 'opaque', subkey = 'enabled'):
@@ -1378,27 +1376,25 @@
checked = self.IsItemChecked(dragItem)
image = self.GetItemImage(dragItem, 0)
text = self.GetItemText(dragItem)
- if self.GetLayerInfo(dragItem, key = 'ctrl'):
- # recreate data layer
- btnbmp = LMIcons["layerOptions"].GetBitmap((16,16))
- newctrl = buttons.GenBitmapButton(self, id = wx.ID_ANY, bitmap = btnbmp, size = (24, 24))
- newctrl.SetToolTipString(_("Click to edit layer settings"))
- self.Bind(wx.EVT_BUTTON, self.OnLayerContextMenu, newctrl)
- data = self.GetPyData(dragItem)
-
- elif self.GetLayerInfo(dragItem, key = 'type') == 'command':
+ if self.GetLayerInfo(dragItem, key = 'type') == 'command':
# recreate command layer
- newctrl = wx.TextCtrl(self, id = wx.ID_ANY, value = '',
- pos = wx.DefaultPosition, size = (250,25),
- style = wx.TE_MULTILINE|wx.TE_WORDWRAP)
+ newctrl = self._createCommandCtrl()
try:
newctrl.SetValue(self.GetLayerInfo(dragItem, key = 'maplayer').GetCmd(string = True))
except:
pass
newctrl.Bind(wx.EVT_TEXT_ENTER, self.OnCmdChanged)
- newctrl.Bind(wx.EVT_TEXT, self.OnCmdChanged)
data = self.GetPyData(dragItem)
+ elif self.GetLayerInfo(dragItem, key = 'ctrl'):
+ # recreate data layer
+ btnbmp = LMIcons["layerOptions"].GetBitmap((16,16))
+ newctrl = buttons.GenBitmapButton(self, id = wx.ID_ANY, bitmap = btnbmp, size = (24, 24))
+ newctrl.SetToolTipString(_("Click to edit layer settings"))
+ self.Bind(wx.EVT_BUTTON, self.OnLayerContextMenu, newctrl)
+ data = self.GetPyData(dragItem)
+
+
elif self.GetLayerInfo(dragItem, key = 'type') == 'group':
# recreate group
newctrl = None
@@ -1689,3 +1685,13 @@
if items:
return items
return None
+
+ def _createCommandCtrl(self):
+ """!Creates text control for command layer"""
+ height = 25
+ if sys.platform in ('win32', 'darwin'):
+ height = 40
+ ctrl = wx.TextCtrl(self, id = wx.ID_ANY, value = '',
+ pos = wx.DefaultPosition, size = (self.GetSize()[0]-100, height),
+ style = wx.TE_PROCESS_ENTER | wx.TE_DONTWRAP)
+ return ctrl
More information about the grass-commit
mailing list