fix missing root in empty search results panel
authorSurkov Sergey <surkovsv93@gmail.com>
Tue, 05 Dec 2017 12:38:04 +0300
changeset 1884 48bd91d7a0ae
parent 1883 20ec80d6fd70
child 1885 570122574a97
child 1962 f41dc3829af6
fix missing root in empty search results panel
IDEFrame.py
controls/SearchResultPanel.py
--- a/IDEFrame.py	Mon Dec 04 19:35:31 2017 +0300
+++ b/IDEFrame.py	Tue Dec 05 12:38:04 2017 +0300
@@ -1514,12 +1514,13 @@
             tagname = None
 
         # Refresh treectrl items according to project infos
-        infos = self.Controler.GetProjectInfos()
-        root = self.ProjectTree.GetRootItem()
-        if root is None or not root.IsOk():
-            root = self.ProjectTree.AddRoot(infos["name"])
-        self.GenerateProjectTreeBranch(root, infos)
-        self.ProjectTree.Expand(root)
+        if self.Controler:
+            infos = self.Controler.GetProjectInfos()
+            root = self.ProjectTree.GetRootItem()
+            if root is None or not root.IsOk():
+                root = self.ProjectTree.AddRoot(infos["name"])
+            self.GenerateProjectTreeBranch(root, infos)
+            self.ProjectTree.Expand(root)
 
         # Select new item corresponding to previous selected item
         if tagname is not None:
--- a/controls/SearchResultPanel.py	Mon Dec 04 19:35:31 2017 +0300
+++ b/controls/SearchResultPanel.py	Tue Dec 05 12:38:04 2017 +0300
@@ -175,6 +175,9 @@
     def RefreshView(self):
         self.SearchResultsTree.DeleteAllItems()
         if self.Criteria is None:
+            self.SearchResultsTree.AddRoot("")
+            root = self.SearchResultsTree.GetRootItem()
+            root.SetHilight(False)
             self.HeaderLabel.SetLabel(_("No search results available."))
             self.ResetButton.Enable(False)
         else: