[GRASS-SVN] r44947 - in grass/trunk/gui: icons/grass2 wxpython
wxpython/gui_modules wxpython/icons
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jan 11 03:44:06 EST 2011
Author: martinl
Date: 2011-01-11 00:44:05 -0800 (Tue, 11 Jan 2011)
New Revision: 44947
Added:
grass/trunk/gui/icons/grass2/edit.png
Modified:
grass/trunk/gui/wxpython/gui_modules/layertree.py
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/gui_modules/toolbars.py
grass/trunk/gui/wxpython/gui_modules/vdigit.py
grass/trunk/gui/wxpython/gui_modules/wxvdriver.py
grass/trunk/gui/wxpython/icons/grass2_icons.py
grass/trunk/gui/wxpython/icons/grass_icons.py
grass/trunk/gui/wxpython/icons/icon.py
grass/trunk/gui/wxpython/icons/silk_icons.py
grass/trunk/gui/wxpython/wxgui.py
grass/trunk/gui/wxpython/wxpythonlib.dox
Log:
wxGUI: layer toolbar: add icon for editing vector maps
vector digitizer pythonization in progress
Added: grass/trunk/gui/icons/grass2/edit.png
===================================================================
(Binary files differ)
Property changes on: grass/trunk/gui/icons/grass2/edit.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Modified: grass/trunk/gui/wxpython/gui_modules/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/layertree.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/gui_modules/layertree.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -313,9 +313,8 @@
mltype = self.GetPyData(self.layer_selected)[0]['type']
except:
mltype = None
- #
+
# vector layers (specific items)
- #
if mltype and mltype == "vector":
self.popupMenu.AppendSeparator()
self.popupMenu.Append(self.popupID4, text = _("Show attribute data"))
@@ -379,9 +378,7 @@
self.popupMenu.Enable(self.popupID7, False)
self.popupMenu.Enable(self.popupID14, False)
- #
# raster layers (specific items)
- #
elif mltype and mltype == "raster":
self.popupMenu.Append(self.popupID12, text = _("Zoom to selected map(s) (ignore NULLs)"))
self.Bind(wx.EVT_MENU, self.mapdisplay.OnZoomToRaster, id = self.popupID12)
@@ -406,7 +403,7 @@
self.popupMenu.Enable(self.popupID6, False)
self.popupMenu.Enable(self.popupID11, False)
- ## self.PopupMenu(self.popupMenu, pos)
+ # self.PopupMenu(self.popupMenu, pos)
self.PopupMenu(self.popupMenu)
self.popupMenu.Destroy()
@@ -572,7 +569,7 @@
self.mapdisplay.AddToolbar('vdigit')
else: # tool already enabled
pass
-
+
# mark layer as 'edited'
self.mapdisplay.toolbars['vdigit'].StartEditing(maplayer)
@@ -585,7 +582,8 @@
maplayer = self.GetPyData(self.layer_selected)[0]['maplayer']
self.mapdisplay.toolbars['vdigit'].OnExit()
- self.mapdisplay.imgVectorMap = None
+ if self.lmgr:
+ self.lmgr.toolbar.Enable('vdigit', enable = True)
self._setGradient()
self.RefreshLine(self.layer_selected)
@@ -1129,13 +1127,18 @@
return
digitToolbar = self.mapdisplay.toolbars['vdigit']
- mapLayer = self.GetPyData(layer)[0]['maplayer']
- bgmap = UserSettings.Get(group = 'vdigit', key = 'bgmap', subkey = 'value',
- internal = True)
- if digitToolbar and digitToolbar.GetLayer() == mapLayer:
- self._setGradient('vdigit')
- elif bgmap == mapLayer.GetName():
- self._setGradient('bgmap')
+ if digitToolbar:
+ mapLayer = self.GetPyData(layer)[0]['maplayer']
+ bgmap = UserSettings.Get(group = 'vdigit', key = 'bgmap', subkey = 'value',
+ internal = True)
+
+ if digitToolbar:
+ if digitToolbar.GetLayer() == mapLayer:
+ self._setGradient('vdigit')
+ elif bgmap == mapLayer.GetName():
+ self._setGradient('bgmap')
+ else:
+ self._setGradient()
else:
self._setGradient()
@@ -1160,9 +1163,7 @@
except:
pass
- #
# update statusbar -> show command string
- #
if self.GetPyData(layer) and self.GetPyData(layer)[0]['maplayer']:
cmd = self.GetPyData(layer)[0]['maplayer'].GetCmd(string = True)
if len(cmd) > 0:
@@ -1177,9 +1178,7 @@
self.mapdisplay.MapWindow.ZoomToMap(layers = [mapLayer,],
render = render)
- #
# update nviz tools
- #
if self.mapdisplay.toolbars['nviz'] and \
self.GetPyData(self.layer_selected) is not None:
if self.layer_selected.IsChecked():
@@ -1242,18 +1241,13 @@
self.RecreateItem(child, dropTarget, parent = newItem)
self.Delete(child)
child = self.GetNextChild(old, cookie)[0]
- #self.Expand(newItem)
-
+
# delete layer at original position
try:
self.Delete(old) # entry in render.Map layers list automatically deleted by OnDeleteLayer handler
except AttributeError:
- # FIXME being ugly (item.SetWindow(None))
pass
- # reorder layers in render.Map to match new order after drag and drop
- #self.ReorderLayers()
-
# redraw map if auto-rendering is enabled
self.rerender = True
self.reorder = True
@@ -1339,9 +1333,7 @@
self.GetPyData(newItem)[0]['ctrl'] = None
self.CheckItem(newItem, checked = checked) # causes a new render
-
- # newItem.SetHeight(TREE_ITEM_HEIGHT)
-
+
return newItem
def _getLayerName(self, item):
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -1168,8 +1168,7 @@
maplayer = self.toolbars['vdigit'].GetLayer()
if maplayer:
self.toolbars['vdigit'].OnExit()
- self.imgVectorMap = None
-
+
if self.toolbars['nviz']:
self.toolbars['nviz'].OnExit()
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -266,8 +266,6 @@
# render output objects
self.mapfile = None # image file to be rendered
self.img = None # wx.Image object (self.mapfile)
- # used in digitization tool (do not redraw vector map)
- self.imgVectorMap = None
# decoration overlays
self.overlays = {}
# images and their PseudoDC ID's for painting and dragging
Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -50,7 +50,7 @@
def __init__(self, parent):
self.parent = parent
wx.ToolBar.__init__(self, parent = self.parent, id = wx.ID_ANY)
-
+
self.action = dict()
self.Bind(wx.EVT_TOOL, self.OnTool)
@@ -65,7 +65,7 @@
self._data = toolData
- def ToolbarData(self):
+ def _toolbarData(self):
"""!Toolbar data (virtual)"""
return None
@@ -78,8 +78,8 @@
bmpDisabled = wx.NullBitmap
if label:
- Debug.msg(3, "CreateTool(): tool=%d, label=%s bitmap=%s" % \
- (tool, label, bitmap))
+ Debug.msg(3, "CreateTool(): tool=%d, label=%s bitmap=%d" % \
+ (tool, label, bitmap.GetWidth()))
toolWin = self.AddLabelTool(tool, label, bitmap,
bmpDisabled, kind,
shortHelp, longHelp)
@@ -104,7 +104,8 @@
self.SetToolLongHelp(tool[0], "")
def OnTool(self, event):
- """!Tool selected"""
+ """!Tool selected
+ """
if self.parent.GetName() == "GCPFrame":
return
@@ -173,7 +174,7 @@
self.mapcontent = mapcontent # render.Map
AbstractToolbar.__init__(self, parent = parent) # MapFrame
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# optional tools
choices = [ _('2D view'), ]
@@ -235,7 +236,7 @@
self.FixSize(width = 90)
- def ToolbarData(self):
+ def _toolbarData(self):
"""!Toolbar data"""
self.displaymap = wx.NewId()
self.rendermap = wx.NewId()
@@ -354,12 +355,12 @@
def __init__(self, parent):
AbstractToolbar.__init__(self, parent)
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# realize the toolbar
self.Realize()
- def ToolbarData(self):
+ def _toolbarData(self):
self.gcpSave = wx.NewId()
self.gcpReload = wx.NewId()
self.gcpAdd = wx.NewId()
@@ -402,7 +403,7 @@
"""
AbstractToolbar.__init__(self, parent)
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# add tool to toggle active map window
self.togglemapid = wx.NewId()
@@ -427,7 +428,7 @@
self.EnableTool(self.zoomback, False)
- def ToolbarData(self):
+ def _toolbarData(self):
"""!Toolbar data"""
self.displaymap = wx.NewId()
self.rendermap = wx.NewId()
@@ -502,7 +503,7 @@
self.mapcontent = mapcontent
AbstractToolbar.__init__(self, parent)
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# realize the toolbar
self.Realize()
@@ -515,7 +516,7 @@
self.EnableTool(self.zoomback, False)
- def ToolbarData(self):
+ def _toolbarData(self):
"""!Toolbar data"""
self.displaymap = wx.NewId()
self.rendermap = wx.NewId()
@@ -574,12 +575,12 @@
def __init__(self, parent):
AbstractToolbar.__init__(self, parent)
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# realize the toolbar
self.Realize()
- def ToolbarData(self):
+ def _toolbarData(self):
self.gcpSave = wx.NewId()
self.gcpAdd = wx.NewId()
self.gcpDelete = wx.NewId()
@@ -643,7 +644,7 @@
self.settingsDialog = None
# create toolbars (two rows optionally)
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
self.Bind(wx.EVT_TOOL, self.OnTool)
# default action (digitize new point, line, etc.)
@@ -668,7 +669,7 @@
self.FixSize(width = 105)
- def ToolbarData(self):
+ def _toolbarData(self):
"""!Toolbar data
"""
data = []
@@ -1281,7 +1282,7 @@
self.parent.statusbar.SetStatusText(_("Please wait, "
"opening vector map <%s> for editing...") % mapLayer.GetName(),
0)
-
+
self.parent.MapWindow.pdcVector = wx.PseudoDC()
self.parent.digit = VDigit(mapwindow = self.parent.MapWindow)
@@ -1296,6 +1297,9 @@
# update toolbar
self.combo.SetValue(mapLayer.GetName())
self.parent.toolbars['map'].combo.SetValue (_('Digitize'))
+ lmgr = self.parent.GetLayerManager()
+ if lmgr:
+ lmgr.toolbar.Enable('vdigit', enable = False)
Debug.msg (4, "VDigitToolbar.StartEditing(): layer=%s" % mapLayer.GetName())
@@ -1340,11 +1344,15 @@
"closing and rebuilding topology of "
"vector map <%s>...") % self.mapLayer.GetName(),
0)
- self.parent.GetLayerManager().notebook.SetSelection(1)
+ lmgr = self.parent.GetLayerManager()
+ if lmgr:
+ lmgr.toolbar.Enable('vdigit', enable = True)
+ lmgr.notebook.SetSelection(1)
self.parent.digit.CloseMap()
- self.parent.GetLayerManager().GetLogWindow().GetProgressBar().SetValue(0)
- self.parent.GetLayerManager().GetLogWindow().WriteCmdLog(_("Editing of vector map <%s> successfully finished") % \
- self.mapLayer.GetName())
+ if lmgr:
+ lmgr.GetLogWindow().GetProgressBar().SetValue(0)
+ lmgr.GetLogWindow().WriteCmdLog(_("Editing of vector map <%s> successfully finished") % \
+ self.mapLayer.GetName())
# re-active layer
item = self.parent.tree.FindItemByData('maplayer', self.mapLayer)
if item and self.parent.tree.IsItemChecked(item):
@@ -1421,12 +1429,12 @@
def __init__(self, parent):
AbstractToolbar.__init__(self, parent)
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# realize the toolbar
self.Realize()
- def ToolbarData(self):
+ def _toolbarData(self):
"""!Toolbar data"""
self.transect = wx.NewId()
self.addraster = wx.NewId()
@@ -1496,12 +1504,12 @@
# only one dialog can be open
self.settingsDialog = None
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# realize the toolbar
self.Realize()
- def ToolbarData(self):
+ def _toolbarData(self):
"""!Toolbar data"""
self.view = wx.NewId()
self.surface = wx.NewId()
@@ -1608,12 +1616,12 @@
def __init__(self, parent):
AbstractToolbar.__init__(self, parent)
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# realize the toolbar
self.Realize()
- def ToolbarData(self):
+ def _toolbarData(self):
"""!Toolbar data"""
self.new = wx.NewId()
self.open = wx.NewId()
@@ -1690,12 +1698,12 @@
def __init__(self, parent):
AbstractToolbar.__init__(self, parent)
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# realize the toolbar
self.Realize()
- def ToolbarData(self):
+ def _toolbarData(self):
"""!Toolbar data"""
self.histogram = wx.NewId()
self.rendermap = wx.NewId()
@@ -1738,13 +1746,14 @@
def __init__(self, parent):
AbstractToolbar.__init__(self, parent)
- self.InitToolbar(self.ToolbarData())
+ self.InitToolbar(self._toolbarData())
# realize the toolbar
self.Realize()
- def ToolbarData(self):
- """!Toolbar data"""
+ def _toolbarData(self):
+ """!Toolbar data
+ """
self.newdisplay = wx.NewId()
self.workspaceLoad = wx.NewId()
self.workspaceOpen = wx.NewId()
@@ -1757,6 +1766,7 @@
self.addovl = wx.NewId()
self.delcmd = wx.NewId()
self.attribute = wx.NewId()
+ self.vdigit = wx.NewId()
self.preferences = wx.NewId()
self.modeler = wx.NewId()
@@ -1798,6 +1808,9 @@
wx.ITEM_NORMAL, Icons["delcmd"].GetLabel(), Icons["delcmd"].GetDesc(),
self.parent.OnDeleteLayer),
('', '', '', '', '', '', ''),
+ (self.vdigit, 'vdigit', Icons["vdigit"].GetBitmap(),
+ wx.ITEM_NORMAL, Icons["vdigit"].GetLabel(), Icons["vdigit"].GetDesc(),
+ self.parent.OnVDigit),
(self.attribute, 'attrtable', Icons["attrtable"].GetBitmap(),
wx.ITEM_NORMAL, Icons["attrtable"].GetLabel(), Icons["attrtable"].GetDesc(),
self.parent.OnShowAttributeTable),
@@ -1809,4 +1822,3 @@
wx.ITEM_NORMAL, Icons["settings"].GetLabel(), Icons["settings"].GetDesc(),
self.parent.OnPreferences)
)
-
Modified: grass/trunk/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/vdigit.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/gui_modules/vdigit.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -4,14 +4,15 @@
@brief Dialogs for wxGUI vector digitizer
Classes:
+ - VDigit
- VDigitSettingsDialog
- VDigitCategoryDialog
- CategoryListCtrl
- VDigitZBulkDialog
- VDigitDuplicatesDialog
- - VDigitVBuildDialog
+ - CheckListFeature
-(C) 2007-2010 by the GRASS Development Team
+(C) 2007-2011 by the GRASS Development Team
This program is free software under the GNU General Public License
(>=v2). Read the file COPYING that comes with GRASS for details.
Modified: grass/trunk/gui/wxpython/gui_modules/wxvdriver.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxvdriver.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/gui_modules/wxvdriver.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -58,7 +58,7 @@
class DisplayDriver:
def __init__(self, device, deviceTmp, mapObj, window, glog, gprogress):
- """Display driver used by vector digitizer
+ """!Display driver used by vector digitizer
@param device wx.PseudoDC device where to draw vector objects
@param deviceTmp wx.PseudoDC device where to draw temporary vector objects
@@ -135,8 +135,8 @@
# topology
self._resetTopology()
- self.drawSelected = False
- self.drawSegments = False
+ self._drawSelected = False
+ self._drawSegments = False
self.UpdateSettings()
@@ -229,7 +229,7 @@
dcId = 1
self.topology['highlight'] += 1
- if not self.drawSelected:
+ if not self._drawSelected:
return
else:
pdc = self.dc
@@ -246,7 +246,7 @@
p = robj.point[i]
self._drawCross(pdc, p)
else:
- if dcId > 0 and self.drawSegments:
+ if dcId > 0 and self._drawSegments:
dcId = 2 # first segment
i = 0
while i < robj.npoints - 1:
@@ -362,9 +362,6 @@
return ret
- def _printIds(self):
- pass
-
def _isSelected(self, line, force = False):
"""!Check if vector object selected?
@@ -495,8 +492,8 @@
return None
if thisMapInfo:
- self.drawSegments = drawSeg
- self.drawSelected = True
+ self._drawSegments = drawSeg
+ self._drawSelected = True
# select by ids
self.selected['cats'] = list()
@@ -571,7 +568,7 @@
return None
if thisMapInfo:
- self.drawSelected = True
+ self._drawSelected = True
# select by ids
self.selected['cats'] = list()
@@ -622,7 +619,7 @@
if thisMapInfo:
# drawing segments can be very expensive
# only one features selected
- self.drawSegments = True
+ self._drawSegments = True
return { 'line' : line_nearest,
'point' : (px.value, py.value, pz.value) }
@@ -660,7 +657,7 @@
dc_ids = list()
- if not self.drawSegments:
+ if not self._drawSegments:
dc_ids.append(1)
elif len(self.selected['ids']) > 0:
# only first selected feature
@@ -673,12 +670,6 @@
return dc_ids
- def GetDuplicates(self):
- pass
-
- def GetRegionSelected(self):
- pass
-
def SetSelected(self, ids, layer = -1):
"""!Set selected vector objects
@@ -686,9 +677,9 @@
@param layer layer number for features selected based on category number
"""
if ids:
- self.drawSelected = True
+ self._drawSelected = True
else:
- self.drawSelected = False
+ self._drawSelected = False
if layer > 0:
selected.field = layer
@@ -698,19 +689,19 @@
self.selected['ids'] = ids
def GetSelectedVertex(self, pos):
- """Get PseudoDC vertex id of selected line
+ """!Get PseudoDC vertex id of selected line
Set bounding box for vertices of line.
- \param pos position
+ @param pos position
- \return id of center, left and right vertex
- \return 0 no line found
- \return -1 on error
+ @return id of center, left and right vertex
+ @return 0 no line found
+ @return -1 on error
"""
returnId = list()
# only one object can be selected
- if len(self.selected['ids']) != 1 or not self.drawSegments:
+ if len(self.selected['ids']) != 1 or not self._drawSegments:
return returnId
startId = 1
@@ -768,7 +759,7 @@
@param flag True to draw selected features
"""
- self.drawSelected = bool(flag)
+ self._drawSelected = bool(flag)
def CloseMap(self):
"""!Close vector map
@@ -831,12 +822,6 @@
return self.poMapInfo
- def ReloadMap(self):
- pass
-
- def SetDevice(self):
- pass
-
def GetMapBoundingBox(self):
"""!Get bounding box of (opened) vector map layer
@@ -851,12 +836,6 @@
return bbox.W, bbox.S, bbox.B, \
bbox.E, bbox.N, bbox.T
- def Is3D(self):
- pass
-
- def SetRegion(self):
- pass
-
def UpdateSettings(self, alpha = 255):
"""!Update display driver settings
Modified: grass/trunk/gui/wxpython/icons/grass2_icons.py
===================================================================
--- grass/trunk/gui/wxpython/icons/grass2_icons.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/icons/grass2_icons.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -84,6 +84,7 @@
"addlabels" : 'layer-label-add.png',
"delcmd" : 'layer-remove.png',
"attrtable" : 'table.png',
+ "vdigit" : 'edit.png',
"addrgb" : 'layer-rgb-add.png',
"addhis" : 'layer-his-add.png',
"addthematic": 'layer-vector-thematic-add.png',
Modified: grass/trunk/gui/wxpython/icons/grass_icons.py
===================================================================
--- grass/trunk/gui/wxpython/icons/grass_icons.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/icons/grass_icons.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -67,6 +67,7 @@
"addovl" : 'module-d.grid.gif',
"delcmd" : 'edit-cut.gif',
"attrtable" : 'db-values.gif',
+ "vdigit" : wx.ART_ERROR,
"addrgb" : 'module-d.rgb.gif',
"addhis" : 'channel-his.gif',
"addshaded" : 'module-d.shadedmap.gif',
Modified: grass/trunk/gui/wxpython/icons/icon.py
===================================================================
--- grass/trunk/gui/wxpython/icons/icon.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/icons/icon.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -10,7 +10,7 @@
Classes:
- MetaIcon
-(C) 2007-2008, 2010 by the GRASS Development Team
+(C) 2007-2008, 2010-2011 by the GRASS Development Team
This program is free software under the GNU General Public
License (>=v2). Read the file COPYING that comes with GRASS
for details.
@@ -214,6 +214,8 @@
label=_("Quit")),
"attrtable" : MetaIcon (img=Icons["attrtable"],
label=_("Show attribute table")),
+ "vdigit" : MetaIcon (img=Icons["vdigit"],
+ label=_("Edit vector maps")),
"addrgb" : MetaIcon (img=Icons["addrgb"],
label=_("Add RGB map layer")),
"addhis" : MetaIcon (img=Icons["addhis"],
Modified: grass/trunk/gui/wxpython/icons/silk_icons.py
===================================================================
--- grass/trunk/gui/wxpython/icons/silk_icons.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/icons/silk_icons.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -87,6 +87,7 @@
"addlabels" : 'tag_blue_add.png',
"delcmd" : 'bin_closed.png',
"attrtable" : 'application_view_columns.png',
+ "vdigit" : wx.ART_ERROR,
"addrgb" : 'rgb.png',
"addhis" : 'his.png',
"addthematic": 'thematic.png',
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/wxgui.py 2011-01-11 08:44:05 UTC (rev 44947)
@@ -114,8 +114,8 @@
# initialize variables
self.disp_idx = 0 # index value for map displays and layer trees
- self.curr_page = '' # currently selected page for layer tree notebook
- self.curr_pagenum = '' # currently selected page number for layer tree notebook
+ self.curr_page = None # currently selected page for layer tree notebook
+ self.curr_pagenum = None # currently selected page number for layer tree notebook
self.workspaceFile = workspace # workspace file
self.workspaceChanged = False # track changes in workspace
self.georectifying = None # reference to GCP class or None
@@ -430,6 +430,45 @@
cmd = self.GetMenuCmd(event)
menuform.GUI().ParseCommand(cmd, parentframe = self)
+ def OnVDigit(self, event):
+ """!Start vector digitizer
+ """
+ if not self.curr_page:
+ self.MsgNoLayerSelected()
+ return
+
+ tree = self.GetLayerTree()
+ layer = tree.layer_selected
+ # no map layer selected
+ if not layer:
+ self.MsgNoLayerSelected()
+ return
+
+ # available only for vector map layers
+ try:
+ mapLayer = tree.GetPyData(layer)[0]['maplayer']
+ except:
+ mapLayer = None
+
+ if not mapLayer or mapLayer.GetType() != 'vector':
+ gcmd.GMessage(parent = self,
+ message = _("Selected map layer is not vector."))
+ return
+
+ if mapLayer.GetMapset() != grass.gisenv()['MAPSET']:
+ gcmd.GMessage(parent = self,
+ message = _("Editing is allowed only for vector maps from the "
+ "current mapset."))
+ return
+
+ if not tree.GetPyData(layer)[0]:
+ return
+ dcmd = tree.GetPyData(layer)[0]['cmd']
+ if not dcmd:
+ return
+
+ tree.OnStartEditing(None)
+
def OnRunScript(self, event):
"""!Run script"""
# open dialog and choose script file
@@ -1028,7 +1067,8 @@
self.MsgNoLayerSelected()
return
- layer = self.curr_page.maptree.layer_selected
+ tree = self.GetLayerTree()
+ layer = tree.layer_selected
# no map layer selected
if not layer:
self.MsgNoLayerSelected()
@@ -1036,21 +1076,18 @@
# available only for vector map layers
try:
- maptype = self.curr_page.maptree.GetPyData(layer)[0]['maplayer'].type
+ maptype = tree.GetPyData(layer)[0]['maplayer'].type
except:
maptype = None
if not maptype or maptype != 'vector':
- wx.MessageBox(parent = self,
- message = _("Attribute management is available only "
- "for vector maps."),
- caption = _("Message"),
- style = wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
+ gcmd.GMessage(parent = self,
+ message = _("Selected map layer is not vector."))
return
- if not self.curr_page.maptree.GetPyData(layer)[0]:
+ if not tree.GetPyData(layer)[0]:
return
- dcmd = self.curr_page.maptree.GetPyData(layer)[0]['cmd']
+ dcmd = tree.GetPyData(layer)[0]['cmd']
if not dcmd:
return
Modified: grass/trunk/gui/wxpython/wxpythonlib.dox
===================================================================
--- grass/trunk/gui/wxpython/wxpythonlib.dox 2011-01-10 20:30:20 UTC (rev 44946)
+++ grass/trunk/gui/wxpython/wxpythonlib.dox 2011-01-11 08:44:05 UTC (rev 44947)
@@ -266,10 +266,7 @@
\subsection vdigit Vector digitizer
- gui_modules/vdigit.py
- - gui_modules::vdigit::AbstractDigit
- gui_modules::vdigit::VDigit
- - gui_modules::vdigit::AbstractDisplayDriver
- - gui_modules::vdigit::CDisplayDriver
- gui_modules::vdigit::VDigitSettingsDialog
- gui_modules::vdigit::VDigitCategoryDialog
- gui_modules::vdigit::CategoryListCtrl
@@ -277,6 +274,13 @@
- gui_modules::vdigit::VDigitDuplicatesDialog
- gui_modules::vdigit::CheckListFeature
+- gui_modules/wxvdriver.py
+ - gui_modules::wxvdriver::DisplayDriver
+
+- gui_modules/wxvdigit.py
+ - gui_modules::wxvdigit::VDigitError
+ - gui_modules::wxvdigit::IVDigit
+
\subsection wxnviz 3D view mode (wxNviz)
- gui_modules/nviz_mapdisp.py
More information about the grass-commit
mailing list