[GRASS-SVN] r44351 - in grass/trunk/gui/wxpython: . gui_modules xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 18 04:27:20 EST 2010
Author: martinl
Date: 2010-11-18 01:27:19 -0800 (Thu, 18 Nov 2010)
New Revision: 44351
Modified:
grass/trunk/gui/wxpython/gui_modules/gdialogs.py
grass/trunk/gui/wxpython/wxgui.py
grass/trunk/gui/wxpython/xml/menudata.xml
Log:
wxGUI: simplify import/link menu items
Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2010-11-16 11:34:26 UTC (rev 44350)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2010-11-18 09:27:19 UTC (rev 44351)
@@ -971,11 +971,16 @@
self.btn_cancel.SetToolTipString(_("Close dialog"))
self.btn_cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
# run
- self.btn_run = wx.Button(parent=self.panel, id=wx.ID_OK)
+ self.btn_run = wx.Button(parent=self.panel, id=wx.ID_OK, label = _("&Import"))
+ self.btn_run.SetToolTipString(_("Import selected layers"))
self.btn_run.SetDefault()
self.btn_run.Enable(False)
self.btn_run.Bind(wx.EVT_BUTTON, self.OnRun)
-
+ # run command dialog
+ self.btn_cmd = wx.Button(parent = self.panel, id = wx.ID_ANY,
+ label = _("Command dialog"))
+ self.btn_cmd.Bind(wx.EVT_BUTTON, self.OnCmdDialog)
+
def doLayout(self):
"""!Do layout"""
dialogSizer = wx.BoxSizer(wx.VERTICAL)
@@ -1010,7 +1015,7 @@
#
btnsizer = wx.BoxSizer(orient=wx.HORIZONTAL)
- btnsizer.Add(item=self.btn_cancel, proportion=0,
+ btnsizer.Add(item=self.btn_cmd, proportion=0,
flag=wx.ALL | wx.ALIGN_CENTER,
border=10)
@@ -1018,6 +1023,10 @@
flag=wx.ALL | wx.ALIGN_CENTER,
border=10)
+ btnsizer.Add(item=self.btn_cancel, proportion=0,
+ flag=wx.ALL | wx.ALIGN_CENTER,
+ border=10)
+
dialogSizer.Add(item=btnsizer, proportion=0,
flag=wx.ALIGN_CENTER)
@@ -1041,6 +1050,10 @@
def OnRun(self, event):
"""!Import/Link data (each layes as separate vector map)"""
pass
+
+ def OnCmdDialog(self, event):
+ """!Show command dialog"""
+ pass
def AddLayers(self, returncode, cmd = None):
"""!Add imported/linked layers into layer tree"""
@@ -1085,6 +1098,8 @@
"""!Dialog for bulk import of various raster/vector data"""
def __init__(self, parent, ogr = False, link = False):
self.link = link
+ self.ogr = ogr
+
if ogr:
ImportDialog.__init__(self, parent, type = 'ogr')
if link:
@@ -1114,9 +1129,17 @@
if link:
self.btn_run.SetLabel(_("&Link"))
self.btn_run.SetToolTipString(_("Link selected layers"))
+ if ogr:
+ self.btn_cmd.SetToolTipString(_('Open %s dialog') % 'v.external')
+ else:
+ self.btn_cmd.SetToolTipString(_('Open %s dialog') % 'r.external')
else:
self.btn_run.SetLabel(_("&Import"))
self.btn_run.SetToolTipString(_("Import selected layers"))
+ if ogr:
+ self.btn_cmd.SetToolTipString(_('Open %s dialog') % 'v.in.ogr')
+ else:
+ self.btn_cmd.SetToolTipString(_('Open %s dialog') % 'r.in.gdal')
self.doLayout()
@@ -1171,7 +1194,23 @@
onDone = self.AddLayers)
self.OnCancel()
+
+ def OnCmdDialog(self, event):
+ """!Show command dialog"""
+ if self.link:
+ if self.ogr:
+ name = 'v.external'
+ else:
+ name = 'r.external'
+ else:
+ if self.ogr:
+ name = 'v.in.ogr'
+ else:
+ name = 'r.in.gdal'
+ menuform.GUI().ParseCommand(cmd = [name],
+ parentframe = self, modal = True)
+
class DxfImportDialog(ImportDialog):
"""!Dialog for bulk import of DXF layers"""
def __init__(self, parent):
@@ -1246,6 +1285,11 @@
self.btn_run.Enable(True)
else:
self.btn_run.Enable(False)
+
+ def OnCmdDialog(self, event):
+ """!Show command dialog"""
+ menuform.GUI().ParseCommand(cmd = ['v.in.dxf'],
+ parentframe = self, modal = True)
class LayersList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin,
listmix.CheckListCtrlMixin, listmix.TextEditMixin):
Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py 2010-11-16 11:34:26 UTC (rev 44350)
+++ grass/trunk/gui/wxpython/wxgui.py 2010-11-18 09:27:19 UTC (rev 44351)
@@ -958,26 +958,31 @@
def OnImportDxfFile(self, event):
"""!Convert multiple DXF layers to GRASS vector map layers"""
dlg = gdialogs.DxfImportDialog(parent=self)
+ dlg.CentreOnScreen()
dlg.ShowModal()
def OnImportGdalLayers(self, event):
"""!Convert multiple GDAL layers to GRASS raster map layers"""
dlg = gdialogs.GdalImportDialog(parent=self)
+ dlg.CentreOnScreen()
dlg.ShowModal()
def OnLinkGdalLayers(self, event):
"""!Link multiple GDAL layers to GRASS raster map layers"""
dlg = gdialogs.GdalImportDialog(parent=self, link = True)
+ dlg.CentreOnScreen()
dlg.ShowModal()
def OnImportOgrLayers(self, event):
"""!Convert multiple OGR layers to GRASS vector map layers"""
dlg = gdialogs.GdalImportDialog(parent=self, ogr = True)
+ dlg.CentreOnScreen()
dlg.ShowModal()
def OnLinkOgrLayers(self, event):
"""!Links multiple OGR layers to GRASS vector map layers"""
dlg = gdialogs.GdalImportDialog(parent=self, ogr = True, link = True)
+ dlg.CentreOnScreen()
dlg.ShowModal()
def OnImportWMS(self, event):
Modified: grass/trunk/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/trunk/gui/wxpython/xml/menudata.xml 2010-11-16 11:34:26 UTC (rev 44350)
+++ grass/trunk/gui/wxpython/xml/menudata.xml 2010-11-18 09:27:19 UTC (rev 44351)
@@ -57,27 +57,16 @@
<label>Import raster data</label>
<help>Import raster data into a GRASS map layer using GDAL.</help>
<keywords>raster,import</keywords>
- <handler>OnMenuCmd</handler>
+ <handler>OnImportGdalLayers</handler>
<command>r.in.gdal</command>
</menuitem>
<menuitem>
- <label>Bulk import of raster data</label>
- <help>Converts multiple GDAL supported layers to GRASS raster maps.</help>
- <handler>OnImportGdalLayers</handler>
- </menuitem>
- <separator />
- <menuitem>
<label>Link raster data</label>
<help>Link GDAL supported raster data as a pseudo GRASS raster map layer.</help>
<keywords>raster,import</keywords>
- <handler>OnMenuCmd</handler>
+ <handler>OnLinkGdalLayers</handler>
<command>r.external</command>
</menuitem>
- <menuitem>
- <label>Bulk link of raster data</label>
- <help>Link multiple GDAL supported raster maps as pseudo GRASS raster map layers.</help>
- <handler>OnLinkGdalLayers</handler>
- </menuitem>
<separator />
<menuitem>
<label>ASCII x,y,z point import and gridding</label>
@@ -165,27 +154,16 @@
<label>Import vector data</label>
<help>Converts vector layers into a GRASS vector map using OGR.</help>
<keywords>vector,import</keywords>
- <handler>OnMenuCmd</handler>
+ <handler>OnImportOgrLayers</handler>
<command>v.in.ogr</command>
</menuitem>
<menuitem>
- <label>Bulk import of vector data</label>
- <help>Converts multiple OGR supported layers into GRASS vector maps.</help>
- <handler>OnImportOgrLayers</handler>
- </menuitem>
- <separator />
- <menuitem>
<label>Link vector data</label>
<help>Creates a new pseudo-vector map as a link to an OGR-supported layer.</help>
<keywords>vector,external,ogr</keywords>
- <handler>OnMenuCmd</handler>
+ <handler>OnLinkOgrLayers</handler>
<command>v.external</command>
</menuitem>
- <menuitem>
- <label>Bulk link of vector data</label>
- <help>Creates multiple new pseduo-vector maps as a read-only links using OGR.</help>
- <handler>OnLinkOgrLayers</handler>
- </menuitem>
<separator />
<menuitem>
<label>ASCII points or GRASS ASCII format</label>
@@ -220,14 +198,9 @@
<label>DXF import</label>
<help>Converts files in DXF format to GRASS vector map format.</help>
<keywords>vector,import,dxf</keywords>
- <handler>OnMenuCmd</handler>
+ <handler>OnImportDxfFile</handler>
<command>v.in.dxf</command>
</menuitem>
- <menuitem>
- <label>Bulk import of DXF</label>
- <help>Converts multiple DXF layers to GRASS vector maps.</help>
- <handler>OnImportDxfFile</handler>
- </menuitem>
<separator />
<menuitem>
<label>WFS</label>
More information about the grass-commit
mailing list