# HG changeset patch # User lbessard # Date 1190131447 -7200 # Node ID 6f2689a2438b2501a566e9177a6609de07723a00 # Parent 00acf2162135f2fbf1a2822dbfd81cfc73e03641 Corrections for Windows diff -r 00acf2162135 -r 6f2689a2438b Beremiz.py --- a/Beremiz.py Mon Sep 17 18:04:13 2007 +0200 +++ b/Beremiz.py Tue Sep 18 18:04:07 2007 +0200 @@ -65,7 +65,7 @@ def LogCommand(self, Command, sz_limit = 100): - import os, popen2, fcntl, select, signal + import os, popen2, select, signal child = popen2.Popen3(Command, 1) # capture stdout and stderr from command child.tochild.close() # don't need to talk to child @@ -323,6 +323,7 @@ if projectOpen: self.PluginRoot.LoadProject(projectOpen, self.Log) self.RefreshPluginTree() + self.PluginTree.SelectItem(self.PluginTree.GetRoot()) self.RefreshPluginParams() self.RefreshButtons() @@ -361,20 +362,21 @@ last_selected = self.GetSelectedPluginName() self.GenerateTreeBranch(root, infos, True) self.PluginTree.Expand(self.PluginTree.GetRootItem()) - self.SelectedPluginByName(root,last_selected) + self.SelectedPluginByName(root, last_selected) self.RefreshPluginParams() def SelectedPluginByName(self, root, name): - toks = name.split('.',1) - item, root_cookie = self.PluginTree.GetFirstChild(root) - while item.IsOk(): - if self.PluginTree.GetPyData(item) == toks[0]: - if len(toks)>1: - return self.SelectedPluginByName(item, toks[1]) - else: - self.PluginTree.SelectItem(item, True) - return True - item, root_cookie = self.PluginTree.GetNextChild(root, root_cookie) + if name: + toks = name.split('.',1) + item, root_cookie = self.PluginTree.GetFirstChild(root) + while item.IsOk(): + if self.PluginTree.GetPyData(item) == toks[0]: + if len(toks)>1: + return self.SelectedPluginByName(item, toks[1]) + else: + self.PluginTree.SelectItem(item, True) + return True + item, root_cookie = self.PluginTree.GetNextChild(root, root_cookie) return False def GenerateTreeBranch(self, root, infos, first = False): @@ -712,6 +714,7 @@ result = self.PluginRoot.LoadProject(projectpath, self.Log) if not result: self.RefreshPluginTree() + self.PluginTree.SelectItem(self.PluginTree.GetRootItem()) self.RefreshButtons() self.RefreshMainMenu() else: