[GRASS-SVN] r40840 - grass-addons/gui/wxpython/data_catalog

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Feb 6 01:14:27 EST 2010


Author: rashadkm
Date: 2010-02-06 01:14:26 -0500 (Sat, 06 Feb 2010)
New Revision: 40840

Modified:
   grass-addons/gui/wxpython/data_catalog/LayerTree.py
   grass-addons/gui/wxpython/data_catalog/catalog.py
Log:
added send to ossimplanet for r.planet.py

Modified: grass-addons/gui/wxpython/data_catalog/LayerTree.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/LayerTree.py	2010-02-06 03:12:23 UTC (rev 40839)
+++ grass-addons/gui/wxpython/data_catalog/LayerTree.py	2010-02-06 06:14:26 UTC (rev 40840)
@@ -1,31 +1,11 @@
-"""
- at package layertree.py
-
- at brief Tree widget for listing maps raster, vector and DBF.
-
-Classes:
- - LayerTree
-
-
-(C) 2006-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>
- at author Mohammed Rashad K.M <rashadkm at gmail dot com> (modified for DataCatalog)
-"""
-
 import os
 import sys
 import wx
 import glob
 import render
+from threading import Thread
 
 
-
 #To run DataCatalog from any directory set this pathname for access to gui_modules 
 gbase = os.getenv("GISBASE") 
 pypath = os.path.join(gbase,'etc','wxpython','gui_modules')
@@ -58,6 +38,7 @@
         self.ID_REN= wx.NewId()
         self.ID_COPY = wx.NewId()
         self.ID_DEL = wx.NewId()
