Usage over XML-RPC
This page documents how to use PyKotIcon's capabilities from your own XML-RPC aware client software.
Introduction :
PyKotIcon is usually used as an end user companion to PyKota, with PyKota's pknotify command line tool acting as a PyKotIcon client.
But PyKotIcon is not related to printing quotas in any way, and so you can use it from any XML-RPC aware client.
Methods :
PyKotIcon exposes 4 methods to remote clients, and these methods can easily be called from any XML-RPC client. Following are the description of each method, as well as its input parameters and the format of the return value.
- nop : This methods does exactly nothing :)
- Input : No argument.
- Output : returns the True boolean value.
- quitApplication : This method causes the PyKotIcon application to exit.
- Input : No argument.
- Output : returns the True boolean value.
- showDialog : This methods displays an informational message, and returns the choice the user made, if any.
- Input :
- message : a Binary XML-RPC object representing an UTF-8 encoded character string which will be displayed to the end user. This string can contain literal "\n" sequences which will be automatically expanded into line breaks by PyKotIcon.
- confirmation : a boolean value indicating if the user will be given the choice to valid or cancel (True), or only to valid (False) the dialog box.
- Output :
- The literal string "OK" if the user clicked on the OK button, else the literal string "CANCEL". The latter is only possible if the method was called with its second parameter set to True.
- askDatas : This method can generate an input form and return what the user entered in the different fields.
- Input :
- An array of labels, one label per input field in the form to be created. Each label in the list is passed as a Binary XML-RPC object representing an UTF-8 encoded character string.
- An array of variables names, one name per input field in the form to be created. Each name in the list is passed as an ASCII encoded character string. IMPORTANT : if one of these names is 'password' then this particular field's input box will be visually protected with * in place of the characters typed during input.
- An associative array (e.g. Python mapping) of initial values. Each key is a variable name which must be present in the list above, and each value is a possibly empty initial content, which will be passed as a Binary XML-RPC object representing an UTF-8 encoded character string.
- Output :
- An associative array (e.g. Python mapping) containing the variables names as keys and the variables' contents as values in the following format :
- Each key is an ASCII encoded character string representing the name of a variable to ask which was passed from the caller.
- Each value is a Binary XML-RPC object representing an UTF-8 encoded character string, itself being the result of user input in the form's field for this particular variable.
- A special key named 'isValid' gives access to a boolean value in the associative array. If the value is True, then the input fields' contents are valid. If the value is False, then what the user typed in the input fields has to be discarded because, for example, the user closed the form without validating his entries. In this case, all the other values are empty strings anyway.
Example client :
You can give a look at the source of the example client included with PyKotIcon.