diff -r 389f2046e495 -r d12779e971bd Viewer.py --- a/Viewer.py Fri Aug 22 17:18:12 2008 +0200 +++ b/Viewer.py Fri Aug 22 17:22:54 2008 +0200 @@ -108,10 +108,16 @@ message = "\"%s\" is already used by \"%s\"!"%(name, values[0]) else: blockname = values[2] + if len(values) > 3: + blockinputs = values[3] + else: + blockinputs = None if values[1] != "function" and blockname == "": - dialog = wx.TextEntryDialog(self.ParentWindow, "Block name", "Please enter a block name", "", wx.OK|wx.CANCEL|wx.CENTRE) - if dialog.ShowModal(): + dialog = wx.TextEntryDialog(self.ParentWindow.ParentWindow, "Block name", "Please enter a block name", "", wx.OK|wx.CANCEL|wx.CENTRE) + if dialog.ShowModal() == wx.ID_OK: blockname = dialog.GetValue() + else: + return dialog.Destroy() if blockname.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames()]: message = "\"%s\" pou already exists!"%blockname @@ -119,7 +125,7 @@ message = "\"%s\" element for this pou already exists!"%blockname else: id = self.ParentWindow.GetNewId() - block = FBD_Block(self.ParentWindow, values[0], blockname, id) + block = FBD_Block(self.ParentWindow, values[0], blockname, id, inputs = blockinputs) width, height = block.GetMinSize() if scaling is not None: x = round(float(x) / float(scaling[0])) * scaling[0] @@ -1432,6 +1438,7 @@ self.RefreshBuffer() self.RefreshScrollBars() self.ParentWindow.RefreshVariablePanel(self.TagName) + self.ParentWindow.RefreshInstancesTree() block.Refresh() dialog.Destroy() @@ -1721,6 +1728,7 @@ self.RefreshBuffer() self.RefreshScrollBars() self.ParentWindow.RefreshVariablePanel(self.TagName) + self.ParentWindow.RefreshInstancesTree() block.Refresh(rect) dialog.Destroy() @@ -2105,7 +2113,8 @@ for element in elements: element.RefreshModel() wx.CallAfter(self.ParentWindow.RefreshVariablePanel, self.TagName) - + wx.CallAfter(self.ParentWindow.RefreshInstancesTree) + def DeleteVariable(self, variable): connectors = variable.GetConnectors() if connectors["output"]: @@ -2238,6 +2247,8 @@ self.SelectedElement = None self.RefreshBuffer() self.RefreshScrollBars() + self.ParentWindow.RefreshVariablePanel(self.TagName) + self.ParentWindow.RefreshInstancesTree() self.RefreshRect(self.GetScrolledRect(rect), False) def Copy(self): @@ -2255,6 +2266,7 @@ self.RefreshBuffer() self.RefreshScrollBars() self.ParentWindow.RefreshVariablePanel(self.TagName) + self.ParentWindow.RefreshInstancesTree() def CanAddBlock(self, block): if self.CurrentLanguage == "SFC":