[GRASS-SVN] r41949 - grass-addons/gui/wxpython/data_catalog
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 21 08:37:38 EDT 2010
Author: rashadkm
Date: 2010-04-21 08:37:36 -0400 (Wed, 21 Apr 2010)
New Revision: 41949
Removed:
grass-addons/gui/wxpython/data_catalog/menudata.py
grass-addons/gui/wxpython/data_catalog/right.py
Modified:
grass-addons/gui/wxpython/data_catalog/LayerTree.py
grass-addons/gui/wxpython/data_catalog/README
grass-addons/gui/wxpython/data_catalog/catalog.py
grass-addons/gui/wxpython/data_catalog/mapframe.py
grass-addons/gui/wxpython/data_catalog/wx_utils.py
Log:
fixed display for different location and mapsets
Modified: grass-addons/gui/wxpython/data_catalog/LayerTree.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/LayerTree.py 2010-04-21 12:19:27 UTC (rev 41948)
+++ grass-addons/gui/wxpython/data_catalog/LayerTree.py 2010-04-21 12:37:36 UTC (rev 41949)
@@ -50,6 +50,8 @@
self.dict = {}
+ self.layer = []
+ self.maplayer = None
@@ -298,22 +300,30 @@
self.mapname = self.GetItemText(item) + "@" + frame.cmbMapset.GetValue()
#for f in frames:
# print f.GetName()
+ maptree = mapframe.maptree
if pText == "Raster Map" :
self.cmd= ['d.rast', str("map=" + self.mapname)]
l_type="raster"
- #mapframe.Map.AddLayer(type=l_type, name=self.mapname, command=self.cmd)
+ self.maplayer = mapframe.Map.AddLayer(type=l_type, name=self.mapname, command=self.cmd)
- mapframe.maptree.AddLayer(ltype="raster", lname=self.mapname, lchecked=True,lcmd=self.cmd)
-
+ #mapframe.maptree.AddLayer(ltype="raster", lname=self.mapname, lchecked=True,lcmd=self.cmd)
+ maptree.ltype = 'raster'
mapframe.Map.region = mapframe.Map.GetRegion()
-# mapframe.MapWindow2D.flag = True
-# mapframe.MapWindow2D.UpdateMap(render=True)
+ mapframe.MapWindow2D.flag = True
+ mapframe.MapWindow2D.UpdateMap(render=True)
+ mapframe.MapWindow2D.flag = False
+ layer = maptree.PrependItem(parent=maptree.root, text=self.mapname, ct_type=1)
+ maptree.first = True
+ maptree.layer_selected = layer
+ maptree.CheckItem(layer)
+ #self.layer.append(self.maplayer)
+ maptree.PlusLayer(self.maplayer)
-
+
#update new layer
# mapframe.maptree.SetPyData(newItem, mapframe.maptree.GetPyData(dragItem))
Modified: grass-addons/gui/wxpython/data_catalog/README
===================================================================
--- grass-addons/gui/wxpython/data_catalog/README 2010-04-21 12:19:27 UTC (rev 41948)
+++ grass-addons/gui/wxpython/data_catalog/README 2010-04-21 12:37:36 UTC (rev 41949)
@@ -2,3 +2,5 @@
from grass shell type:
python catalog.py
+
+To send files to ossimplanet please download r.planet and v.planet and copy it in application directory
Modified: grass-addons/gui/wxpython/data_catalog/catalog.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/catalog.py 2010-04-21 12:19:27 UTC (rev 41948)
+++ grass-addons/gui/wxpython/data_catalog/catalog.py 2010-04-21 12:37:36 UTC (rev 41949)
@@ -149,8 +149,9 @@
self.menucmd = dict()
-
-
+ self.mapfile = []
+ self.mapname = None
+ self.cmd = None
#creating sizers
@@ -519,6 +520,7 @@
# self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
# self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnPageClosed)
+
self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnCBPageChanged)
self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnCBPageClosed)
@@ -580,29 +582,35 @@
"""!Page in notebook (display) changed"""
- #import pdb
- #pdb.set_trace()
-
-
old_pgnum = event.GetOldSelection()
new_pgnum = event.GetSelection()
self.oldpage = self.notebook.GetPage(old_pgnum)
-
-
- # self.cb_mapfile.append(render.Map)
-
-
-
+
self.curr_page = self.notebook.GetCurrentPage()
self.curr_pagenum = self.notebook.GetSelection()
+ self.ltree.DeleteAllItems()
+ count = self.notebook.GetPageCount()
+ for index in range(0,count):
+ page = self.notebook.GetPage(index)
+ maptree = page.maptree
+ maptree.DeleteAllItems()
+ maptree.root = maptree.AddRoot("Map Layers")
+ maptree.SetPyData(maptree.root, (None,None))
+ for i in range(0,len(maptree.layer)):
+ maptree.Map.DeleteLayer(maptree.layer[i])
+ maptree.mapdict[str(maptree.layer[i].name)]=maptree.layer[i].type
+
+ self.mapfile.append(maptree.layer[i].name)
+ self.oldpage.MapWindow2D.EraseMap()
- self.ltree.DeleteAllItems()
+ print maptree.mapdict
+
# self.cmbMapset.SetValue(self.cb_loclist[self.disp_idx])
# self.cmbLocation.SetValue(self.cb_loclist[self.disp_idx])
# self.disp_idx
@@ -648,15 +656,58 @@
self.update_grassrc(self.gisrc)
# self.page.Map.GetWindow()
# self.page.Map.InitGisEnv()
- for key, val in self.page.maptree.mapdict.iteritems():
+ page=self.notebook.GetCurrentPage()
+ maptree = page.maptree
+ for key, val in maptree.mapdict.iteritems():
self.mapname = key
+
if val == "raster":
l_type="raster"
+ maptree.ltype = 'raster'
self.cmd= ['d.rast', str("map=" + self.mapname)]
else:
l_type = "vector"
+ maptree.ltype = 'vector'
self.cmd= ['d.vect', str("map=" + self.mapname)]
+ layer = maptree.PrependItem(parent=maptree.root, text=self.mapname, ct_type=1)
+ page.MapWindow2D.flag = True
+ page.MapWindow2D.UpdateMap(render=True)
+ #page.MapWindow2D.flag = False
+ maptree.first = True
+ maptree.layer_selected = layer
+ maptree.CheckItem(layer)
+ #self.layer.append(self.maplayer)
+ #maptree.PlusLayer(self.maplayer)
+
+
+ # try:
+ maptree.Map.AddLayer(type=l_type, name=self.mapname, command=self.cmd)
+ # except:
+ # pass
+
+ #mapframe.maptree.AddLayer(ltype="raster", lname=self.mapname, lchecked=True,lcmd=self.cmd)
+
+
+ maptree.Map.region = self.page.maptree.Map.GetRegion()
+
+ #page.MapWindow2D.flag = False
+
+ #page.MapWindow2D.EraseMap()
+
+
+
+ count = self.notebook.GetPageCount()
+
+ for index in range(0,count):
+ page = self.notebook.GetPage(index)
+ # page.MapWindow2D.flag = False
+
+ page.MapWindow2D.flag = False
+
+ #self.layer.append(self.maplayer)
+ #maptree.PlusLayer(self.maplayer)
+
# self.page.maptree.AddLayer(ltype=l_type, lname=self.mapname, lchecked=True,lcmd=self.cmd)
#item1 = self.page.maptree.FindItem(idParent=self.page.maptree.root,prefixOrig=self.mapname)
@@ -692,7 +743,7 @@
# except:
# pass
- # event.Skip()
+ event.Skip()
@@ -1461,10 +1512,10 @@
"""
Debug.msg(1, "GMFrame.NewDisplay(): idx=%d" % self.disp_idx)
- wx.MessageBox(parent=self,
- message=_("This part is under development. New display does not work when you change location and mapset"),
- caption=_("Data Catalog"),
- style=wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
+ #wx.MessageBox(parent=self,
+ # message=_("This part is under development. New display does not work when you change location and mapset"),
+ # caption=_("Data Catalog"),
+ # style=wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
# make a new page in the bookcontrol for the layer tree (on page 0 of the notebook)
@@ -1810,8 +1861,6 @@
dlg.Destroy()
for layer in self.current.maptree.GetSelections():
- if self.current.maptree.GetPyData(layer)[0]['type'] == 'group':
- self.current.maptree.DeleteChildren(layer)
self.current.maptree.Delete(layer)
@@ -1837,10 +1886,12 @@
nb = self.notebook.GetCurrentPage()
#print nb.maptree
index = self.notebook.GetSelection()
- nb.Map.DeleteLayer( nb.maptree.layer[index])
+ try:
+ nb.Map.DeleteLayer( self.ltree.layer[index])
+ nb.maptree.layer.remove(self.ltree.layer[index])
+ except:
+ pass
- nb.maptree.layer.remove(nb.maptree.layer[index])
-
#except:
# pass
@@ -1915,6 +1966,8 @@
self.page = self.notebook.GetPage(self.notebook.GetSelection())
self.page.Map.__init__()
self.page.Map.region = self.page.Map.GetRegion()
+ self.page.Map.projinfo = self.page.Map.ProjInfo()
+ self.page.Map.wind = self.page.Map.GetWindow()
if self.locationchange == True:
self.cb_loclist.append( str(self.cmbLocation.GetValue()) )
Modified: grass-addons/gui/wxpython/data_catalog/mapframe.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/mapframe.py 2010-04-21 12:19:27 UTC (rev 41948)
+++ grass-addons/gui/wxpython/data_catalog/mapframe.py 2010-04-21 12:37:36 UTC (rev 41949)
@@ -270,6 +270,7 @@
#
self.resize = False # indicates whether or not a resize event has taken place
self.dragimg = None # initialize variable for map panning
+ self.flag = False
#
# Variable for drawing on DC
@@ -691,175 +692,175 @@
@param render re-render map composition
@param renderVector re-render vector map layer enabled for editing (used for digitizer)
"""
+ if self.flag == True:
+ start = time.clock()
- start = time.clock()
+ self.resize = False
- self.resize = False
+ if len(self.Map.GetListOfLayers()) == 0:
+ return False
+
+ if self.img is None:
+ render = True
- # if len(self.Map.GetListOfLayers()) == 0:
- # return False
-
- if self.img is None:
- render = True
-
- #
- # initialize process bar (only on 'render')
- #
- if render is True or renderVector is True:
- self.parent.onRenderGauge.Show()
- if self.parent.onRenderGauge.GetRange() > 0:
- self.parent.onRenderGauge.SetValue(1)
-
- #
- # render background image if needed
- #
-
- # update layer dictionary if there has been a change in layers
- if self.tree and self.tree.reorder == True:
- self.tree.ReorderLayers()
+ #
+ # initialize process bar (only on 'render')
+ #
+ if render is True or renderVector is True:
+ self.parent.onRenderGauge.Show()
+ if self.parent.onRenderGauge.GetRange() > 0:
+ self.parent.onRenderGauge.SetValue(1)
- # reset flag for auto-rendering
- if self.tree:
- self.tree.rerender = False
-
- if render:
- # update display size
- self.Map.ChangeMapSize(self.GetClientSize())
- if self.parent.compResolution.IsChecked():
- # use computation region resolution for rendering
- windres = True
+ #
+ # render background image if needed
+ #
+
+ # update layer dictionary if there has been a change in layers
+ if self.tree and self.tree.reorder == True:
+ self.tree.ReorderLayers()
+
+ # reset flag for auto-rendering
+ if self.tree:
+ self.tree.rerender = False
+
+ if render:
+ # update display size
+ self.Map.ChangeMapSize(self.GetClientSize())
+ if self.parent.compResolution.IsChecked():
+ # use computation region resolution for rendering
+ windres = True
+ else:
+ windres = False
+ self.mapfile = self.Map.Render(force=True, mapWindow=self.parent,
+ windres=windres)
else:
- windres = False
- self.mapfile = self.Map.Render(force=True, mapWindow=self.parent,
- windres=windres)
- else:
- self.mapfile = self.Map.Render(force=False, mapWindow=self.parent)
-
- self.img = self.GetImage() # id=99
+ self.mapfile = self.Map.Render(force=False, mapWindow=self.parent)
- #
- # clear pseudoDcs
- #
- for pdc in (self.pdc,
- self.pdcDec,
- self.pdcTmp):
- pdc.Clear()
- pdc.RemoveAll()
-
- #
- # draw background map image to PseudoDC
- #
- if not self.img:
- self.Draw(self.pdc, pdctype='clear')
- else:
- try:
- id = self.imagedict[self.img]['id']
- except:
- return False
+ self.img = self.GetImage() # id=99
+
+ #
+ # clear pseudoDcs
+ #
+ for pdc in (self.pdc,
+ self.pdcDec,
+ self.pdcTmp):
+ pdc.Clear()
+ pdc.RemoveAll()
+
+ #
+ # draw background map image to PseudoDC
+ #
+ if not self.img:
+ self.Draw(self.pdc, pdctype='clear')
+ else:
+ try:
+ id = self.imagedict[self.img]['id']
+ except:
+ return False
- self.Draw(self.pdc, self.img, drawid=id)
+ self.Draw(self.pdc, self.img, drawid=id)
- #
- # render vector map layer
- #
- digitToolbar = self.parent.toolbars['vdigit']
- if renderVector and digitToolbar and \
- digitToolbar.GetLayer():
- # set region
- self.parent.digit.driver.UpdateRegion()
- # re-calculate threshold for digitization tool
- self.parent.digit.driver.GetThreshold()
- # draw map
- self.pdcVector.Clear()
- self.pdcVector.RemoveAll()
- try:
- item = self.tree.FindItemByData('maplayer', digitToolbar.GetLayer())
- except TypeError:
- item = None
+ #
+ # render vector map layer
+ #
+ digitToolbar = self.parent.toolbars['vdigit']
+ if renderVector and digitToolbar and \
+ digitToolbar.GetLayer():
+ # set region
+ self.parent.digit.driver.UpdateRegion()
+ # re-calculate threshold for digitization tool
+ self.parent.digit.driver.GetThreshold()
+ # draw map
+ self.pdcVector.Clear()
+ self.pdcVector.RemoveAll()
+ try:
+ item = self.tree.FindItemByData('maplayer', digitToolbar.GetLayer())
+ except TypeError:
+ item = None
+
+ if item and self.tree.IsItemChecked(item):
+ self.parent.digit.driver.DrawMap()
+
+ # translate tmp objects (pointer position)
+ if digitToolbar.GetAction() == 'moveLine':
+ if hasattr(self, "vdigitMove") and \
+ self.vdigitMove.has_key('beginDiff'):
+ # move line
+ for id in self.vdigitMove['id']:
+ # print self.pdcTmp.GetIdBounds(id)
+ self.pdcTmp.TranslateId(id,
+ self.vdigitMove['beginDiff'][0],
+ self.vdigitMove['beginDiff'][1])
+ del self.vdigitMove['beginDiff']
- if item and self.tree.IsItemChecked(item):
- self.parent.digit.driver.DrawMap()
+ #
+ # render overlays
+ #
+ for img in self.GetOverlay():
+ # draw any active and defined overlays
+ if self.imagedict[img]['layer'].IsActive():
+ id = self.imagedict[img]['id']
+ self.Draw(self.pdc, img=img, drawid=id,
+ pdctype=self.overlays[id]['pdcType'], coords=self.overlays[id]['coords'])
- # translate tmp objects (pointer position)
- if digitToolbar.GetAction() == 'moveLine':
- if hasattr(self, "vdigitMove") and \
- self.vdigitMove.has_key('beginDiff'):
- # move line
- for id in self.vdigitMove['id']:
- # print self.pdcTmp.GetIdBounds(id)
- self.pdcTmp.TranslateId(id,
- self.vdigitMove['beginDiff'][0],
- self.vdigitMove['beginDiff'][1])
- del self.vdigitMove['beginDiff']
-
- #
- # render overlays
- #
- for img in self.GetOverlay():
- # draw any active and defined overlays
- if self.imagedict[img]['layer'].IsActive():
- id = self.imagedict[img]['id']
- self.Draw(self.pdc, img=img, drawid=id,
- pdctype=self.overlays[id]['pdcType'], coords=self.overlays[id]['coords'])
+ for id in self.textdict.keys():
+ self.Draw(self.pdc, img=self.textdict[id], drawid=id,
+ pdctype='text', coords=[10, 10, 10, 10])
- for id in self.textdict.keys():
- self.Draw(self.pdc, img=self.textdict[id], drawid=id,
- pdctype='text', coords=[10, 10, 10, 10])
+ # optionally draw computational extent box
+ self.DrawCompRegionExtent()
- # optionally draw computational extent box
- self.DrawCompRegionExtent()
+ #
+ # redraw pdcTmp if needed
+ #
+ if len(self.polycoords) > 0:
+ self.DrawLines(self.pdcTmp)
- #
- # redraw pdcTmp if needed
- #
- if len(self.polycoords) > 0:
- self.DrawLines(self.pdcTmp)
+ if self.gframe.georectifying:
+ # -> georectifier (redraw GCPs)
+ if self.parent.toolbars['georect']:
+ coordtype = 'gcpcoord'
+ else:
+ coordtype = 'mapcoord'
+ self.gframe.georectifying.DrawGCP(coordtype)
+
+ #
+ # clear measurement
+ #
+
+ if self.mouse["use"] == "measure":
+ self.ClearLines(pdc=self.pdcTmp)
+ self.polycoords = []
+ self.mouse['use'] = 'pointer'
+ self.mouse['box'] = 'point'
+ self.mouse['end'] = [0, 0]
+ self.SetCursor(self.parent.cursors["default"])
+
+ stop = time.clock()
- if self.gframe.georectifying:
- # -> georectifier (redraw GCPs)
- if self.parent.toolbars['georect']:
- coordtype = 'gcpcoord'
+ #
+ # hide process bar
+ #
+ self.parent.onRenderGauge.Hide()
+
+ #
+ # update statusbar
+ #
+ ### self.Map.SetRegion()
+ self.parent.StatusbarUpdate()
+ if grass.find_file(name = 'MASK', element = 'cell')['name']:
+ # mask found
+ self.parent.maskInfo.SetLabel(_('MASK'))
else:
- coordtype = 'mapcoord'
- self.gframe.georectifying.DrawGCP(coordtype)
+ self.parent.maskInfo.SetLabel('')
- #
- # clear measurement
- #
-
- if self.mouse["use"] == "measure":
- self.ClearLines(pdc=self.pdcTmp)
- self.polycoords = []
- self.mouse['use'] = 'pointer'
- self.mouse['box'] = 'point'
- self.mouse['end'] = [0, 0]
- self.SetCursor(self.parent.cursors["default"])
+ Debug.msg (2, "BufferedWindow.UpdateMap(): render=%s, renderVector=%s -> time=%g" % \
+ (render, renderVector, (stop-start)))
- stop = time.clock()
+ return True
- #
- # hide process bar
- #
- self.parent.onRenderGauge.Hide()
-
- #
- # update statusbar
- #
- ### self.Map.SetRegion()
- self.parent.StatusbarUpdate()
- if grass.find_file(name = 'MASK', element = 'cell')['name']:
- # mask found
- self.parent.maskInfo.SetLabel(_('MASK'))
- else:
- self.parent.maskInfo.SetLabel('')
-
- Debug.msg (2, "BufferedWindow.UpdateMap(): render=%s, renderVector=%s -> time=%g" % \
- (render, renderVector, (stop-start)))
-
- return True
-
def DrawCompRegionExtent(self):
"""
Draw computational region extent in the display
Deleted: grass-addons/gui/wxpython/data_catalog/menudata.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/menudata.py 2010-04-21 12:19:27 UTC (rev 41948)
+++ grass-addons/gui/wxpython/data_catalog/menudata.py 2010-04-21 12:37:36 UTC (rev 41949)
@@ -1,80 +0,0 @@
-"""
- at package menudata.py
-
- at brief Complex list for main menu entries for GRASS wxPython GUI.
-
-Classes:
- - Data
-
-COPYRIGHT: (C) 2007-2008 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.
-
- at author Michael Barton (Arizona State University)
- at author Yann Chemin <yann.chemin gmail.com>
- at author Martin Landa <landa.martin gmail.com>
- at author Glynn Clements
-"""
-
-import os
-try:
- import xml.etree.ElementTree as etree
-except ImportError:
- import elementtree.ElementTree as etree # Python <= 2.4
-
-class Data:
- '''Data object that returns menu descriptions to be used in wxgui.py.'''
- def __init__(self, gisbase=None):
- if not gisbase:
- gisbase = os.getenv('GISBASE')
- filename = gisbase + '/etc/wxpython/xml/menudata.xml'
- self.tree = etree.parse(filename)
-
- def getMenuItem(self, mi):
- if mi.tag == 'separator':
- return ('', '', '', '')
- elif mi.tag == 'menuitem':
- label = _(mi.find('label').text)
- help = _(mi.find('help').text)
- handler = mi.find('handler').text
- gcmd = mi.find('command')
- if gcmd != None:
- gcmd = gcmd.text
- else:
- gcmd = ""
- return (label, help, handler, gcmd)
- elif mi.tag == 'menu':
- return self.getMenu(mi)
- else:
- raise Exception()
-
- def getMenu(self, m):
- label = _(m.find('label').text)
- items = m.find('items')
- return (label, tuple(map(self.getMenuItem, items)))
-
- def getMenuBar(self, mb):
- return tuple(map(self.getMenu, mb.findall('menu')))
-
- def getMenuData(self, md):
- return list(map(self.getMenuBar, md.findall('menubar')))
-
- def GetMenu(self):
- return self.getMenuData(self.tree.getroot())
-
- def PrintStrings(self, fh):
- fh.write('menustrings = [\n')
- for node in self.tree.getiterator():
- if node.tag in ['label', 'help']:
- fh.write(' _(%r),\n' % node.text)
- fh.write(' \'\']\n')
-
-if __name__ == "__main__":
- import sys
- if len(sys.argv) < 2:
- sys.exit(1)
-
- Data(sys.argv[1]).PrintStrings(sys.stdout)
-
- sys.exit(0)
Deleted: grass-addons/gui/wxpython/data_catalog/right.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/right.py 2010-04-21 12:19:27 UTC (rev 41948)
+++ grass-addons/gui/wxpython/data_catalog/right.py 2010-04-21 12:37:36 UTC (rev 41949)
@@ -1,39 +0,0 @@
-import wx
-import wx_utils as wx_utils
-
-class RightTree(wx.TreeCtrl):
-
- def __init__(self, parent, id,
- pos = wx.DefaultPosition,
- size = wx.DefaultSize,
- style= wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS):
-
- wx.TreeCtrl.__init__(self, parent, id, pos, size, style)
- self.itemFont2 = wx.Font(pointSize=9,weight=0, family=wx.FONTFAMILY_DEFAULT ,style=wx.FONTSTYLE_ITALIC)
-
-
- def PopulateDisplay(self):
- root1 = self.AddRoot('root')
- node_raster2 = self.AppendItem(root1, "Display 0")
- node_vector2 = self.AppendItem(root1, "Display 1")
- node_dbf2 = self.AppendItem(root1, "Display 2")
- treeNodes2 = [node_raster2,node_vector2,node_dbf2]
- #Nodes with no children are given an italic type font
- for node in treeNodes2:
- if not self.ItemHasChildren(node):
- if self.GetItemText(node) == 'Display 0':
- tmp_item2 = self.AppendItem(node, "No raster maps found.")
- elif self.GetItemText(node) == 'Display 1':
- tmp_item2 = self.AppendItem(node, "No vector maps found.")
- elif self.GetItemText(node) == 'Display 2':
- tmp_item2 = self.AppendItem(node, "No DBF files found.")
- self.SetItemFont(tmp_item2,self.itemFont2)
-
- #self.pg_panel = wx.Panel(self.gm_cb, id=wx.ID_ANY, style= wx.EXPAND)
- #self.gm_cb.AddPage(self.pg_panel, text="Display "+ str(self.disp_idx + 1), select = True)
- #self.curr_page = self.gm_cb.GetCurrentPage()
-
-
- # create layer tree (tree control for managing GIS layers) and put on new notebook page
-
-
Modified: grass-addons/gui/wxpython/data_catalog/wx_utils.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/wx_utils.py 2010-04-21 12:19:27 UTC (rev 41948)
+++ grass-addons/gui/wxpython/data_catalog/wx_utils.py 2010-04-21 12:37:36 UTC (rev 41949)
@@ -93,6 +93,8 @@
self.item = None
self.layer = []
+
+ self.ltype = None
@@ -214,7 +216,7 @@
self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.OnActivateLayer)
self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnChangeSel)
self.Bind(CT.EVT_TREE_ITEM_CHECKED, self.OnLayerChecked)
- # self.Bind(wx.EVT_TREE_DELETE_ITEM, self.OnDeleteLayer)
+ #self.Bind(wx.EVT_TREE_DELETE_ITEM, self.OnDeleteLayer)
self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnLayerContextMenu)
#self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnDrag)
self.Bind(wx.EVT_TREE_END_DRAG, self.OnEndDrag)
@@ -259,10 +261,11 @@
event.Skip()
return
- ltype = self.GetPyData(self.layer_selected)[0]['type']
+ #ltype = 'raster'
+ #print self.ltype
Debug.msg (4, "LayerTree.OnContextMenu: layertype=%s" % \
- ltype)
+ self.ltype)
if not hasattr (self, "popupID1"):
self.popupID1 = wx.NewId()
@@ -292,25 +295,23 @@
q= p.GetParent()
r= q.GetParent()
frame= r.GetParent()
- print "Ss"
- print frame.GetName()
self.Bind(wx.EVT_MENU, frame.OnDeleteLayer, id=self.popupID1)
- if ltype != "command": # rename
+ if self.ltype != "command": # rename
self.popupMenu.Append(self.popupID2, text=_("Rename"))
self.Bind(wx.EVT_MENU, self.RenameLayer, id=self.popupID2)
if numSelected > 1:
self.popupMenu.Enable(self.popupID2, False)
# map layer items
- if ltype != "group" and \
- ltype != "command":
+ if self.ltype != "group" and \
+ self.ltype != "command":
self.popupMenu.AppendSeparator()
self.popupMenu.Append(self.popupID8, text=_("Change opacity level"))
self.Bind(wx.EVT_MENU, self.OnPopupOpacityLevel, id=self.popupID8)
self.popupMenu.Append(self.popupID3, text=_("Properties"))
self.Bind(wx.EVT_MENU, self.OnPopupProperties, id=self.popupID3)
- if ltype in ('raster', 'vector', 'rgb'):
+ if self.ltype in ('raster', 'vector', 'rgb'):
self.popupMenu.Append(self.popupID9, text=_("Zoom to selected map(s)"))
self.Bind(wx.EVT_MENU, self.mapdisplay.MapWindow2D.OnZoomToMap, id=self.popupID9)
self.popupMenu.Append(self.popupID10, text=_("Set computational region from selected map(s)"))
@@ -321,7 +322,7 @@
# specific items
try:
- mltype = self.GetPyData(self.layer_selected)[0]['type']
+ mltype = self.ltype
except:
mltype = None
#
@@ -453,7 +454,7 @@
rast3d = []
for layer in self.GetSelections():
mapLayer = self.GetPyData(layer)[0]['maplayer']
- mltype = self.GetPyData(layer)[0]['type']
+ mltype = self.ltype
if mltype == 'raster':
rast.append(mapLayer.name)
@@ -646,6 +647,11 @@
"""!Rename layer"""
self.EditLabel(self.layer_selected)
+
+ def PlusLayer(self,maplayer):
+ self.layer.append(maplayer)
+
+
def AddLayer(self, ltype, lname=None, lchecked=None,
lopacity=1.0, lcmd=None, lgroup=None, lvdigit=None, lnviz=None):
"""!Add new item to the layer tree, create corresponding MapLayer instance.
@@ -1027,11 +1033,14 @@
item = event.GetItem()
checked = item.IsChecked()
+ #import pdb
+ #pdb.set_trace()
+
digitToolbar = self.mapdisplay.toolbars['vdigit']
if self.first == False:
# change active parameter for item in layers list in render.Map
- if self.GetPyData(item)[0]['type'] == 'group':
+ if self.ltype == 'group':
child, cookie = self.GetFirstChild(item)
while child:
self.CheckItem(child, checked)
More information about the grass-commit
mailing list