[GRASS-SVN] r55369 - grass-addons/grass7/gui/wxpython/newgui
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Mar 13 14:57:42 PDT 2013
Author: rashadkm
Date: 2013-03-13 14:57:41 -0700 (Wed, 13 Mar 2013)
New Revision: 55369
Modified:
grass-addons/grass7/gui/wxpython/newgui/api_test.py
grass-addons/grass7/gui/wxpython/newgui/frame.py
Log:
newgui(toolbar decoupled)
Modified: grass-addons/grass7/gui/wxpython/newgui/api_test.py
===================================================================
--- grass-addons/grass7/gui/wxpython/newgui/api_test.py 2013-03-13 19:05:23 UTC (rev 55368)
+++ grass-addons/grass7/gui/wxpython/newgui/api_test.py 2013-03-13 21:57:41 UTC (rev 55369)
@@ -38,15 +38,23 @@
from gui_core.mapdisp import MapFrameBase
import gettext
import core.render as render
-from core.render import Map, MapLayer
+from render2 import Map, MapLayer
from core.gcmd import RunCommand, GMessage
from core.debug import Debug
-from lmgr.lmgr_layertree import LMIcons
+from lmgr.layertree import LMIcons
from gui_core.toolbars import BaseIcons
from icons.icon import MetaIcon
from core.utils import GetLayerNameFromCmd
+class ToolBarNames:
+ NEWDISPLAY = { "monitor-create" : [wx.NewId(), _('Start new map display')] }
+ WORKSPACENEW = { "create" : [wx.NewId(), _('Create new workspace (Ctrl+N)')] }
+ WORKSPACEOPEN ={ "open" : [wx.NewId(), _('Open existing workspace file (Ctrl+O')] }
+ WORKSPACESAVE ={ "save" : [wx.NewId(), _('Save current workspace to file (Ctrl+S)')] }
+ ADDRASTER = { "layer-raster-add" : [wx.NewId(), _("Add raster map layer")] }
+ ADDVECTOR = { "layer-vector-add" : [wx.NewId(), _("Add vector map layer")] }
+
class MySingleMapFrame(MapFrameBase):
"""! Frame with one map window.
@@ -82,26 +90,44 @@
vbox = wx.BoxSizer(wx.HORIZONTAL)
p = wx.Panel(self,-1)
-
-
#self.ltree = LayerTree(self, self.Map)
#
# initialize region values
#
+
self._initMap(Map = self.Map)
self._lmgr = LayerManager(p,self.Map)
self.MapWindow = BufferedWindow2(p, giface = giface, id = id, Map = self.Map)
+
+ self.toolbar = None
vbox.Add(self._lmgr, 1, wx.EXPAND | wx.ALL, 20)
vbox.Add(self.MapWindow, 1, wx.EXPAND | wx.ALL, 20)
p.SetSizer(vbox)
+ def CreateWxToolBar(self):
+ self.toolbar = self.CreateToolBar()
+
+ def AddToolBarItem(self, tname, func):
+ if self.toolbar is None:
+ raise "ToolBar not created"
+ label = tname.keys()[0]
+
+ tid = tname.values()[0][0]
+ tooltip = tname.values()[0][1]
+
+ self.toolbar.AddLabelTool(tid, label, self.GetIcon(label), shortHelp = tooltip)
+ wx.EVT_TOOL( self, tid, func )
+ def GetIcon(self, tname):
+ return MetaIcon(img = tname).GetBitmap()
+
+
def GetLayerByIndex(self, index):
return self.GetLayerManager().GetLayerByIndex(index)
Modified: grass-addons/grass7/gui/wxpython/newgui/frame.py
===================================================================
--- grass-addons/grass7/gui/wxpython/newgui/frame.py 2013-03-13 19:05:23 UTC (rev 55368)
+++ grass-addons/grass7/gui/wxpython/newgui/frame.py 2013-03-13 21:57:41 UTC (rev 55369)
@@ -22,7 +22,9 @@
from api_test import MySingleMapFrame
-from core.render import MapLayer
+from api_test import ToolBarNames
+from render2 import MapLayer
+from lmgr.toolbars import LMWorkspaceToolbar
class MyFrame(MySingleMapFrame):
"""!main frame
"""
@@ -42,10 +44,18 @@
self.cmd =["d.rast", "map=aspect at PERMANENT"]
self.rlayer = MapLayer(ltype = 'raster', cmd = self.cmd, Map = self.GetMap(), name = "elevation")
self.AddLayer(self.rlayer)
+ #LMWorkspaceToolbar(self)
+ self.CreateWxToolBar()
+ self.AddToolBarItem(ToolBarNames.NEWDISPLAY, self.dummyfunc)
+ self.AddToolBarItem(ToolBarNames.WORKSPACENEW,self.dummyfunc)
+ self.AddToolBarItem(ToolBarNames.ADDRASTER,self.dummyfunc)
+ self.AddToolBarItem(ToolBarNames.ADDVECTOR,self.dummyfunc)
#print self.GetLayerByIndex(0).name
#print self.GetCurrentIndex()
-
+ def dummyfunc(self,event):
+ xx =1
+ print xx
def main():
More information about the grass-commit
mailing list