remote_control to use exceptions.py and the latter to be included in POTFILES.in [please always do this when new files]

This commit is contained in:
Nikos Kouremenos 2005-12-01 17:49:45 +00:00
parent fa03f0498d
commit 618e89c480
2 changed files with 5 additions and 19 deletions

View file

@ -30,6 +30,7 @@ src/tabbed_chat_window.py
src/tooltips.py src/tooltips.py
src/vcard.py src/vcard.py
src/common/check_paths.py src/common/check_paths.py
src/common/exceptions.py
src/common/GnuPG.py src/common/GnuPG.py
src/common/GnuPGInterface.py src/common/GnuPGInterface.py
src/common/__init__.py src/common/__init__.py

View file

@ -23,6 +23,7 @@ import gtk
import os import os
import sys import sys
from common import exceptions
from common import gajim from common import gajim
from time import time from time import time
from common import i18n from common import i18n
@ -57,15 +58,15 @@ class Remote:
if 'dbus' not in globals() and not os.name == 'nt': if 'dbus' not in globals() and not os.name == 'nt':
print _('D-Bus python bindings are missing in this computer') print _('D-Bus python bindings are missing in this computer')
print _('D-Bus capabilities of Gajim cannot be used') print _('D-Bus capabilities of Gajim cannot be used')
raise DbusNotSupported() raise exceptions.DbusNotSupported
# dbus 0.23 leads to segfault with threads_init() # dbus 0.23 leads to segfault with threads_init()
if sys.version[:4] >= '2.4' and _version[1] < 30: if sys.version[:4] >= '2.4' and _version[1] < 30:
raise DbusNotSupported() raise exceptions.DbusNotSupported
try: try:
session_bus = dbus.SessionBus() session_bus = dbus.SessionBus()
except: except:
raise SessionBusNotPresent() raise exceptions.SessionBusNotPresent
if _version[1] >= 41: if _version[1] >= 41:
service = dbus.service.BusName(SERVICE, bus=session_bus) service = dbus.service.BusName(SERVICE, bus=session_bus)
@ -513,19 +514,3 @@ class SignalObject(DbusPrototype):
remove_contact = method(INTERFACE)(remove_contact) remove_contact = method(INTERFACE)(remove_contact)
add_contact = method(INTERFACE)(add_contact) add_contact = method(INTERFACE)(add_contact)
get_status = method(INTERFACE)(get_status) get_status = method(INTERFACE)(get_status)
class SessionBusNotPresent(Exception):
'''This exception indicates that there is no session daemon'''
def __init__(self):
Exception.__init__(self)
def __str__(self):
return _('Session bus is not available')
class DbusNotSupported(Exception):
'''D-Bus is not installed or python bindings are missing'''
def __init__(self):
Exception.__init__(self)
def __str__(self):
return _('D-Bus is not present on this machine or python module is missing')