equal
deleted
inserted
replaced
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
25 |
25 |
26 import os |
26 import os |
27 import sys |
27 import sys |
28 import getopt |
28 import getopt |
|
29 import threading |
29 from threading import Thread |
30 from threading import Thread |
|
31 import traceback |
|
32 import __builtin__ |
|
33 import Pyro.core as pyro |
|
34 |
|
35 from runtime import PLCObject, PLCprint, ServicePublisher |
|
36 import util.paths as paths |
30 |
37 |
31 |
38 |
32 def usage(): |
39 def usage(): |
33 print """ |
40 print """ |
34 Usage of Beremiz PLC execution service :\n |
41 Usage of Beremiz PLC execution service :\n |
99 extensions.append(a) |
106 extensions.append(a) |
100 else: |
107 else: |
101 usage() |
108 usage() |
102 sys.exit() |
109 sys.exit() |
103 |
110 |
104 import util.paths as paths |
111 |
105 beremiz_dir = paths.AbsDir(__file__) |
112 beremiz_dir = paths.AbsDir(__file__) |
106 |
113 |
107 if len(argv) > 1: |
114 if len(argv) > 1: |
108 usage() |
115 usage() |
109 sys.exit() |
116 sys.exit() |
112 os.chdir(WorkingDir) |
119 os.chdir(WorkingDir) |
113 elif len(argv) == 0: |
120 elif len(argv) == 0: |
114 WorkingDir = os.getcwd() |
121 WorkingDir = os.getcwd() |
115 argv = [WorkingDir] |
122 argv = [WorkingDir] |
116 |
123 |
117 import __builtin__ |
|
118 if __name__ == '__main__': |
124 if __name__ == '__main__': |
119 __builtin__.__dict__['_'] = lambda x: x |
125 __builtin__.__dict__['_'] = lambda x: x |
120 |
126 |
121 |
127 |
122 def Bpath(*args): |
128 def Bpath(*args): |
373 currenticon = self.MakeIcon(stopicon) |
379 currenticon = self.MakeIcon(stopicon) |
374 else: |
380 else: |
375 currenticon = self.MakeIcon(defaulticon) |
381 currenticon = self.MakeIcon(defaulticon) |
376 self.SetIcon(currenticon, "Beremiz Service") |
382 self.SetIcon(currenticon, "Beremiz Service") |
377 |
383 |
378 from runtime import PLCObject, PLCprint, ServicePublisher |
|
379 import Pyro.core as pyro |
|
380 |
384 |
381 if not os.path.isdir(WorkingDir): |
385 if not os.path.isdir(WorkingDir): |
382 os.mkdir(WorkingDir) |
386 os.mkdir(WorkingDir) |
383 |
387 |
384 |
388 |
529 WorkingDir, argv, autostart, |
533 WorkingDir, argv, autostart, |
530 statuschange, pyruntimevars=pyruntimevars) |
534 statuschange, pyruntimevars=pyruntimevars) |
531 |
535 |
532 |
536 |
533 # Exception hooks s |
537 # Exception hooks s |
534 import threading |
|
535 import traceback |
|
536 |
538 |
537 |
539 |
538 def LogException(*exp): |
540 def LogException(*exp): |
539 if pyroserver.plcobj is not None: |
541 if pyroserver.plcobj is not None: |
540 pyroserver.plcobj.LogMessage(0, '\n'.join(traceback.format_exception(*exp))) |
542 pyroserver.plcobj.LogMessage(0, '\n'.join(traceback.format_exception(*exp))) |