--- a/Viewer.py Fri Jul 24 12:49:57 2009 +0200
+++ b/Viewer.py Fri Jul 24 17:12:59 2009 +0200
@@ -208,27 +208,27 @@
try:
values = eval(data)
except:
- message = "Invalid value \"%s\" for viewer block"%data
+ message = _("Invalid value \"%s\" for viewer block")%data
values = None
if not isinstance(values, TupleType):
- message = "Invalid value \"%s\" for viewer block"%data
+ message = _("Invalid value \"%s\" for viewer block")%data
values = None
if values is not None:
if values[1] == "debug":
pass
elif values[1] == "program":
- message = "Programs can't be used by other POUs!"
+ message = _("Programs can't be used by other POUs!")
elif values[1] in ["function", "functionBlock", "program"]:
name, type = self.ParentWindow.Controler.GetEditedElementType(self.ParentWindow.GetTagName(), self.ParentWindow.Debug)
words = self.ParentWindow.TagName.split("::")
if name == values[0]:
- message = "\"%s\" can't use itself!"%name
+ message = _("\"%s\" can't use itself!")%name
elif type == "function" and values[1] != "function":
- message = "Function Blocks can't be used in Functions!"
+ message = _("Function Blocks can't be used in Functions!")
elif words[0] == "T" and values[1] != "function":
- message = "Function Blocks can't be used in Transitions!"
+ message = _("Function Blocks can't be used in Transitions!")
elif self.ParentWindow.Controler.PouIsUsedBy(name, values[0], self.ParentWindow.Debug):
- message = "\"%s\" is already used by \"%s\"!"%(name, values[0])
+ message = _("\"%s\" is already used by \"%s\"!")%(name, values[0])
else:
blockname = values[2]
if len(values) > 3:
@@ -243,9 +243,9 @@
return
dialog.Destroy()
if blockname.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
- message = "\"%s\" pou already exists!"%blockname
+ message = _("\"%s\" pou already exists!")%blockname
elif blockname.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(self.ParentWindow.GetTagName(), self.ParentWindow.Debug)]:
- message = "\"%s\" element for this pou already exists!"%blockname
+ message = _("\"%s\" element for this pou already exists!")%blockname
else:
id = self.ParentWindow.GetNewId()
block = FBD_Block(self.ParentWindow, values[0], blockname, id, inputs = blockinputs)
@@ -283,9 +283,9 @@
else:
self.AddParentVariableBlock(x, y, scaling, var_class, values[0], values[2])
else:
- message = "Unknown variable \"%s\" this POU!" % values[0]
+ message = _("Unknown variable \"%s\" for this POU!") % values[0]
else:
- message = "Variable don't belong to this POU!"
+ message = _("Variable don't belong to this POU!")
if message is not None:
wx.CallAfter(self.ShowMessage, message)
@@ -332,7 +332,7 @@
self.ParentWindow.Refresh(False)
def ShowMessage(self, message):
- message = wx.MessageDialog(self.ParentWindow, message, "Error", wx.OK|wx.ICON_ERROR)
+ message = wx.MessageDialog(self.ParentWindow, message, _("Error"), wx.OK|wx.ICON_ERROR)
message.ShowModal()
message.Destroy()
@@ -355,18 +355,18 @@
def _init_coll_AlignmentMenu_Items(self, parent):
# Create menu items
AppendMenu(parent, help='', id=ID_VIEWERALIGNMENTMENUITEMS0,
- kind=wx.ITEM_NORMAL, text=u'Left')
+ kind=wx.ITEM_NORMAL, text=_(u'Left'))
AppendMenu(parent, help='', id=ID_VIEWERALIGNMENTMENUITEMS1,
- kind=wx.ITEM_NORMAL, text=u'Center')
+ kind=wx.ITEM_NORMAL, text=_(u'Center'))
AppendMenu(parent, help='', id=ID_VIEWERALIGNMENTMENUITEMS2,
- kind=wx.ITEM_NORMAL, text=u'Right')
+ kind=wx.ITEM_NORMAL, text=_(u'Right'))
parent.AppendSeparator()
AppendMenu(parent, help='', id=ID_VIEWERALIGNMENTMENUITEMS4,
- kind=wx.ITEM_NORMAL, text=u'Top')
+ kind=wx.ITEM_NORMAL, text=_(u'Top'))
AppendMenu(parent, help='', id=ID_VIEWERALIGNMENTMENUITEMS5,
- kind=wx.ITEM_NORMAL, text=u'Middle')
+ kind=wx.ITEM_NORMAL, text=_(u'Middle'))
AppendMenu(parent, help='', id=ID_VIEWERALIGNMENTMENUITEMS6,
- kind=wx.ITEM_NORMAL, text=u'Bottom')
+ kind=wx.ITEM_NORMAL, text=_(u'Bottom'))
# Link menu event to corresponding called functions
self.Bind(wx.EVT_MENU, self.OnAlignLeftMenu,
id=ID_VIEWERALIGNMENTMENUITEMS0)
@@ -385,35 +385,35 @@
def _init_coll_ContextualMenu_Items(self, parent):
# Create menu items
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS0,
- kind=wx.ITEM_RADIO, text=u'No Modifier')
+ kind=wx.ITEM_RADIO, text=_(u'No Modifier'))
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS1,
- kind=wx.ITEM_RADIO, text=u'Negated')
+ kind=wx.ITEM_RADIO, text=_(u'Negated'))
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS2,
- kind=wx.ITEM_RADIO, text=u'Rising Edge')
+ kind=wx.ITEM_RADIO, text=_(u'Rising Edge'))
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS3,
- kind=wx.ITEM_RADIO, text=u'Falling Edge')
+ kind=wx.ITEM_RADIO, text=_(u'Falling Edge'))
parent.AppendSeparator()
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS5,
- kind=wx.ITEM_NORMAL, text=u'Add Wire Segment')
+ kind=wx.ITEM_NORMAL, text=_(u'Add Wire Segment'))
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS6,
- kind=wx.ITEM_NORMAL, text=u'Delete Wire Segment')
+ kind=wx.ITEM_NORMAL, text=_(u'Delete Wire Segment'))
parent.AppendSeparator()
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS8,
- kind=wx.ITEM_NORMAL, text=u'Add Divergence Branch')
+ kind=wx.ITEM_NORMAL, text=_(u'Add Divergence Branch'))
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS9,
- kind=wx.ITEM_NORMAL, text=u'Delete Divergence Branch')
+ kind=wx.ITEM_NORMAL, text=_(u'Delete Divergence Branch'))
parent.AppendSeparator()
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS11,
- kind=wx.ITEM_NORMAL, text=u'Clear Execution Order')
+ kind=wx.ITEM_NORMAL, text=_(u'Clear Execution Order'))
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS12,
- kind=wx.ITEM_NORMAL, text=u'Reset Execution Order')
+ kind=wx.ITEM_NORMAL, text=_(u'Reset Execution Order'))
parent.AppendSeparator()
- parent.AppendMenu(ID_VIEWERCONTEXTUALMENUITEMS14, "Alignment", self.AlignmentMenu)
+ parent.AppendMenu(ID_VIEWERCONTEXTUALMENUITEMS14, _("Alignment"), self.AlignmentMenu)
parent.AppendSeparator()
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS16,
- kind=wx.ITEM_NORMAL, text=u'Edit Block')
+ kind=wx.ITEM_NORMAL, text=_(u'Edit Block'))
AppendMenu(parent, help='', id=ID_VIEWERCONTEXTUALMENUITEMS17,
- kind=wx.ITEM_NORMAL, text=u'Delete')
+ kind=wx.ITEM_NORMAL, text=_(u'Delete'))
# Link menu event to corresponding called functions
self.Bind(wx.EVT_MENU, self.OnNoModifierMenu,
id=ID_VIEWERCONTEXTUALMENUITEMS0)
@@ -1793,9 +1793,9 @@
def AddNewComment(self, bbox):
if wx.VERSION >= (2, 5, 0):
- dialog = wx.TextEntryDialog(self.ParentWindow, "Edit comment", "Please enter comment text", "", wx.OK|wx.CANCEL|wx.TE_MULTILINE)
+ dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), "", wx.OK|wx.CANCEL|wx.TE_MULTILINE)
else:
- dialog = wx.TextEntryDialog(self.ParentWindow, "Edit comment", "Please enter comment text", "", wx.OK|wx.CANCEL)
+ dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), "", wx.OK|wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValue()
id = self.GetNewId()
@@ -1968,7 +1968,7 @@
for block in self.Blocks.itervalues():
if isinstance(block, SFC_Step):
choices.append(block.GetName())
- dialog = wx.SingleChoiceDialog(self.ParentWindow, "Add a new jump", "Please choose a target", choices, wx.OK|wx.CANCEL)
+ dialog = wx.SingleChoiceDialog(self.ParentWindow, _("Add a new jump"), _("Please choose a target"), choices, wx.OK|wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
id = self.GetNewId()
value = dialog.GetStringSelection()
@@ -2207,9 +2207,9 @@
dialog.SetMinStepSize(step.GetSize())
values = {"name" : step.GetName()}
connectors = step.GetConnectors()
- values["input"] = connectors["input"] != None
- values["output"] = connectors["output"] != None
- values["action"] = connectors["action"] != None
+ values["input"] = len(connectors["inputs"]) > 0
+ values["output"] = len(connectors["outputs"]) > 0
+ values["action"] = step.GetActionConnector() != None
dialog.SetValues(values)
if dialog.ShowModal() == wx.ID_OK:
values = dialog.GetValues()
@@ -2259,7 +2259,7 @@
for block in self.Blocks.itervalues():
if isinstance(block, SFC_Step):
choices.append(block.GetName())
- dialog = wx.SingleChoiceDialog(self.ParentWindow, "Edit jump target", "Please choose a target", choices, wx.OK|wx.CANCEL)
+ dialog = wx.SingleChoiceDialog(self.ParentWindow, _("Edit jump target"), _("Please choose a target"), choices, wx.OK|wx.CANCEL)
dialog.SetSelection(choices.index(jump.GetTarget()))
if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetStringSelection()
@@ -2294,9 +2294,9 @@
def EditCommentContent(self, comment):
if wx.VERSION >= (2, 5, 0):
- dialog = wx.TextEntryDialog(self.ParentWindow, "Edit comment", "Please enter comment text", comment.GetContent(), wx.OK|wx.CANCEL|wx.TE_MULTILINE)
+ dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), comment.GetContent(), wx.OK|wx.CANCEL|wx.TE_MULTILINE)
else:
- dialog = wx.TextEntryDialog(self.ParentWindow, "Edit comment", "Please enter comment text", comment.GetContent(), wx.OK|wx.CANCEL)
+ dialog = wx.TextEntryDialog(self.ParentWindow, _("Edit comment"), _("Please enter comment text"), comment.GetContent(), wx.OK|wx.CANCEL)
if dialog.ShowModal() == wx.ID_OK:
value = dialog.GetValue()
rect = comment.GetRedrawRect(1, 1)