comparison src/cagou/core/cagou_main.py @ 72:1a324c682d8a

core: use onBridgeConnected and exit code 3 when bridge can't be imported
author Goffi <goffi@goffi.org>
date Sun, 18 Dec 2016 21:01:04 +0100
parents 1c738621bc8d
children 674b1fa3c945
comparison
equal deleted inserted replaced
71:8c9fe2c5aacc 72:1a324c682d8a
247 self.service = service 247 self.service = service
248 248
249 bridge_module = dynamic_import.bridge(bridge_name, 'sat_frontends.bridge') 249 bridge_module = dynamic_import.bridge(bridge_name, 'sat_frontends.bridge')
250 if bridge_module is None: 250 if bridge_module is None:
251 log.error(u"Can't import {} bridge".format(bridge_name)) 251 log.error(u"Can't import {} bridge".format(bridge_name))
252 sys.exit(1) 252 sys.exit(3)
253 else: 253 else:
254 log.info(u"Loading {} bridge".format(bridge_name)) 254 log.debug(u"Loading {} bridge".format(bridge_name))
255 super(Cagou, self).__init__(bridge_factory=bridge_module.Bridge, xmlui=xmlui, check_options=quick_utils.check_options, connect_bridge=False) 255 super(Cagou, self).__init__(bridge_factory=bridge_module.Bridge, xmlui=xmlui, check_options=quick_utils.check_options, connect_bridge=False)
256 self._import_kv() 256 self._import_kv()
257 self.app = CagouApp() 257 self.app = CagouApp()
258 self.app.host = self 258 self.app.host = self
259 self.media_dir = self.app.media_dir = config.getConfig(main_config, '', 'media_dir') 259 self.media_dir = self.app.media_dir = config.getConfig(main_config, '', 'media_dir')
266 def visible_widgets(self): 266 def visible_widgets(self):
267 for w_list in self._visible_widgets.itervalues(): 267 for w_list in self._visible_widgets.itervalues():
268 for w in w_list: 268 for w in w_list:
269 yield w 269 yield w
270 270
271 def _bridgeCb(self): 271 def onBridgeConnected(self):
272 super(Cagou, self)._bridgeCb()
273 self.bridge.getReady(self.onBackendReady) 272 self.bridge.getReady(self.onBackendReady)
274 273
275 def _bridgeEb(self, failure): 274 def _bridgeEb(self, failure):
276 if bridge_name == "pb" and sys.platform == "android": 275 if bridge_name == "pb" and sys.platform == "android":
277 try: 276 try: