Beremiz_service.py
changeset 1834 cd42b426028b
parent 1831 56b48961cc68
child 1841 9fd29e8b1393
equal deleted inserted replaced
1833:2269739dd098 1834:cd42b426028b
    27 from __future__ import print_function
    27 from __future__ import print_function
    28 import os
    28 import os
    29 import sys
    29 import sys
    30 import getopt
    30 import getopt
    31 import threading
    31 import threading
    32 from threading import Thread, currentThread
    32 from threading import Thread, currentThread, Semaphore
    33 import traceback
    33 import traceback
    34 import __builtin__
    34 import __builtin__
    35 import Pyro.core as pyro
    35 import Pyro.core as pyro
    36 
    36 
    37 from runtime import PLCObject, PLCprint, ServicePublisher
    37 from runtime import PLCObject, PLCprint, ServicePublisher
   494 
   494 
   495     if havewx:
   495     if havewx:
   496         reactor.registerWxApp(app)
   496         reactor.registerWxApp(app)
   497 
   497 
   498 if havewx:
   498 if havewx:
   499     from threading import Semaphore
       
   500     wx_eval_lock = Semaphore(0)
   499     wx_eval_lock = Semaphore(0)
   501     main_thread = currentThread()
   500     main_thread = currentThread()
   502 
   501 
   503     def statuschangeTskBar(status):
   502     def statuschangeTskBar(status):
   504         wx.CallAfter(taskbar_instance.UpdateIcon, status)
   503         wx.CallAfter(taskbar_instance.UpdateIcon, status)
   566 installThreadExcepthook()
   565 installThreadExcepthook()
   567 
   566 
   568 if havetwisted:
   567 if havetwisted:
   569     if webport is not None:
   568     if webport is not None:
   570         try:
   569         try:
   571             import runtime.NevowServer as NS
   570             import runtime.NevowServer as NS  # pylint: disable=C0412
   572         except Exception, e:
   571         except Exception, e:
   573             print(_("Nevow/Athena import failed :"), e)
   572             print(_("Nevow/Athena import failed :"), e)
   574             webport = None
   573             webport = None
   575         NS.WorkingDir = WorkingDir
   574         NS.WorkingDir = WorkingDir
   576 
   575 
   577     if wampconf is not None:
   576     if wampconf is not None:
   578         try:
   577         try:
   579             import runtime.WampClient as WC
   578             import runtime.WampClient as WC  # pylint: disable=C0412
   580         except Exception, e:
   579         except Exception, e:
   581             print(_("WAMP import failed :"), e)
   580             print(_("WAMP import failed :"), e)
   582             wampconf = None
   581             wampconf = None
   583 
   582 
   584 # Load extensions
   583 # Load extensions