beremiz

add i18n to PLC status

2016-12-01, Andrey Skvortsov
b1be42401522
Parents e17406dd4f06
Children 9277d3174744
add i18n to PLC status

Extra strings are added to the code to make mki18n.py to find these
strings in source files and put them into i18n/messages.pot.
--- a/ProjectController.py Thu Dec 01 16:59:16 2016 +0300
+++ b/ProjectController.py Thu Dec 01 18:30:34 2016 +0300
@@ -1269,17 +1269,27 @@
updated = True
self.AppFrame.RefreshStatusToolBar()
if status == "Disconnected":
- self.AppFrame.ConnectionStatusBar.SetStatusText(_(status), 1)
+ self.AppFrame.ConnectionStatusBar.SetStatusText(self.GetTextStatus(status), 1)
self.AppFrame.ConnectionStatusBar.SetStatusText('', 2)
else:
self.AppFrame.ConnectionStatusBar.SetStatusText(
_("Connected to URI: %s") % self.BeremizRoot.getURI_location().strip(), 1)
- self.AppFrame.ConnectionStatusBar.SetStatusText(_(status), 2)
+ self.AppFrame.ConnectionStatusBar.SetStatusText(self.GetTextStatus(status), 2)
return updated
+ def GetTextStatus(self, status):
+ msgs = {
+ "Started": _("Started"),
+ "Stopped": _("Stopped"),
+ "Empty": _("Empty"),
+ "Broken": _("Broken"),
+ "Disconnected": _("Disconnected")
+ }
+ return msgs.get(status, status)
+
def ShowPLCProgress(self, status = "", progress = 0):
self.AppFrame.ProgressStatusBar.Show()
- self.AppFrame.ConnectionStatusBar.SetStatusText(status, 1)
+ self.AppFrame.ConnectionStatusBar.SetStatusText(self.GetTextStatus(status), 1)
self.AppFrame.ProgressStatusBar.SetValue(progress)
def HidePLCProgress(self):