https://github.com/stylesuxx/python-dbus-examples
Python DBUS examples including emitting/receiving signals and calling proxied methods.
https://github.com/stylesuxx/python-dbus-examples
Last synced: 4 months ago
JSON representation
Python DBUS examples including emitting/receiving signals and calling proxied methods.
- Host: GitHub
- URL: https://github.com/stylesuxx/python-dbus-examples
- Owner: stylesuxx
- Created: 2014-06-10T21:01:13.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2025-01-19T00:48:36.000Z (6 months ago)
- Last Synced: 2025-03-18T13:19:18.327Z (4 months ago)
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 41
- Watchers: 2
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Python DBUS examples
> A collection of python DBUS examples.
## Abstract
The first time I had to deal with python and DBUS I was overwhelmed by the lack
of concrete examples, so this repository was born. More documentation may be found in the comments.## Dependencies
The following are python dependencies:
* dbus-python
* relies on libdbus-1-dev
* PyGObject
* relies on libgirepository1.0-devOn a debian based system the os dependencies can be installed like this:
```
sudo apt install libdbus-1-dev libcairo2-dev libgirepository1.0-dev cmake
```Easiest way of installing the python dependencies is using [virtualenv](https://virtualenv.pypa.io/) and installing dependencies via pip:
```
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
```## Usage
In your first terminal run the **dbus monitor** and grep for the examples methods:dbus-monitor | grep /tld/domain/sub
In a second terminal run the **reciever**:
./receiver.py
The receiver has a *catch all* handler, so a lot of output is expected there.
in a third terminal you can now either:
* Run the **invoker**, which will call the proxxied receivers Test object methods:./invoker.py
The invoker will invoke 3 Methodes on the receiver:
* foo: This will simply return *Foo* as a string
* fail: Will trigger an exception in the receiver which the invoker can handle
* quit: Will stop the receiver* run the **emitter**, which will emit a test signal and a quit signal:
./emitter.py
After running either of them, the *receiver will be stopped*.