[GRASS-SVN] r52927 - in grass/trunk/gui/wxpython: core gmodeler gui_core lmgr scripts
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Aug 26 08:34:28 PDT 2012
Author: annakrat
Date: 2012-08-26 08:34:27 -0700 (Sun, 26 Aug 2012)
New Revision: 52927
Modified:
grass/trunk/gui/wxpython/core/settings.py
grass/trunk/gui/wxpython/gmodeler/frame.py
grass/trunk/gui/wxpython/gui_core/forms.py
grass/trunk/gui/wxpython/gui_core/goutput.py
grass/trunk/gui/wxpython/gui_core/preferences.py
grass/trunk/gui/wxpython/gui_core/widgets.py
grass/trunk/gui/wxpython/lmgr/frame.py
grass/trunk/gui/wxpython/scripts/vkrige.py
Log:
wxGUI: command dialog notebook styles added (experimental)
Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py 2012-08-26 13:03:30 UTC (rev 52926)
+++ grass/trunk/gui/wxpython/core/settings.py 2012-08-26 15:34:27 UTC (rev 52927)
@@ -146,6 +146,9 @@
'iconTheme' : {
'type' : 'grass'
},
+ 'commandNotebook' : {
+ 'selection' : 2
+ },
},
#
# language
@@ -819,7 +822,12 @@
self.internalSettings['appearance']['gSelectPopupHeight']['min'] = 50
# there is also maxHeight given to TreeCtrlComboPopup.GetAdjustedSize
self.internalSettings['appearance']['gSelectPopupHeight']['max'] = 1000
-
+ self.internalSettings['appearance']['commandNotebook']['choices'] = \
+ (_("Basic top"),
+ _("Basic left"),
+ _("Fancy green"),
+ _("List left"))
+
self.internalSettings['display']['driver']['choices'] = ['cairo', 'png']
self.internalSettings['display']['statusbarMode']['choices'] = None # set during MapFrame init
self.internalSettings['display']['mouseWheelZoom']['choices'] = (_('Zoom and recenter'),
Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py 2012-08-26 13:03:30 UTC (rev 52926)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py 2012-08-26 15:34:27 UTC (rev 52927)
@@ -105,7 +105,7 @@
self.pythonPanel = PythonPanel(parent = self)
- self.goutput = GMConsole(parent = self, notebook = self.notebook)
+ self.goutput = GMConsole(parent = self, frame = self, notebook = self.notebook)
self.notebook.AddPage(page = self.canvas, text=_('Model'), name = 'model')
self.notebook.AddPage(page = self.itemPanel, text=_('Items'), name = 'items')
Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py 2012-08-26 13:03:30 UTC (rev 52926)
+++ grass/trunk/gui/wxpython/gui_core/forms.py 2012-08-26 15:34:27 UTC (rev 52927)
@@ -90,7 +90,7 @@
from core import gcmd
from core import utils
from core.settings import UserSettings
-from gui_core.widgets import FloatValidator, GNotebook
+from gui_core.widgets import FloatValidator, GNotebook, FormNotebook, FormListbook
wxUpdateDialog, EVT_DIALOG_UPDATE = NewEvent()
@@ -781,32 +781,56 @@
panelsizer = wx.BoxSizer(orient = wx.VERTICAL)
# build notebook
- self.notebook = GNotebook(self, style = globalvar.FNPageStyle | FN.FNB_NO_X_BUTTON )
- self.notebook.SetTabAreaColour(globalvar.FNPageColor)
- self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChange)
+ style = UserSettings.Get(group = 'appearance', key = 'commandNotebook', subkey = 'selection')
+ if style == 0: # basic top
+ self.notebook = FormNotebook(self, style = wx.BK_TOP)
+ self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChange)
+ elif style == 1: # basic left
+ self.notebook = FormNotebook(self, style = wx.BK_LEFT)
+ self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChange)
+ elif style == 2: # fancy green
+ self.notebook = GNotebook(self, style = globalvar.FNPageStyle | FN.FNB_NO_X_BUTTON )
+ self.notebook.SetTabAreaColour(globalvar.FNPageColor)
+ self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChange)
+ elif style == 3:
+ self.notebook = FormListbook(self, style = wx.BK_LEFT)
+ self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChange)
+ self.notebook.Refresh()
+ imageList = wx.ImageList(16, 16)
+ self.notebook.AssignImageList(imageList)
+
tab = {}
tabsizer = {}
for section in sections:
tab[section] = ScrolledPanel(parent = self.notebook)
tab[section].SetScrollRate(10, 10)
tabsizer[section] = wx.BoxSizer(orient = wx.VERTICAL)
- self.notebook.AddPage(page = tab[section], text = section)
+ self.notebook.AddPage(page = tab[section], text = section, name = section)
+ index = self.AddBitmapToImageList(section, imageList)
+ if index >= 0:
+ self.notebook.SetPageImage(section, index)
# are we running from command line?
### add 'command output' tab regardless standalone dialog
if self.parent.GetName() == "MainFrame" and self.parent.get_dcmd is None:
from gui_core.goutput import GMConsole
- self.goutput = GMConsole(parent = self, margin = False)
+ self.goutput = GMConsole(parent = self.notebook, frame = self.parent, margin = False, notebook = self.notebook)
self.outpage = self.notebook.AddPage(page = self.goutput, text = _("Command output"), name = 'output')
+ index = self.AddBitmapToImageList(section = 'output', imageList = imageList)
+ if index >= 0:
+ self.notebook.SetPageImage('output', index)
else:
self.goutput = None
- self.manual_tab = HelpPanel(parent = self, grass_command = self.task.name)
+ self.manual_tab = HelpPanel(parent = self.notebook, grass_command = self.task.name)
if not self.manual_tab.IsFile():
self.manual_tab.Hide()
else:
self.notebook.AddPage(page = self.manual_tab, text = _("Manual"), name = 'manual')
+ index = self.AddBitmapToImageList(section = 'manual', imageList = imageList)
+ if index >= 0:
+ self.notebook.SetPageImage('manual', index)
self.notebook.SetSelection(0)
@@ -1957,6 +1981,19 @@
event.Skip()
+ def AddBitmapToImageList(self, section, imageList):
+ iconTheme = UserSettings.Get(group = 'appearance', key = 'iconTheme', subkey = 'type')
+ iconSectionDict = {'manual': os.path.join(globalvar.ETCICONDIR, iconTheme, 'help.png'),
+ _("Optional"): os.path.join(globalvar.ETCICONDIR, iconTheme, 'settings.png')}
+ if section in iconSectionDict.keys():
+ bitmap = wx.Bitmap(iconSectionDict[section])
+ bitmap.SetSize((16, 16))
+ idx = imageList.Add(bitmap)
+ return idx
+
+ return -1
+
+
class GUI:
def __init__(self, parent = None, show = True, modal = False,
centreOnParent = False, checkError = False, lmgr = None):
Modified: grass/trunk/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/goutput.py 2012-08-26 13:03:30 UTC (rev 52926)
+++ grass/trunk/gui/wxpython/gui_core/goutput.py 2012-08-26 15:34:27 UTC (rev 52927)
@@ -198,7 +198,7 @@
class GMConsole(wx.SplitterWindow):
"""!Create and manage output console for commands run by GUI.
"""
- def __init__(self, parent, id = wx.ID_ANY, margin = False,
+ def __init__(self, parent, frame, id = wx.ID_ANY, margin = False,
notebook = None,
style = wx.TAB_TRAVERSAL | wx.FULL_REPAINT_ON_RESIZE,
**kwargs):
@@ -210,6 +210,7 @@
# initialize variables
self.parent = parent # GMFrame | CmdPanel | ?
+ self.frame = frame
if notebook:
self._notebook = notebook
else:
@@ -285,7 +286,7 @@
self.btnCmdProtocol.SetToolTipString(_("Toggle to save list of executed commands into file; "
"content saved when switching off."))
- if self.parent.GetName() != 'LayerManager':
+ if self.frame.GetName() != 'LayerManager':
self.btnCmdClear.Hide()
self.btnCmdProtocol.Hide()
@@ -329,7 +330,7 @@
cmdBtnSizer.Add(item = self.btnCmdAbort, proportion = 1,
flag = wx.ALIGN_CENTER | wx.RIGHT, border = 5)
- if self.parent.GetName() != 'LayerManager':
+ if self.frame.GetName() != 'LayerManager':
proportion = (1, 1)
else:
proportion = (2, 3)
@@ -506,7 +507,7 @@
except IOError, e:
GError(_("Unable to write file '%(filePath)s'.\n\nDetails: %(error)s") %
{'filePath': filePath, 'error' : e },
- parent = self.parent)
+ parent = self.frame)
fileHistory = None
if fileHistory:
@@ -518,7 +519,7 @@
if command[0] in globalvar.grassCmd:
# send GRASS command without arguments to GUI command interface
# except display commands (they are handled differently)
- if self.parent.GetName() == "LayerManager" and \
+ if self.frame.GetName() == "LayerManager" and \
command[0][0:2] == "d." and \
'help' not in ' '.join(command[1:]):
# display GRASS commands
@@ -542,23 +543,23 @@
'd.barscale' : 'barscale',
'd.redraw' : 'redraw'}[command[0]]
except KeyError:
- GMessage(parent = self.parent,
+ GMessage(parent = self.frame,
message = _("Command '%s' not yet implemented in the WxGUI. "
"Try adding it as a command layer instead.") % command[0])
return
if layertype == 'barscale':
- self.parent.curr_page.maptree.GetMapDisplay().OnAddBarscale(None)
+ self.frame.GetLayerTree().GetMapDisplay().OnAddBarscale(None)
elif layertype == 'rastleg':
- self.parent.curr_page.maptree.GetMapDisplay().OnAddLegend(None)
+ self.frame.GetLayerTree().GetMapDisplay().OnAddLegend(None)
elif layertype == 'redraw':
- self.parent.curr_page.maptree.GetMapDisplay().OnRender(None)
+ self.frame.GetLayerTree().GetMapDisplay().OnRender(None)
else:
# add layer into layer tree
lname, found = utils.GetLayerNameFromCmd(command, fullyQualified = True,
layerType = layertype)
- if self.parent.GetName() == "LayerManager":
- self.parent.curr_page.maptree.AddLayer(ltype = layertype,
+ if self.frame.GetName() == "LayerManager":
+ self.frame.GetLayerTree().AddLayer(ltype = layertype,
lname = lname,
lcmd = command)
@@ -602,8 +603,8 @@
if switchPage:
self._notebook.SetSelectionByName('output')
- self.parent.SetFocus()
- self.parent.Raise()
+ self.frame.SetFocus()
+ self.frame.Raise()
# activate computational region (set with g.region)
# for all non-display commands.
@@ -689,7 +690,7 @@
GError(_("Unable to write file '%(path)s'.\n\nDetails: %(error)s") % {'path': path, 'error': e})
finally:
output.close()
- self.parent.SetStatusText(_("Commands output saved into '%s'") % path)
+ self.frame.SetStatusText(_("Commands output saved into '%s'") % path)
dlg.Destroy()
@@ -714,9 +715,9 @@
"""!Update statusbar text"""
if event.GetString():
nItems = len(self.cmdPrompt.GetCommandItems())
- self.parent.SetStatusText(_('%d modules match') % nItems, 0)
+ self.frame.SetStatusText(_('%d modules match') % nItems, 0)
else:
- self.parent.SetStatusText('', 0)
+ self.frame.SetStatusText('', 0)
event.Skip()
@@ -733,7 +734,7 @@
# message prefix
if type == 'warning':
- messege = 'WARNING: ' + message
+ message = 'WARNING: ' + message
elif type == 'error':
message = 'ERROR: ' + message
@@ -804,7 +805,7 @@
finally:
output.close()
- self.parent.SetStatusText(_("Commands protocol saved into '%s'") % self.cmdFileProtocol)
+ self.frame.SetStatusText(_("Commands protocol saved into '%s'") % self.cmdFileProtocol)
del self.cmdFileProtocol
def OnCmdProtocol(self, event = None):
@@ -837,23 +838,23 @@
def OnCmdRun(self, event):
"""!Run command"""
- if self.parent.GetName() == 'Modeler':
- self.parent.OnCmdRun(event)
+ if self.frame.GetName() == 'Modeler':
+ self.frame.OnCmdRun(event)
self.WriteCmdLog('(%s)\n%s' % (str(time.ctime()), ' '.join(event.cmd)))
self.btnCmdAbort.Enable()
def OnCmdPrepare(self, event):
"""!Prepare for running command"""
- if self.parent.GetName() == 'Modeler':
- self.parent.OnCmdPrepare(event)
+ if self.frame.GetName() == 'Modeler':
+ self.frame.OnCmdPrepare(event)
event.Skip()
def OnCmdDone(self, event):
"""!Command done (or aborted)"""
- if self.parent.GetName() == 'Modeler':
- self.parent.OnCmdDone(event)
+ if self.frame.GetName() == 'Modeler':
+ self.frame.OnCmdDone(event)
# Process results here
try:
@@ -890,13 +891,13 @@
Debug.SetLevel()
self.Redirect()
- if self.parent.GetName() == "LayerManager":
+ if self.frame.GetName() == "LayerManager":
self.btnCmdAbort.Enable(False)
if event.cmd[0] not in globalvar.grassCmd or \
event.cmd[0] == 'r.mapcalc':
return
- tree = self.parent.GetLayerTree()
+ tree = self.frame.GetLayerTree()
display = None
if tree:
display = tree.GetMapDisplay()
@@ -922,37 +923,37 @@
if mapName in mapLayers:
display.GetWindow().UpdateMap(render = True)
return
- elif self.parent.GetName() == 'Modeler':
+ elif self.frame.GetName() == 'Modeler':
pass
else: # standalone dialogs
- dialog = self.parent.parent
- if hasattr(self.parent.parent, "btn_abort"):
+ dialog = self.frame
+ if hasattr(dialog, "btn_abort"):
dialog.btn_abort.Enable(False)
- if hasattr(self.parent.parent, "btn_cancel"):
+ if hasattr(dialog, "btn_cancel"):
dialog.btn_cancel.Enable(True)
- if hasattr(self.parent.parent, "btn_clipboard"):
+ if hasattr(dialog, "btn_clipboard"):
dialog.btn_clipboard.Enable(True)
- if hasattr(self.parent.parent, "btn_help"):
+ if hasattr(dialog, "btn_help"):
dialog.btn_help.Enable(True)
- if hasattr(self.parent.parent, "btn_run"):
+ if hasattr(dialog, "btn_run"):
dialog.btn_run.Enable(True)
if event.returncode == 0 and not event.aborted:
try:
- winName = self.parent.parent.parent.GetName()
+ winName = self.frame.parent.GetName()
except AttributeError:
winName = ''
if winName == 'LayerManager':
- mapTree = self.parent.parent.parent.GetLayerTree()
+ mapTree = self.frame.parent.GetLayerTree()
elif winName == 'LayerTree':
- mapTree = self.parent.parent.parent
+ mapTree = self.frame.parent
elif winName: # GMConsole
- mapTree = self.parent.parent.parent.parent.GetLayerTree()
+ mapTree = self.frame.parent.parent.GetLayerTree()
else:
mapTree = None
Modified: grass/trunk/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/preferences.py 2012-08-26 13:03:30 UTC (rev 52926)
+++ grass/trunk/gui/wxpython/gui_core/preferences.py 2012-08-26 15:34:27 UTC (rev 52927)
@@ -570,7 +570,28 @@
flag = wx.ALIGN_RIGHT |
wx.ALIGN_CENTER_VERTICAL,
pos = (row, 1))
-
+ #
+ # command dialog style
+ #
+ row += 1
+ gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+ label = _("Command dialog style:")),
+ flag = wx.ALIGN_LEFT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 0))
+ styleList = wx.Choice(parent = panel, id = wx.ID_ANY, size = (325, -1),
+ choices = self.settings.Get(group = 'appearance', key = 'commandNotebook',
+ subkey = 'choices', internal = True),
+ name = "GetSelection")
+ styleList.SetSelection(self.settings.Get(group = 'appearance', key = 'commandNotebook',
+ subkey = 'selection'))
+ self.winId['appearance:commandNotebook:selection'] = styleList.GetId()
+
+ gridSizer.Add(item = styleList,
+ flag = wx.ALIGN_RIGHT |
+ wx.ALIGN_CENTER_VERTICAL,
+ pos = (row, 1))
+
sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
Modified: grass/trunk/gui/wxpython/gui_core/widgets.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/widgets.py 2012-08-26 13:03:30 UTC (rev 52926)
+++ grass/trunk/gui/wxpython/gui_core/widgets.py 2012-08-26 15:34:27 UTC (rev 52927)
@@ -50,32 +50,37 @@
from wx.lib.newevent import NewEvent
wxSymbolSelectionChanged, EVT_SYMBOL_SELECTION_CHANGED = NewEvent()
-class GNotebook(FN.FlatNotebook):
- """!Generic notebook widget
+
+class NotebookController:
+ """!Provides handling of notebook page names.
+
+ Translates page names to page indices.
+ Class is aggregated in notebook subclasses.
+ Notebook subclasses must delegate methods to controller.
+ Methods inherited from notebook class must be delegated explicitly
+ and other methods can be delegated by @c __getattr__.
"""
- def __init__(self, parent, style, **kwargs):
- if globalvar.hasAgw:
- FN.FlatNotebook.__init__(self, parent, id = wx.ID_ANY, agwStyle = style, **kwargs)
- else:
- FN.FlatNotebook.__init__(self, parent, id = wx.ID_ANY, style = style, **kwargs)
-
+ def __init__(self, classObject, widget):
self.notebookPages = {}
-
+ self.classObject = classObject
+ self.widget = widget
+
def AddPage(self, **kwargs):
"""!Add a new page
"""
if 'name' in kwargs:
self.notebookPages[kwargs['name']] = kwargs['page']
del kwargs['name']
- super(GNotebook, self).AddPage(**kwargs)
+ self.classObject.AddPage(self.widget, **kwargs)
+
def InsertPage(self, **kwargs):
"""!Insert a new page
"""
if 'name' in kwargs:
self.notebookPages[kwargs['name']] = kwargs['page']
del kwargs['name']
- super(GNotebook, self).InsertPage(**kwargs)
+ self.classObject.InsertPage(self.widget, **kwargs)
def DeletePage(self, page):
"""!Delete page
@@ -85,9 +90,10 @@
"""
delPageIndex = self.GetPageIndexByName(page)
if delPageIndex != -1:
- super(GNotebook, self).DeletePage(delPageIndex)
- del self.notebookPages[page]
- return True
+ ret = self.classObject.DeletePage(self.widget, delPageIndex)
+ if ret:
+ del self.notebookPages[page]
+ return ret
else:
return False
@@ -99,9 +105,10 @@
"""
delPageIndex = self.GetPageIndexByName(page)
if delPageIndex != -1:
- super(GNotebook, self).RemovePage(delPageIndex)
- del self.notebookPages[page]
- return True
+ ret = self.classObject.RemovePage(self.widget, delPageIndex)
+ if ret:
+ del self.notebookPages[page]
+ return ret
else:
return False
@@ -111,9 +118,36 @@
@param page names, eg. 'layers', 'output', 'search', 'pyshell', 'nviz'
"""
idx = self.GetPageIndexByName(page)
- if self.GetSelection() != idx:
- self.SetSelection(idx)
+ if self.classObject.GetSelection(self.widget) != idx:
+ self.classObject.SetSelection(self.widget, idx)
+
+ def GetPageIndexByName(self, page):
+ """!Get notebook page index
+ @param page name
+ """
+ if page not in self.notebookPages:
+ return -1
+ for pageIndex in range(self.classObject.GetPageCount(self.widget)):
+ if self.notebookPages[page] == self.classObject.GetPage(self.widget, pageIndex):
+ break
+ return pageIndex
+
+ def SetPageImage(self, page, index):
+ """!Sets image index for page
+
+ @param page page name
+ @param index image index (in wx.ImageList)
+ """
+ pageIndex = self.GetPageIndexByName(page)
+ self.classObject.SetPageImage(self.widget, pageIndex, index)
+
+
+class FlatNotebookController(NotebookController):
+ """!Controller specialized for FN.FlatNotebook subclasses"""
+ def __init__(self, classObject, widget):
+ NotebookController.__init__(self, classObject, widget)
+
def GetPageIndexByName(self, page):
"""!Get notebook page index
@@ -122,8 +156,116 @@
if page not in self.notebookPages:
return -1
- return self.GetPageIndex(self.notebookPages[page])
+ return self.classObject.GetPageIndex(self.widget, self.notebookPages[page])
+
+class GNotebook(FN.FlatNotebook):
+ """!Generic notebook widget.
+
+ Enables advanced style settings.
+ Problems with hidden tabs and does not respect system colors (native look).
+ """
+ def __init__(self, parent, style, **kwargs):
+ if globalvar.hasAgw:
+ FN.FlatNotebook.__init__(self, parent, id = wx.ID_ANY, agwStyle = style, **kwargs)
+ else:
+ FN.FlatNotebook.__init__(self, parent, id = wx.ID_ANY, style = style, **kwargs)
+
+ self.controller = FlatNotebookController(classObject = FN.FlatNotebook, widget = self)
+
+ def AddPage(self, **kwargs):
+ """! @copydoc NotebookController::AddPage()"""
+ self.controller.AddPage(**kwargs)
+
+ def InsertPage(self, **kwargs):
+ """! @copydoc NotebookController::InsertPage()"""
+ self.controller.InsertPage(**kwargs)
+
+ def DeletePage(self, page):
+ """! @copydoc NotebookController::DeletePage()"""
+ return self.controller.DeletePage(page)
+
+ def RemovePage(self, page):
+ """! @copydoc NotebookController::RemovePage()"""
+ return self.controller.RemovePage(page)
+
+ def SetPageImage(self, page, index):
+ """! @copydoc NotebookController::SetPageImage()"""
+ return self.controller.SetPageImage(page, index)
+
+ def SetPageImage(self, page, index):
+ """!Does nothing because we don't want images for this style"""
+ pass
+
+ def __getattr__(self, name):
+ return getattr(self.controller, name)
+
+class FormNotebook(wx.Notebook):
+ """!Notebook widget.
+
+ Respects native look.
+ """
+ def __init__(self, parent, style):
+ wx.Notebook.__init__(self, parent, id = wx.ID_ANY, style = style)
+ self.controller = NotebookController(classObject = wx.Notebook, widget = self)
+
+ def AddPage(self, **kwargs):
+ """!@copydoc NotebookController::AddPage()"""
+ self.controller.AddPage(**kwargs)
+
+ def InsertPage(self, **kwargs):
+ """! @copydoc NotebookController::InsertPage()"""
+ self.controller.InsertPage(**kwargs)
+
+ def DeletePage(self, page):
+ """ @copydoc NotebookController::DeletePage()"""
+ return self.controller.DeletePage(page)
+
+ def RemovePage(self, page):
+ """ @copydoc NotebookController::RemovePage()"""
+ return self.controller.RemovePage(page)
+
+ def SetPageImage(self, page, index):
+ """! @copydoc NotebookController::SetPageImage()"""
+ return self.controller.SetPageImage(page, index)
+
+ def __getattr__(self, name):
+ return getattr(self.controller, name)
+
+
+class FormListbook(wx.Listbook):
+ """!Notebook widget.
+
+ Respects native look.
+ """
+ def __init__(self, parent, style):
+ wx.Listbook.__init__(self, parent, id = wx.ID_ANY, style = style)
+ self.controller = NotebookController(classObject = wx.Listbook, widget = self)
+
+ def AddPage(self, **kwargs):
+ """!@copydoc NotebookController::AddPage()"""
+ self.controller.AddPage(**kwargs)
+
+ def InsertPage(self, **kwargs):
+ """! @copydoc NotebookController::InsertPage()"""
+ self.controller.InsertPage(**kwargs)
+
+ def DeletePage(self, page):
+ """ @copydoc NotebookController::DeletePage()"""
+ return self.controller.DeletePage(page)
+
+ def RemovePage(self, page):
+ """ @copydoc NotebookController::RemovePage()"""
+ return self.controller.RemovePage(page)
+
+ def SetPageImage(self, page, index):
+ """! @copydoc NotebookController::SetPageImage()"""
+ return self.controller.SetPageImage(page, index)
+
+ def __getattr__(self, name):
+ return getattr(self.controller, name)
+
+
class ScrolledPanel(SP.ScrolledPanel):
"""!Custom ScrolledPanel to avoid strange behaviour concerning focus"""
def __init__(self, parent, style = wx.TAB_TRAVERSAL):
Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py 2012-08-26 13:03:30 UTC (rev 52926)
+++ grass/trunk/gui/wxpython/lmgr/frame.py 2012-08-26 15:34:27 UTC (rev 52927)
@@ -253,7 +253,7 @@
self.notebook.AddPage(page = self.gm_cb, text = _("Map layers"), name = 'layers')
# create 'command output' text area
- self.goutput = GMConsole(self)
+ self.goutput = GMConsole(self, frame = self)
self.notebook.AddPage(page = self.goutput, text = _("Command console"), name = 'output')
self._setCopyingOfSelectedText()
@@ -307,6 +307,7 @@
self.notebook.SetSelectionByName('layers')
self.notebook.RemovePage('nviz')
del self.nviz
+
# hide toolbar
self._auimgr.GetPane('toolbarNviz').Hide()
for pos, toolbar in enumerate(('toolbarVector', 'toolbarTools', 'toolbarMisc')):
Modified: grass/trunk/gui/wxpython/scripts/vkrige.py
===================================================================
--- grass/trunk/gui/wxpython/scripts/vkrige.py 2012-08-26 13:03:30 UTC (rev 52926)
+++ grass/trunk/gui/wxpython/scripts/vkrige.py 2012-08-26 15:34:27 UTC (rev 52927)
@@ -102,7 +102,7 @@
self.CreatePage(package = Rpackage, Rinstance = Rinstance, controller = controller)
## Command output. From menuform module, cmdPanel class
- self.goutput = goutput.GMConsole(parent = self, margin = False,
+ self.goutput = goutput.GMConsole(parent = self, frame = self.parent, margin = False,
notebook = self.RPackagesBook)
self.goutputId = self.RPackagesBook.GetPageCount()
self.outpage = self.RPackagesBook.AddPage(self.goutput, text = _("Command output"))
More information about the grass-commit
mailing list