]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/samples/ide/activegrid/tool/OutlineService.py
DocView patches from Morgen Hua: bug fixes, and additional SVN
[wxWidgets.git] / wxPython / samples / ide / activegrid / tool / OutlineService.py
index 95ccd9e357b64d7f1530050cd533298e3e168064..573327db894e132c4154f3d2e2de68c950badb36 100644 (file)
@@ -84,6 +84,7 @@ class OutlineView(Service.ServiceView):
         item = self.GetControl().GetSelection()
         if item:
             self.GetControl().CallDoSelectCallback(item)
+        event.Skip()
 
 
     def ResumeActionOnSelect(self):
@@ -156,11 +157,8 @@ class OutlineView(Service.ServiceView):
                 treeCtrl.Expand(child)
             (child, cookie) = treeCtrl.GetNextChild(parentItem, cookie)
 
-        # wxBug: This causes a crash, tried using ScrollTo which crashed as well.  Then tried calling it with wx.CallAfter and that crashed as well, with both EnsureVisible and ScrollTo
-        # self.GetControl().EnsureVisible(self.GetControl().GetRootItem())
-        # So doing the following massive hack which forces the treectrl to scroll up to the top item
-        treeCtrl.Collapse(parentItem)
-        treeCtrl.Expand(parentItem)
+        if parentItem:
+            treeCtrl.EnsureVisible(parentItem)
 
 
 class OutlineTreeCtrl(wx.TreeCtrl):
@@ -442,12 +440,13 @@ class OutlineService(Service.Service):
         if not self.GetView():
             return
 
-        self.SaveExpansionState()
-        if view.DoLoadOutlineCallback(force=force):
-            self.GetView().OnSort(wx.ConfigBase_Get().ReadInt("OutlineSort", SORT_NONE))
-            self.LoadExpansionState()
-        if position >= 0:
-            self.SyncToPosition(position)
+        if hasattr(view, "DoLoadOutlineCallback"):
+            self.SaveExpansionState()
+            if view.DoLoadOutlineCallback(force=force):
+                self.GetView().OnSort(wx.ConfigBase_Get().ReadInt("OutlineSort", SORT_NONE))
+                self.LoadExpansionState()
+            if position >= 0:
+                self.SyncToPosition(position)
 
 
     def SyncToPosition(self, position):
@@ -501,8 +500,8 @@ class OutlineService(Service.Service):
                         foundRegisteredView = True
                         break
 
-                if not foundRegisteredView:
-                    self.GetView().ClearTreeCtrl()
+            if not foundRegisteredView:
+                self.GetView().ClearTreeCtrl()
                     
         self._timer.Start(1000) # 1 second interval