Frontends: management of unlaunched SàT Backend (information message and exit)
DBus Bridge Frontend: added an exception to manage unlaunched SàT Backend (BridgeExceptionNoService) Quick App, jp: a message is print when the previous exception is launched
This commit is contained in:
parent
489cbcfebf
commit
d2ca8812df
1 changed files with 29 additions and 11 deletions
|
|
@ -22,16 +22,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
from bridge_frontend import BridgeFrontend
|
||||
import dbus, dbus.glib
|
||||
|
||||
class BridgeExceptionNoService(Exception):
|
||||
pass
|
||||
|
||||
class DBusBridgeFrontend(BridgeFrontend):
|
||||
def __init__(self):
|
||||
self.sessions_bus = dbus.SessionBus()
|
||||
self.db_object = self.sessions_bus.get_object('org.goffi.SAT',
|
||||
'/org/goffi/SAT/bridge')
|
||||
self.db_comm_iface = dbus.Interface(self.db_object,
|
||||
dbus_interface='org.goffi.SAT.communication')
|
||||
self.db_req_iface = dbus.Interface(self.db_object,
|
||||
dbus_interface='org.goffi.SAT.request')
|
||||
try:
|
||||
self.sessions_bus = dbus.SessionBus()
|
||||
self.db_object = self.sessions_bus.get_object('org.goffi.SAT',
|
||||
'/org/goffi/SAT/bridge')
|
||||
self.db_comm_iface = dbus.Interface(self.db_object,
|
||||
dbus_interface='org.goffi.SAT.communication')
|
||||
self.db_req_iface = dbus.Interface(self.db_object,
|
||||
dbus_interface='org.goffi.SAT.request')
|
||||
except dbus.exceptions.DBusException,e:
|
||||
if e._dbus_error_name=='org.freedesktop.DBus.Error.ServiceUnknown':
|
||||
raise BridgeExceptionNoService
|
||||
else:
|
||||
raise e
|
||||
#props = self.db_comm_iface.getProperties()
|
||||
|
||||
def register(self, functionName, handler, iface="communication"):
|
||||
|
|
|
|||
Loading…
Reference in a new issue