atc » Google Wave http://blog.alexcollins.org Musings of technology, sport, life et al Thu, 10 Jun 2010 10:24:24 +0000 en hourly 1 http://wordpress.org/?v=3.0.5 Google Wave Extensions Python API – Annotation Documentation http://blog.alexcollins.org/2009/10/19/google-wave-extensions-python-api-annotation-documentation/ http://blog.alexcollins.org/2009/10/19/google-wave-extensions-python-api-annotation-documentation/#comments Mon, 19 Oct 2009 06:57:53 +0000 atc http://blog.beplacid.net/?p=93 Quick post documenting the much-sought-after structure of the Python API’s Annotation name/value pairing. If you want to annotate a blip’s content, you’ll need to utilise the values below:

  • conv/title
  • lang = en
  • style/fontWeight = bold
  • style/fontStyle = italic
  • style/textDecoration = underline
  • style/textDecoration = line-through
  • style/fontSize = 2em
  • style/color =r gb(229, 51, 51)
  • style/backgroundColor = rgb(51, 127, 229)
  • link/manual = http://example.com/

A Python example of using the above:


msg = "This is a message for you"
doc = wavelet.GetDocument()
doc.SetText(msg)
doc.SetAnnotation(Range(msg[-4:], len(msg) - 1), "style/fontStyle", "italic")

The above should italicise the word “you” in the variable “msg”.

According to Google employee ‘Pamela’, this isn’t set in stone “as we aren’t confident in their stability”. Thanks to Dave of the same Google Group thread for documenting and posting the styling annotation name and value pairs.

Hope that helps someone ;)

]]>
http://blog.alexcollins.org/2009/10/19/google-wave-extensions-python-api-annotation-documentation/feed/ 1
Google Wave Python API and Annotations http://blog.alexcollins.org/2009/10/19/google-wave-python-api-and-annotations/ http://blog.alexcollins.org/2009/10/19/google-wave-python-api-and-annotations/#comments Mon, 19 Oct 2009 01:08:53 +0000 atc http://blog.beplacid.net/?p=90 I spent a considerable amount of time this weekend hacking away at my Google Wave robot, Wave Toolkit. It’s a lot of fun and I’ve managed to write something that allows for quick implementation of ‘commands’ from initial idea to ‘live’.

One of the frustrating things about developing Google Wave extensions is the poor documentation. It starts out great: lovely overview documentation and tutorial, with plenty of insight and step-by-step instructions; and then nothing. It stops there. Apart from reading the API documentation which can be cumbersome, you’re left alone in the dark, weeping like a sad puppy after meeting its new owners.

An example of this is using Annotations within Google Wave; formatting text for bold or italics,  providing nicely worded hyperlinks or embedding images is governed by inserting annotations that ‘explain’ how the text should look. If you try to find out how to use these objects within the Python API you’ll see it’s nearly impossible. I got my answer only from guessing and scouring the Google Group and reading and example in Java, then posting when that didn’t work and finally getting some helpful advice. Please Google, document this protocol more!

So, to save an further frustration, here’s how to use Annotations in the Google Wave python API for robots:
doc = wavelet.CreateBlip().GetDocument()
doc.SetText("THIS IS ANNOTATED TEXT")
doc.SetAnnotation(Range(2, 12), "link/manual", "http://www.google.com")

I hope to hell that helps someone and saves the pain I underwent to work it out! Buggered if I know how to bold text though…Happy hacking!

]]>
http://blog.alexcollins.org/2009/10/19/google-wave-python-api-and-annotations/feed/ 2
Google Wave Extensions – Wave Toolkit http://blog.alexcollins.org/2009/10/17/wave-toolkit-google-wave-extensions/ http://blog.alexcollins.org/2009/10/17/wave-toolkit-google-wave-extensions/#comments Sat, 17 Oct 2009 22:38:36 +0000 atc http://blog.beplacid.net/?p=82 Update: You might find my latest posts on Google Wave helpful.

So I managed to join the select elite bandwagon that is the Google Wave preview, which entitled me to early access to Google’s new masterpiece and 8 invites to bribe friends with (although I only have a few, so the whole eight might not stretch too far…). I have to admit, I’m not sure what the fuss is about. It’s clever, really clever; but there’s not much to it yet. It is, for all intents and purposes, a well-marketed collaboration tool, or put simply: a clever chatroom. Time will tell though. Perhaps its usefulness is yet to be seen.

Being a devout geek, and a sucker for anything Google, I was led to explore the programming possibilities behind Wave. Rather brilliantly Google have created an API that will allow you to do one of two things: create a ‘Robot’ – an automated participant programmed by you – or embed your own ‘gadget’ in a wave (think a Google map, but your content). The API is rich, if its documentation can be a bit light in some respects (where the hell are the CreateBlip() and such methods documented?! All you get in the API docs are ‘Get*’ methods…pointless!).

Introducing Wave Toolkit

Having programmed plenty of bots for IRC and Eternal Lands over the years I had the experience and ideas behind creating an automated character that can be used to aid users, or simply provide a bit of light entertainment. So after plenty of reading and hacking, I managed to come up with Wave Toolkit; a simple Python robot for wave that provides features that are either lacking or a little tool that might aid your chatroom…err I mean collaborative-blue-sky-thinking…yeah.

To get a bot running you do need a Google App Engine account, which allowed me to explore this little world offered by Google. It’s cleverly done and nicely polished. Still think it’s just cleverly managed free-hosting though ;)

The capabilities of robots within the Google Wave extension API are pretty much exactly what a human participant can do: edit, post, delete and edit ‘blips‘, create waves, see who’s participating and apparently manipulate playback. It’s very fun writing something that can do all this too; that wonderful satisfying feeling of achievement when you spam “hello world” to a wave…

Wave Toolkit‘s in constant development so it might be a little ropey, but please feel free to add wave-toolkit@appspot.com as a contact and invite it to a wave, and feel free to suggest new things, report bugs or even tell me you love it. ;)

So back to coding more lovely Python, and perhaps writing something useful for all the wavers out there. Right? ;)

]]>
http://blog.alexcollins.org/2009/10/17/wave-toolkit-google-wave-extensions/feed/ 7