[Google Wave APIs] Re: GadgetSubmitDelta right after append new gadget (python)
In answer to myself. If I change the gadget to use varName instead of var_name and the same in the bot - it works. Interesting little gotcha. On 19. okt.. 2009, at 18.17, Chris Searle wrote: > > On 19. okt.. 2009, at 17.54, Agustin Horischnik wrote: > >> >> Hey Chris, no that wasn't the issue in this case but you're right, I >> tried and it does make var_name into varName... >> >> Thanks for the answer. > > What does your gadget expect? var_name or varName? > > Did I get it right that you were successful with this type of code: > > gadget = document.Gadget(gadgetUrl) > doc.InsertElement(pos, gadget) > delta = {'key', val} > doc.GadgetSubmitDelta(gadget, delta) > > Because it's not working for me - which is why I was wondering about > the change of name. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: GadgetSubmitDelta right after append new gadget (python)
On 19. okt.. 2009, at 17.54, Agustin Horischnik wrote: > > Hey Chris, no that wasn't the issue in this case but you're right, I > tried and it does make var_name into varName... > > Thanks for the answer. What does your gadget expect? var_name or varName? Did I get it right that you were successful with this type of code: gadget = document.Gadget(gadgetUrl) doc.InsertElement(pos, gadget) delta = {'key', val} doc.GadgetSubmitDelta(gadget, delta) Because it's not working for me - which is why I was wondering about the change of name. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: GadgetSubmitDelta right after append new gadget (python)
Hmm. Similar discussion to http://groups.google.com/group/google-wave-api/browse_thread/thread/48afca48b1c0a5c1/83144f3e95397066#83144f3e95397066 I've currently tried gadget = document.Gadget(gadgetUrl) doc.InsertElement(pos, gadget) delta = {'key', val} doc.GadgetSubmitDelta(gadget, delta) gadget = document.Gadget(gadgetUrl) delta = {'key', val} doc.GadgetSubmitDelta(gadget, delta) doc.InsertElement(pos, gadget) gadget = document.Gadget(gadgetUrl) doc.InsertElement(pos, gadget) delta = {'key', val} gadget.submitDelta(delta) gadget = document.Gadget(gadgetUrl) delta = {'key', val} gadget.submitDelta(delta) doc.InsertElement(pos, gadget) So - that's calling SubmitDelta on the gadget and using doc.GadgetSubmitDelta - both before and after inserting it in the blip. I see in the robot log the following json (amongst the rest of it): { "blipId":"b+Kp80wU6wE", "index":116, "waveletId":"wavesandbox.com!conv+root", "javaClass":"com.google.wave.api.impl.OperationImpl", "waveId":"wavesandbox.com!w+Rn8AWHfwA", "property":{ "type":"GADGET", "properties":{ "javaClass":"java.util.HashMap", "map":{ "url":"http://cdsscratch.appspot.com/ flickrey.xml", "flickrImageId":"4019022326" } }, "java_class":"com.google.wave.api.Gadget" }, "type":"DOCUMENT_ELEMENT_INSERT" }, { "blipId":"b+Kp80wU6wE", "index":-1, "waveletId":"wavesandbox.com!conv+root", "javaClass":"com.google.wave.api.impl.OperationImpl", "waveId":"wavesandbox.com!w+Rn8AWHfwA", "property":{ "type":"GADGET", "properties":{ "javaClass":"java.util.HashMap", "map":{ "url":"http://cdsscratch.appspot.com/ flickrey.xml", "flickrImageId":"4019022326" } }, "java_class":"com.google.wave.api.Gadget" }, "type":"DOCUMENT_ELEMENT_MODIFY_ATTRS" }, Now - this is interesting. The wave state variable I'm trying to set here is flickr_image_id (and I read flickr_image_id inside the gadget). I can see in the map its getting set to flickrImageId. The delta itself looks like: delta = { 'flickr_image_id' : pm.match.group(2) } In a different place I see user_id replaced with userId Could this be the issue? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Dynamic height gadget not always resizing
OK - it's in the preview - not the sandbox - but the wave w%252BjUkCkVHKe I just opened it twice and got these two results: http://skitch.com/chrissearle/ndaw4/gadget-size-not-correct http://skitch.com/chrissearle/ndai1/chris-3-google-wave It seems pretty random which you get too. 2009/10/19 pamela (Google Employee) > Hi Jonny- > Can you post a link to the gadget? That would make it easier to debug. I > don't see any bugs filed that match your description of the problem. > > Thanks! > > - pamela > > > On Tue, Oct 20, 2009 at 12:10 AM, Jonathan Hunt wrote: > >> >> Hi Chris, >> >> I tried modifying my gadget so that the size of the image was always >> specified explicity (i.e. start with default size and use img.onload >> to update the size) before calling gadgets.window.adjustHeight(); but >> I still have the same problem. >> >> I notice that the js file having the error >> >> https://www-wave-opensocial.googleusercontent.com/gadgets/js/dynamic-height:wave:wave-preview.js?v=1cf0e493105d2223097f7244b563bea&container=wave&debug=0 >> can also be loaded with debug=1, but I can't find a way to put the >> Wave preview in debug mode and I don't have access to the sandbox. You >> might want to see if this is something you can do in the sandbox as >> then you can see what line in the file the error is occuring at. >> >> If you do find a fix please let me know, as I can't figure it out for >> my gadget, and it's making the gadget much less useful than it >> otherwise might be. It seems to be to occur more frequently in Chrome >> and more often on pages with lots of gadgets. >> >> Google any help or acknowledgement is this is your bug would be >> appreciated. >> >> Cheers, >> Jonny >> >> On Mon, Oct 19, 2009 at 7:59 PM, Chris Searle >> wrote: >> > >> >> Is this simply a preview problem (can't say that I've seen it in the >> >> developer sandbox) ? >> > >> > OK - today I can say I see it in the developer sandbox too :( >> > > >> > >> >> >> >> -- >> Jonathan J Hunt >> Homepage: http://www.42quarks.com >> (Further contact details there) >> "Physics isn't the most important thing. Love is." Richard Feynman >> >> >> > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Initializing gadget state from robot
> > You need to get the Gadget entry from the gadget you added. Once you > > do this, you can use element.setField(key, value) to control its > > state. I'm not sure how to go about getting the gadget object for a > > newly added gadget (gadget insert/append have no return types). > > Perhaps you can go back and try something like GadgetView.getGadgets > > or getGadget("url") to find it again. Here's what I'm doing: gadget = document.Gadget(gadgetUrl) doc.InsertElement(m.start(0), gadget) Now - from http://wave-robot-python-client.googlecode.com/svn/trunk/pydocs/waveapi.document.Gadget-class.html I wonder - can I not just call: gadget.SubmitDelta() after adding it to the doc? Not that I can see what format it should be in yet ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Dynamic height gadget not always resizing
> Is this simply a preview problem (can't say that I've seen it in the > developer sandbox) ? OK - today I can say I see it in the developer sandbox too :( --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Dynamic height gadget not always resizing
No - I have tested in safari and ff mac - and I have several other users who are using the range of browsers - all see it - and randomly - not always the same wave or same gadget instance. At present - the gagdet has no real state - it is initialized in python and then just draws itself in stateUpdated. I'll be moving to a static xml gagdet soon (will be doing the json fetch in js instead of in python - and using real gadget state) - so I'll see if that makes a difference - however - since the delivered gadget is a javascript piece - then it should be the same. I just wondered if this was a known or commonly experienced problem. Note that the gadget displays an image. I wonder if the image is added to the DOM but not yet fully retrieved when the resize call is triggered (just guessing here - but if the actual image file isn't retrieved maybe it doesn't know the size?) 2009/10/19 Jonathan Hunt > > Hi Chris, > > Are you using Google Chrome - are there any errors output on the > console? I am having problems in Google Chrome (Mac) with gadget > resizing but not on Firefox. > > Regards, > Jonny > > On Mon, Oct 19, 2009 at 3:30 PM, Chris Searle > wrote: > > > > Have a gadget with the dynamic-height feature. > > > > The last line of the stateUpdated method is > > gadgets.window.adjustHeight(); > > > > However, I see that the gadget stays at 200px quite often. Leaving and > > re-opening the wave sometimes helps, not always. If you have the > > gadget several times in a wave some resize some don't. It all seems a > > little random. > > > > Is this simply a preview problem (can't say that I've seen it in the > > developer sandbox) ? > > > > > > > > > > > -- > Jonathan J Hunt > Homepage: http://www.42quarks.com > (Further contact details there) > "Physics isn't the most important thing. Love is." Richard Feynman > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Dynamic height gadget not always resizing
Have a gadget with the dynamic-height feature. The last line of the stateUpdated method is gadgets.window.adjustHeight(); However, I see that the gadget stays at 200px quite often. Leaving and re-opening the wave sometimes helps, not always. If you have the gadget several times in a wave some resize some don't. It all seems a little random. Is this simply a preview problem (can't say that I've seen it in the developer sandbox) ? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Initializing gadget state from robot
On 18. okt.. 2009, at 21.56, RoboPhred wrote: > > You need to get the Gadget entry from the gadget you added. Once you > do this, you can use element.setField(key, value) to control its > state. I'm not sure how to go about getting the gadget object for a > newly added gadget (gadget insert/append have no return types). > Perhaps you can go back and try something like GadgetView.getGadgets > or getGadget("url") to find it again. Ah. Looks interesting. This would allow me to replace my python code with a static XML file (would have to move the code - a urlfetch that retrieves json - to the gadget - but that's not too hard). I'll look into this. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Initializing gadget state from robot
If you have a robot add a gadget to a wave (adding a document.Gadget to the blip document) - is there a way to initialize the state of the gadget? For example - if the robot has found enough information in the blip text itself - it would be nice to just use it instead of presenting the user with the form that is used when no state is present. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Gadget - css and element ID isolation.
On 18. okt.. 2009, at 18.23, David Nesting wrote: > On Sun, Oct 18, 2009 at 9:15 AM, Chris Searle > wrote: > It struck me - if there are two instances of a given gadget how is > this handled? Are IDs unique only within the gadget, within the > containing blip, wavelet or whole wave? > > The gadgets are rendered in their own IFRAME, so they are completely > isolated from other content on the page. As simple as that eh? Thanks for clarifying - makes a lot more sense in that case ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Gadget - css and element ID isolation.
Starting to play with gadgets - and I see in a lot of the examples creation of html elements with an ID that is then JS manipulated. For example from the jquery/yui sample I've been reading: It struck me - if there are two instances of a given gadget how is this handled? Are IDs unique only within the gadget, within the containing blip, wavelet or whole wave? Similar question on css - how isolated are gadgets? I had assumed that for example plain text would be the same size as normal blip content but they appear to be a good deal larger. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Position calculcations, range handling and offsets
Right now I've caved in and done a reverse search (get all matches, reverse the list and then apply) - so that we start at the end of the string and work back. It works - but it seems wildly inelegant. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Position calculcations, range handling and offsets
Starting to wonder if it would be better for the bot to replace the link not with a picture but with a gadget (served from the same appspot app) - wondering if that would give better display control. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Position calculcations, range handling and offsets
On Oct 14, 4:46 pm, "Chris C." wrote: > I was going to suggest an offset variable, but as you say, it appears > that the subsequent regex search is on the just-updated text. I'm not > sure what the issue is (I have a dice rolling bot that uses regex and > inserts results after the relevant dice expression, and I use an > offset variable to adjust the insertion points by an amount equal to > the length of what was inserted on the previous iteration). Perhaps > there's a mutability issue with doc.getText()? I use Java, so I don't > know how that works. I could try this - but - how much offset is an image? It seems a little strange to me - but - then I feel a little unclear about the blip's document structure. What is the result of getText() when the blip contains media for example. The same applies to knowing what formatting you can add (want to have a nice title, the image and a couple of links - one to the image page one to the image license - but I don't yet know how to apply this kind of formatting programatically). I could do the "get all matches in list, reverse it and then apply" - but that seems less elegant. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Position calculcations, range handling and offsets
Am having an issue that I don't understand. I have a bot that looks for URLs (regexp matching) and replaces them with an image. Here's a code piece: def OnBlipSubmitted(properties, context): blip = context.GetBlipById(properties['blipId']) doc = blip.GetDocument() m = r.search(doc.GetText()) while m != None: doc.DeleteRange(document.Range(m.start(0), m.end(0))) image = getImage(m.group(2)) newimage = document.Image(image.thumb.source, caption=image.title, width=image.thumb.width, height=image.thumb.height) doc.InsertElement(m.start(0), newimage) m = r.search(doc.GetText()) So - I grab the first match - remove it, insert an image then search again - on the new text. This works fine for the first URL - it gets it exactly right. However - if I add the following to a blip: http://www.example.com/foo/bar bla bla http://www.example.com/bar/foo I expect IMG bla bla IMG I get IMG bla bIMGfoo That is - the second one is three characters (always 3) too early both in start and end. From what I can see - its the values of m.start and m.end that are at fault. The actual match itself is correct - since the values of m.group(0) and m.group(2) are exactly right for the input. I'm uncertain as to why this is - what could be in the text that is confusing it. If anyone can give me any hints ? Oh - and while asking - what is the caption param of an Image for? It certainly doesn't appear in the blip even though it's being set. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---
[Google Wave APIs] Re: Sandbox vs Preview
On 13. okt.. 2009, at 16.48, PJ Gray wrote: > I wrote a couple robots last night after getting my preview invite > last week. Last night they were both working fairly good (only my > own bugs to worry about!), but today they ruun real > sloow.Sometimes not responding to new blips for 5+ > minutes. Then, just today I got my sandbox invite and tried my > robots there and they work super fast. > > Just the nature of the beast I suppose, correct?Nothing I can do > to help this? I've noticed this the last two days. Early morning (CEST) bots are running fast on both sandbox and preview. Continues until approx 16:00-17:00 CEST - then the preview gets slow. The developer sandbox stays fast (almost instant). A colleague joked "ah - that's when the US comes online" - I have no idea if that is anything more than a joke - but I await tomorrow morning with interest to see if it speeds up again ;) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google Wave API" group. To post to this group, send email to google-wave-api@googlegroups.com To unsubscribe from this group, send email to google-wave-api+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-wave-api?hl=en -~--~~~~--~~--~--~---