예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
파일: ComarIface.py 프로젝트: Tayyib/uludag
    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)
예제 #5
0
            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: