1 #!/usr/bin/env python |
1 #!/usr/bin/env python |
2 # -*- coding: utf-8 -*- |
2 # -*- coding: utf-8 -*- |
|
3 |
|
4 # This file is part of Beremiz, a Integrated Development Environment for |
|
5 # programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
3 # |
6 # |
4 #Copyright (C) 2015: Edouard TISSERANT |
7 # Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
5 # |
8 # |
6 #See COPYING file for copyrights details. |
9 # See COPYING file for copyrights details. |
7 # |
10 # |
8 #This library is free software; you can redistribute it and/or |
11 # This program is free software; you can redistribute it and/or |
9 #modify it under the terms of the GNU General Public |
12 # modify it under the terms of the GNU General Public License |
10 #License as published by the Free Software Foundation; either |
13 # as published by the Free Software Foundation; either version 2 |
11 #version 2.1 of the License, or (at your option) any later version. |
14 # of the License, or (at your option) any later version. |
12 # |
15 # |
13 #This library is distributed in the hope that it will be useful, |
16 # This program is distributed in the hope that it will be useful, |
14 #but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 #General Public License for more details. |
19 # GNU General Public License for more details. |
17 # |
20 # |
18 #You should have received a copy of the GNU General Public |
21 # You should have received a copy of the GNU General Public License |
19 #License along with this library; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
20 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
21 |
24 |
22 import sys, traceback, atexit |
25 import sys, traceback, atexit |
23 #from twisted.python import log |
26 #from twisted.python import log |
24 from twisted.internet import reactor, threads |
27 from twisted.internet import reactor, threads |
25 from autobahn.twisted import wamp |
28 from autobahn.twisted import wamp |
103 try: |
106 try: |
104 return threads.blockingCallFromThread( |
107 return threads.blockingCallFromThread( |
105 reactor, _WampSession.call, wampfuncname, |
108 reactor, _WampSession.call, wampfuncname, |
106 *args,**kwargs) |
109 *args,**kwargs) |
107 except TransportLost, e: |
110 except TransportLost, e: |
108 confnodesroot.logger.write_error("Connection lost!\n") |
111 confnodesroot.logger.write_error(_("Connection lost!\n")) |
109 confnodesroot._SetConnector(None) |
112 confnodesroot._SetConnector(None) |
110 except Exception,e: |
113 except Exception,e: |
111 errmess = traceback.format_exc() |
114 errmess = traceback.format_exc() |
112 confnodesroot.logger.write_error(errmess+"\n") |
115 confnodesroot.logger.write_error(errmess+"\n") |
113 print errmess |
116 print errmess |