--- a/Viewer.py Fri Oct 05 18:01:50 2007 +0200
+++ b/Viewer.py Fri Oct 05 18:11:27 2007 +0200
@@ -73,16 +73,23 @@
message.ShowModal()
message.Destroy()
else:
+ blockname = values[2]
+ 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():
+ blockname = dialog.GetValue()
+ dialog.Destroy()
id = self.ParentWindow.GetNewId()
- block = FBD_Block(self.ParentWindow, values[0], values[2], id)
+ block = FBD_Block(self.ParentWindow, values[0], blockname, id)
block.SetPosition(x, y)
width, height = block.GetMinSize()
block.SetSize(width, height)
self.ParentWindow.AddBlock(block)
- self.ParentWindow.Controler.AddCurrentElementEditingBlock(id, values[0], values[2])
+ self.ParentWindow.Controler.AddCurrentElementEditingBlock(id, values[0], blockname)
self.ParentWindow.RefreshBlockModel(block)
self.ParentWindow.RefreshBuffer()
self.ParentWindow.RefreshScrollBars()
+ self.ParentWindow.ParentWindow.RefreshEditor()
self.ParentWindow.Refresh()
elif values[1] != "location":
id = self.ParentWindow.GetNewId()
@@ -920,7 +927,7 @@
self.SelectedElement.Delete()
self.SelectedElement = None
self.Refresh(False)
- if not self.SavedMode:
+ if self.Mode != MODE_SELECTION and not self.SavedMode:
wx.CallAfter(self.ParentWindow.ResetCurrentMode)
event.Skip()