@@ -119,6 +119,10 @@ def set_bus(self, bus=None):
119
119
self ._bus = bus or get_mycroft_bus ()
120
120
self .setup_default_handlers ()
121
121
122
+ @property
123
+ def gui_disabled (self ) -> bool :
124
+ return Configuration ().get ("gui" , {}).get ("disable_gui" , False )
125
+
122
126
@property
123
127
def bus (self ):
124
128
"""
@@ -276,6 +280,8 @@ def gui_set(self, message: Message):
276
280
self .on_gui_changed_callback ()
277
281
278
282
def _sync_data (self ):
283
+ if self .gui_disabled :
284
+ return
279
285
if not self .bus :
280
286
raise RuntimeError ("bus not set, did you call self.bind() ?" )
281
287
data = self .__session_data .copy ()
@@ -322,6 +328,8 @@ def clear(self):
322
328
self .__session_data = {}
323
329
self ._pages = []
324
330
self .current_page_idx = - 1
331
+ if self .gui_disabled :
332
+ return
325
333
if not self .bus :
326
334
raise RuntimeError ("bus not set, did you call self.bind() ?" )
327
335
self .bus .emit (Message ("gui.clear.namespace" ,
@@ -337,6 +345,8 @@ def send_event(self, event_name: str,
337
345
params: json serializable object containing any parameters that
338
346
should be sent along with the request.
339
347
"""
348
+ if self .gui_disabled :
349
+ return
340
350
params = params or {}
341
351
if not self .bus :
342
352
raise RuntimeError ("bus not set, did you call self.bind() ?" )
@@ -442,6 +452,8 @@ def show_pages(self, page_names: List[str], index: int = 0,
442
452
self ._pages = page_names
443
453
self .current_page_idx = index
444
454
455
+ if self .gui_disabled :
456
+ return
445
457
# First sync any data...
446
458
data = self .__session_data .copy ()
447
459
data .update ({'__from' : self .skill_id })
@@ -470,6 +482,8 @@ def remove_pages(self, page_names: List[str]):
470
482
Request to remove a list of pages from the GUI.
471
483
@param page_names: list of page resources requested
472
484
"""
485
+ if self .gui_disabled :
486
+ return
473
487
if not self .bus :
474
488
raise RuntimeError ("bus not set, did you call self.bind() ?" )
475
489
if isinstance (page_names , str ):
@@ -489,6 +503,8 @@ def remove_all_pages(self, except_pages=None):
489
503
Request to remove all pages from the GUI.
490
504
@param except_pages: list of optional page resources to keep
491
505
"""
506
+ if self .gui_disabled :
507
+ return
492
508
if not self .bus :
493
509
raise RuntimeError ("bus not set, did you call self.bind() ?" )
494
510
self .bus .emit (Message ("gui.page.delete.all" ,
0 commit comments