+        self.ID_OSSIM = wx.NewId()
 
         acel = wx.AcceleratorTable([ 
 		        (wx.ACCEL_CTRL,  ord('R'), self.ID_REN ) ,
@@ -145,18 +126,19 @@
 
 
     def OnTreePopUp(self,event):
-	    """
-	    Display a popupMenu for copy,rename & delete operations
-	    """
-	    item =  event.GetItem()
-	    if not self.ItemHasChildren(item) and \
-		       self.GetItemFont(item) != self.itemFont:
+        """
+        Display a popupMenu for copy,rename & delete operations
+        """
+        item =  event.GetItem()
+        if not self.ItemHasChildren(item) and \
+               self.GetItemFont(item) != self.itemFont:
 
-		    self.popupmenu = wx.Menu()
-		    mnuCopy = self.popupmenu.Append(self.ID_COPY,'&Copy\tCtrl+C')
-		    mnuRename = self.popupmenu.Append(self.ID_REN,'&Rename\tCtrl-R')
-		    mnuDel = self.popupmenu.Append(self.ID_DEL,'&Delete\tDEL')
-		    self.PopupMenu(self.popupmenu)
+            self.popupmenu = wx.Menu()
+            mnuCopy = self.popupmenu.Append(self.ID_COPY,'&Copy\tCtrl+C')
+            mnuRename = self.popupmenu.Append(self.ID_REN,'&Rename\tCtrl-R')
+            mnuDel = self.popupmenu.Append(self.ID_DEL,'&Delete\tDEL')
+            mnuOssim = self.popupmenu.Append(self.ID_OSSIM,'&send to OssimPlanet')
+            self.PopupMenu(self.popupmenu)
 
 
     def OnCopy( self,event ):
@@ -259,9 +241,30 @@
         elif ret == wx.ID_CANCEL:
          dlg.Destroy()
          return
+
+    def OnOssim( self,event ):
+        """
+        Performs grass command for deleting a map
+        """
+        item =  self.GetSelection()
         
+        parent  =self.GetItemParent(item) 
+        if self.GetItemText(parent) == "Raster Map" :
+            cmdflag = 'r.planet.py -a map=' + str(self.GetItemText(item))
+        elif self.tree.GetItemText(parent) == "Vector Map" :
+            cmdflag = 'v.planet.py -a map=' + str(self.GetItemText(item))
 
+        if cmdflag:
+            
+            #command = ["r.planet.py", cmdflag]
+            #gcmd.CommandThread(command,stdout=None,stderr=None).run()
+            current = OssimPlanet(cmdflag)
+            current.start()
 
+        
+        
+
+
     def OnCloseWindow(self,event):
 
 	    if self.gisrc['LOCATION_NAME'] != self.iLocation or \
@@ -312,6 +315,11 @@
             panel.MapWindow2D.flag = True
             panel.MapWindow2D.UpdateMap(render=True)
 
-		
+class OssimPlanet(Thread):
+   def __init__ (self,cmd):
+      Thread.__init__(self)
+      self.cmd =  cmd
+   def run(self):
+      os.system(self.cmd)		
 
 

Modified: grass-addons/gui/wxpython/data_catalog/catalog.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/catalog.py	2010-02-06 03:12:23 UTC (rev 40839)
+++ grass-addons/gui/wxpython/data_catalog/catalog.py	2010-02-06 06:14:26 UTC (rev 40840)
@@ -28,6 +28,7 @@
 import getopt
 import platform
 import shlex
+import gc
 
 try:
     import xml.etree.ElementTree as etree
@@ -107,6 +108,7 @@
     def __init__(self, parent=None, id=wx.ID_ANY, title=_("Data Catalog"),
                  workspace=None,size=wx.DefaultSize,pos=wx.DefaultPosition):
 
+        gc.enable()        
         self.iconsize  = (16, 16)
         self.baseTitle = title
 
@@ -143,17 +145,6 @@
         self.g_catalog=None
 
 
-        self.ID_REN= wx.NewId()
-        self.ID_COPY = wx.NewId()
-        self.ID_DEL = wx.NewId()
-
-        acel = wx.AcceleratorTable([ 
-                (wx.ACCEL_CTRL,  ord('R'), self.ID_REN ) ,
-                (wx.ACCEL_CTRL,  ord('C'), self.ID_COPY) ,
-                (wx.ACCEL_NORMAL, wx.WXK_DELETE, self.ID_DEL) ])
-
-
-        self.SetAcceleratorTable(acel)
         self.menucmd       = dict() 
 
 
@@ -226,9 +217,11 @@
 
         self.Map =    self.GetMapDisplay()
 
+        
 
 
 
+
     def GetMapDisplay(self):
         self.winlist = self.GetChildren()
         for win in self.winlist:
@@ -1589,6 +1582,7 @@
         self.notebook.DeleteAllPages()
         self.Destroy()
 
+
         
     def MsgNoLayerSelected(self):
         """!Show dialog message 'No layer selected'"""
@@ -1650,22 +1644,23 @@
     def doBindings(self):
         
 	    #Event bindings for combo boxes
-	    self.Bind(wx.EVT_COMBOBOX,self.OnMapsetChange,self.cmbMapset)
-	    self.Bind(wx.EVT_COMBOBOX,self.OnLocationChange,self.cmbLocation)
+        self.Bind(wx.EVT_COMBOBOX,self.OnMapsetChange,self.cmbMapset)
+        self.Bind(wx.EVT_COMBOBOX,self.OnLocationChange,self.cmbLocation)
 
-	    #Event bindings for tree -(display,popup,label edit.)
-	    self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.ltree.OnDisplay,self.ltree)
-	    self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK,self.ltree.OnTreePopUp,self.ltree)
-	    self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.ltree.OnEndRename,self.ltree)
-	    self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.ltree.OnBeginRename,self.ltree)
+        #Event bindings for tree -(display,popup,label edit.)
+        self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.ltree.OnDisplay,self.ltree)
+        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK,self.ltree.OnTreePopUp,self.ltree)
+        self.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.ltree.OnEndRename,self.ltree)
+        self.Bind(wx.EVT_TREE_BEGIN_LABEL_EDIT, self.ltree.OnBeginRename,self.ltree)
 
 	    #Event bindings for tree menu
-	    self.Bind(wx.EVT_MENU,self.ltree.OnCopy,id=self.ltree.ID_COPY)
-	    self.Bind(wx.EVT_MENU,self.ltree.OnRename,id=self.ltree.ID_REN)
-	    self.Bind(wx.EVT_MENU,self.ltree.OnDelete,id=self.ltree.ID_DEL)
+        self.Bind(wx.EVT_MENU,self.ltree.OnCopy,id=self.ltree.ID_COPY)
+        self.Bind(wx.EVT_MENU,self.ltree.OnRename,id=self.ltree.ID_REN)
+        self.Bind(wx.EVT_MENU,self.ltree.OnDelete,id=self.ltree.ID_DEL)
+        self.Bind(wx.EVT_MENU,self.ltree.OnOssim,id=self.ltree.ID_OSSIM)
 
 
-	    self.Bind(wx.EVT_CLOSE,    self.OnCloseWindow)
+        self.Bind(wx.EVT_CLOSE,    self.OnCloseWindow)
 
 	    #Event bindings for v/r.info checkbox
 	    #self.Bind(wx.EVT_CHECKBOX, self.OnToggleInfo,self.chkInfo)



More information about the grass-commit mailing list