comparison frontends/src/quick_frontend/quick_app.py @ 627:d207c2186519

core, bridge, jp, quick_frontend: SàT stop more gracefully if bridge can't be initialised: - new BridgeInitError and BridgeExceptionNoService are in core.exceptions - D-Bus NotSupported is catched in bridge, and launch a BridgeInitError - BridgeInitError stop SàT core, jp, and quick_frontends with an explanation message. fix bug 27
author Goffi <goffi@goffi.org>
date Fri, 21 Jun 2013 02:00:37 +0200
parents 0730fc83ef51
children 7ea6d5a86e58
comparison
equal deleted inserted replaced
626:190ccc6dc36c 627:d207c2186519
15 # GNU Affero General Public License for more details. 15 # GNU Affero General Public License for more details.
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 import sys
20 from logging import debug, info, warning, error 21 from logging import debug, info, warning, error
21 from sat.tools.jid import JID 22 from sat.tools.jid import JID
22 from sat_frontends.bridge.DBus import DBusBridgeFrontend,BridgeExceptionNoService 23 from sat_frontends.bridge.DBus import DBusBridgeFrontend
24 from sat.core.exceptions import BridgeExceptionNoService, BridgeInitError
23 from sat_frontends.quick_frontend.quick_utils import escapePrivate, unescapePrivate 25 from sat_frontends.quick_frontend.quick_utils import escapePrivate, unescapePrivate
24 from optparse import OptionParser 26 from optparse import OptionParser
25 27
26 import sat_frontends.quick_frontend.constants 28 import sat_frontends.quick_frontend.constants
27 29
39 ## bridge ## 41 ## bridge ##
40 try: 42 try:
41 self.bridge=DBusBridgeFrontend() 43 self.bridge=DBusBridgeFrontend()
42 except BridgeExceptionNoService: 44 except BridgeExceptionNoService:
43 print(_(u"Can't connect to SàT backend, are you sure it's launched ?")) 45 print(_(u"Can't connect to SàT backend, are you sure it's launched ?"))
44 import sys 46 sys.exit(1)
47 except BridgeInitError:
48 print(_(u"Can't init bridge"))
45 sys.exit(1) 49 sys.exit(1)
46 self.bridge.register("connected", self.connected) 50 self.bridge.register("connected", self.connected)
47 self.bridge.register("disconnected", self.disconnected) 51 self.bridge.register("disconnected", self.disconnected)
48 self.bridge.register("connectionError", self.connectionError) 52 self.bridge.register("connectionError", self.connectionError)
49 self.bridge.register("newContact", self.newContact) 53 self.bridge.register("newContact", self.newContact)