Sfoglia il codice sorgente

wxGUI/nviz: wxNviz settings in separated window

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@42441 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 anni fa
parent
commit
2b9ef3d8c9

+ 1 - 1
gui/wxpython/gui_modules/gselect.py

@@ -180,7 +180,7 @@ class TreeCtrlComboPopup(wx.combo.ComboPopup):
         if not force and not self.updateOnPopup:
         if not force and not self.updateOnPopup:
             return
             return
         if self.onPopup:
         if self.onPopup:
-            selected, exclude = self.onPopup()
+            selected, exclude = self.onPopup(self.type)
         else:
         else:
             selected = None
             selected = None
             exclude  = False
             exclude  = False

+ 1 - 4
gui/wxpython/gui_modules/layertree.py

@@ -362,10 +362,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             self.Bind (wx.EVT_MENU, self.OnProfile, id=self.popupID5)
             self.Bind (wx.EVT_MENU, self.OnProfile, id=self.popupID5)
             self.popupMenu.Append(self.popupID6, _("Metadata"))
             self.popupMenu.Append(self.popupID6, _("Metadata"))
             self.Bind (wx.EVT_MENU, self.OnMetadata, id=self.popupID6)
             self.Bind (wx.EVT_MENU, self.OnMetadata, id=self.popupID6)
-            if self.mapdisplay.toolbars['nviz']:
-                self.popupMenu.Append(self.popupID11, _("3D view properties"))
-                self.Bind (wx.EVT_MENU, self.OnNvizProperties, id=self.popupID11)
-
+            
             if numSelected > 1:
             if numSelected > 1:
                 self.popupMenu.Enable(self.popupID12, False)
                 self.popupMenu.Enable(self.popupID12, False)
                 self.popupMenu.Enable(self.popupID13, False)
                 self.popupMenu.Enable(self.popupID13, False)

+ 7 - 7
gui/wxpython/gui_modules/nviz_mapdisp.py

@@ -183,7 +183,7 @@ class GLWindow(MapWindow, glcanvas.GLCanvas):
                     elif layer.type ==  'vector':
                     elif layer.type ==  'vector':
                         self._layermanager.nviz.UpdatePage('vector')
                         self._layermanager.nviz.UpdatePage('vector')
                 
                 
