Esempio n. 1
0
class ProcessConfig:
    argv = dbus_attr(List(Str()))
    monitor = dbus_attr(Bool(), default=False)
    restart = dbus_attr(Bool(), default=False)
    cleanup = dbus_attr(Bool(), default=False)
    env = dbus_attr(Dict(Str(), Str()))
    cwd = dbus_attr(Str())
Esempio n. 2
0
class BaseConfig:
    applications = subconfig(ApplicationsConfig)
    autostart = subconfig(AutostartConfig)
    dbus = subconfig(DBusConfig)
    executors = subconfig(ExecutorsConfig)
    format = subconfig(FormatConfig)
    logger = subconfig(LoggerConfig)
    menu = subconfig(MenuConfig)
    meta = subconfig(MetaConfig)
    mime = subconfig(MimeConfig)
    urls = dbus_attr(Dict(Str(), Str()))
Esempio n. 3
0
def dbus_service(thing_cls):
    svc = Service("some.namespace")

    a = svc.object("/thing/A")

    @a.method([Str()], Bool())
    def method_one(s):
        assert type(s) == str
        return s == "numberwang"

    @a.method([thing_cls], thing_cls)
    def method_two(thing):
        assert isinstance(thing, thing_cls)
        return thing_cls("pong")

    a.signal("signal_a", Str())
    a.signal("signal_b", thing_cls)

    a.property("property_u", Str(), "pony", writeable=True)
    a.property("property_v", Bool(), True)

    b = svc.object("/thing/B")

    @b.method([thing_cls], Str())
    def method_three(thing):
        assert isinstance(thing, thing_cls)
        return "that's right"

    @b.method([Bool()], Str())
    def method_four(b):
        assert type(b) == bool
        return "that's not it chief"

    b.signal("signal_c", Bool())
    b.signal("signal_d", thing_cls)

    b.property("property_w", Int32(), 12)

    return dict(
        svc=svc,
        a=a,
        b=b,
        method_one=method_one,
        method_two=method_two,
        method_three=method_three,
        method_four=method_four,
    )
Esempio n. 4
0
class ProcessState:
    name = dbus_attr(Str(), default="???")
    state = dbus_attr(Str(), default="UNKNOWN")
    restart = dbus_attr(Bool(), default=False)
    threshold = dbus_attr(Int64())
    killTime = dbus_attr(Int64())
    minRestartDelay = dbus_attr(Int64())
    maxRestartDelay = dbus_attr(Int64())

    @classmethod
    def from_procmon_state(cls, state):
        return cls(
            name=state.name,
            state=state.state.value,
            restart=state.settings.restart,
            threshold=state.settings.threshold or -1,
            killTime=state.settings.killTime or -1,
            minRestartDelay=state.settings.minRestartDelay or -1,
            maxRestartDelay=state.settings.maxRestartDelay or -1,
        )
Esempio n. 5
0
    def attach(self, service):
        obj = service.object("/korbenware/Session")

        @obj.method([], SessionState)
        def get_state():
            return SessionState.from_session(self)

        @obj.method([Str()], Bool())
        def run_xdg_application(name):
            self.primary_executor.run_xdg_application_by_name(name)
            return True

        @obj.method([Str()], Bool())
        def stop_xdg_application(name):
            self.primary_executor.stop_process(name)
            return True

        @obj.method([Str()], Bool())
        def start_xdg_application(name):
            self.primary_executor.start_process(name)
            return True

        @obj.method([Str()], Bool())
        def restart_xdg_application(name):
            self.primary_executor.restart_process(name)
            return True

        @obj.method([Str()], Bool())
        def restart_critical_process(name):
            self.critical_executor.restart_process(name)
            return True

        @obj.method([], Bool())
        def shutdown():
            self.stop()
            return True

        return obj
Esempio n. 6
0
 class Thing:
     string = dbus_attr(Str())
Esempio n. 7
0
class MimeConfig:
    cache = dbus_attr(Str(), default="/usr/share/applications/mimeinfo.cache")
    environment = dbus_attr(Str(), default=XDG_CURRENT_DESKTOP)
Esempio n. 8
0
class MetaConfig:
    config_filename = dbus_attr(Str(), default="????")
Esempio n. 9
0
class MenuConfig:
    filename = dbus_attr(Str())
Esempio n. 10
0
class LoggerConfig:
    level = dbus_attr(Str(), default="debug")
Esempio n. 11
0
class FormatConfig:
    pygments_formatter = dbus_attr(Str(), default="trac")
Esempio n. 12
0
class DBusConfig:
    namespace = dbus_attr(Str(), default="org.jfhbrook.korbenware")
Esempio n. 13
0
class AutostartConfig:
    directories = dbus_attr(List(Str()), default=XDG_AUTOSTART_DIRS)
    environment_name = dbus_attr(Str(), default=XDG_CURRENT_DESKTOP)
    skip_unparsed = dbus_attr(Bool(), default=False)
    skip_invalid = dbus_attr(Bool(), default=False)
Esempio n. 14
0
class ApplicationsConfig:
    directories = dbus_attr(List(Str()), default=XDG_APPLICATIONS_DIRS)
    skip_unparsed = dbus_attr(Bool(), default=False)
    skip_invalid = dbus_attr(Bool(), default=False)
Esempio n. 15
0
class ExecutorsConfig:
    primary = dbus_attr(Dict(Str(), ProcessConfig))
    critical = dbus_attr(Dict(Str(), CriticalProcessConfig))