--- a/dialogs/BlockPreviewDialog.py Mon Jun 10 00:55:57 2013 +0200
+++ b/dialogs/BlockPreviewDialog.py Mon Jun 10 01:15:39 2013 +0200
@@ -80,7 +80,8 @@
format = _("\"%s\" is a keyword. It can't be used!")
elif uppercase_block_name in self.Controller.GetProjectPouNames():
format = _("\"%s\" pou already exists!")
- elif (self.DefaultBlockName.upper() != uppercase_block_name and
+ elif ((self.DefaultBlockName is None or
+ self.DefaultBlockName.upper() != uppercase_block_name) and
uppercase_block_name in self.Controller.GetEditedElementVariables(
self.TagName)):
format = _("\"%s\" element for this pou already exists!")
--- a/dialogs/FBDBlockDialog.py Mon Jun 10 00:55:57 2013 +0200
+++ b/dialogs/FBDBlockDialog.py Mon Jun 10 01:15:39 2013 +0200
@@ -129,7 +129,7 @@
message = _("Form isn't complete. Name must be filled!")
if message is not None:
self.ShowMessage(message)
- elif name_enabled and self.TestBlockName(block_name):
+ elif not name_enabled or self.TestBlockName(block_name):
BlockPreviewDialog.OnOK(self, event)
def SetValues(self, values):
@@ -140,9 +140,10 @@
values.get("inputs", None))
for name, value in values.items():
if name == "name":
- self.DefaultBlockName = value
- if default_name_model.match(value) is None:
- self.CurrentBlockName = value
+ if value != "":
+ self.DefaultBlockName = value
+ if default_name_model.match(value) is None:
+ self.CurrentBlockName = value
self.BlockName.ChangeValue(value)
elif name == "extension":
self.Inputs.SetValue(value)