-                self._layermanager.nviz.UpdateSettings()
+                ### self._layermanager.nviz.UpdateSettings()
                 
                 
                 # update widgets
                 # update widgets
                 win = self._layermanager.nviz.FindWindowById( \
                 win = self._layermanager.nviz.FindWindowById( \
@@ -608,8 +608,8 @@ class GLWindow(MapWindow, glcanvas.GLCanvas):
             win.SetItems(self.GetLayerNames(layer.type))
             win.SetItems(self.GetLayerNames(layer.type))
 
 
             # remove surface page
             # remove surface page
-            if toolWin.notebook.GetSelection() ==  toolWin.page[nvizType]['id']:
-                toolWin.notebook.RemovePage(toolWin.page[nvizType]['id'])
+            if toolWin.GetSelection() ==  toolWin.page[nvizType]['id']:
+                toolWin.RemovePage(toolWin.page[nvizType]['id'])
                 toolWin.page[nvizType]['id'] = -1
                 toolWin.page[nvizType]['id'] = -1
                 toolWin.page['settings']['id'] = 1
                 toolWin.page['settings']['id'] = 1
         
         
@@ -702,16 +702,16 @@ class GLWindow(MapWindow, glcanvas.GLCanvas):
                     { 'name' : layer.name, 'type' : vtype }
                     { 'name' : layer.name, 'type' : vtype }
             
             
             data[vtype].pop('object')
             data[vtype].pop('object')
-            
-            self.layers.remove(id)
+
+            ### self.layers.remove(id)
         
         
         # update tools window
         # update tools window
         if hasattr(self._layermanager, "nviz") and \
         if hasattr(self._layermanager, "nviz") and \
                 vecType is None:
                 vecType is None:
             toolWin = self._layermanager.nviz
             toolWin = self._layermanager.nviz
             # remove surface page
             # remove surface page
-            if toolWin.notebook.GetSelection() ==  toolWin.page['surface']['id']:
-                toolWin.notebook.RemovePage(toolWin.page['surface']['id'])
+            if toolWin.GetSelection() ==  toolWin.page['surface']['id']:
+                toolWin.RemovePage(toolWin.page['surface']['id'])
                 toolWin.page['surface']['id'] = -1
                 toolWin.page['surface']['id'] = -1
                 toolWin.page['settings']['id'] = 1
                 toolWin.page['settings']['id'] = 1
         
         

File diff suppressed because it is too large
+ 770 - 692
gui/wxpython/gui_modules/nviz_tools.py


+ 2 - 0
gui/wxpython/gui_modules/preferences.py

@@ -11,6 +11,7 @@ Classes:
  - PreferencesDialog
  - PreferencesDialog
  - DefaultFontDialog
  - DefaultFontDialog
  - MapsetAccess
  - MapsetAccess
+ - NvizPreferencesDialog
 
 
 (C) 2007-2010 by the GRASS Development Team
 (C) 2007-2010 by the GRASS Development Team
 This program is free software under the GNU General Public
 This program is free software under the GNU General Public
@@ -2218,3 +2219,4 @@ class CheckListMapset(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.Check
         mapset = self.parent.all_mapsets_ordered[index]
         mapset = self.parent.all_mapsets_ordered[index]
         if mapset == self.parent.curr_mapset:
         if mapset == self.parent.curr_mapset:
             self.CheckItem(index, True)
             self.CheckItem(index, True)
+    

+ 9 - 4
gui/wxpython/gui_modules/toolbars.py

@@ -39,6 +39,7 @@ import vdigit
 from vdigit import VDigitSettingsDialog as VDigitSettingsDialog
 from vdigit import VDigitSettingsDialog as VDigitSettingsDialog
 from debug import Debug as Debug
 from debug import Debug as Debug
 from preferences import globalSettings as UserSettings
 from preferences import globalSettings as UserSettings
+from nviz_tools import NvizPreferencesDialog
 
 
 gmpath = os.path.join(globalvar.ETCWXDIR, "icons")
 gmpath = os.path.join(globalvar.ETCWXDIR, "icons")
 sys.path.append(gmpath)
 sys.path.append(gmpath)
@@ -1329,13 +1330,15 @@ class ProfileToolbar(AbstractToolbar):
             )
             )
     
     
 class NvizToolbar(AbstractToolbar):
 class NvizToolbar(AbstractToolbar):
-    """!
-    Nviz toolbar
+    """!Nviz toolbar
     """
     """
     def __init__(self, parent, mapcontent):
     def __init__(self, parent, mapcontent):
         self.mapcontent = mapcontent
         self.mapcontent = mapcontent
         AbstractToolbar.__init__(self, parent)
         AbstractToolbar.__init__(self, parent)
         
         
+        # only one dialog can be open
+        self.settingsDialog   = None
+        
         self.InitToolbar(self.ToolbarData())
         self.InitToolbar(self.ToolbarData())
         
         
         # realize the toolbar
         # realize the toolbar
@@ -1358,8 +1361,10 @@ class NvizToolbar(AbstractToolbar):
     
     
     def OnSettings(self, event):
     def OnSettings(self, event):
         """!Show nviz notebook page"""
         """!Show nviz notebook page"""
-        self.parent.parent.lmgr.notebook.SetSelection(3)
-    
+        if not self.settingsDialog:
+            self.settingsDialog = NvizPreferencesDialog(parent = self.parent)
+        self.settingsDialog.Show()
+            
     def OnExit (self, event=None):
     def OnExit (self, event=None):
         """!Quit nviz tool (swith to 2D mode)"""
         """!Quit nviz tool (swith to 2D mode)"""
         # set default mouse settings
         # set default mouse settings

+ 1 - 0
gui/wxpython/gui_modules/wxnviz.py

@@ -161,6 +161,7 @@ class Nviz(object):
         Nviz_set_surface_attr_default()
         Nviz_set_surface_attr_default()
         # set background color
         # set background color
         Nviz_set_bgcolor(self.data, Nviz_color_from_str("white")) # TODO
         Nviz_set_bgcolor(self.data, Nviz_color_from_str("white")) # TODO
+        self.SetBgColor("white")
         
         
         # initialize view
         # initialize view
         Nviz_init_view()
         Nviz_init_view()