X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b792147db7e5ceb5da741f5f6e27fea79944a04c..181568ed64a5f72886725288a279ead508598e33:/wxPython/samples/ide/activegrid/tool/OutlineService.py?ds=sidebyside diff --git a/wxPython/samples/ide/activegrid/tool/OutlineService.py b/wxPython/samples/ide/activegrid/tool/OutlineService.py index c04f1ecc1f..289d4315cb 100644 --- a/wxPython/samples/ide/activegrid/tool/OutlineService.py +++ b/wxPython/samples/ide/activegrid/tool/OutlineService.py @@ -84,6 +84,7 @@ class OutlineView(Service.ServiceView): item = self.GetControl().GetSelection() if item: self.GetControl().CallDoSelectCallback(item) + event.Skip() def ResumeActionOnSelect(self): @@ -146,7 +147,11 @@ class OutlineView(Service.ServiceView): return treeCtrl = self.GetControl() + parentItem = treeCtrl.GetRootItem() + if not parentItem: + return + if expanded[0] != treeCtrl.GetItemText(parentItem): return @@ -156,8 +161,7 @@ class OutlineView(Service.ServiceView): treeCtrl.Expand(child) (child, cookie) = treeCtrl.GetNextChild(parentItem, cookie) - if parentItem: - treeCtrl.EnsureVisible(parentItem) + treeCtrl.EnsureVisible(parentItem) class OutlineTreeCtrl(wx.TreeCtrl): @@ -266,7 +270,7 @@ class OutlineTreeCtrl(wx.TreeCtrl): if self.ItemHasChildren(item): child, cookie = self.GetFirstChild(item) - while child and child.IsOk(): + while child.IsOk(): self.FindDistanceToTreeItems(child, position, distances, items) child, cookie = self.GetNextChild(item, cookie) return False @@ -320,7 +324,7 @@ class OutlineService(Service.Service): def __init__(self, serviceName, embeddedWindowLocation = wx.lib.pydocview.EMBEDDED_WINDOW_BOTTOM): Service.Service.__init__(self, serviceName, embeddedWindowLocation) - self._validTemplates = [] + self._validViewTypes = [] def _CreateView(self): @@ -492,9 +496,8 @@ class OutlineService(Service.Service): if self.GetView(): currView = wx.GetApp().GetDocumentManager().GetCurrentView() if currView: - for template in self._validTemplates: - type = template.GetViewType() - if isinstance(currView, type): + for viewType in self._validViewTypes: + if isinstance(currView, viewType): self.LoadOutline(currView) foundRegisteredView = True break @@ -505,14 +508,14 @@ class OutlineService(Service.Service): self._timer.Start(1000) # 1 second interval - def AddTemplateForBackgroundHandler(self, template): - self._validTemplates.append(template) + def AddViewTypeForBackgroundHandler(self, viewType): + self._validViewTypes.append(viewType) - def GetTemplatesForBackgroundHandler(self): - return self._validTemplates + def GetViewTypesForBackgroundHandler(self): + return self._validViewTypes - def RemoveTemplateForBackgroundHandler(self, template): - self._validTemplates.remove(template) + def RemoveViewTypeForBackgroundHandler(self, viewType): + self._validViewTypes.remove(viewType)