[GRASS-SVN] r43913 - in
grass/branches/releasebranch_6_4/gui/wxpython: gui_modules scripts
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Oct 14 11:49:19 EDT 2010
Author: martinl
Date: 2010-10-14 08:49:19 -0700 (Thu, 14 Oct 2010)
New Revision: 43913
Removed:
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/grassenv.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbox.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/track.py
grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py
grass/branches/releasebranch_6_4/gui/wxpython/scripts/d.rast3d
grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.cmd
grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.db
grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.mon
grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.rast
grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.vect
Log:
remove other unused files after major backport
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/grassenv.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/grassenv.py 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/grassenv.py 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,44 +0,0 @@
-"""
-MODULE: grassenv
-
-PURPOSE: GRASS environment variable management
-
-AUTHORS: The GRASS Development Team
- Jachym Cepicky (Mendel University of Agriculture)
- Martin Landa <landa.martin gmail.com>
-
-COPYRIGHT: (C) 2006-2007 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.
-
-"""
-
-import os
-import sys
-
-import globalvar
-
-try:
- import subprocess
-except:
- CompatPath = os.path.join(globalvar.ETCWXDIR, "compat")
- sys.path.append(CompatPath)
- import subprocess
-
-# import gcmd
-
-def GetGRASSVariable(var):
- """Return GRASS variable or '' if variable is not defined"""
- # gisEnv = gcmd.Command(['g.gisenv'])
-
- gisEnv = subprocess.Popen(['g.gisenv' + globalvar.EXT_BIN],
- stdin=None,
- stdout=subprocess.PIPE,
- stderr=None)
-
- for item in gisEnv.stdout.readlines():
- if var in item:
- return item.split('=')[1].replace("'",'').replace(';','').strip()
-
- return None
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbox.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbox.py 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/toolbox.py 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,212 +0,0 @@
-test_config = """
-<qgisgrass name="Test config">
-<modules>
- <section label="First Section">
- <grass name="g.gisenv"/>
- <grass name="d.vect"/>
- </section>
- <section label="Second Section">
- <grass name="r.to.vect.line"/>
- <grass name="r.to.vect.area"/>
- </section>
- <grass name="v.buffer"/>
-</modules>
-</qgisgrass>
-"""
-test_modules = {"g.gisenv":"""
-<qgisgrassmodule label="GRASS environment variables" module="g.gisenv">
-</qgisgrassmodule>
-""","r.to.vect.area":"""
-<qgisgrassmodule label="Convert a raster to vector areas" module="r.to.vect">
- <option key="input" />
- <option key="output" />
- <option key="feature" answer="area" hidden="yes" />
- <flag key="s" answer="on" hidden="yes" />
-</qgisgrassmodule>
-""","r.to.vect.line":"""
-<qgisgrassmodule label="Convert a raster to vector areas" module="r.to.vect">
- <option key="input" />
- <option key="output" />
- <option key="feature" answer="line" hidden="yes" />
- <flag key="s" answer="on" hidden="yes" />
-</qgisgrassmodule>
-""","v.surf.idw":"""
-<qgisgrassmodule label="Interpolate attribute values (IDW)" module="v.surf.idw">
- <option key="input" layeroption="layer" typemask="point,line" id="input" />
- <field key="column" layerid="input" type="integer,double" label="Attribute field (interpolated values)" />
- <option key="npoints" />
- <option key="output" />
-</qgisgrassmodule>
-"""
-}
-import xml.dom.minidom
-import menuform
-
-class handleQgisGrass:
-
- def __init__(self, qgisgrass):
- modules = qgisgrass.childNodes[0].GetElementsByTagName('modules')[0]
- for child in modules.childNodes:
- if child.localName == 'grass':
- self.handleGrass( child )
- elif child.localName == 'section':
- self.handleSection( child )
-
- def handleSection( self,section ):
- for child in section.GetElementsByTagName('grass'):
- self.handleGrass( child )
-
- def handleGrass( self, grass ):
- raise NotImplementedError
-
-class printQgisGrass( handleQgisGrass ):
- def __init__(self, qgisgrass):
- print "in qgisgrass"
- handleQgisGrass.__init__( self, qgisgrass )
-
- def handleSection( self,section ):
- print "Section:",section.getAttribute('label')
- handleQgisGrass.handleSection( self, section )
-
- def handleGrass( self, grass ):
- print "Command:",grass.getAttribute('name')
-
-
-class wxQgisGrass( handleQgisGrass ):
- pass
-
-
-class handleQgisGrassModule:
-
- def __init__( self, qgisgrassmodule):
- qgisgrassm = qgisgrassmodule.GetElementsByTagName( "qgisgrassmodule" )[0]
- self.handleAttributes( qgisgrassm )
- for inner in qgisgrassm.childNodes:
- it = inner.localName
- if it == 'option':
- self.handleOption( inner )
- elif it == 'flag':
- self.handleFlag( inner )
- elif it is not None:
- self.handleOther( inner )
-
- def handleAttributes( self, node ):
- for (l,a) in node.attributes.items():
- self.handleAttribute( l, a, node )
-
- def handleAttribute( self, label, value, parent ):
- raise NotImplementedError
-
- def handleOption( self, option ):
- self.handleAttributes( option )
-
- def handleFlag( self, flag ):
- self.handleAttributes( flag )
-
- def handleOther( self, other ):
- self.handleAttributes( other )
-
-class printQgisGrassModule( handleQgisGrassModule ):
-
- def __init__( self, qgisgrassmodule):
- self.handleOption = self.printHandler
- self.handleFlag = self.printHandler
- self.handleOther = self.printHandler
- print "in qgisgrassmodule"
- handleQgisGrassModule.__init__( self, qgisgrassmodule )
-
- def printHandler( self, opt ):
- print opt.localName
- handleQgisGrassModule.handleOther( self, opt )
- print
-
- def handleAttribute( self, label, value, option ):
- print "%s:%s" % (label, value)
-
-class wxQgisGrassModule( handleQgisGrassModule ):
- def __init__(self, qgisgrassmodule, label='' ):
- """qgisGrassModule is a string containing the .qgm xml file"""
- self.task = None
- self.label = label
- self.description = ''
- handleQgisGrassModule.__init__( self, qgisgrassmodule )
- self.task.description = self.description
- menuform.GrassGUIApp( self.task ).MainLoop()
-
- def handleOption( self, opt, getit = menuform.grassTask.get_param, **other ):
- a = dict(opt.attributes.items())
- p = getit( self.task, a['key'] )
- # visibility:
- p['guisection'] = _( 'Main' ) # this should be the only tab present
- p['hidden'] = 'no' # unhide params ...
- if a.get('hidden','no') == 'yes': p['hidden'] = 'yes' # ...except when explicitly hidden
- # overrides:
- if a.has_key( 'answer' ): p['value'] = a['answer']
- if a.has_key( 'label' ): p['description'] = a['label']
- for (k,i) in other.items():
- p[k] = i
- # exclusions:
- if a.has_key('exclude'):
- vals = p['value'].split(',')
- exclusions = a['exclude'].split( ',' )
- for excluded in exclusions:
- if excluded in vals:
- idx = vals.index(excluded)
- vals[ idx:idx+1 ] = []
- p['value'] = ','.join( vals )
- if p.get('default','') in exclusions: p['default'] = ''
-
- def handleOther( self, opt ):
- tag = opt.localName
- att = dict( opt.attributes.items() )
- if tag == 'field':
- pass
- elif tag == 'file':
- filters = dict(opt.attributes.items()).get('filters','(*.*)')
- try:
- glob = re.match(r'\((.+)\)').groups(0)
- except KeyError:
- glob = '*.*'
- self.handleOption( opt, gisprompt=True, element='file', filemask=glob )
- elif tag == 'selection':
- pass
-
-
- def handleFlag( self, flag ):
- self.handleOption( flag, getit = menuform.grassTask.get_flag )
-
- def handleAttribute( self, label, value, option ):
- if option.localName == 'qgisgrassmodule':
- if label=='module':
- self.task = menuform.grassTask( grassModule = value )
- for pf in self.task.params + self.task.flags:
- pf['hidden'] = 'yes' # hide eveything initially
- if label=='label':
- self.description = value
-
-from sys import argv
-
-if __name__ == '__main__':
- import os,gettext
- gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
-
- if len( argv ) != 2:
- print "Usage: %s <toolbox command>" % sys.argv[0]
- else:
- the_module = argv[1]
- if the_module != 'test':
- qgm = open( the_module ).read()
- x = wxQgisGrassModule( xml.dom.minidom.parseString( qgm ), label = the_module )
- else:
- # self test
- config = xml.dom.minidom.parseString( test_config )
- printQgisGrass( config )
- print
- for m in test_modules.keys():
- print m
- module = xml.dom.minidom.parseString( test_modules[m] )
- printQgisGrassModule( module )
- print "----------------"
- m = "r.to.vect.area"
- x = wxQgisGrassModule( xml.dom.minidom.parseString( test_modules[ m ] ), label = m )
-
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/track.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/track.py 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/track.py 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,69 +0,0 @@
-"""
-Variables set at initialization
-"""
-global curr_disp
-curr_disp=""
-global ctrl_dict
-ctrl_dict={}
-
-class Track:
- """
- This class has functions and variables for tracking map display,
- associated notebook pages, and other index values.
- """
-
- def SetCtrlDict(self, idx, disp, page, tree):
- """
- This method stores the associated display index, display ID,
- controls book page ID, and map layer tree ID in a dictionary
- """
- global ctrl_dict
- ctrl_dict[idx]=[disp, page, tree]
- return ctrl_dict
-
- def GetCtrls(self, idx, num):
- """
- Returns widget ID for map display (num=0), controls book page
- (num=1), or map layer tree (num=2) for a given map display
- index (idx)
- """
- global ctrl_dict
- ctrls = ctrl_dict[idx][num]
- return ctrls
-
- def popCtrl(self, idx):
- """
- Removes entry from display and control dictionary.
- Used when display is closed
- """
- global ctrl_dict
- if ctrl_dict != "":
- ctrl_dict.pop(idx)
-
- def GetDisp_idx(self, ctrl_id):
- """
- Returns the display index for the display/controls dictionary entry
- given the widget ID of the control (ctrl_id)
- """
- global ctrl_dict
- for idx,ctrl in ctrl_dict.items():
- if ctrl_id in ctrl:
- return idx
-
- def SetDisp(self, disp_idx, disp_id):
- """
- Creates a tuple of the currently active display index and its corresponding
- map display frame ID.
- """
- global curr_disp
- curr_disp = (disp_idx, disp_id)
- return curr_disp
-
- def GetDisp(self):
- """
- Returns the (display index, display ID) tuple of the currently
- active display
- """
- global curr_disp
- return curr_disp
-
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/wxgui_utils.py 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,1447 +0,0 @@
-"""
- at package wxgui_utils.py
-
- at brief Utility classes for GRASS wxPython GUI. Main functions include
-tree control for GIS map layer management, command console, and
-command parsing.
-
-Classes:
- - AbstractLayer
- - Layer
- - LayerTree
-
-(C) 2007-2009 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 Jachym Cepicky (Mendel University of Agriculture)
- at author Martin Landa <landa.martin gmail.com>
-"""
-
-import os
-import sys
-import string
-
-import wx
-try:
- import wx.lib.agw.customtreectrl as CT
-except ImportError:
- import wx.lib.customtreectrl as CT
-import wx.combo
-import wx.lib.newevent
-import wx.lib.buttons as buttons
-
-import globalvar
-
-import gdialogs
-import menuform
-import toolbars
-import mapdisp
-import render
-import gcmd
-import grassenv
-import histogram
-import utils
-import profile
-from debug import Debug as Debug
-from icon import Icons as Icons
-from preferences import globalSettings as UserSettings
-from vdigit import haveVDigit
-try:
- import subprocess
-except:
- from compat import subprocess
-
-try:
- import treemixin
-except ImportError:
- from wx.lib.mixins import treemixin
-
-
-TREE_ITEM_HEIGHT = 25
-
-class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
- """
- Creates layer tree structure
- """
- def __init__(self, parent,
- id=wx.ID_ANY, pos=wx.DefaultPosition,
- size=wx.DefaultSize, style=wx.SUNKEN_BORDER,
- ctstyle=CT.TR_HAS_BUTTONS | CT.TR_HAS_VARIABLE_ROW_HEIGHT |
- CT.TR_HIDE_ROOT | CT.TR_ROW_LINES | CT.TR_FULL_ROW_HIGHLIGHT |
- CT.TR_MULTIPLE,**kargs):
- self.items = []
- self.itemCounter = 0
- ctstyle |= style
- if 'style' in kargs:
- ctstyle |= kargs['style']
- del kargs['style']
-
- if globalvar.hasAgw:
- super(LayerTree, self).__init__(parent, id, pos, size, agwStyle = ctstyle)
- else:
- super(LayerTree, self).__init__(parent, id, pos, size, style = ctstyle, ctstyle = ctstyle)
- self.SetName("LayerTree")
-
- ### SetAutoLayout() causes that no vertical scrollbar is displayed
- ### when some layers are not visible in layer tree
- # self.SetAutoLayout(True)
- self.SetGradientStyle(1)
- self.EnableSelectionGradient(True)
- self.SetFirstGradientColour(wx.Colour(100, 100, 100))
- self.SetSecondGradientColour(wx.Colour(150, 150, 150))
-
- self.Map = render.Map() # instance of render.Map to be associated with display
- self.root = None # ID of layer tree root node
- self.groupnode = 0 # index value for layers
- self.optpage = {} # dictionary of notebook option pages for each map layer
- self.layer_selected = None # ID of currently selected layer
- self.saveitem = {} # dictionary to preserve layer attributes for drag and drop
- self.first = True # indicates if a layer is just added or not
- self.flag = '' # flag for drag and drop hittest
- self.disp_idx = kargs['idx']
- self.gismgr = kargs['gismgr']
- self.notebook = kargs['notebook'] # GIS Manager notebook for layer tree
- self.treepg = parent # notebook page holding layer tree
- self.auimgr = kargs['auimgr'] # aui manager
- self.rerender = False # layer change requires a rerendering if auto render
- self.reorder = False # layer change requires a reordering
-
- # init associated map display
- pos = wx.Point((self.disp_idx + 1) * 25, (self.disp_idx + 1) * 25)
- self.mapdisplay = mapdisp.MapFrame(self,
- id=wx.ID_ANY, pos=pos,
- size=globalvar.MAP_WINDOW_SIZE,
- style=wx.DEFAULT_FRAME_STYLE,
- tree=self, notebook=self.notebook,
- gismgr=self.gismgr, page=self.treepg,
- Map=self.Map, auimgr=self.auimgr)
-
- # title
- self.mapdisplay.SetTitle(_("GRASS GIS Map Display: " +
- str(self.disp_idx + 1) +
- " - Location: " + grassenv.GetGRASSVariable("LOCATION_NAME")))
-
- # show new display
- if kargs['showMapDisplay'] is True:
- self.mapdisplay.Show()
- self.mapdisplay.Refresh()
- self.mapdisplay.Update()
-
- self.root = self.AddRoot(_("Map Layers"))
- self.SetPyData(self.root, (None,None))
- self.items = []
-
- #create image list to use with layer tree
- il = wx.ImageList(16, 16, mask = True)
-
- trart = wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, (16, 16))
- self.folder_open = il.Add(trart)
- trart = wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16, 16))
- self.folder = il.Add(trart)
-
- bmpsize = (16, 16)
- trgif = Icons["addrast"].GetBitmap(bmpsize)
- self.rast_icon = il.Add(trgif)
-
- trgif = Icons["addrast3d"].GetBitmap(bmpsize)
- self.rast3d_icon = il.Add(trgif)
-
- trgif = Icons["addrgb"].GetBitmap(bmpsize)
- self.rgb_icon = il.Add(trgif)
-
- trgif = Icons["addhis"].GetBitmap(bmpsize)
- self.his_icon = il.Add(trgif)
-
- trgif = Icons["addshaded"].GetBitmap(bmpsize)
- self.shaded_icon = il.Add(trgif)
-
- trgif = Icons["addrarrow"].GetBitmap(bmpsize)
- self.rarrow_icon = il.Add(trgif)
-
- trgif = Icons["addrnum"].GetBitmap(bmpsize)
- self.rnum_icon = il.Add(trgif)
-
- trgif = Icons["addvect"].GetBitmap(bmpsize)
- self.vect_icon = il.Add(trgif)
-
- trgif = Icons["addthematic"].GetBitmap(bmpsize)
- self.theme_icon = il.Add(trgif)
-
- trgif = Icons["addchart"].GetBitmap(bmpsize)
- self.chart_icon = il.Add(trgif)
-
- trgif = Icons["addgrid"].GetBitmap(bmpsize)
- self.grid_icon = il.Add(trgif)
-
- trgif = Icons["addgeodesic"].GetBitmap(bmpsize)
- self.geodesic_icon = il.Add(trgif)
-
- trgif = Icons["addrhumb"].GetBitmap(bmpsize)
- self.rhumb_icon = il.Add(trgif)
-
- trgif = Icons["addlabels"].GetBitmap(bmpsize)
- self.labels_icon = il.Add(trgif)
-
- trgif = Icons["addcmd"].GetBitmap(bmpsize)
- self.cmd_icon = il.Add(trgif)
-
- self.AssignImageList(il)
-
- # use when groups implemented
- ## self.tree.SetItemImage(self.root, fldridx, wx.TreeItemIcon_Normal)
- ## self.tree.SetItemImage(self.root, fldropenidx, wx.TreeItemIcon_Expanded)
-
- self.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.OnExpandNode)
- self.Bind(wx.EVT_TREE_ITEM_COLLAPSED, self.OnCollapseNode)
- 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_ITEM_RIGHT_CLICK, self.OnLayerContextMenu)
- #self.Bind(wx.EVT_TREE_BEGIN_DRAG, self.OnDrag)
- self.Bind(wx.EVT_TREE_END_DRAG, self.OnEndDrag)
- #self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.OnChangeLayerName)
- self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
- # self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
- self.Bind(wx.EVT_IDLE, self.OnIdle)
-
- def OnIdle(self, event):
- """
- Only re-order and re-render a composite map image from GRASS during
- idle time instead of multiple times during layer changing.
- """
- if self.rerender:
- if self.mapdisplay.autoRender.GetValue():
- self.mapdisplay.MapWindow.UpdateMap(render=True)
-
- event.Skip()
-
- def OnKeyUp(self, event):
- """Key pressed"""
- key = event.GetKeyCode()
- if key == wx.WXK_DELETE and self.gismgr:
- self.gismgr.OnDeleteLayer(None)
-
- event.Skip()
-
- #def OnChangeLayerName (self, event):
- # """Change layer name"""
- # Debug.msg (3, "LayerTree.OnChangeLayerName: name=%s" % event.GetLabel())
-
- def OnLayerContextMenu (self, event):
- """Contextual menu for item/layer"""
- if not self.layer_selected:
- event.Skip()
- return
-
- ltype = self.GetPyData(self.layer_selected)[0]['type']
-
- Debug.msg (4, "LayerTree.OnContextMenu: layertype=%s" % \
- ltype)
-
- if not hasattr (self, "popupID1"):
- self.popupID1 = wx.NewId()
- self.popupID2 = wx.NewId()
- self.popupID3 = wx.NewId()
- self.popupID4 = wx.NewId()
- self.popupID5 = wx.NewId()
- self.popupID6 = wx.NewId()
- self.popupID7 = wx.NewId()
- self.popupID8 = wx.NewId()
- self.popupID9 = wx.NewId()
- self.popupID10 = wx.NewId()
- self.popupID11 = wx.NewId() # nviz
- self.popupID12 = wx.NewId()
- self.popupID13 = wx.NewId()
- self.popupID14 = wx.NewId()
- self.popupID15 = wx.NewId()
-
- self.popupMenu = wx.Menu()
-
- numSelected = len(self.GetSelections())
-
- # general item
- self.popupMenu.Append(self.popupID1, text=_("Remove"))
- self.Bind(wx.EVT_MENU, self.gismgr.OnDeleteLayer, id=self.popupID1)
-
- if 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":
- 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'):
- self.popupMenu.Append(self.popupID9, text=_("Zoom to selected map(s)"))
- self.Bind(wx.EVT_MENU, self.mapdisplay.MapWindow.OnZoomToMap, id=self.popupID9)
- self.popupMenu.Append(self.popupID10, text=_("Set computational region from selected map(s)"))
- self.Bind(wx.EVT_MENU, self.OnSetCompRegFromMap, id=self.popupID10)
- if numSelected > 1:
- self.popupMenu.Enable(self.popupID8, False)
- self.popupMenu.Enable(self.popupID3, False)
-
- # specific items
- try:
- 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"))
- self.Bind (wx.EVT_MENU, self.gismgr.OnShowAttributeTable, id=self.popupID4)
-
- self.popupMenu.Append(self.popupID5, text=_("Start editing"))
- self.popupMenu.Append(self.popupID6, text=_("Stop editing"))
- self.popupMenu.Enable(self.popupID6, False)
- self.Bind (wx.EVT_MENU, self.OnStartEditing, id=self.popupID5)
- self.Bind (wx.EVT_MENU, self.OnStopEditing, id=self.popupID6)
-
- layer = self.GetPyData(self.layer_selected)[0]['maplayer']
- # enable editing only for vector map layers available in the current mapset
- digitToolbar = self.mapdisplay.toolbars['vdigit']
- if digitToolbar:
- # background vector map
- self.popupMenu.Append(self.popupID14,
- text=_("Use as background vector map"),
- kind=wx.ITEM_CHECK)
- self.Bind(wx.EVT_MENU, self.OnSetBgMap, id=self.popupID14)
- if UserSettings.Get(group='vdigit', key='bgmap', subkey='value',
- internal=True) == layer.GetName():
- self.popupMenu.Check(self.popupID14, True)
-
- if layer.GetMapset() != grassenv.GetGRASSVariable("MAPSET"):
- # only vector map in current mapset can be edited
- self.popupMenu.Enable (self.popupID5, False)
- self.popupMenu.Enable (self.popupID6, False)
- elif digitToolbar and digitToolbar.GetLayer():
- # vector map already edited
- vdigitLayer = digitToolbar.GetLayer()
- if vdigitLayer is layer:
- # disable 'start editing'
- self.popupMenu.Enable (self.popupID5, False)
- # enable 'stop editing'
- self.popupMenu.Enable(self.popupID6, True)
- # disable 'remove'
- self.popupMenu.Enable(self.popupID1, False)
- # disable 'bgmap'
- self.popupMenu.Enable(self.popupID14, False)
- else:
- # disable 'start editing'
- self.popupMenu.Enable(self.popupID5, False)
- # disable 'stop editing'
- self.popupMenu.Enable(self.popupID6, False)
- # enable 'bgmap'
- self.popupMenu.Enable(self.popupID14, True)
-
- self.popupMenu.Append(self.popupID7, _("Metadata"))
- self.Bind (wx.EVT_MENU, self.OnMetadata, id=self.popupID7)
- if numSelected > 1:
- self.popupMenu.Enable(self.popupID4, False)
- self.popupMenu.Enable(self.popupID5, False)
- self.popupMenu.Enable(self.popupID6, False)
- 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.MapWindow.OnZoomToRaster, id=self.popupID12)
- self.popupMenu.Append(self.popupID13, text=_("Set computational region from selected map(s) (ignore NULLs)"))
- self.Bind(wx.EVT_MENU, self.OnSetCompRegFromRaster, id=self.popupID13)
- self.popupMenu.AppendSeparator()
- self.popupMenu.Append(self.popupID15, _("Set color table"))
- self.Bind (wx.EVT_MENU, self.OnColorTable, id=self.popupID15)
- self.popupMenu.Append(self.popupID4, _("Histogram"))
- self.Bind (wx.EVT_MENU, self.OnHistogram, id=self.popupID4)
- self.popupMenu.Append(self.popupID5, _("Profile"))
- self.Bind (wx.EVT_MENU, self.OnProfile, id=self.popupID5)
- self.popupMenu.Append(self.popupID6, _("Metadata"))
- self.Bind (wx.EVT_MENU, self.OnMetadata, id=self.popupID6)
- if self.mapdisplay.toolbars['nviz']:
- self.popupMenu.Append(self.popupID11, _("Nviz properties"))
- self.Bind (wx.EVT_MENU, self.OnNvizProperties, id=self.popupID11)
-
- if numSelected > 1:
- self.popupMenu.Enable(self.popupID12, False)
- self.popupMenu.Enable(self.popupID13, False)
- self.popupMenu.Enable(self.popupID15, False)
- self.popupMenu.Enable(self.popupID4, False)
- self.popupMenu.Enable(self.popupID5, False)
- self.popupMenu.Enable(self.popupID6, False)
- self.popupMenu.Enable(self.popupID11, False)
-
- ## self.PopupMenu(self.popupMenu, pos)
- self.PopupMenu(self.popupMenu)
- self.popupMenu.Destroy()
-
- def OnMetadata(self, event):
- """Print metadata of raster/vector map layer
- TODO: Dialog to modify metadata
- """
- mapLayer = self.GetPyData(self.layer_selected)[0]['maplayer']
- mltype = self.GetPyData(self.layer_selected)[0]['type']
-
- if mltype == 'raster':
- cmd = ['r.info']
- elif mltype == 'vector':
- cmd = ['v.info']
- cmd.append('map=%s' % mapLayer.name)
-
- # print output to command log area
- self.gismgr.goutput.RunCmd(cmd, switchPage=True)
-
- def OnSetCompRegFromRaster(self, event):
- """Set computational region from selected raster map (ignore NULLs)"""
- mapLayer = self.GetPyData(self.layer_selected)[0]['maplayer']
-
- cmd = ['g.region',
- '-p',
- 'zoom=%s' % mapLayer.name]
-
- # print output to command log area
- self.gismgr.goutput.RunCmd(cmd)
-
- def OnSetCompRegFromMap(self, event):
- """Set computational region from selected raster/vector map"""
- rast = []
- vect = []
- rast3d = []
- for layer in self.GetSelections():
- mapLayer = self.GetPyData(layer)[0]['maplayer']
- mltype = self.GetPyData(layer)[0]['type']
-
- if mltype == 'raster':
- rast.append(mapLayer.name)
- elif mltype == 'vector':
- vect.append(mapLayer.name)
- elif mltype == '3d-raster':
- rast3d.append(mapLayer.name)
-
- cmd = ['g.region']
- if rast:
- cmd.append('rast=%s' % ','.join(rast))
- if vect:
- cmd.append('vect=%s' % ','.join(vect))
- if rast3d:
- cmd.append('rast3d=%s' % ','.join(rast3d))
-
- # print output to command log area
- if len(cmd) > 1:
- cmd.append('-p')
- self.gismgr.goutput.RunCmd(cmd)
-
- def OnProfile(self, event):
- """Plot profile of given raster map layer"""
- mapLayer = self.GetPyData(self.layer_selected)[0]['maplayer']
- if not mapLayer.name:
- wx.MessageBox(parent=self,
- message=_("Unable to create profile of "
- "raster map."),
- caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
- return False
-
- if not hasattr (self, "profileFrame"):
- self.profileFrame = None
-
- if hasattr (self.mapdisplay, "profile") and self.mapdisplay.profile:
- self.profileFrame = self.mapdisplay.profile
-
- if not self.profileFrame:
- self.profileFrame = profile.ProfileFrame(self.mapdisplay,
- id=wx.ID_ANY, pos=wx.DefaultPosition, size=(700,300),
- style=wx.DEFAULT_FRAME_STYLE, rasterList=[mapLayer.name])
- # show new display
- self.profileFrame.Show()
-
- def OnColorTable(self, event):
- """Set color table for raster map"""
- name = self.GetPyData(self.layer_selected)[0]['maplayer'].name
- menuform.GUI().ParseCommand(['r.colors',
- 'map=%s' % name],
- parentframe=self)
-
- def OnHistogram(self, event):
- """
- Plot histogram for given raster map layer
- """
- mapLayer = self.GetPyData(self.layer_selected)[0]['maplayer']
- if not mapLayer.name:
- wx.MessageBox(parent=self,
- message=_("Unable to display histogram of "
- "raster map."),
- caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
- return False
-
- if not hasattr (self, "histogramFrame"):
- self.histogramFrame = None
-
- if hasattr (self.mapdisplay, "histogram") and self.mapdisplay.histogram:
- self.histogramFrame = self.mapdisplay.histogram
-
- if not self.histogramFrame:
- self.histogramFrame = histogram.HistFrame(self,
- id=wx.ID_ANY,
- pos=wx.DefaultPosition, size=globalvar.HIST_WINDOW_SIZE,
- style=wx.DEFAULT_FRAME_STYLE)
- # show new display
- self.histogramFrame.Show()
-
- self.histogramFrame.SetHistLayer(mapLayer.name)
- self.histogramFrame.HistWindow.UpdateHist()
- self.histogramFrame.Refresh()
- self.histogramFrame.Update()
-
- return True
-
- def OnStartEditing(self, event):
- """
- Start editing vector map layer requested by the user
- """
- try:
- maplayer = self.GetPyData(self.layer_selected)[0]['maplayer']
- except:
- event.Skip()
- return
-
- if not self.mapdisplay.toolbars['vdigit']: # enable tool
- self.mapdisplay.AddToolbar('vdigit')
-
- # mark layer as 'edited'
- if self.mapdisplay.toolbars['vdigit']:
- self.mapdisplay.toolbars['vdigit'].StartEditing(maplayer)
-
- def OnStopEditing(self, event):
- """
- Stop editing the current vector map layer
- """
- maplayer = self.GetPyData(self.layer_selected)[0]['maplayer']
-
- self.mapdisplay.toolbars['vdigit'].OnExit()
- self.mapdisplay.imgVectorMap = None
-
- def OnSetBgMap(self, event):
- """Set background vector map for editing sesstion"""
- if event.IsChecked():
- mapName = self.GetPyData(self.layer_selected)[0]['maplayer'].GetName()
- UserSettings.Set(group='vdigit', key='bgmap', subkey='value',
- value=str(mapName), internal=True)
- else:
- UserSettings.Set(group='vdigit', key='bgmap', subkey='value',
- value='', internal=True)
-
- def OnPopupProperties (self, event):
- """Popup properties dialog"""
- self.PropertiesDialog(self.layer_selected)
-
- def OnPopupOpacityLevel(self, event):
- """Popup opacity level indicator"""
- if not self.GetPyData(self.layer_selected)[0]['ctrl']:
- return
-
- #win = self.FindWindowById(self.GetPyData(self.layer_selected)[0]['ctrl'])
- #type = win.GetName()
- #
- #self.layer_selected.DeleteWindow()
-
- maplayer = self.GetPyData(self.layer_selected)[0]['maplayer']
- current_opacity = maplayer.GetOpacity()
-
- dlg = gdialogs.SetOpacityDialog(self, opacity=current_opacity,
- title=_("Set opacity <%s>") % maplayer.GetName())
- dlg.CentreOnParent()
-
- if dlg.ShowModal() == wx.ID_OK:
- new_opacity = dlg.GetOpacity() # string
- self.Map.ChangeOpacity(maplayer, new_opacity)
- maplayer.SetOpacity(new_opacity)
- opacity_pct = int(new_opacity * 100)
- layername = self.GetItemText(self.layer_selected)
- layerbase = layername.split('(')[0].strip()
- self.SetItemText(self.layer_selected,
- layerbase + ' (opacity: ' + str(opacity_pct) + '%)')
-
- # vector layer currently edited
- if self.mapdisplay.toolbars['vdigit'] and \
- self.mapdisplay.toolbars['vdigit'].GetLayer() == maplayer:
- alpha = int(new_opacity * 255)
- self.mapdisplay.digit.driver.UpdateSettings(alpha)
-
- # redraw map if auto-rendering is enabled
- self.rerender = True
- self.reorder = True
- #if self.mapdisplay.autoRender.GetValue():
- # print "*** Opacity OnRender *****"
- # self.mapdisplay.OnRender(None)
-
- def OnNvizProperties(self, event):
- """Nviz-related properties (raster/vector/volume)
-
- @todo vector/volume
- """
- if not self.mapdisplay.nvizToolWin.IsShown():
- self.mapdisplay.nvizToolWin.Show()
-
- self.mapdisplay.nvizToolWin.SetPage('surface')
-
- def RenameLayer (self, event):
- """Rename layer"""
- self.EditLabel(self.layer_selected)
-
- def AddLayer(self, ltype, lname=None, lchecked=None,
- lopacity=1.0, lcmd=None, lgroup=None, lnviz=None):
- """Add new item to the layer tree, create corresponding MapLayer instance.
- Launch property dialog if needed (raster, vector, etc.)
-
- @param ltype layer type (raster, vector, 3d-raster, ...)
- @param lname layer name
- @param lchecked if True layer is checked
- @param lopacity layer opacity level
- @param lcmd command (given as a list)
- @param lgroup group name or None
- @param lnviz layer Nviz properties
- """
-
- self.first = True
- params = {} # no initial options parameters
-
- # deselect active item
- if self.layer_selected:
- self.SelectItem(self.layer_selected, select=False)
-
- Debug.msg (3, "LayerTree().AddLayer(): ltype=%s" % (ltype))
-
- 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.Bind(wx.EVT_TEXT_ENTER, self.OnCmdChanged)
- # ctrl.Bind(wx.EVT_TEXT, self.OnCmdChanged)
- elif ltype == 'group':
- # group item
- ctrl = None
- grouptext = _('Layer group:') + str(self.groupnode)
- self.groupnode += 1
- else:
- btnbmp = Icons["layeropts"].GetBitmap((16,16))
- ctrl = buttons.GenBitmapButton(self, id=wx.ID_ANY, bitmap=btnbmp, size=(24,24))
- ctrl.SetToolTipString(_("Click to edit layer settings"))
- self.Bind(wx.EVT_BUTTON, self.OnLayerContextMenu, ctrl)
- # add layer to the layer tree
- if self.layer_selected and self.layer_selected != self.GetRootItem():
- if self.GetPyData(self.layer_selected)[0]['type'] == 'group' \
- and self.IsExpanded(self.layer_selected):
- # add to group (first child of self.layer_selected) if group expanded
- layer = self.PrependItem(parent=self.layer_selected,
- text='', ct_type=1, wnd=ctrl)
- else:
- # prepend to individual layer or non-expanded group
- if lgroup is False:
- # -> last child of root (loading from workspace)
- layer = self.AppendItem(parentId=self.root,
- text='', ct_type=1, wnd=ctrl)
- elif lgroup is True:
- # -> last child of group (loading from workspace)
- parent = self.GetItemParent(self.layer_selected)
- if parent is self.root: # first item in group
- parent=self.layer_selected
- layer = self.AppendItem(parentId=parent,
- text='', ct_type=1, wnd=ctrl)
- elif lgroup is None:
- # -> previous sibling of selected layer
- parent = self.GetItemParent(self.layer_selected)
- layer = self.InsertItem(parentId=parent,
- input=self.GetPrevSibling(self.layer_selected),
- text='', ct_type=1, wnd=ctrl)
- else: # add first layer to the layer tree (first child of root)
- layer = self.PrependItem(parent=self.root, text='', ct_type=1, wnd=ctrl)
-
- # layer is initially unchecked as inactive (beside 'command')
- # use predefined value if given
- if lchecked is not None:
- checked = lchecked
- else:
- checked = True
-
- self.CheckItem(layer, checked=checked)
-
- # select new item
- self.SelectItem(layer, select=True)
- self.layer_selected = layer
-
- # add text and icons for each layer ltype
- if ltype == 'raster':
- self.SetItemImage(layer, self.rast_icon)
- self.SetItemText(layer, '%s %s' % (_('raster'), _('(double click to set properties)')))
- elif ltype == '3d-raster':
- self.SetItemImage(layer, self.rast3d_icon)
- self.SetItemText(layer, '%s %s' % (_('3d raster'), _('(double click to set properties)')))
- elif ltype == 'rgb':
- self.SetItemImage(layer, self.rgb_icon)
- self.SetItemText(layer, '%s %s' % (_('RGB'), _('(double click to set properties)')))
- elif ltype == 'his':
- self.SetItemImage(layer, self.his_icon)
- self.SetItemText(layer, '%s %s' % (_('HIS'), _('(double click to set properties)')))
- elif ltype == 'shaded':
- self.SetItemImage(layer, self.shaded_icon)
- self.SetItemText(layer, '%s %s' % (_('Shaded relief'), _('(double click to set properties)')))
- elif ltype == 'rastnum':
- self.SetItemImage(layer, self.rnum_icon)
- self.SetItemText(layer, '%s %s' % (_('raster cell numbers'), _('(double click to set properties)')))
- elif ltype == 'rastarrow':
- self.SetItemImage(layer, self.rarrow_icon)
- self.SetItemText(layer, '%s %s' % (_('raster flow arrows'), _('(double click to set properties)')))
- elif ltype == 'vector':
- self.SetItemImage(layer, self.vect_icon)
- self.SetItemText(layer, '%s %s' % (_('vector'), _('(double click to set properties)')))
- elif ltype == 'thememap':
- self.SetItemImage(layer, self.theme_icon)
- self.SetItemText(layer, '%s %s' % (_('thematic map'), _('(double click to set properties)')))
- elif ltype == 'themechart':
- self.SetItemImage(layer, self.chart_icon)
- self.SetItemText(layer, '%s %s' % (_('thematic charts'), _('(double click to set properties)')))
- elif ltype == 'grid':
- self.SetItemImage(layer, self.grid_icon)
- self.SetItemText(layer, '%s %s' % (_('grid'), _('(double click to set properties)')))
- elif ltype == 'geodesic':
- self.SetItemImage(layer, self.geodesic_icon)
- self.SetItemText(layer, '%s %s' % (_('geodesic line'), _('(double click to set properties)')))
- elif ltype == 'rhumb':
- self.SetItemImage(layer, self.rhumb_icon)
- self.SetItemText(layer, '%s %s' % (_('rhumbline'), _('(double click to set properties)')))
- elif ltype == 'labels':
- self.SetItemImage(layer, self.labels_icon)
- self.SetItemText(layer, '%s %s' % (_('vector labels'), _('(double click to set properties)')))
- elif ltype == 'command':
- self.SetItemImage(layer, self.cmd_icon)
- elif ltype == 'group':
- self.SetItemImage(layer, self.folder)
- self.SetItemText(layer, grouptext)
-
- self.first = False
-
- if ltype != 'group':
- if lcmd and len(lcmd) > 1:
- cmd = lcmd
- render = False
- name = utils.GetLayerNameFromCmd(lcmd)
- else:
- cmd = []
- if ltype == 'command' and lname:
- for c in lname.split(';'):
- cmd.append(c.split(' '))
-
- render = False
- name = None
-
- if ctrl:
- ctrlId = ctrl.GetId()
- else:
- ctrlId = None
-
- # add a data object to hold the layer's command (does not apply to generic command layers)
- self.SetPyData(layer, ({'cmd': cmd,
- 'type' : ltype,
- 'ctrl' : ctrlId,
- 'maplayer' : None,
- 'nviz' : lnviz,
- 'propwin' : None},
- None))
-
- # find previous map layer instance
- prevItem = self.GetFirstChild(self.root)[0]
- prevMapLayer = None
- pos = -1
- while prevItem and prevItem.IsOk() and prevItem != layer:
- if self.GetPyData(prevItem)[0]['maplayer']:
- prevMapLayer = self.GetPyData(prevItem)[0]['maplayer']
-
- prevItem = self.GetNextSibling(prevItem)
-
- if prevMapLayer:
- pos = self.Map.GetLayerIndex(prevMapLayer)
- else:
- pos = -1
-
- maplayer = self.Map.AddLayer(pos=pos,
- type=ltype, command=self.GetPyData(layer)[0]['cmd'], name=name,
- l_active=checked, l_hidden=False,
- l_opacity=lopacity, l_render=render)
- self.GetPyData(layer)[0]['maplayer'] = maplayer
-
- # run properties dialog if no properties given
- if len(cmd) == 0:
- self.PropertiesDialog(layer, show=True)
-
- if ltype == '3d-raster' and \
- not self.mapdisplay.toolbars['nviz']:
- self.EnableItem(layer, False)
-
- else: # group
- self.SetPyData(layer, ({'cmd': None,
- 'type' : ltype,
- 'ctrl' : None,
- 'maplayer' : None,
- 'propwin' : None},
- None))
-
- # use predefined layer name if given
- if lname:
- if ltype == 'group':
- self.SetItemText(layer, lname)
- elif ltype == 'command':
- ctrl.SetValue(lname)
- else:
- name = lname + ' (opacity: ' + \
- str(self.GetPyData(layer)[0]['maplayer'].GetOpacity()) + '%)'
- self.SetItemText(layer, name)
-
- # updated progress bar range (mapwindow statusbar)
- if checked is True:
- self.mapdisplay.onRenderGauge.SetRange(len(self.Map.GetListOfLayers(l_active=True)))
-
- # layer.SetHeight(TREE_ITEM_HEIGHT)
-
- return layer
-
- def PropertiesDialog (self, layer, show=True):
- """Launch the properties dialog"""
- if self.GetPyData(layer)[0].has_key('propwin') and \
- self.GetPyData(layer)[0]['propwin'] is not None:
- # recycle GUI dialogs
- win = self.GetPyData(layer)[0]['propwin']
- # update properties (columns, layers)
- win.notebookpanel.OnUpdateSelection(None)
- if win.IsShown():
- win.SetFocus()
- else:
- win.Show()
-
- return
-
- completed = ''
- params = self.GetPyData(layer)[1]
- ltype = self.GetPyData(layer)[0]['type']
-
- Debug.msg (3, "LayerTree.PropertiesDialog(): ltype=%s" % \
- ltype)
-
- if self.GetPyData(layer)[0]['cmd']:
- cmdValidated = menuform.GUI().ParseCommand(self.GetPyData(layer)[0]['cmd'],
- completed=(self.GetOptData,layer,params),
- parentframe=self, show=show)
- self.GetPyData(layer)[0]['cmd'] = cmdValidated
- elif ltype == 'raster':
- cmd = ['d.rast']
-
- if UserSettings.Get(group='cmd', key='rasterOverlay', subkey='enabled'):
- cmd.append('-o')
- menuform.GUI().ParseCommand(cmd, completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == '3d-raster':
- cmd = ['d.rast3d']
- menuform.GUI().ParseCommand(cmd, completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'rgb':
- menuform.GUI().ParseCommand(['d.rgb'], completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'his':
- menuform.GUI().ParseCommand(['d.his'], completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'shaded':
- menuform.GUI().ParseCommand(['d.shadedmap'], completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'rastarrow':
- menuform.GUI().ParseCommand(['d.rast.arrow'], completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'rastnum':
- menuform.GUI().ParseCommand(['d.rast.num'], completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'vector':
- types = ''
- for type in UserSettings.Get(group='cmd', key='showType').keys():
- if UserSettings.Get(group='cmd', key='showType', subkey=[type, 'enabled']):
- types += type + ','
- types = types.rstrip(',')
-
- menuform.GUI().ParseCommand(['d.vect', 'type=%s' % types],
- completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'thememap':
- # -s flag requested, otherwise only first thematic category is displayed
- # should be fixed by C-based d.thematic.* modules
- menuform.GUI().ParseCommand(['d.vect.thematic', '-s'],
- completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'themechart':
- menuform.GUI().ParseCommand(['d.vect.chart'],
- completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'grid':
- menuform.GUI().ParseCommand(['d.grid'], completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'geodesic':
- menuform.GUI().ParseCommand(['d.geodesic'], completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'rhumb':
- menuform.GUI().ParseCommand(['d.rhumbline'], completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'labels':
- menuform.GUI().ParseCommand(['d.labels'], completed=(self.GetOptData,layer,params),
- parentframe=self)
- elif ltype == 'cmdlayer':
- pass
- elif ltype == 'group':
- pass
-
- def OnActivateLayer(self, event):
- """Double click on the layer item.
- Launch property dialog, or expand/collapse group of items, etc."""
-
- layer = event.GetItem()
- self.layer_selected = layer
-
- self.PropertiesDialog (layer)
-
- if self.GetPyData(layer)[0]['type'] == 'group':
- if self.IsExpanded(layer):
- self.Collapse(layer)
- else:
- self.Expand(layer)
-
- def OnDeleteLayer(self, event):
- """Remove selected layer item from the layer tree"""
-
- item = event.GetItem()
-
- try:
- item.properties.Close(True)
- except:
- pass
-
- if item != self.root:
- Debug.msg (3, "LayerTree.OnDeleteLayer(): name=%s" % \
- (self.GetItemText(item)))
- else:
- self.root = None
-
- # unselect item
- self.Unselect()
- self.layer_selected = None
-
- try:
- if self.GetPyData(item)[0]['type'] != 'group':
- self.Map.DeleteLayer( self.GetPyData(item)[0]['maplayer'])
- except:
- pass
-
- # redraw map if auto-rendering is enabled
- self.rerender = True
- self.reorder = True
- #if self.mapdisplay.autoRender.GetValue():
- # print "*** Delete OnRender *****"
- # self.mapdisplay.OnRender(None)
-
- if self.mapdisplay.toolbars['vdigit']:
- self.mapdisplay.toolbars['vdigit'].UpdateListOfLayers (updateTool=True)
-
- # update progress bar range (mapwindow statusbar)
- self.mapdisplay.onRenderGauge.SetRange(len(self.Map.GetListOfLayers(l_active=True)))
-
- event.Skip()
-
- def OnLayerChecked(self, event):
- """Enable/disable data layer"""
- item = event.GetItem()
- checked = item.IsChecked()
-
- 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':
- child, cookie = self.GetFirstChild(item)
- while child:
- self.CheckItem(child, checked)
- mapLayer = self.GetPyData(child)[0]['maplayer']
- if not digitToolbar or \
- (digitToolbar and digitToolbar.GetLayer() != mapLayer):
- # ignore when map layer is edited
- self.Map.ChangeLayerActive(mapLayer, checked)
- child = self.GetNextSibling(child)
- else:
- mapLayer = self.GetPyData(item)[0]['maplayer']
- if not digitToolbar or \
- (digitToolbar and digitToolbar.GetLayer() != mapLayer):
- # ignore when map layer is edited
- self.Map.ChangeLayerActive(mapLayer, checked)
-
- #
- # update progress bar range (mapwindow statusbar)
- #
- self.mapdisplay.onRenderGauge.SetRange(len(self.Map.GetListOfLayers(l_active=True)))
-
- #
- # nviz
- #
- if self.mapdisplay.toolbars['nviz'] and \
- self.GetPyData(item) is not None:
- # nviz - load/unload data layer
- mapLayer = self.GetPyData(item)[0]['maplayer']
-
- self.mapdisplay.SetStatusText(_("Please wait, updating data..."), 0)
-
- if checked: # enable
- if mapLayer.type == 'raster':
- self.mapdisplay.MapWindow.LoadRaster(item)
- elif mapLayer.type == '3d-raster':
- self.mapdisplay.MapWindow.LoadRaster3d(item)
- elif mapLayer.type == 'vector':
- self.mapdisplay.MapWindow.LoadVector(item)
-
- else: # disable
- data = self.GetPyData(item)[0]['nviz']
-
- if mapLayer.type == 'raster':
- self.mapdisplay.MapWindow.UnloadRaster(item)
- elif mapLayer.type == '3d-raster':
- self.mapdisplay.MapWindow.UnloadRaster3d(item)
- elif mapLayer.type == 'vector':
- self.mapdisplay.MapWindow.UnloadVector(item)
-
- if hasattr(self.mapdisplay, "nvizToolWin"):
- toolWin = self.mapdisplay.nvizToolWin
- # remove vector page
- if toolWin.notebook.GetSelection() == toolWin.page['vector']['id']:
- toolWin.notebook.RemovePage(toolWin.page['vector']['id'])
- toolWin.page['vector']['id'] = -1
- toolWin.page['settings']['id'] = 1
-
- self.mapdisplay.SetStatusText("", 0)
-
- # redraw map if auto-rendering is enabled
- self.rerender = True
- self.reorder = True
- #if self.mapdisplay.autoRender.GetValue():
- # print "*** Checked OnRender *****"
- # self.mapdisplay.OnRender(None)
-
- def OnCmdChanged(self, event):
- """Change command string"""
- ctrl = event.GetEventObject().GetId()
- cmd = event.GetString()
-
- layer = self.GetFirstVisibleItem()
-
- while layer and layer.IsOk():
- if self.GetPyData(layer)[0]['ctrl'] == ctrl:
- break
-
- layer = self.GetNextVisible(layer)
-
- # change parameters for item in layers list in render.Map
- self.ChangeLayer(layer)
-
- event.Skip()
-
- def OnChangeSel(self, event):
- """Selection changed"""
- oldlayer = event.GetOldItem()
- layer = event.GetItem()
- if layer == oldlayer:
- event.Veto()
- return
-
- self.layer_selected = layer
-
- try:
- if self.IsSelected(oldlayer):
- self.SetItemWindowEnabled(oldlayer, True)
- else:
- self.SetItemWindowEnabled(oldlayer, False)
-
- if self.IsSelected(layer):
- self.SetItemWindowEnabled(layer, True)
- else:
- self.SetItemWindowEnabled(layer, False)
- except:
- pass
-
- try:
- self.RefreshLine(oldlayer)
- self.RefreshLine(layer)
- 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:
- self.gismgr.SetStatusText(cmd)
-
- #
- # update nviz tools
- #
- if self.mapdisplay.toolbars['nviz'] and \
- self.GetPyData(self.layer_selected) is not None:
-
- if self.layer_selected.IsChecked():
- # update Nviz tool window
- type = self.GetPyData(self.layer_selected)[0]['maplayer'].type
-
- if type == 'raster':
- self.mapdisplay.nvizToolWin.UpdatePage('surface')
- self.mapdisplay.nvizToolWin.SetPage('surface')
- elif type == 'vector':
- self.mapdisplay.nvizToolWin.UpdatePage('vector')
- self.mapdisplay.nvizToolWin.SetPage('vector')
- elif type == '3d-raster':
- self.mapdisplay.nvizToolWin.UpdatePage('volume')
- self.mapdisplay.nvizToolWin.SetPage('volume')
- else:
- for page in ('surface', 'vector', 'volume'):
- pageId = self.mapdisplay.nvizToolWin.page[page]['id']
- if pageId > -1:
- self.mapdisplay.nvizToolWin.notebook.RemovePage(pageId)
- self.mapdisplay.nvizToolWin.page[page]['id'] = -1
- self.mapdisplay.nvizToolWin.page['settings']['id'] = 1
-
- def OnCollapseNode(self, event):
- """
- Collapse node
- """
- if self.GetPyData(self.layer_selected)[0]['type'] == 'group':
- self.SetItemImage(self.layer_selected, self.folder)
-
- def OnExpandNode(self, event):
- """
- Expand node
- """
- self.layer_selected = event.GetItem()
- if self.GetPyData(self.layer_selected)[0]['type'] == 'group':
- self.SetItemImage(self.layer_selected, self.folder_open)
-
- def OnEndDrag(self, event):
- self.StopDragging()
- dropTarget = event.GetItem()
- self.flag = self.HitTest(event.GetPoint())[1]
- if self.IsValidDropTarget(dropTarget):
- self.UnselectAll()
- if dropTarget != None:
- self.SelectItem(dropTarget)
- self.OnDrop(dropTarget, self._dragItem)
- elif dropTarget == None:
- self.OnDrop(dropTarget, self._dragItem)
-
- def OnDrop(self, dropTarget, dragItem):
- # save everthing associated with item to drag
- try:
- old = dragItem # make sure this member exists
- except:
- return
-
- Debug.msg (4, "LayerTree.OnDrop(): layer=%s" % \
- (self.GetItemText(dragItem)))
-
- # recreate data layer, insert copy of layer in new position, and delete original at old position
- newItem = self.RecreateItem (dragItem, dropTarget)
-
- # if recreated layer is a group, also recreate its children
- if self.GetPyData(newItem)[0]['type'] == 'group':
- (child, cookie) = self.GetFirstChild(dragItem)
- if child:
- while child:
- 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
- #if self.mapdisplay.autoRender.GetValue():
- # print "*** Drop OnRender *****"
- # self.mapdisplay.OnRender(None)
-
- # select new item
- self.SelectItem(newItem)
-
- def RecreateItem (self, dragItem, dropTarget, parent=None):
- """
- Recreate item (needed for OnEndDrag())
- """
- Debug.msg (4, "LayerTree.RecreateItem(): layer=%s" % \
- self.GetItemText(dragItem))
-
- # fetch data (dragItem)
- checked = self.IsItemChecked(dragItem)
- image = self.GetItemImage(dragItem, 0)
- text = self.GetItemText(dragItem)
- if self.GetPyData(dragItem)[0]['ctrl']:
- # recreate data layer
- btnbmp = Icons["layeropts"].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.GetPyData(dragItem)[0]['type'] == 'command':
- # recreate command layer
- oldctrl = None
- newctrl = wx.TextCtrl(self, id=wx.ID_ANY, value='',
- pos=wx.DefaultPosition, size=(250,25),
- style=wx.TE_MULTILINE|wx.TE_WORDWRAP)
- try:
- newctrl.SetValue(self.GetPyData(dragItem)[0]['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.GetPyData(dragItem)[0]['type'] == 'group':
- # recreate group
- newctrl = None
- data = None
-
- # decide where to put recreated item
- if dropTarget != None and dropTarget != self.GetRootItem():
- if parent:
- # new item is a group
- afteritem = parent
- else:
- # new item is a single layer
- afteritem = dropTarget
-
- # dragItem dropped on group
- if self.GetPyData(afteritem)[0]['type'] == 'group':
- newItem = self.PrependItem(afteritem, text=text, \
- ct_type=1, wnd=newctrl, image=image, \
- data=data)
- self.Expand(afteritem)
- else:
- #dragItem dropped on single layer
- newparent = self.GetItemParent(afteritem)
- newItem = self.InsertItem(newparent, self.GetPrevSibling(afteritem), \
- text=text, ct_type=1, wnd=newctrl, \
- image=image, data=data)
- else:
- # if dragItem not dropped on a layer or group, append or prepend it to the layer tree
- if self.flag & wx.TREE_HITTEST_ABOVE:
- newItem = self.PrependItem(self.root, text=text, \
- ct_type=1, wnd=newctrl, image=image, \
- data=data)
- elif (self.flag & wx.TREE_HITTEST_BELOW) or (self.flag & wx.TREE_HITTEST_NOWHERE) \
- or (self.flag & wx.TREE_HITTEST_TOLEFT) or (self.flag & wx.TREE_HITTEST_TORIGHT):
- newItem = self.AppendItem(self.root, text=text, \
- ct_type=1, wnd=newctrl, image=image, \
- data=data)
-
- #update new layer
- self.SetPyData(newItem, self.GetPyData(dragItem))
- if newctrl:
- self.GetPyData(newItem)[0]['ctrl'] = newctrl.GetId()
- else:
- self.GetPyData(newItem)[0]['ctrl'] = None
-
- self.CheckItem(newItem, checked=checked) # causes a new render
-
- # newItem.SetHeight(TREE_ITEM_HEIGHT)
-
- return newItem
-
- def GetOptData(self, dcmd, layer, params, propwin):
- """Process layer data"""
- # set layer text to map name
- if dcmd:
- mapLayer = self.GetPyData(layer)[0]['maplayer']
- opacity = int(mapLayer.GetOpacity(float=True) * 100)
- mapname = utils.GetLayerNameFromCmd(dcmd, layerType=mapLayer.type,
- fullyQualified=True)
- if not mapname:
- wx.MessageBox(parent=self,
- message=_("Map <%s> not found.") % utils.GetLayerNameFromCmd(dcmd),
- caption=_("Error"),
- style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
-
- return
-
- self.SetItemText(layer, mapname + ' (opacity: ' + str(opacity) + '%)')
-
- # update layer data
- if params:
- self.SetPyData(layer, (self.GetPyData(layer)[0], params))
- if dcmd:
- self.GetPyData(layer)[0]['cmd'] = dcmd
- self.GetPyData(layer)[0]['propwin'] = propwin
-
- # change parameters for item in layers list in render.Map
- self.ChangeLayer(layer)
-
- if self.mapdisplay.toolbars['nviz'] and dcmd:
- # update nviz session
- mapLayer = self.GetPyData(layer)[0]['maplayer']
- mapWin = self.mapdisplay.MapWindow
- if len(mapLayer.GetCmd()) > 0:
- id = -1
- if mapLayer.type == 'raster':
- if mapWin.IsLoaded(layer):
- mapWin.UnloadRaster(layer)
-
- mapWin.LoadRaster(layer)
-
- elif mapLayer.type == '3d-raster':
- if mapWin.IsLoaded(layer):
- mapWin.UnloadRaster3d(layer)
-
- mapWin.LoadRaster3d(layer)
-
- elif mapLayer.type == 'vector':
- if mapWin.IsLoaded(layer):
- mapWin.UnloadVector(layer)
-
- mapWin.LoadVector(layer)
-
- # reset view when first layer loaded
- nlayers = len(mapWin.Map.GetListOfLayers(l_type=('raster', 'vector'),
- l_active=True))
- if nlayers < 2:
- mapWin.ResetView()
-
- def ReorderLayers(self):
- """Add commands from data associated with
- any valid layers (checked or not) to layer list in order to
- match layers in layer tree."""
-
- # make a list of visible layers
- treelayers = []
-
- vislayer = self.GetFirstVisibleItem()
-
- if not vislayer or self.GetPyData(vislayer) is None:
- return
-
- itemList = ""
-
- for item in range(self.GetCount()):
- itemList += self.GetItemText(vislayer) + ','
- if self.GetPyData(vislayer)[0]['type'] != 'group':
- treelayers.append(self.GetPyData(vislayer)[0]['maplayer'])
-
- if not self.GetNextVisible(vislayer):
- break
- else:
- vislayer = self.GetNextVisible(vislayer)
-
- Debug.msg (4, "LayerTree.ReorderLayers(): items=%s" % \
- (itemList))
-
- # reorder map layers
- treelayers.reverse()
- self.Map.ReorderLayers(treelayers)
- self.reorder = False
-
- def ChangeLayer(self, item):
- """Change layer"""
- type = self.GetPyData(item)[0]['type']
- layerName = None
-
- if type == 'command':
- win = self.FindWindowById(self.GetPyData(item)[0]['ctrl'])
- if win.GetValue() != None:
- cmd = win.GetValue().split(';')
- cmdlist = []
- for c in cmd:
- cmdlist.append(c.split(' '))
- opac = 1.0
- chk = self.IsItemChecked(item)
- hidden = not self.IsVisible(item)
- elif type != 'group':
- if self.GetPyData(item)[0] is not None:
- cmdlist = self.GetPyData(item)[0]['cmd']
- opac = self.GetPyData(item)[0]['maplayer'].GetOpacity(float=True)
- chk = self.IsItemChecked(item)
- hidden = not self.IsVisible(item)
- # determine layer name
- layerName = utils.GetLayerNameFromCmd(cmdlist, fullyQualified=True)
- if not layerName:
- layerName = self.GetItemText(item)
-
- maplayer = self.Map.ChangeLayer(layer=self.GetPyData(item)[0]['maplayer'], type=type,
- command=cmdlist, name=layerName,
- l_active=chk, l_hidden=hidden, l_opacity=opac, l_render=False)
-
- self.GetPyData(item)[0]['maplayer'] = maplayer
-
- # if digitization tool enabled -> update list of available vector map layers
- if self.mapdisplay.toolbars['vdigit']:
- self.mapdisplay.toolbars['vdigit'].UpdateListOfLayers(updateTool=True)
-
- # redraw map if auto-rendering is enabled
- self.rerender = True
- self.reorder = True
- #if self.mapdisplay.autoRender.GetValue():
- # print "*** Change OnRender *****"
- # self.mapdisplay.OnRender(None)
-
- def OnCloseWindow(self, event):
- pass
- # self.Map.Clean()
-
- def FindItemByData(self, key, value):
- """Find item based on key and value (see PyData[0])"""
- item = self.GetFirstChild(self.root)[0]
- return self.__FindSubItemByData(item, key, value)
-
- def EnableItemType(self, type, enable=True):
- """Enable/disable items in layer tree"""
- item = self.GetFirstChild(self.root)[0]
- while item and item.IsOk():
- mapLayer = self.GetPyData(item)[0]['maplayer']
- if mapLayer and type == mapLayer.type:
- self.EnableItem(item, enable)
-
- item = self.GetNextSibling(item)
-
- def __FindSubItemByData(self, item, key, value):
- """Support method for FindItemByValue"""
- while item and item.IsOk():
- itemValue = self.GetPyData(item)[0][key]
- if value == itemValue:
- return item
- if self.GetPyData(item)[0]['type'] == 'group':
- subItem = self.GetFirstChild(item)[0]
- found = self.__FindSubItemByData(subItem, key, value)
- if found:
- return found
- item = self.GetNextSibling(item)
-
- return None
-
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/scripts/d.rast3d
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/d.rast3d 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/d.rast3d 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-#
-############################################################################
-#
-# MODULE: d.rast3d
-#
-# AUTHOR(S): Martin Landa <landa.martin gmail.com>
-#
-# PURPOSE: Wrapper for wxGUI -- add 3d raster map layer into layer tree
-#
-# COPYRIGHT: (C) 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.
-#
-#############################################################################
-
-#%module
-#% description: Displays 3d raster data in the active frame on the graphics monitor.
-#% keywords: display, raster3d
-#%end
-
-#%option
-#% key: map
-#% type: string
-#% gisprompt: old,grid3,3d-raster
-#% description: 3D raster map to be displayed
-#% required : yes
-#%end
-
-from grass.script import core as grass
-
-if __name__ == "__main__":
- options, flags = grass.parser()
- main()
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.cmd
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.cmd 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.cmd 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,49 +0,0 @@
-#!/bin/sh
-
-#%module
-#% description: Wrapper for display commands and pX monitors
-#% keywords: display
-#%end
-#%option
-#% key: cmd
-#% type: string
-#% required: yes
-#% multiple: no
-#% label: Command to be performed
-#% description: Example: "d.rast map=elevation.dem at PERMANENT catlist=1300-1400 -i"
-#%end
-#%option
-#% key: opacity
-#% type: string
-#% required: no
-#% multiple: no
-#% key_desc: val
-#% description: Opacity level in percentage
-#% answer: 100
-#%end
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
-fi
-
-if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
-fi
-
-cmdfile="`g.gisenv get=GRASS_PYCMDFILE`"
-
-if [ -e ${cmdfile} ] && [ -n "${cmdfile}" ]; then
- :
-else
- g.message -e "GRASS_PYCMDFILE - File not found. Run p.mon"
- exit 1
-fi
-
-cmd="${GIS_OPT_CMD}"
-
-g.message -d message="$0: ${cmd}"
-
-echo "${cmd}" >> "${cmdfile}"
-
-exit 0
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.db
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.db 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.db 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,35 +0,0 @@
-#!/bin/sh
-
-#%Module
-#% description: Start stand-alone attribute table manager
-#% keywords: database
-#%End
-#%Option
-#% key: table
-#% type: string
-#% required: yes
-#% multiple: no
-#% description: Table name
-#%End
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
-fi
-
-if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
-fi
-
-# CODE GOES HERE
-
-if [ -z "$PYTHONPATH" ] ; then
- PYTHONPATH="$GISBASE/etc/wxpython"
-else
- PYTHONPATH="$GISBASE/etc/wxpython:$PYTHONPATH"
-fi
-export PYTHONPATH
-
-"$GRASS_PYTHON" "$PYTHONPATH/gui_modules/dbm.py" "$GIS_OPT_TABLE"
-
-exit 0
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.mon
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.mon 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.mon 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,91 +0,0 @@
-#!/bin/sh
-
-#%Module
-#% description: To establish and control use of a graphics display monitor.
-#% keywords: display
-#%End
-#%Flag
-#% key: l
-#% description: List all monitors
-#%End
-#%Flag
-#% key: L
-#% description: List all monitors (with current status)
-#%End
-#%Flag
-#% key: p
-#% description: Print name of currently selected monitor
-#%End
-#%Flag
-#% key: r
-#% description: Release currently selected monitor
-#%End
-#%Flag
-#% key: s
-#% description: Do not automatically select when starting
-#%End
-#%Option
-#% key: start
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Name of graphics monitor to start (p0-p9)
-#%End
-#%Option
-#% key: stop
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Name of graphics monitor to stop
-#%End
-#%Option
-#% key: select
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Name of graphics monitor to select
-#%End
-#%Option
-#% key: unlock
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Name of graphics monitor to unlock
-#%End
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
-fi
-
-if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
-fi
-
-# CODE GOES HERE
-
-if [ -z "$PYTHONPATH" ] ; then
- PYTHONPATH="$GISBASE/etc/wxpython"
-else
- PYTHONPATH="$GISBASE/etc/wxpython:$PYTHONPATH"
-fi
-export PYTHONPATH
-
-start="$GIS_OPT_START"
-select="$GIS_OPT_SELECT"
-stop="$GIS_OPT_STOP"
-unlock="$GIS_OPT_UNLOCK"
-
-# create the command file
-command_file="`g.tempfile pid=$$`"
-g.gisenv set="GRASS_PYCMDFILE=${command_file}"
-
-if [ -n "$start" ] ; then
- "$GRASS_PYTHON" "$PYTHONPATH/gui_modules/mapdisp.py" "$start" "${command_file}" &
-fi
-
-if [[ -n "$stop" || -n "$select" || -n "$unlock" ]] ; then
- g.message -w "Not implemented yet"
-fi
-
-exit 0
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.rast
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.rast 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.rast 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,113 +0,0 @@
-#!/bin/sh
-
-#%Module
-#% description: Displays and overlays raster map layers in the active display frame on the graphics monitor
-#% keywords: display
-#%End
-#%flag
-#% key: i
-#% description: Invert catlist
-#%End
-#%Option
-#% key: map
-#% type: string
-#% required: yes
-#% multiple: no
-#% description: Raster map to be displayed
-#% gisprompt: old,cell,raster
-#%End
-#%Option
-#% key: catlist
-#% type: string
-#% required: no
-#% multiple: yes
-#% key_desc: cat[-cat]
-#% description: List of categories to be displayed (INT maps)
-#%End
-#%Option
-#% key: vallist
-#% type: string
-#% required: no
-#% multiple: yes
-#% key_desc: val[-val]
-#% description: List of values to be displayed (FP maps)
-#%End
-#%Option
-#% key: opacity
-#% type: string
-#% required: no
-#% multiple: no
-#% key_desc: val[-val]
-#% description: Set opacity between 0-100%
-#%End
-
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
-fi
-
-if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
-fi
-
-# CODE GOES HERE
-
-cmdfile="`g.gisenv get=GRASS_PYCMDFILE`"
-
-if [ -e ${cmdfile} ] && [ -n "${cmdfile}" ]; then
- echo -n
-else
- g.message -e "GRASS_PYCMDFILE - File not found. Run p.mon"
- exit 1
-fi
-
-
-eval "`echo ${GIS_OPT_MAP} | sed -e 's/^/NAME=/' -e 's/@/; MAPSET=/'`;"
-
-#echo $NAME
-
-if [ -z "${MAPSET}" ]; then
- mapset=""
-else
- mapset="mapset=${MAPSET}"
-fi
-
-#echo $MAPSET
-
-eval "`g.findfile element=cell file=${NAME} ${mapset}`"
-
-#echo $NAME
-#echo $MAPSET
-
-if [ -z "${GIS_OPT_CATLIST}" ]; then
- CATLIST="None"
-else
- CATLIST="${GIS_OPT_CATLIST}"
-fi
-
-if [ -z "${GIS_OPT_VALLIST}" ]; then
- VALLIST="None"
-else
- VALLIST="${GIS_OPT_VALLIST}"
-fi
-
-if [ -z "${GIS_OPT_OPACITY}" ]; then
- OPACITY="100"
-else
- OPACITY="${GIS_OPT_OPACITY}"
-fi
-
-if [ "${GIS_FLAG_I}" -eq "1" ]; then
- INVERT="True"
-else
- INVERT="False"
-fi
-
-
-#cmd="self.map.AddRasterLayer(self, $NAME $MAPSET $CATLIST $VALLIST $INVERCATS $INVERT $OPACITY)"
-
-cmd="addraster ${name} ${mapset} ${CATLIST} ${VALLIST} ${INVERT} ${OPACITY}"
-
-#echo "${cmd}"
-echo "${cmd}" >> "${cmdfile}"
Deleted: grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.vect
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.vect 2010-10-14 15:41:08 UTC (rev 43912)
+++ grass/branches/releasebranch_6_4/gui/wxpython/scripts/p.vect 2010-10-14 15:49:19 UTC (rev 43913)
@@ -1,335 +0,0 @@
-#!/bin/sh
-
-#%Module
-#% description: Displays GRASS vector data in the active frame on the graphics monitor.
-#% keywords: display
-#%End
-#%Flag
-#% key: v
-#% description: Run verbosely
-#%End
-#%Flag
-#% key: a
-#% description: Get colors from map table column (of form RRR:GGG:BBB)
-#% guisection: Colors
-#%End
-#%Flag
-#% key: c
-#% description: Random colors according to category number (or layer number if 'layer=-1' is given)
-#% guisection: Colors
-#%End
-#%Flag
-#% key: i
-#% description: Use values from 'cats' option as line ID
-#% guisection: Query
-#%End
-#%Flag
-#% key: x
-#% description: Don't add to list of vectors and commands in monitor (it won't be drawn if the monitor is refreshed)
-#%End
-#%Option
-#% key: map
-#% type: string
-#% required: yes
-#% multiple: no
-#% key_desc: name
-#% description: Name of input vector map
-#% gisprompt: old,vector,vector
-#%End
-#%Option
-#% key: type
-#% type: string
-#% required: no
-#% multiple: yes
-#% options: point,line,boundary,centroid,area,face
-#% label: Type
-#% description: Feature type(s)
-#% answer: point,line,boundary,centroid,area,face
-#%End
-#%Option
-#% key: display
-#% type: string
-#% required: no
-#% multiple: yes
-#% options: shape,cat,topo,dir,attr,zcoor
-#% description: Display
-#% answer: shape
-#%End
-#%Option
-#% key: attrcol
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Name of column to be displayed
-#% guisection: Labels
-#%End
-#%Option
-#% key: icon
-#% type: string
-#% required: no
-#% multiple: no
-#% options: demo/muchomurka,demo/smrk,basic/arrow1,basic/arrow2,basic/box,basic/circle,basic/cross1,basic/cross2,basic/diamond,basic/marker,basic/octagon,basic/point,basic/pushpin,basic/star,basic/triangle,basic/x,extra/4pt_star,extra/adcp,extra/airport,extra/alpha_flag,extra/bridge,extra/compass,extra/dive_flag,extra/fancy_compass,extra/half-circle,extra/offbox_ne,extra/offbox_nw,extra/offbox_se,extra/offbox_sw,extra/pentagon,extra/target
-#% description: Point and centroid symbol
-#% answer: basic/x
-#% guisection: Symbols
-#%End
-#%Option
-#% key: size
-#% type: integer
-#% required: no
-#% multiple: no
-#% description: Symbol size
-#% answer: 8
-#% guisection: Symbols
-#%End
-#%Option
-#% key: layer
-#% type: integer
-#% required: no
-#% multiple: no
-#% label: Layer number
-#% description: Layer number. If -1, all layers are displayed.
-#% answer: 1
-#%End
-#%Option
-#% key: cats
-#% type: string
-#% required: no
-#% multiple: no
-#% key_desc: range
-#% label: Category values
-#% description: Example: 1,3,7-9,13
-#% guisection: Query
-#%End
-#%Option
-#% key: where
-#% type: string
-#% required: no
-#% multiple: no
-#% key_desc: sql_query
-#% label: WHERE conditions of SQL statement without 'where' keyword.
-#% description: Example: income < 1000 and inhab >= 10000
-#% guisection: Query
-#%End
-#%Option
-#% key: width
-#% type: integer
-#% required: no
-#% multiple: no
-#% description: Line width
-#% answer: 0
-#% guisection: Lines
-#%End
-#%Option
-#% key: wcolumn
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Name of column for line widths (these values will be scaled by wscale)
-#% guisection: Lines
-#%End
-#%Option
-#% key: wscale
-#% type: double
-#% required: no
-#% multiple: no
-#% description: Scale factor for wcolumn
-#% answer: 1
-#% guisection: Lines
-#%End
-#%Option
-#% key: color
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Line color
-#% answer: black
-#% gisprompt: color,grass,color
-#% guisection: Colors
-#%End
-#%Option
-#% key: fcolor
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Area fill color
-#% answer: 200:200:200
-#% gisprompt: color,grass,color
-#% guisection: Colors
-#%End
-#%Option
-#% key: rgb_column
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Name of color definition column (for use with -a flag)
-#% answer: GRASSRGB
-#% guisection: Colors
-#%End
-#%Option
-#% key: llayer
-#% type: integer
-#% required: no
-#% multiple: no
-#% description: Layer for labels (default: the given layer number)
-#% guisection: Labels
-#%End
-#%Option
-#% key: lcolor
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Label color
-#% answer: red
-#% gisprompt: color,grass,color
-#% guisection: Labels
-#%End
-#%Option
-#% key: bgcolor
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Label background color
-#% answer: none
-#% gisprompt: color,grass,color
-#% guisection: Labels
-#%End
-#%Option
-#% key: bcolor
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Label border color
-#% answer: none
-#% gisprompt: color,grass,color
-#% guisection: Labels
-#%End
-#%Option
-#% key: lsize
-#% type: integer
-#% required: no
-#% multiple: no
-#% description: Label size (pixels)
-#% answer: 8
-#% guisection: Labels
-#%End
-#%Option
-#% key: font
-#% type: string
-#% required: no
-#% multiple: no
-#% description: Font name
-#% guisection: Labels
-#%End
-#%Option
-#% key: xref
-#% type: string
-#% required: no
-#% multiple: no
-#% options: left,center,right
-#% description: Label horizontal justification
-#% answer: left
-#% guisection: Labels
-#%End
-#%Option
-#% key: yref
-#% type: string
-#% required: no
-#% multiple: no
-#% options: top,center,bottom
-#% description: Label vertical justification
-#% answer: center
-#% guisection: Labels
-#%End
-#%Option
-#% key: minreg
-#% type: double
-#% required: no
-#% multiple: no
-#% description: Minimum region size (average from height and width) when map is displayed
-#%End
-#%Option
-#% key: maxreg
-#% type: double
-#% required: no
-#% multiple: no
-#% description: Maximum region size (average from height and width) when map is displayed
-#%End
-#%Option
-#% key: render
-#% type: string
-#% required: no
-#% multiple: no
-#% options: g,r,d,c
-#% description: Rendering method for filled polygons
-#% answer: g
-#%End
-
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
-fi
-
-if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
-fi
-
-# CODE GOES HERE
-
-cmdfile="`g.gisenv get=GRASS_PYCMDFILE`"
-
-if [ -e ${cmdfile} ] && [ -n "${cmdfile}" ]; then
- echo -n
-else
- echo "WARNING: GRASS_PYCMDFILE - File not found. Run p.mon" >&2
- exit 1
-fi
-
-
-eval "`echo ${GIS_OPT_MAP} | sed -e 's/^/NAME=/' -e 's/@/; MAPSET=/'`;"
-
-#echo $NAME
-
-if [ -z "${MAPSET}" ]; then
- mapset=""
-else
- mapset="mapset=${MAPSET}"
-fi
-
-#echo $MAPSET
-
-eval "`g.findfile element=vector file=${NAME} ${mapset}`"
-
-#echo $NAME
-#echo $MAPSET
-
-if [ -z "${GIS_OPT_CATLIST}" ]; then
- CATLIST="None"
-else
- CATLIST="${GIS_OPT_CATLIST}"
-fi
-
-if [ -z "${GIS_OPT_VALLIST}" ]; then
- VALLIST="None"
-else
- VALLIST="${GIS_OPT_VALLIST}"
-fi
-
-if [ -z "${GIS_OPT_OPACITY}" ]; then
- OPACITY="100"
-else
- OPACITY="${GIS_OPT_OPACITY}"
-fi
-
-if [ "${GIS_FLAG_c}" -eq "1" ]; then
- CATSCOLORS="True"
-else
- CATSCOLORS="False"
-fi
-
-
-#cmd="self.map.AddRasterLayer(self, $NAME $MAPSET $CATLIST $VALLIST $INVERCATS $INVERT $OPACITY)"
-
-cmd="addvector ${name} ${mapset}"
-echo "${cmd}" >> "${cmdfile}"
More information about the grass-commit
mailing list