|
@@ -13,6 +13,7 @@ License (>=v2). Read the file COPYING that comes with GRASS
|
|
|
for details.
|
|
|
|
|
|
@author Tereza Fiedlerova
|
|
|
+@author Linda Kladivova l.kladivova@seznam.cz
|
|
|
"""
|
|
|
|
|
|
import wx
|
|
@@ -23,6 +24,8 @@ from datacatalog.tree import DataCatalogTree
|
|
|
from datacatalog.toolbars import DataCatalogToolbar
|
|
|
from gui_core.infobar import InfoBar
|
|
|
from datacatalog.infomanager import DataCatalogInfoManager
|
|
|
+from gui_core.wrap import Menu
|
|
|
+from gui_core.forms import GUI
|
|
|
|
|
|
from grass.pydispatch.signal import Signal
|
|
|
|
|
@@ -110,29 +113,64 @@ class DataCatalog(wx.Panel):
|
|
|
db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
|
|
|
self.tree.CreateMapset(db_node, loc_node)
|
|
|
|
|
|
- def OnImportOgrLayers(self, event, cmd=None):
|
|
|
+ def OnCreateLocation(self, event):
|
|
|
+ """Create new location"""
|
|
|
+ db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
|
|
|
+ self.tree.CreateLocation(db_node)
|
|
|
+
|
|
|
+ def OnDownloadLocation(self, event):
|
|
|
+ """Download location to current grass database"""
|
|
|
+ db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
|
|
|
+ self.tree.DownloadLocation(db_node)
|
|
|
+
|
|
|
+ def OnImportGdalLayers(self, event):
|
|
|
+ """Convert multiple GDAL layers to GRASS raster map layers"""
|
|
|
+ from modules.import_export import GdalImportDialog
|
|
|
+ dlg = GdalImportDialog(parent=self, giface=self.giface)
|
|
|
+ dlg.CentreOnScreen()
|
|
|
+ dlg.Show()
|
|
|
+
|
|
|
+ def OnImportOgrLayers(self, event):
|
|
|
"""Convert multiple OGR layers to GRASS vector map layers"""
|
|
|
from modules.import_export import OgrImportDialog
|
|
|
dlg = OgrImportDialog(parent=self, giface=self.giface)
|
|
|
dlg.CentreOnScreen()
|
|
|
dlg.Show()
|
|
|
|
|
|
- def OnImportGdalLayers(self, event, cmd=None):
|
|
|
- """Convert multiple GDAL layers to GRASS raster map layers"""
|
|
|
+ def OnLinkGdalLayers(self, event):
|
|
|
+ """Link multiple GDAL layers to GRASS raster map layers"""
|
|
|
from modules.import_export import GdalImportDialog
|
|
|
- dlg = GdalImportDialog(parent=self, giface=self.giface)
|
|
|
+ dlg = GdalImportDialog(parent=self, giface=self.giface, link=True)
|
|
|
dlg.CentreOnScreen()
|
|
|
dlg.Show()
|
|
|
|
|
|
- def OnCreateLocation(self, event):
|
|
|
- """Create new location"""
|
|
|
- db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
|
|
|
- self.tree.CreateLocation(db_node)
|
|
|
+ def OnLinkOgrLayers(self, event):
|
|
|
+ """Links multiple OGR layers to GRASS vector map layers"""
|
|
|
+ from modules.import_export import OgrImportDialog
|
|
|
+ dlg = OgrImportDialog(parent=self, giface=self.giface, link=True)
|
|
|
+ dlg.CentreOnScreen()
|
|
|
+ dlg.Show()
|
|
|
|
|
|
- def OnDownloadLocation(self, event):
|
|
|
- """Download location to current grass database"""
|
|
|
- db_node, loc_node, mapset_node = self.tree.GetCurrentDbLocationMapsetNode()
|
|
|
- self.tree.DownloadLocation(db_node)
|
|
|
+ def OnRasterOutputFormat(self, event):
|
|
|
+ """Set raster output format handler"""
|
|
|
+ from modules.import_export import GdalOutputDialog
|
|
|
+ dlg = GdalOutputDialog(parent=self, ogr=False)
|
|
|
+ dlg.CentreOnScreen()
|
|
|
+ dlg.Show()
|
|
|
+
|
|
|
+ def OnVectorOutputFormat(self, event):
|
|
|
+ """Set vector output format handler"""
|
|
|
+ from modules.import_export import GdalOutputDialog
|
|
|
+ dlg = GdalOutputDialog(parent=self, ogr=True)
|
|
|
+ dlg.CentreOnScreen()
|
|
|
+ dlg.Show()
|
|
|
+
|
|
|
+ def GuiParseCommand(self, cmd):
|
|
|
+ """Generic handler"""
|
|
|
+ GUI(parent=self, giface=self.giface).ParseCommand(cmd=[cmd])
|
|
|
+
|
|
|
+ def OnMoreOptions(self, event):
|
|
|
+ self.giface.Help(entry="topic_import")
|
|
|
|
|
|
def SetRestriction(self, restrict):
|
|
|
"""Allow editing other mapsets or restrict editing to current mapset"""
|
|
@@ -140,3 +178,58 @@ class DataCatalog(wx.Panel):
|
|
|
|
|
|
def Filter(self, text, element=None):
|
|
|
self.tree.Filter(text=text, element=element)
|
|
|
+
|
|
|
+ def OnImportMenu(self, event):
|
|
|
+ """Create popup menu for other import options"""
|
|
|
+ # create submenu
|
|
|
+ subMenu = Menu()
|
|
|
+
|
|
|
+ subitem = wx.MenuItem(subMenu, wx.ID_ANY, _("Link external raster data [r.external]"))
|
|
|
+ subMenu.AppendItem(subitem)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnLinkGdalLayers, subitem)
|
|
|
+
|
|
|
+ subitem = wx.MenuItem(subMenu, wx.ID_ANY, _("Link external vector data [v.external]"))
|
|
|
+ subMenu.AppendItem(subitem)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnLinkOgrLayers, subitem)
|
|
|
+
|
|
|
+ subMenu.AppendSeparator()
|
|
|
+
|
|
|
+ subitem = wx.MenuItem(subMenu, wx.ID_ANY, _("Set raster output format [r.external.out]"))
|
|
|
+ subMenu.AppendItem(subitem)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnRasterOutputFormat, subitem)
|
|
|
+
|
|
|
+ subitem = wx.MenuItem(subMenu, wx.ID_ANY, _("Set vector output format [v.external.out]"))
|
|
|
+ subMenu.AppendItem(subitem)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnVectorOutputFormat, subitem)
|
|
|
+
|
|
|
+ # create menu
|
|
|
+ menu = Menu()
|
|
|
+
|
|
|
+ item = wx.MenuItem(menu, wx.ID_ANY, _("Unpack GRASS raster map [r.unpack]"))
|
|
|
+ menu.AppendItem(item)
|
|
|
+ self.Bind(wx.EVT_MENU, lambda evt: self.GuiParseCommand('r.unpack'), item)
|
|
|
+
|
|
|
+ item = wx.MenuItem(menu, wx.ID_ANY, _("Unpack GRASS vector map [v.unpack]"))
|
|
|
+ menu.AppendItem(item)
|
|
|
+ self.Bind(wx.EVT_MENU, lambda evt: self.GuiParseCommand('v.unpack'), item)
|
|
|
+
|
|
|
+ menu.AppendSeparator()
|
|
|
+
|
|
|
+ item = wx.MenuItem(menu, wx.ID_ANY, _("Create raster map from x,y,z data [r.in.xyz]"))
|
|
|
+ menu.AppendItem(item)
|
|
|
+ self.Bind(wx.EVT_MENU, lambda evt: self.GuiParseCommand('r.in.xyz'), item)
|
|
|
+
|
|
|
+ item = wx.MenuItem(menu, wx.ID_ANY, _("Create vector map from x,y,z data [v.in.ascii]"))
|
|
|
+ menu.AppendItem(item)
|
|
|
+ self.Bind(wx.EVT_MENU, lambda evt: self.GuiParseCommand('v.in.ascii'), item)
|
|
|
+
|
|
|
+ menu.AppendSeparator()
|
|
|
+ menu.AppendMenu(wx.ID_ANY, _("Link external data"), subMenu)
|
|
|
+
|
|
|
+ menu.AppendSeparator()
|
|
|
+ item = wx.MenuItem(menu, wx.ID_ANY, _("More options..."))
|
|
|
+ menu.AppendItem(item)
|
|
|
+ self.Bind(wx.EVT_MENU, self.OnMoreOptions, item)
|
|
|
+
|
|
|
+ self.PopupMenu(menu)
|
|
|
+ menu.Destroy()
|