Ejemplo n.º 1
0
class ExecutorState:
    running = dbus_attr(Int16())
    processes = dbus_attr(List(ProcessState))

    @classmethod
    def from_executor(cls, executor):
        monitor = executor.monitor.asdict()
        return cls(
            running=monitor.get("running", -1),
            processes=[
                ProcessState.from_procmon_state(state)
                for state in monitor.get("processes", {}).values()
            ],
        )
Ejemplo 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()))
Ejemplo n.º 3
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())
Ejemplo 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,
        )
Ejemplo n.º 5
0
class SessionState:
    running = dbus_attr(Bool(), default=False)
    loaded_at = dbus_attr(DateTime())
    started_at = dbus_attr(DateTime())
    stopped_at = dbus_attr(DateTime())
    config = dbus_attr(BaseConfig)
    critical_executor = dbus_attr(ExecutorState)
    primary_executor = dbus_attr(ExecutorState)

    @classmethod
    def from_session(cls, session):
        return cls(
            running=session.running,
            loaded_at=session.loaded_at,
            started_at=session.started_at,
            stopped_at=session.stopped_at,
            config=session.config,
            critical_executor=ExecutorState.from_executor(session.critical_executor),
            primary_executor=ExecutorState.from_executor(session.primary_executor),
        )
Ejemplo n.º 6
0
 class Thing:
     string = dbus_attr(Str())
Ejemplo n.º 7
0
class NestedContainer:
    list_of = dbus_attr(List(SimpleContainer))
    dict_of = dbus_attr(Dict(Str(), SimpleContainer))
Ejemplo n.º 8
0
class SimpleContainer:
    some_str = dbus_attr(Str())
    some_int32 = dbus_attr(Int32())
    some_list = dbus_attr(List(Str()))
    some_dict = dbus_attr(Dict(Str(), Int32()))
Ejemplo n.º 9
0
class MimeConfig:
    cache = dbus_attr(Str(), default="/usr/share/applications/mimeinfo.cache")
    environment = dbus_attr(Str(), default=XDG_CURRENT_DESKTOP)
Ejemplo n.º 10
0
class MenuConfig:
    filename = dbus_attr(Str())
Ejemplo n.º 11
0
class LoggerConfig:
    level = dbus_attr(Str(), default="debug")
Ejemplo n.º 12
0
class FormatConfig:
    pygments_formatter = dbus_attr(Str(), default="trac")
Ejemplo n.º 13
0
class DBusConfig:
    namespace = dbus_attr(Str(), default="org.jfhbrook.korbenware")
Ejemplo n.º 14
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)
Ejemplo n.º 15
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)
Ejemplo n.º 16
0
class MetaConfig:
    config_filename = dbus_attr(Str(), default="????")
Ejemplo n.º 17
0
class ExecutorsConfig:
    primary = dbus_attr(Dict(Str(), ProcessConfig))
    critical = dbus_attr(Dict(Str(), CriticalProcessConfig))