zoukankan      html  css  js  c++  java
  • python dbus note

    ..

    python dbus 设置

    import dbus
    bus = dbus.SessionBus()
    //参数为prog 和path
    obj = bus.get_object('com.deepin.wm','/com/deepin/wm')
    //参数为interface
    intf = dbus.Interface(obj,'org.freedesktop.DBus.Properties')
    //参数为方法
    meth = intf.get_dbus_method('Set')
    meth(dbus.String('com.deepin.wm'),dbus.String('compositingEnabled'),dbus.Boolean(True, variant_level=1))

    ..占位

     1 #Method
     2 def mothodAddUserLayout():
     3     progname = 'com.deepin.daemon.InputDevices'
     4     objpath = '/com/deepin/daemon/InputDevice/Keyboard'
     5     intfname = 'com.deepin.daemon.InputDevice.Keyboard'
     6     methname = 'AddUserLayout'
     7 
     8     bus = dbus.SessionBus()
     9     obj = bus.get_object(progname, objpath)  # Here we get object
    10     intf = dbus.Interface(obj, intfname)      # Here we get interface
    11     meth = intf.get_dbus_method(methname)      # Here we get method
    12     #参数
    13     meth("cn;altgr-pinyin")
    14 
    15 #propties GetAll
    16 def propGetAll():
    17     progname = 'com.deepin.daemon.InputDevices'
    18     objpath = '/com/deepin/daemon/InputDevice/Keyboard'
    19     intfname = 'org.freedesktop.DBus.Properties'
    20     methname = 'GetAll'
    21 
    22     bus = dbus.SessionBus()
    23     obj = bus.get_object(progname, objpath)  # Here we get object
    24     intf = dbus.Interface(obj, intfname)      # Here we get interface
    25     meth = intf.get_dbus_method(methname)      # Here we get method
    26     # print(meth)
    27     # print(meth())
    28     v = meth("com.deepin.daemon.InputDevice.Keyboard")
    29     # v 是字典
    30     layout_arr = v["UserLayoutList"]
    31     # for x in v:
    32     #     print(x)
    33 
    34     return layout_arr

  • 相关阅读:
    Cinema in Akiba(线段树)
    SGU
    632-掷骰子
    ZOJ
    nyoj 1129 Salvation(搜索)
    symbol table meaning
    C/C++编译和链接过程详解 (重定向表,导出符号表,未解决符号表)
    编译链接 C++
    while(cin.eof)出错 poj
    华为oj 购物单
  • 原文地址:https://www.cnblogs.com/eiguleo/p/14437185.html
Copyright © 2011-2022 走看看