RpcDoclet does some fancy stuff to combine api and standard javadoc markups into a combined html file.
Looking at TextDocumentationGenerator (in the same folder) might be a better option.
RobbieOn Wed, Apr 4, 2012 at 4:10 PM, Hariharan Srinath <srinathde...@gmail.com> wrote:Cool! Thanks for this guidance... this is precisely what I was struggling a bit to to understand in android.py :-)
I'll take a crack at putting together the complete androidhelper class for current R5 API functions over next few days & get back to the group.
Robbie - Yes, I BeautifulSouped the API Wiki page to extract the <pre> sections but after a few tries, had not automated it too much - had simply done some manual editing.
But given this approach at coding helper classes works, i'll take another crack at better automation... either by parsing the API Wiki using Python or perhaps building something based on your current approach in RpcDoclet.java in the DocumentationGenerator - which probably would be a bit more difficult but possibly more elegant & sustainable.
Regards
SrinathOn Wed, Apr 4, 2012 at 7:13 AM, Robbie Matthews <rjmatt...@gmail.com> wrote:
That's not quite right... here is the tested, partial implementation (attached).
This is how you'd use in in development:
----------------
import androidhelper as android
droid=android.Android()
droid.makeToast("Hello")
----------------
Autocompletion works in idle, and so does the actual class (tested using remote control)
RobbieOn Wed, Apr 4, 2012 at 10:54 AM, Robbie Matthews <rjmatt...@gmail.com> wrote:
Look at the original android.py:
http://code.google.com/p/android-scripting/source/browse/python/ase/android.py
__getattr__ is just a catchall for any undefined methods (which is all of them, by default). It just wraps up the arguments and calls _rpc.
So, for each of your "helper" methods, just pass the arguments on to _rpc:
So your help class would now look like this:
----------
class AndroidHelpe(Android):self._rpc("addContextMenuItem",label,event,eventData)
def addContextMenuItem(label, event, eventData=None):
'''
addContextMenuItem(
String label: label for this menu item,
String event: event that will be generated on menu item click,
Object eventData[optional])
Adds a new item to context menu.
'''
-------
,
RobbieOn Wed, Apr 4, 2012 at 10:04 AM, Sergey Zelenev <zel...@gmail.com> wrote:
I've tried, but my python skills are not strong enough..
it looks like the helper methods should be returning something like super(Android,self).__getattr__(self.__name__) for each of the methods, but I don't know how to pass the values to getattr
вторник, 3 апреля 2012 г. 18:01:12 UTC-5 пользователь Robbie написал:I agree. Anyone want to build it?
I assume the original author built something to parse the wiki page to build this... if he made that code available, it could be added to.
RobbieOn Wed, Apr 4, 2012 at 7:36 AM, <python-for-android@googlecode.com> wrote:
Comment #4 on issue 43 by zele...@gmail.com: Android class definition "helper" files to support SL4A development on PCs
http://code.google.com/p/python-for-android/issues/detail?id=43
The class in the module isn't really functional as far as I can tell.
What if we call this module androidhelper.py and import it instead of android.py?
Would something like this work better?
import android as droid
class Android(droid.Android):
def __init__(self, addr=None):
super(Android, self).__init__(addr)
def addContextMenuItem(label, event, eventData=None):
'''
addContextMenuItem(
String label: label for this menu item,
String event: event that will be generated on menu item click,
Object eventData[optional])
Adds a new item to context menu.
'''
super(Android,self).addContextMenuItem(label, event, eventData)
def addOptionsMenuItem(label, event,eventData=None,iconName=None):
'''
addOptionsMenuItem(
etc..
This way we can do the following:
import androidhelper as android
droid = android.Android()
In my opinion this would give us the helper and would not break RPC
Robbie Matthews gives a full, no-holds barred introduction to Android programming for tablets. No previous experience required! Learn More …
Thank You!
Nope.. no objections - hope it becomes useful.
Best Regards
Srinath