내 넷북에서 외부 모니터를 활성화하거나 비활성화하는 간단한 스크립트를 먼저 호출 할 수 있기를 원합니다. 내 데스크톱으로 XFCE를 사용하여 Fedora 17을 실행하고 있습니다. 파이썬과 파이썬 dbus를 사용하여 토글을 켜고 끌 수 있어야합니다. 내 문제는 새로운 설정을 활성화하는 신호를 보내는 방법을 알아낼 수 없다는 것입니다. 불행히도 파이썬은 내가 자주 사용하는 언어가 아닙니다. 내가 자리에있는 코드는 : 그것은 실패 밖으로 걷어차는Python-dbus를 사용하여 dbus에서 신호 방출
import dbus
item = 'org.xfce.Xfconf'
path = '/org/xfce/Xfconf'
channel = 'displays'
base = '/'
setting = '/Default/VGA1/Active'
bus = dbus.SessionBus()
remote_object = bus.get_object(item, path)
remote_interface = dbus.Interface(remote_object, "org.xfce.Xfconf")
if remote_interface.GetProperty(channel, setting):
remote_interface.SetProperty(channel, setting, '0')
remote_object.PropertyChanged(channel, setting, '0')
else:
remote_interface.SetProperty(channel, setting, '1')
remote_object.PropertyChanged(channel, setting, '0')
:
Traceback (most recent call last): File "./vgaToggle", line 31, in <module>
remote_object.PropertyChanged(channel, setting, '0')
File "/usr/lib/python2.7/site-packages/dbus/proxies.py", line 140, in __call__
**keywords)
File "/usr/lib/python2.7/site-packages/dbus/connection.py", line 630, in call_blocking
message, timeout) dbus.exceptions.DBusException:
org.freedesktop.DBus.Error.UnknownMethod: Method "PropertyChanged"
with signature "sss" on interface "(null)" doesn't exist
내가 검색 시간이 약간의 시간에 나는이 가까이에 아무것도 많은 파이썬 예제를 발견하고 있지 않다 . 미리 감사드립니다.