# HG changeset patch # User lbessard # Date 1191599749 -7200 # Node ID ddf0cdd71558b64751a460c92591a2729827b6ef # Parent a20fb174f46ed55477db6687f8e578a5a9aa604d Adding support for refresh block list where beremiz loose focus (fixing bug on grid editors in plcopeneditor) diff -r a20fb174f46e -r ddf0cdd71558 Beremiz.py --- a/Beremiz.py Fri Oct 05 17:51:55 2007 +0200 +++ b/Beremiz.py Fri Oct 05 17:55:49 2007 +0200 @@ -260,6 +260,7 @@ self._init_utils() self.SetClientSize(wx.Size(1000, 600)) self.SetMenuBar(self.menuBar1) + self.Bind(wx.EVT_ACTIVATE, self.OnFrameActivated) self.MainSplitter = wx.SplitterWindow(id=ID_BEREMIZMAINSPLITTER, name='MainSplitter', parent=self, point=wx.Point(0, 0), @@ -332,7 +333,11 @@ self.RefreshPluginParams() self.RefreshButtons() self.RefreshMainMenu() - + + def OnFrameActivated(self, event): + if not event.GetActive(): + self.PluginRoot.RefreshPluginsBlockLists() + def RefreshButtons(self): if self.PluginRoot.HasProjectOpened(): self.PluginChilds.Enable(True) @@ -493,6 +498,7 @@ button.Bind(wx.EVT_BUTTON, self.GetButtonCallBackFunction(plugin, method), id=id) boxsizer.AddWindow(button, 0, border=5, flag=wx.GROW|wx.RIGHT) self.ParamsPanelMainSizer.Layout() + self.ParamsPanel.SetClientSize(self.ParamsPanel.GetClientSize()) # Refresh PluginChilds self.PluginChilds.Clear() @@ -575,10 +581,7 @@ def RefreshSizerElement(self, sizer, elements, path, clean = True): if clean: - if wx.VERSION >= (2, 7, 0): - sizer.Clear(True) - else: - self.ClearSizer(sizer) + sizer.Clear(True) first = True for element_infos in elements: if path: diff -r a20fb174f46e -r ddf0cdd71558 plugger.py --- a/plugger.py Fri Oct 05 17:51:55 2007 +0200 +++ b/plugger.py Fri Oct 05 17:55:49 2007 +0200 @@ -665,10 +665,13 @@ # Update PLCOpenEditor Plugin Block types from loaded plugins def RefreshPluginsBlockLists(self): - ClearPluginTypes() - AddPluginBlockList(self.BlockTypesFactory()) - for child in self.IterChilds(): - AddPluginBlockList(child.BlockTypesFactory()) + if getattr(self, "PluggedChilds", None) is not None: + ClearPluginTypes() + AddPluginBlockList(self.BlockTypesFactory()) + for child in self.IterChilds(): + AddPluginBlockList(child.BlockTypesFactory()) + if self.PLCEditor is not None: + self.PLCEditor.RefreshEditor() def PlugPath(self, PlugName=None): return self.ProjectPath @@ -871,7 +874,7 @@ new_dialog.Show() def _EditPLC(self, logger): - if not self.PLCEditor: + if self.PLCEditor is None: self.RefreshPluginsBlockLists() def _onclose(): self.PLCEditor = None