--- a/Beremiz.py Wed Dec 07 18:25:37 2016 +0300
+++ b/Beremiz.py Wed Dec 07 18:32:34 2016 +0300
@@ -574,7 +574,7 @@
{False : "-x 0", True :"-x 1"}[taskbaricon],
self.local_runtime_tmpdir),
- timeout=500, keyword = "working",
+ timeout=500, keyword = self.local_runtime_tmpdir, cwd = self.local_runtime_tmpdir)
self.local_runtime.spin()
--- a/Beremiz_service.py Wed Dec 07 18:25:37 2016 +0300
+++ b/Beremiz_service.py Wed Dec 07 18:32:34 2016 +0300
@@ -112,6 +112,48 @@
if __name__ == '__main__':
__builtin__.__dict__['_'] = lambda x: x
+ return os.path.join(beremiz_dir,*args) + # Import module for internationalization + # Get folder containing translation files + localedir = os.path.join(beremiz_dir,"locale") + # Get the default language + langid = wx.LANGUAGE_DEFAULT + # Define translation domain (name of translation files) + loc = __builtin__.__dict__.get('loc', None) + loc = wx.Locale(langid) + __builtin__.__dict__['loc'] = loc + # Define location for searching translation files + loc.AddCatalogLookupPathPrefix(localedir) + default_locale = locale.getdefaultlocale()[1] + # sys.stdout.encoding = default_locale + # if Beremiz_service is started from Beremiz IDE + # sys.stdout.encoding is None (that means 'ascii' encoding'). + # And unicode string returned by wx.GetTranslation() are + # automatically converted to 'ascii' string. + def unicode_translation(message): + return wx.GetTranslation(message).encode(default_locale) + if __name__ == '__main__': + __builtin__.__dict__['_'] = unicode_translation + # __builtin__.__dict__['_'] = wx.GetTranslation @@ -133,34 +175,8 @@
app = wx.PySimpleApp(redirect=False)
app.SetTopWindow(wx.Frame(None, -1))
- # Import module for internationalization
- return os.path.join(beremiz_dir,*args)
- # Get folder containing translation files
- localedir = os.path.join(beremiz_dir,"locale")
- # Get the default language
- langid = wx.LANGUAGE_DEFAULT
- # Define translation domain (name of translation files)
- loc = __builtin__.__dict__.get('loc', None)
- loc = wx.Locale(langid)
- __builtin__.__dict__['loc'] = loc
- # Define location for searching translation files
- loc.AddCatalogLookupPathPrefix(localedir)
- def unicode_translation(message):
- return wx.GetTranslation(message).encode("utf-8")
- if __name__ == '__main__':
- __builtin__.__dict__['_'] = wx.GetTranslation#unicode_translation
defaulticon = wx.Image(Bpath("images", "brz.png"))
starticon = wx.Image(Bpath("images", "icoplay24.png"))
@@ -175,7 +191,7 @@
- def __init__(self, parent, message, caption = "Please enter text", defaultValue = "",
+ def __init__(self, parent, message, caption = _("Please enter text"), defaultValue = "", style = wx.OK|wx.CANCEL|wx.CENTRE, pos = wx.DefaultPosition):
wx.TextEntryDialog.__init__(self, parent, message, caption, defaultValue, style, pos)
@@ -406,9 +422,13 @@
uri = self.daemon.connect(self.plcobj,"PLCObject")
- print "Pyro port :",self.port
- print "Pyro object's uri :",uri
- print "Current working directory :",self.workdir
+ print _("Pyro port :"), self.port + print _("Pyro object's uri :"), uri + # Beremiz IDE detects daemon start by looking + # for self.workdir in the daemon's stdout. + # Therefore don't delete the following line + print _("Current working directory :"), self.workdir # Configure and publish service
# Not publish service if localhost in address params
@@ -416,7 +436,7 @@
self.ip_addr is not None and
self.ip_addr != "localhost" and
self.ip_addr != "127.0.0.1"):
- print "Publishing service on local network"
+ print _("Publishing service on local network") self.servicepublisher = ServicePublisher.ServicePublisher()
self.servicepublisher.RegisterService(self.servicename, self.ip_addr, self.port)
@@ -451,7 +471,7 @@
- print "Twisted unavailable."
+ print _("Twisted unavailable.") @@ -529,7 +549,7 @@
import runtime.NevowServer as NS
- print "Nevow/Athena import failed :", e
+ print _("Nevow/Athena import failed :"), e NS.WorkingDir = WorkingDir
@@ -537,7 +557,7 @@
import runtime.WampClient as WC
- print "WAMP import failed :", e
+ print _("WAMP import failed :"), e @@ -553,7 +573,7 @@
pyruntimevars["website"] = website
statuschange.append(NS.website_statuslistener_factory(website))
- print "Nevow Web service failed.", e
+ print _("Nevow Web service failed. "), e if wampconf is not None :
@@ -561,7 +581,7 @@
pyruntimevars["wampsession"] = WC.GetSession
- print "WAMP client startup failed.", e
+ print _("WAMP client startup failed. "), e if havetwisted or havewx:
--- a/connectors/PYRO/__init__.py Wed Dec 07 18:25:37 2016 +0300
+++ b/connectors/PYRO/__init__.py Wed Dec 07 18:32:34 2016 +0300
@@ -112,10 +112,10 @@
return func(*args, **kwargs)
except Pyro.errors.ConnectionClosedError, e:
- confnodesroot.logger.write_error("Connection lost!\n")
+ confnodesroot.logger.write_error(_("Connection lost!\n")) confnodesroot._SetConnector(None)
except Pyro.errors.ProtocolError, e:
- confnodesroot.logger.write_error("Pyro exception: " + str(e) + "\n")
+ confnodesroot.logger.write_error(_("Pyro exception: %s\n") % e) # confnodesroot.logger.write_error(traceback.format_exc())
errmess = ''.join(Pyro.util.getPyroTraceback(e))
--- a/connectors/WAMP/__init__.py Wed Dec 07 18:25:37 2016 +0300
+++ b/connectors/WAMP/__init__.py Wed Dec 07 18:32:34 2016 +0300
@@ -108,7 +108,7 @@
reactor, _WampSession.call, wampfuncname,
- confnodesroot.logger.write_error("Connection lost!\n")
+ confnodesroot.logger.write_error(_("Connection lost!\n")) confnodesroot._SetConnector(None)
errmess = traceback.format_exc()
--- a/runtime/NevowServer.py Wed Dec 07 18:25:37 2016 +0300
+++ b/runtime/NevowServer.py Wed Dec 07 18:32:34 2016 +0300
@@ -178,7 +178,7 @@
reactor.listenTCP(port, site)
- print "Http interface port :",port
+ print _("HTTP interface port :"), port