X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f365323fd60d5d5d2435a066267e0a54d0fbe745..fe45b493dcc42fea4ad4f781a4fb7844d2e95fd0:/wxPython/wx/py/crust.py diff --git a/wxPython/wx/py/crust.py b/wxPython/wx/py/crust.py index d3715d50ef..df4d830f04 100644 --- a/wxPython/wx/py/crust.py +++ b/wxPython/wx/py/crust.py @@ -75,19 +75,50 @@ class Crust(wx.SplitterWindow): self.dispatcherlisting = DispatcherListing(parent=self.notebook) self.notebook.AddPage(page=self.dispatcherlisting, text='Dispatcher') + - self.SplitHorizontally(self.shell, self.notebook, -self.sashoffset) + # Initialize in an unsplit mode, and check later after loading + # settings if we should split or not. + self.shell.Hide() + self.notebook.Hide() + self.Initialize(self.shell) + self._shouldsplit = True + wx.CallAfter(self._CheckShouldSplit) self.SetMinimumPaneSize(100) self.Bind(wx.EVT_SIZE, self.SplitterOnSize) self.Bind(wx.EVT_SPLITTER_SASH_POS_CHANGED, self.OnChanged) + self.Bind(wx.EVT_SPLITTER_DCLICK, self.OnSashDClick) + + def _CheckShouldSplit(self): + if self._shouldsplit: + self.SplitHorizontally(self.shell, self.notebook, -self.sashoffset) + self.lastsashpos = self.GetSashPosition() + else: + self.lastsashpos = -1 + self.issplit = self.IsSplit() + + def ToggleTools(self): + """Toggle the display of the filling and other tools""" + if self.issplit: + self.Unsplit() + else: + self.SplitHorizontally(self.shell, self.notebook, -self.sashoffset) + self.lastsashpos = self.GetSashPosition() + self.issplit = self.IsSplit() + + def ToolsShown(self): + return self.issplit - def OnChanged(self, event): """update sash offset from the bottom of the window""" self.sashoffset = self.GetSize().height - event.GetSashPosition() + self.lastsashpos = event.GetSashPosition() event.Skip() - + + def OnSashDClick(self, event): + self.Unsplit() + self.issplit = False # Make the splitter expand the top window when resized def SplitterOnSize(self, event): @@ -110,13 +141,17 @@ class Crust(wx.SplitterWindow): zoom = config.ReadInt('View/Zoom/Display', -99) if zoom != -99: self.display.SetZoom(zoom) - + self.issplit = config.ReadInt('Sash/IsSplit', True) + if not self.issplit: + self._shouldsplit = False def SaveSettings(self, config): self.shell.SaveSettings(config) self.filling.SaveSettings(config) - config.WriteInt('Sash/CrustPos', self.GetSashPosition()) + if self.lastsashpos != -1: + config.WriteInt('Sash/CrustPos', self.lastsashpos) + config.WriteInt('Sash/IsSplit', self.issplit) config.WriteInt('View/Zoom/Display', self.display.GetZoom()) @@ -307,6 +342,13 @@ class CrustFrame(frame.Frame, frame.ShellFrameMixin): dialog.Destroy() + def ToggleTools(self): + """Toggle the display of the filling and other tools""" + return self.crust.ToggleTools() + + def ToolsShown(self): + return self.crust.ToolsShown() + def OnHelp(self, event): """Show a help dialog.""" frame.ShellFrameMixin.OnHelp(self, event)