LEW21 / pydbus

Pythonic DBus library
GNU Lesser General Public License v2.1
327 stars 76 forks source link

Change reserved id vars, translate int states/bits to strings/tuples #47

Closed hcoin closed 7 years ago

hcoin commented 7 years ago

Refactor many modules that use python reserved ids as variables to different variable names.

Comment out or note unused / unusued wild imports.

Add module, doc and sample translation dictionary to automatically convert integers not used as numbers but as states or groups of related booleans stored as bits to / from strings / tuples.

So before, interface.property==10. Now, interface.property=='What10Means'

Before, interface.property_flags=0x102 Now, interface.property_flags=('what0x100means','what2means')

hcoin commented 7 years ago

Made many additions, docs, fixes. See the hcoin version for details and latest. Once it passes all the unit testing I'll send another request. I'm a little concerned the original author has other interests at a higher priority.

LEW21 commented 7 years ago

Hi,

Thanks for your work, and indeed as you've mentioned I've other priorities now - I'm working on https://gitlab.com/aiakos/aiakos. However, I believe I'll find some time to cleanup/merge all the PRs and release new version this or next month.

In terms of this feature - I strongly believe that translation data should be added to the DBus introspection data, maintained on the daemon's side of the pipe, and downloaded dynamically by pydbus and other dbus clients.

In case this is impossible (for example because you want it to work with old versions of daemons), there could be a language-neutral repo with this data, so that other DBus libs will be able to use it too. There are a lot of languages with DBus client libs, and I don't think doing the work in each of them standalone is a good idea. They should be as similar as possible.

There are links to multiple of them in the comments of https://github.com/LEW21/pydbus/issues/27 - you might want to discuss this topic with their maintainers, or on the dbus mailing list; they also might have more time for this than I have.

hcoin commented 7 years ago

That's the plan. I'm finishing up the unit testing now. All that's left is checking out naming the variables and translations on containers (dict, tuple, list). I doubt I'm going to take the time to make it work with python 2. It's pretty clear the authors of dbus servers should be the maintainers of the python translation dictionary. I've written a pretty flexible import module, adding the option to download a translation if none locally is found shouldn't be much of a job.

hcoin commented 7 years ago

Added a c extension to support publishing on pre 2.4.6 glib&co releases.

hcoin commented 7 years ago

Latest release on my fork supercedes this one. This can be deteled.