equal
deleted
inserted
replaced
39 import runtime |
39 import runtime |
40 from runtime.PyroServer import PyroServer |
40 from runtime.PyroServer import PyroServer |
41 from runtime.xenomai import TryPreloadXenomai |
41 from runtime.xenomai import TryPreloadXenomai |
42 from runtime import LogMessageAndException |
42 from runtime import LogMessageAndException |
43 from runtime import PlcStatus |
43 from runtime import PlcStatus |
|
44 from runtime.Stunnel import ensurePSK |
44 import util.paths as paths |
45 import util.paths as paths |
45 |
46 |
46 |
47 |
47 def version(): |
48 def version(): |
48 from version import app_version |
49 from version import app_version |
413 if havetwisted: |
414 if havetwisted: |
414 if havewx: |
415 if havewx: |
415 reactor.registerWxApp(app) |
416 reactor.registerWxApp(app) |
416 |
417 |
417 twisted_reactor_thread_id = None |
418 twisted_reactor_thread_id = None |
418 ui_thread = None |
419 ui_thread = None |
419 |
420 |
420 if havewx: |
421 if havewx: |
421 wx_eval_lock = Semaphore(0) |
422 wx_eval_lock = Semaphore(0) |
422 |
423 |
423 def statuschangeTskBar(status): |
424 def statuschangeTskBar(status): |
437 current_id = currentThread().ident |
438 current_id = currentThread().ident |
438 |
439 |
439 if ui_thread is not None \ |
440 if ui_thread is not None \ |
440 and ui_thread.ident != current_id \ |
441 and ui_thread.ident != current_id \ |
441 and (not havetwisted or ( |
442 and (not havetwisted or ( |
442 twisted_reactor_thread_id is not None |
443 twisted_reactor_thread_id is not None |
443 and twisted_reactor_thread_id != current_id)): |
444 and twisted_reactor_thread_id != current_id)): |
444 |
445 |
445 o = type('', (object,), dict(call=(tocall, args, kwargs), res=None)) |
446 o = type('', (object,), dict(call=(tocall, args, kwargs), res=None)) |
446 wx.CallAfter(wx_evaluator, o) |
447 wx.CallAfter(wx_evaluator, o) |
447 wx_eval_lock.acquire() |
448 wx_eval_lock.acquire() |
448 return o.res |
449 return o.res |
506 |
507 |
507 # Service name is used as an ID for stunnel's PSK |
508 # Service name is used as an ID for stunnel's PSK |
508 # Some extension may set 'servicename' to a computed ID or Serial Number |
509 # Some extension may set 'servicename' to a computed ID or Serial Number |
509 # instead of using commandline '-n' |
510 # instead of using commandline '-n' |
510 if servicename is not None and PSKpath is not None: |
511 if servicename is not None and PSKpath is not None: |
511 from runtime.Stunnel import ensurePSK |
|
512 ensurePSK(servicename, PSKpath) |
512 ensurePSK(servicename, PSKpath) |
513 |
513 |
514 runtime.CreatePLCObjectSingleton( |
514 runtime.CreatePLCObjectSingleton( |
515 WorkingDir, argv, statuschange, evaluator, pyruntimevars) |
515 WorkingDir, argv, statuschange, evaluator, pyruntimevars) |
516 |
516 |