497 if havewx: |
497 if havewx: |
498 reactor.registerWxApp(app) |
498 reactor.registerWxApp(app) |
499 |
499 |
500 if havewx: |
500 if havewx: |
501 wx_eval_lock = Semaphore(0) |
501 wx_eval_lock = Semaphore(0) |
|
502 # FIXME : beware wx mainloop is _not_ running in main thread |
502 # main_thread = currentThread() |
503 # main_thread = currentThread() |
503 |
504 |
504 def statuschangeTskBar(status): |
505 def statuschangeTskBar(status): |
505 wx.CallAfter(taskbar_instance.UpdateIcon, status) |
506 wx.CallAfter(taskbar_instance.UpdateIcon, status) |
506 |
507 |
510 tocall, args, kwargs = obj.call |
511 tocall, args, kwargs = obj.call |
511 obj.res = default_evaluator(tocall, *args, **kwargs) |
512 obj.res = default_evaluator(tocall, *args, **kwargs) |
512 wx_eval_lock.release() |
513 wx_eval_lock.release() |
513 |
514 |
514 def evaluator(tocall, *args, **kwargs): |
515 def evaluator(tocall, *args, **kwargs): |
|
516 # FIXME : should implement anti-deadlock |
515 # if main_thread == currentThread(): |
517 # if main_thread == currentThread(): |
516 # # avoid dead lock if called from the wx mainloop |
518 # # avoid dead lock if called from the wx mainloop |
517 # return default_evaluator(tocall, *args, **kwargs) |
519 # return default_evaluator(tocall, *args, **kwargs) |
518 # else: |
520 # else: |
519 o = type('', (object,), dict(call=(tocall, args, kwargs), res=None)) |
521 o = type('', (object,), dict(call=(tocall, args, kwargs), res=None)) |