=========== Per Argument Position Specification =========== This document begins the seemingly 'main work' of the translation module: What to do with a particular argument in a call with possibly other arguments, to a method, signal, or a property, knowing whether the direction of the data is to or from python re: dbus traffic. These are the values of the dictionary keys in the previous section, they provide translation guidance, just called 'guidance' below. Everything in this document is a convenience readability shorthand that accomplishes a subset of what a full translation dictionary argument specification (described in the next document) can do. **_NOTE: If the direction of data is from python to dbus, and the introspection_** **_string contains a 'v', be sure to read "Special Cases 2" below after_** **_reading the main definition._** Each of the following sections is a convenience and readability shorthand for a more capable but harder to read dictionary format described in the next section. At the top of each section is summary statement, how the capability would be expressed if using the full dictionary spec (presented later). * Argspec entry: None None - Do nothing, as if the request to process this argument was omitted. * Argspec entry: string or equivalent. Names the argument position. Changes the argument format to dictionary. Summary: any non container argument, almost always a string, is equivalent to { '_dictkey' : str(non_container_arg) } If guidance is a non-container type (int,string..), name the argument position. Also causes the arguments flowing to python to be in the form of a dictionary with keys using these names, values translated from the dbus, this in place of a positional argument list. Rationale: Here we define an optional facility to free the python programmer from retaining the distracting knowledge of which argument goes in what dbus argument position, and also allows naming each of the dbus arguments used in a method or signal (or property, but as there is only ever one, it's redundant to the property name). **When calling methods, the dictionary used to create the argument** **list on the way to the dbus server is the same as used on the way out.** **If the purpose of the method is to update some argument, give that** **argument the same name in both the translation specifications.** Restated: If the return value of a method is the updated version of a value passed as an argument, give it the same name. Then the user will not have to write busy-work code assigning output variables. One might imagine a class with many well named variables then passing vars(instance) as the argument to any number of dbus methods without further ado, trusting the translation to ignore whatever it doesn't need and arranging what it does need in the order the dbus routine wants and in the format it's looking for. Not so useful for single valued signals, methods and properties, but very useful for more complex calls. Detail: Let's call the passed in non-container (almost always string) guidance value 'argument_name'. When going from python to dbus, instead of the usual arguments expected by the dbus recipient, expect exactly one dictionary with members: {argument_name : ,...} The translation routine will call the dbus proxy with an argument list built with the values in the dictionary ordered in the variable position associated with 'argument_name' in the translation spec. Note: If even ONE translation argument_name position is specified, any missing specifications for other arguments will be replaced by an integer equal to the 0 based index of that argument position as the dictionary key and the translated dbus value as the argument when going to python, and Any omitted argument position/name when going from python to dbus is called as if { : None } was included. Example: So, a dbus method that takes/returns two arguments, with a translation spec: ` { 'MyDbusKeyNameLikeAddConnection', {'method_py_to_dbus': { 1 : 'foo' }}}, ` `#'foo' is not a container, so it is the name used for argument position 1` `{'method_dbus_to_py': { 0 : 'bar' } } } ` `#'bar' is the name used when argument position 0 is meant.` would expect as an argument from python to dbus not the arguments themselves in a fixed order, but instead one dictionary with ` { 0 : \ , ` ` 'foo' : \ }` n.b. if the 0: .. key value pair was omitted, the original pydbus function would be called with arguments ( None , \ ) and return from dbus to python a dictionary (not a tuple or list): ` { 1 : , ` `'bar':