|
@@ -149,7 +149,13 @@ class GMFrame(wx.Frame):
|
|
# create widgets
|
|
# create widgets
|
|
self._createMenuBar()
|
|
self._createMenuBar()
|
|
self.statusbar = self.CreateStatusBar(number=1)
|
|
self.statusbar = self.CreateStatusBar(number=1)
|
|
- self.notebook = self._createNoteBook()
|
|
|
|
|
|
+ self.notebook = self._createNotebook()
|
|
|
|
+ self._createDataCatalog(self.notebook)
|
|
|
|
+ self._createDisplay(self.notebook)
|
|
|
|
+ self._createSearchModule(self.notebook)
|
|
|
|
+ self._createConsole(self.notebook)
|
|
|
|
+ self._createPythonShell(self.notebook)
|
|
|
|
+ self._addPagesToNotebook()
|
|
self.toolbars = {
|
|
self.toolbars = {
|
|
"workspace": LMWorkspaceToolbar(parent=self),
|
|
"workspace": LMWorkspaceToolbar(parent=self),
|
|
"tools": LMToolsToolbar(parent=self),
|
|
"tools": LMToolsToolbar(parent=self),
|
|
@@ -307,10 +313,10 @@ class GMFrame(wx.Frame):
|
|
|
|
|
|
return menu
|
|
return menu
|
|
|
|
|
|
- def _createDisplayPanel(self):
|
|
|
|
|
|
+ def _createDisplayPanel(self, parent):
|
|
"""Creates display panel"""
|
|
"""Creates display panel"""
|
|
# create superior display panel
|
|
# create superior display panel
|
|
- displayPanel = wx.Panel(self.notebook, id=wx.ID_ANY)
|
|
|
|
|
|
+ displayPanel = wx.Panel(parent, id=wx.ID_ANY)
|
|
# create display toolbar
|
|
# create display toolbar
|
|
dmgrToolbar = DisplayPanelToolbar(guiparent=displayPanel, parent=self)
|
|
dmgrToolbar = DisplayPanelToolbar(guiparent=displayPanel, parent=self)
|
|
# create display notebook
|
|
# create display notebook
|
|
@@ -343,29 +349,32 @@ class GMFrame(wx.Frame):
|
|
return self._auimgr.GetPane(name).IsShown()
|
|
return self._auimgr.GetPane(name).IsShown()
|
|
return False
|
|
return False
|
|
|
|
|
|
- def _createNoteBook(self):
|
|
|
|
- """Creates notebook widgets"""
|
|
|
|
|
|
+ def _createNotebook(self):
|
|
|
|
+ """Initialize notebook widget"""
|
|
if sys.platform == "win32":
|
|
if sys.platform == "win32":
|
|
- self.notebook = GNotebook(parent=self, style=globalvar.FNPageDStyle)
|
|
|
|
|
|
+ return GNotebook(parent=self, style=globalvar.FNPageDStyle)
|
|
else:
|
|
else:
|
|
- self.notebook = FormNotebook(parent=self, style=wx.NB_BOTTOM)
|
|
|
|
|
|
+ return FormNotebook(parent=self, style=wx.NB_BOTTOM)
|
|
|
|
|
|
- # create 'data catalog' widget and add it to main notebook page
|
|
|
|
- self.datacatalog = DataCatalog(parent=self.notebook, giface=self._giface)
|
|
|
|
|
|
+ def _createDataCatalog(self, parent):
|
|
|
|
+ """Initialize Data Catalog widget"""
|
|
|
|
+ self.datacatalog = DataCatalog(parent=parent, giface=self._giface)
|
|
self.datacatalog.showNotification.connect(
|
|
self.datacatalog.showNotification.connect(
|
|
lambda message: self.SetStatusText(message)
|
|
lambda message: self.SetStatusText(message)
|
|
)
|
|
)
|
|
|
|
|
|
- self.notebook.AddPage(page=self.datacatalog, text=_("Data"), name="catalog")
|
|
|
|
-
|
|
|
|
- # create displays notebook widget
|
|
|
|
- self.displayPanel, self.notebookLayers = self._createDisplayPanel()
|
|
|
|
- self.notebook.AddPage(page=self.displayPanel, text=_("Display"), name="layers")
|
|
|
|
|
|
+ def _createDisplay(self, parent):
|
|
|
|
+ """Initialize Display widget"""
|
|
|
|
+ self.displayPanel, self.notebookLayers = self._createDisplayPanel(parent)
|
|
|
|
+ # bindings
|
|
|
|
+ self.notebookLayers.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnCBPageChanged)
|
|
|
|
+ self.notebookLayers.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnCBPageClosing)
|
|
|
|
|
|
- # create 'search module' notebook page
|
|
|
|
|
|
+ def _createSearchModule(self, parent):
|
|
|
|
+ """Initialize Search module widget"""
|
|
if not UserSettings.Get(group="manager", key="hideTabs", subkey="search"):
|
|
if not UserSettings.Get(group="manager", key="hideTabs", subkey="search"):
|
|
self.search = SearchModuleWindow(
|
|
self.search = SearchModuleWindow(
|
|
- parent=self.notebook,
|
|
|
|
|
|
+ parent=parent,
|
|
handlerObj=self,
|
|
handlerObj=self,
|
|
giface=self._giface,
|
|
giface=self._giface,
|
|
model=self._moduleTreeBuilder.GetModel(),
|
|
model=self._moduleTreeBuilder.GetModel(),
|
|
@@ -373,10 +382,11 @@ class GMFrame(wx.Frame):
|
|
self.search.showNotification.connect(
|
|
self.search.showNotification.connect(
|
|
lambda message: self.SetStatusText(message)
|
|
lambda message: self.SetStatusText(message)
|
|
)
|
|
)
|
|
- self.notebook.AddPage(page=self.search, text=_("Modules"), name="search")
|
|
|
|
else:
|
|
else:
|
|
self.search = None
|
|
self.search = None
|
|
|
|
|
|
|
|
+ def _createConsole(self, parent):
|
|
|
|
+ """Initialize Console widget"""
|
|
# create 'command output' text area
|
|
# create 'command output' text area
|
|
self._gconsole = GConsole(
|
|
self._gconsole = GConsole(
|
|
guiparent=self,
|
|
guiparent=self,
|
|
@@ -386,51 +396,65 @@ class GMFrame(wx.Frame):
|
|
"^v.import$|^v.external$|^v.external.out$|"
|
|
"^v.import$|^v.external$|^v.external.out$|"
|
|
"^cd$|^cd .*",
|
|
"^cd$|^cd .*",
|
|
)
|
|
)
|
|
|
|
+ # create 'console' widget
|
|
self.goutput = GConsoleWindow(
|
|
self.goutput = GConsoleWindow(
|
|
- parent=self.notebook,
|
|
|
|
|
|
+ parent=parent,
|
|
giface=self._giface,
|
|
giface=self._giface,
|
|
gconsole=self._gconsole,
|
|
gconsole=self._gconsole,
|
|
menuModel=self._moduleTreeBuilder.GetModel(),
|
|
menuModel=self._moduleTreeBuilder.GetModel(),
|
|
gcstyle=GC_PROMPT,
|
|
gcstyle=GC_PROMPT,
|
|
)
|
|
)
|
|
- self.notebook.AddPage(page=self.goutput, text=_("Console"), name="output")
|
|
|
|
-
|
|
|
|
self.goutput.showNotification.connect(
|
|
self.goutput.showNotification.connect(
|
|
lambda message: self.SetStatusText(message)
|
|
lambda message: self.SetStatusText(message)
|
|
)
|
|
)
|
|
|
|
|
|
self._gconsole.mapCreated.connect(self.OnMapCreated)
|
|
self._gconsole.mapCreated.connect(self.OnMapCreated)
|
|
- self.goutput.contentChanged.connect(
|
|
|
|
- lambda notification: self._switchPage(notification)
|
|
|
|
- )
|
|
|
|
-
|
|
|
|
self._gconsole.Bind(
|
|
self._gconsole.Bind(
|
|
EVT_IGNORED_CMD_RUN, lambda event: self.RunSpecialCmd(event.cmd)
|
|
EVT_IGNORED_CMD_RUN, lambda event: self.RunSpecialCmd(event.cmd)
|
|
)
|
|
)
|
|
|
|
|
|
self._setCopyingOfSelectedText()
|
|
self._setCopyingOfSelectedText()
|
|
|
|
|
|
- # create 'python shell' notebook page
|
|
|
|
|
|
+ def _createPythonShell(self, parent):
|
|
|
|
+ """Initialize Python shell widget"""
|
|
if not UserSettings.Get(group="manager", key="hideTabs", subkey="pyshell"):
|
|
if not UserSettings.Get(group="manager", key="hideTabs", subkey="pyshell"):
|
|
self.pyshell = PyShellWindow(
|
|
self.pyshell = PyShellWindow(
|
|
- parent=self.notebook,
|
|
|
|
|
|
+ parent=parent,
|
|
giface=self._giface,
|
|
giface=self._giface,
|
|
simpleEditorHandler=self.OnSimpleEditor,
|
|
simpleEditorHandler=self.OnSimpleEditor,
|
|
)
|
|
)
|
|
- self.notebook.AddPage(page=self.pyshell, text=_("Python"), name="pyshell")
|
|
|
|
else:
|
|
else:
|
|
self.pyshell = None
|
|
self.pyshell = None
|
|
|
|
|
|
|
|
+ def _addPagesToNotebook(self):
|
|
|
|
+ """Add pages to notebook widget"""
|
|
|
|
+ # add 'data catalog' widget to main notebook page
|
|
|
|
+ self.notebook.AddPage(page=self.datacatalog, text=_("Data"), name="catalog")
|
|
|
|
+
|
|
|
|
+ # add 'display' widget to main notebook page
|
|
|
|
+ self.notebook.AddPage(page=self.displayPanel, text=_("Display"), name="layers")
|
|
|
|
+
|
|
|
|
+ # add 'modules' widget to main notebook page
|
|
|
|
+ if self.search:
|
|
|
|
+ self.notebook.AddPage(page=self.search, text=_("Modules"), name="search")
|
|
|
|
+
|
|
|
|
+ # add 'console' widget to main notebook page and add connect switch page signal
|
|
|
|
+ self.notebook.AddPage(page=self.goutput, text=_("Console"), name="output")
|
|
|
|
+ self.goutput.contentChanged.connect(
|
|
|
|
+ lambda notification: self._switchPage(notification)
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
+ # add 'python shell' widget to main notebook page
|
|
|
|
+ if self.pyshell:
|
|
|
|
+ self.notebook.AddPage(page=self.pyshell, text=_("Python"), name="pyshell")
|
|
|
|
+
|
|
# bindings
|
|
# bindings
|
|
if sys.platform == "win32":
|
|
if sys.platform == "win32":
|
|
self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
|
|
self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
|
|
else:
|
|
else:
|
|
self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
|
|
self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChanged)
|
|
- self.notebookLayers.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnCBPageChanged)
|
|
|
|
- self.notebookLayers.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, self.OnCBPageClosing)
|
|
|
|
|
|
|
|
wx.CallAfter(self.datacatalog.LoadItems)
|
|
wx.CallAfter(self.datacatalog.LoadItems)
|
|
- return self.notebook
|
|
|
|
|
|
|
|
def _show_demo_map(self):
|
|
def _show_demo_map(self):
|
|
"""If in demolocation, add demo map to map display
|
|
"""If in demolocation, add demo map to map display
|