diff options
-rw-r--r-- | lib/bb/event.py | 10 | ||||
-rw-r--r-- | lib/bb/server/process.py | 2 | ||||
-rw-r--r-- | lib/bb/server/xmlrpc.py | 2 |
3 files changed, 9 insertions, 5 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py index 3f96bcab..366bc418 100644 --- a/lib/bb/event.py +++ b/lib/bb/event.py @@ -69,6 +69,7 @@ _ui_handler_seq = 0 _event_handler_map = {} _catchall_handlers = {} _eventfilter = None +_uiready = False def execute_handler(name, handler, event, d): event.data = d @@ -113,7 +114,7 @@ def print_ui_queue(): """If we're exiting before a UI has been spawned, display any queued LogRecords to the console.""" logger = logging.getLogger("BitBake") - if not _ui_handlers: + if not _uiready: from bb.msg import BBLogFormatter console = logging.StreamHandler(sys.stdout) console.setFormatter(BBLogFormatter("%(levelname)s: %(message)s")) @@ -135,7 +136,7 @@ def print_ui_queue(): logger.handle(event) def fire_ui_handlers(event, d): - if not _ui_handlers: + if not _uiready: # No UI handlers registered yet, queue up the messages ui_queue.append(event) return @@ -219,7 +220,10 @@ def set_eventfilter(func): global _eventfilter _eventfilter = func -def register_UIHhandler(handler): +def register_UIHhandler(handler, mainui=False): + if mainui: + global _uiready + _uiready = True bb.event._ui_handler_seq = bb.event._ui_handler_seq + 1 _ui_handlers[_ui_handler_seq] = handler level, debug_domains = bb.msg.constructLogOptions() diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py index 3198635e..f022b86c 100644 --- a/lib/bb/server/process.py +++ b/lib/bb/server/process.py @@ -97,7 +97,7 @@ class ProcessServer(Process, BaseImplServer): def run(self): for event in bb.event.ui_queue: self.event_queue.put(event) - self.event_handle.value = bb.event.register_UIHhandler(self) + self.event_handle.value = bb.event.register_UIHhandler(self, True) bb.cooker.server_main(self.cooker, self.main) diff --git a/lib/bb/server/xmlrpc.py b/lib/bb/server/xmlrpc.py index f1a20672..b7647c19 100644 --- a/lib/bb/server/xmlrpc.py +++ b/lib/bb/server/xmlrpc.py @@ -99,7 +99,7 @@ class BitBakeServerCommands(): if (self.cooker.state in [bb.cooker.state.parsing, bb.cooker.state.running]): return None - self.event_handle = bb.event.register_UIHhandler(s) + self.event_handle = bb.event.register_UIHhandler(s, True) return self.event_handle def unregisterEventHandler(self, handlerNum): |