[GRASS-SVN] r44352 - in grass/branches/develbranch_6/gui/wxpython:
. gui_modules xml
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Nov 18 04:32:32 EST 2010
Author: martinl
Date: 2010-11-18 01:32:32 -0800 (Thu, 18 Nov 2010)
New Revision: 44352
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
grass/branches/develbranch_6/gui/wxpython/wxgui.py
grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml
Log:
wxGUI: simplify import/link menu items
(merge r44351 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py 2010-11-18 09:27:19 UTC (rev 44351)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py 2010-11-18 09:32:32 UTC (rev 44352)
@@ -970,11 +970,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)
@@ -1009,7 +1014,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)
@@ -1017,6 +1022,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)
@@ -1040,6 +1049,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"""
@@ -1084,6 +1097,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:
@@ -1113,9 +1128,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()
@@ -1170,7 +1193,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):
@@ -1245,6 +1284,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/branches/develbranch_6/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/wxgui.py 2010-11-18 09:27:19 UTC (rev 44351)
+++ grass/branches/develbranch_6/gui/wxpython/wxgui.py 2010-11-18 09:32:32 UTC (rev 44352)
@@ -1010,26 +1010,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/branches/develbranch_6/gui/wxpython/xml/menudata.xml
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2010-11-18 09:27:19 UTC (rev 44351)
+++ grass/branches/develbranch_6/gui/wxpython/xml/menudata.xml 2010-11-18 09:32:32 UTC (rev 44352)
@@ -55,29 +55,18 @@
<items>
<menuitem>
<label>Import raster data</label>
- <help>Import GDAL supported raster file into a binary raster map layer.</help>
+ <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 file to a binary raster map layer.</help>
+ <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>Aggregate ASCII xyz import</label>
@@ -163,29 +152,18 @@
<items>
<menuitem>
<label>Import vector data</label>
- <help>Convert OGR vector layers to GRASS vector map.</help>
+ <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 selected OGR layers to GRASS vector maps using v.in.ogr</help>
- <handler>OnImportOgrLayers</handler>
- </menuitem>
- <separator />
- <menuitem>
<label>Link vector data</label>
- <help>Creates a new vector as a read-only link to OGR layer.</help>
- <keywords>vector</keywords>
- <handler>OnMenuCmd</handler>
+ <help>Creates a new pseudo-vector map as a link to an OGR-supported layer.</help>
+ <keywords>vector,external,ogr</keywords>
+ <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/GRASS ASCII vector import</label>
@@ -219,15 +197,10 @@
<menuitem>
<label>DXF import</label>
<help>Converts files in DXF format to GRASS vector map format.</help>
- <keywords>vector,import</keywords>
- <handler>OnMenuCmd</handler>
+ <keywords>vector,import,dxf</keywords>
+ <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