def callHandler(self, script, model, method, action): ch = CallHandler(script, model, method, action, 0, self.busSys, self.busSes) ch.registerError(self.comarError) ch.registerDBusError(self.busError) ch.registerAuthError(self.busError) ch.registerCancel(self.cancelError) return ch
def callMethod(self, method, action): ch = CallHandler("grub", "Boot.Loader", method, action, self.winId(), self.busSys, self.busSes) ch.registerAuthError(self.comarError) ch.registerDBusError(self.busError) ch.registerCancel(self.cancelError) return ch
def callMethod(self, method, action, model="Net.Filter"): ch = CallHandler("iptables", model, method, action, self.winId(), self.busSys, self.busSes) ch.registerError(self.comarError) ch.registerAuthError(self.comarError) ch.registerDBusError(self.busError) ch.registerCancel(self.cancelError) return ch
def callMethod(self, method, action, handler, handleErrors, *args): ch = CallHandler("System.Manager", method, action, self.sysBus, self.sesBus) if handleErrors: ch.registerError(self.comarError) ch.registerAuthError(self.comarAuthError) ch.registerDBusError(self.busError) ch.registerCancel(self.cancelError) if handler: ch.registerDone(handler) ch.call(*args)
self.busSys = dbus.SystemBus() self.busSes = dbus.SessionBus() except dbus.DBusException: KMessageBox.error(self, i18n("Unable to connect to DBus."), i18n("DBus Error")) return False return True def callMethod(self, method, action, async = True, handleCancel = True): ch = CallHandler("baselayout", "User.Manager", method, action, self.winId(), async, self.busSys, self.busSes) ch.registerError(self.comarError) ch.registerAuthError(self.comarError) ch.registerDBusError(self.busError) if handleCancel: ch.registerCancel(self.cancelError) return ch def cancelError(self): message = i18n("You are not authorized for this operation.") KMessageBox.sorry(self, message, i18n("Error")) def busError(self, exception): KMessageBox.error(self, str(exception), i18n("DBus Error")) self.setupBusses() def comarError(self, exception): if "Access denied" in exception.message: message = i18n("You are not authorized for this operation.") KMessageBox.sorry(self, message, i18n("Error")) else: