Pharocasts: Display Picasa photos

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Pharocasts: Display Picasa photos

laurent laffont
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector


Cheers,

Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

garduino
Excellent!

2010/8/15 laurent laffont <[hidden email]>:

> Learn:
> - how to get data from an URL
> - parse XML documents
> - build a GUI to display photos with Polymorph
> - how to prototype quickly with debugger and inspector
> http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
> Cheers,
> Laurent Laffont
>
> http://pharocasts.blogspot.com/
> http://magaloma.blogspot.com/
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] Pharocasts: Display Picasa photos

Stéphane Ducasse
+1

Stef
On Aug 16, 2010, at 12:14 AM, Germán Arduino wrote:

> Excellent!
>
> 2010/8/15 laurent laffont <[hidden email]>:
>> Learn:
>> - how to get data from an URL
>> - parse XML documents
>> - build a GUI to display photos with Polymorph
>> - how to prototype quickly with debugger and inspector
>> http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
>> Cheers,
>> Laurent Laffont
>>
>> http://pharocasts.blogspot.com/
>> http://magaloma.blogspot.com/
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [SPAM] [Pharo-users] Pharocasts: Display Picasa photos

Sven Van Caekenberghe
In reply to this post by laurent laffont
Hey Laurent,

Great, very instructive, good example, nice programming style!!

Sven

On 15 Aug 2010, at 23:00, laurent laffont wrote:

> Learn:
> - how to get data from an URL
> - parse XML documents
> - build a GUI to display photos with Polymorph
> - how to prototype quickly with debugger and inspector
>
> http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
>
> Cheers,
>
> Laurent Laffont
>
> http://pharocasts.blogspot.com/
> http://magaloma.blogspot.com/
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] [SPAM] Pharocasts: Display Picasa photos

laurent laffont
Thank you all ! I've tried to make a "Why Pharo is different" screencast, I'm pleased that it seems to work :) 

If you have the courage to put these comments on pharocasts itself (even to say it's crap, just tell why), I will be very grateful ! (and it shows that the community is here)

Cheers,

Laurent 

On Mon, Aug 16, 2010 at 11:57 AM, Igor Stasenko <[hidden email]> wrote:
+1 Very nice hacking excercise!
This is the way how developers should work! :)
Almost all aspects of hacking is covered:
- code in debugger
- finding implementations
- inspecting and exploring objects & classes.

Good work.

On 16 August 2010 12:44, Sven Van Caekenberghe <[hidden email]> wrote:
> Hey Laurent,
>
> Great, very instructive, good example, nice programming style!!
>
> Sven
>
> On 15 Aug 2010, at 23:00, laurent laffont wrote:
>
>> Learn:
>> - how to get data from an URL
>> - parse XML documents
>> - build a GUI to display photos with Polymorph
>> - how to prototype quickly with debugger and inspector
>>
>> http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
>>
>> Cheers,
>>
>> Laurent Laffont
>>
>> http://pharocasts.blogspot.com/
>> http://magaloma.blogspot.com/
>> _______________________________________________
>> Pharo-users mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>
>
> _______________________________________________
> Pharo-users mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users
>



--
Best regards,
Igor Stasenko AKA sig.

_______________________________________________
Pharo-users mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-users


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

Gary Chambers-4
In reply to this post by garduino
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream :=
'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' 
asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
              [:item| | title thumbUrl photoUrl |
               title := (item firstTagNamed: #title) characterData.
               thumbUrl := ((item firstTagNamed: #media:thumbnail)
attributeAt: #url) asUrl.
               photoUrl := ((item firstTagNamed: #media:content)
attributeAt: #url) asUrl.
               photos add: title -> (Form fromBinaryStream: thumbUrl
retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
 scrollPane := GeneralScrollPane new
  scrollTarget: (builder
   newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
 scrollPane openInWindow
  setLabel: title;
  extent: 600@400.
 scrollPane color: Color transparent].

builder := UITheme builder.
((builder
    newRow: (photos collect:
                     [:aPhoto|
                      (builder
     newButtonFor: clickBlock
     getState: nil
     action: #value:value:
     arguments: {aPhoto value. aPhoto key key}
     getEnabled: nil
     label: ((builder newColumn: {
       builder newImage: aPhoto key value.
       builder newLabel: aPhoto key key})
       cellPositioning: #center;
       layoutInset: 10)
     help: nil)]))
 wrapDirection: #topToBottom;
 openInWindow)
  setLabel: (xmlDoc firstTagNamed: #title) characterData;
  extent: 700@680.


Regards, Gary

----- Original Message -----
From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome"
<[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos


> Excellent!
>
> 2010/8/15 laurent laffont <[hidden email]>:
>> Learn:
>> - how to get data from an URL
>> - parse XML documents
>> - build a GUI to display photos with Polymorph
>> - how to prototype quickly with debugger and inspector
>> http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
>> Cheers,
>> Laurent Laffont
>>
>> http://pharocasts.blogspot.com/
>> http://magaloma.blogspot.com/
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

laurent laffont
Cool, it's on Pharocasts !

Laurent

On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
            [:item| | title thumbUrl photoUrl |
             title := (item firstTagNamed: #title) characterData.
             thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
             photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
             photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
scrollPane := GeneralScrollPane new
 scrollTarget: (builder
 newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane openInWindow
 setLabel: title;
 extent: 600@400.
scrollPane color: Color transparent].

builder := UITheme builder.
((builder
  newRow: (photos collect:
                   [:aPhoto|
                    (builder
   newButtonFor: clickBlock
   getState: nil
   action: #value:value:
   arguments: {aPhoto value. aPhoto key key}
   getEnabled: nil
   label: ((builder newColumn: {
     builder newImage: aPhoto key value.
     builder newLabel: aPhoto key key})
     cellPositioning: #center;
     layoutInset: 10)
   help: nil)]))
wrapDirection: #topToBottom;
openInWindow)
 setLabel: (xmlDoc firstTagNamed: #title) characterData;
 extent: 700@680.


Regards, Gary

----- Original Message ----- From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos



Excellent!

2010/8/15 laurent laffont <[hidden email]>:
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector
http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
Cheers,
Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

Mariano Martinez Peck
Hi. I wouldn't like to loose all this cool pieces of code. Even if they are not complete, they work as examples. It would be good to create a ss project like ExternalWebApplicationsCommunication or something like that where you post all this code, Gary's one, and I remember others from your posts or other emails....



2010/8/16 laurent laffont <[hidden email]>
Cool, it's on Pharocasts !

Laurent


On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
            [:item| | title thumbUrl photoUrl |
             title := (item firstTagNamed: #title) characterData.
             thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
             photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
             photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
scrollPane := GeneralScrollPane new
 scrollTarget: (builder
 newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane openInWindow
 setLabel: title;
 extent: 600@400.
scrollPane color: Color transparent].

builder := UITheme builder.
((builder
  newRow: (photos collect:
                   [:aPhoto|
                    (builder
   newButtonFor: clickBlock
   getState: nil
   action: #value:value:
   arguments: {aPhoto value. aPhoto key key}
   getEnabled: nil
   label: ((builder newColumn: {
     builder newImage: aPhoto key value.
     builder newLabel: aPhoto key key})
     cellPositioning: #center;
     layoutInset: 10)
   help: nil)]))
wrapDirection: #topToBottom;
openInWindow)
 setLabel: (xmlDoc firstTagNamed: #title) characterData;
 extent: 700@680.


Regards, Gary

----- Original Message ----- From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos



Excellent!

2010/8/15 laurent laffont <[hidden email]>:
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector
http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
Cheers,
Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

laurent laffont
HelpSystem may be more appropriate ?

Laurent

2010/8/16 Mariano Martinez Peck <[hidden email]>
Hi. I wouldn't like to loose all this cool pieces of code. Even if they are not complete, they work as examples. It would be good to create a ss project like ExternalWebApplicationsCommunication or something like that where you post all this code, Gary's one, and I remember others from your posts or other emails....



2010/8/16 laurent laffont <[hidden email]>

Cool, it's on Pharocasts !

Laurent


On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
            [:item| | title thumbUrl photoUrl |
             title := (item firstTagNamed: #title) characterData.
             thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
             photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
             photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
scrollPane := GeneralScrollPane new
 scrollTarget: (builder
 newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane openInWindow
 setLabel: title;
 extent: 600@400.
scrollPane color: Color transparent].

builder := UITheme builder.
((builder
  newRow: (photos collect:
                   [:aPhoto|
                    (builder
   newButtonFor: clickBlock
   getState: nil
   action: #value:value:
   arguments: {aPhoto value. aPhoto key key}
   getEnabled: nil
   label: ((builder newColumn: {
     builder newImage: aPhoto key value.
     builder newLabel: aPhoto key key})
     cellPositioning: #center;
     layoutInset: 10)
   help: nil)]))
wrapDirection: #topToBottom;
openInWindow)
 setLabel: (xmlDoc firstTagNamed: #title) characterData;
 extent: 700@680.


Regards, Gary

----- Original Message ----- From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos



Excellent!

2010/8/15 laurent laffont <[hidden email]>:
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector
http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
Cheers,
Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

Gary Chambers-4
In reply to this post by laurent laffont

Indeed, I noticed ;-)

Regards, Gary
----- Original Message -----
Sent: Monday, August 16, 2010 1:29 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos

Cool, it's on Pharocasts !

Laurent

On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
            [:item| | title thumbUrl photoUrl |
             title := (item firstTagNamed: #title) characterData.
             thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
             photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
             photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
scrollPane := GeneralScrollPane new
 scrollTarget: (builder
 newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane openInWindow
 setLabel: title;
 extent: 600@400.
scrollPane color: Color transparent].

builder := UITheme builder.
((builder
  newRow: (photos collect:
                   [:aPhoto|
                    (builder
   newButtonFor: clickBlock
   getState: nil
   action: #value:value:
   arguments: {aPhoto value. aPhoto key key}
   getEnabled: nil
   label: ((builder newColumn: {
     builder newImage: aPhoto key value.
     builder newLabel: aPhoto key key})
     cellPositioning: #center;
     layoutInset: 10)
   help: nil)]))
wrapDirection: #topToBottom;
openInWindow)
 setLabel: (xmlDoc firstTagNamed: #title) characterData;
 extent: 700@680.


Regards, Gary

----- Original Message ----- From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos



Excellent!

2010/8/15 laurent laffont <[hidden email]>:
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector
http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
Cheers,
Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

Frederic Pluquet-3
In reply to this post by laurent laffont
Excellent !

Fréd
----
Frédéric Pluquet
Université Libre de Bruxelles (ULB)
Assistant
http://www.ulb.ac.be/di/fpluquet


2010/8/15 laurent laffont <[hidden email]>
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector


Cheers,

Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

Stéphane Ducasse
In reply to this post by laurent laffont
I think that a chapter on fun scripting the web with pharo would be better than an help.


Stef

On Aug 16, 2010, at 3:14 PM, laurent laffont wrote:

> HelpSystem may be more appropriate ?
>
> Laurent
>
> 2010/8/16 Mariano Martinez Peck <[hidden email]>
> Hi. I wouldn't like to loose all this cool pieces of code. Even if they are not complete, they work as examples. It would be good to create a ss project like ExternalWebApplicationsCommunication or something like that where you post all this code, Gary's one, and I remember others from your posts or other emails....
>
>
>
> 2010/8/16 laurent laffont <[hidden email]>
>
> Cool, it's on Pharocasts !
>
> Laurent
>
>
> On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
> Indeed, nice...
>
> Here's an adaptation for Flickr...
>
> | xmlStream xmlDoc photos builder clickBlock |
> xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
> xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.
>
> photos := OrderedCollection new.
> xmlDoc tagsNamed: #item do:
>             [:item| | title thumbUrl photoUrl |
>              title := (item firstTagNamed: #title) characterData.
>              thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
>              photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
>              photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].
>
> clickBlock := [:url :title | | scrollPane |
> scrollPane := GeneralScrollPane new
>  scrollTarget: (builder
>  newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
> scrollPane openInWindow
>  setLabel: title;
>  extent: 600@400.
> scrollPane color: Color transparent].
>
> builder := UITheme builder.
> ((builder
>   newRow: (photos collect:
>                    [:aPhoto|
>                     (builder
>    newButtonFor: clickBlock
>    getState: nil
>    action: #value:value:
>    arguments: {aPhoto value. aPhoto key key}
>    getEnabled: nil
>    label: ((builder newColumn: {
>      builder newImage: aPhoto key value.
>      builder newLabel: aPhoto key key})
>      cellPositioning: #center;
>      layoutInset: 10)
>    help: nil)]))
> wrapDirection: #topToBottom;
> openInWindow)
>  setLabel: (xmlDoc firstTagNamed: #title) characterData;
>  extent: 700@680.
>
>
> Regards, Gary
>
> ----- Original Message ----- From: "Germán Arduino" <[hidden email]>
> To: <[hidden email]>
> Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
> Sent: Sunday, August 15, 2010 11:14 PM
> Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos
>
>
>
> Excellent!
>
> 2010/8/15 laurent laffont <[hidden email]>:
> Learn:
> - how to get data from an URL
> - parse XML documents
> - build a GUI to display photos with Polymorph
> - how to prototype quickly with debugger and inspector
> http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
> Cheers,
> Laurent Laffont
>
> http://pharocasts.blogspot.com/
> http://magaloma.blogspot.com/
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

Gary Chambers-4
+19.7

Lots of cool things can be done simply... (c.f Camp Smalltalk London wrt.
Google Maps)...

Regards, Gary

----- Original Message -----
From: "Stéphane Ducasse" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome"
<[hidden email]>
Sent: Monday, August 16, 2010 4:23 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos


I think that a chapter on fun scripting the web with pharo would be better
than an help.


Stef

On Aug 16, 2010, at 3:14 PM, laurent laffont wrote:

> HelpSystem may be more appropriate ?
>
> Laurent
>
> 2010/8/16 Mariano Martinez Peck <[hidden email]>
> Hi. I wouldn't like to loose all this cool pieces of code. Even if they
> are not complete, they work as examples. It would be good to create a ss
> project like ExternalWebApplicationsCommunication or something like that
> where you post all this code, Gary's one, and I remember others from your
> posts or other emails....
>
>
>
> 2010/8/16 laurent laffont <[hidden email]>
>
> Cool, it's on Pharocasts !
>
> Laurent
>
>
> On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]>
> wrote:
> Indeed, nice...
>
> Here's an adaptation for Flickr...
>
> | xmlStream xmlDoc photos builder clickBlock |
> xmlStream :=
> 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' 
> asUrl retrieveContents contentStream.
> xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.
>
> photos := OrderedCollection new.
> xmlDoc tagsNamed: #item do:
>             [:item| | title thumbUrl photoUrl |
>              title := (item firstTagNamed: #title) characterData.
>              thumbUrl := ((item firstTagNamed: #media:thumbnail)
> attributeAt: #url) asUrl.
>              photoUrl := ((item firstTagNamed: #media:content)
> attributeAt: #url) asUrl.
>              photos add: title -> (Form fromBinaryStream: thumbUrl
> retrieveContents contentStream) -> photoUrl].
>
> clickBlock := [:url :title | | scrollPane |
> scrollPane := GeneralScrollPane new
>  scrollTarget: (builder
>  newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
> scrollPane openInWindow
>  setLabel: title;
>  extent: 600@400.
> scrollPane color: Color transparent].
>
> builder := UITheme builder.
> ((builder
>   newRow: (photos collect:
>                    [:aPhoto|
>                     (builder
>    newButtonFor: clickBlock
>    getState: nil
>    action: #value:value:
>    arguments: {aPhoto value. aPhoto key key}
>    getEnabled: nil
>    label: ((builder newColumn: {
>      builder newImage: aPhoto key value.
>      builder newLabel: aPhoto key key})
>      cellPositioning: #center;
>      layoutInset: 10)
>    help: nil)]))
> wrapDirection: #topToBottom;
> openInWindow)
>  setLabel: (xmlDoc firstTagNamed: #title) characterData;
>  extent: 700@680.
>
>
> Regards, Gary
>
> ----- Original Message ----- From: "Germán Arduino" <[hidden email]>
> To: <[hidden email]>
> Cc: "A friendly place where any question about pharo is welcome"
> <[hidden email]>
> Sent: Sunday, August 15, 2010 11:14 PM
> Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos
>
>
>
> Excellent!
>
> 2010/8/15 laurent laffont <[hidden email]>:
> Learn:
> - how to get data from an URL
> - parse XML documents
> - build a GUI to display photos with Polymorph
> - how to prototype quickly with debugger and inspector
> http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
> Cheers,
> Laurent Laffont
>
> http://pharocasts.blogspot.com/
> http://magaloma.blogspot.com/
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project 


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] [SPAM] Pharocasts: Display Picasa photos

Sean P. DeNigris
Administrator
In reply to this post by laurent laffont
laurent laffont wrote
Thank you all ! I've tried to make a "Why Pharo is different" screencast,
I'm pleased that it seems to work :)
These screencasts are *priceless!!!*  "Programming with live objects" rocked my world when I first started with Smalltalk - it was like a child learning how to walk by seeing someone walking.  Oh, and the best part is that you can so quickly get to any part of it via rewind/fast-forward - very helpful!

laurent laffont wrote
If you have the courage to put these comments on pharocasts itself (even to
say it's crap, just tell why), I will be very grateful ! (and it shows that
the community is here)
Done.  And thanks for asking, I didn't even think of it :)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

laurent laffont
In reply to this post by Gary Chambers-4
This example is really interesting, I've just learn a lot of things.

Laurent

On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
            [:item| | title thumbUrl photoUrl |
             title := (item firstTagNamed: #title) characterData.
             thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
             photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
             photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
scrollPane := GeneralScrollPane new
 scrollTarget: (builder
 newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane openInWindow
 setLabel: title;
 extent: 600@400.
scrollPane color: Color transparent].

builder := UITheme builder.
((builder
  newRow: (photos collect:
                   [:aPhoto|
                    (builder
   newButtonFor: clickBlock
   getState: nil
   action: #value:value:
   arguments: {aPhoto value. aPhoto key key}
   getEnabled: nil
   label: ((builder newColumn: {
     builder newImage: aPhoto key value.
     builder newLabel: aPhoto key key})
     cellPositioning: #center;
     layoutInset: 10)
   help: nil)]))
wrapDirection: #topToBottom;
openInWindow)
 setLabel: (xmlDoc firstTagNamed: #title) characterData;
 extent: 700@680.


Regards, Gary

----- Original Message ----- From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos



Excellent!

2010/8/15 laurent laffont <[hidden email]>:
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector
http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
Cheers,
Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-users] [SPAM] Pharocasts: Display Picasa photos

laurent laffont
In reply to this post by Sean P. DeNigris
On Mon, Aug 16, 2010 at 5:41 PM, Sean P. DeNigris <[hidden email]> wrote:


laurent laffont wrote:
>
> Thank you all ! I've tried to make a "Why Pharo is different" screencast,
> I'm pleased that it seems to work :)
>
These screencasts are *priceless!!!*

Actually, they're free :D

Thanks.

Laurent
 
 "Programming with live objects" rocked
my world when I first started with Smalltalk - it was like a child learning
how to walk by seeing someone walking.  Oh, and the best part is that you
can so quickly get to any part of it via rewind/fast-forward - very helpful!


laurent laffont wrote:
>
> If you have the courage to put these comments on pharocasts itself (even
> to
> say it's crap, just tell why), I will be very grateful ! (and it shows
> that
> the community is here)
>
Done.  And thanks for asking, I didn't even think of it :)
--
View this message in context: http://forum.world.st/Pharocasts-Display-Picasa-photos-tp2326226p2327042.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

Gary Chambers-4
In reply to this post by laurent laffont

Ask away if you'd like more examples of Morphic/Polymorph things...
Even for me, that was the first time I used a Block as the model for a button! :-)

Regards, Gary
----- Original Message -----
Sent: Monday, August 16, 2010 7:31 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos

This example is really interesting, I've just learn a lot of things.

Laurent

On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
            [:item| | title thumbUrl photoUrl |
             title := (item firstTagNamed: #title) characterData.
             thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
             photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
             photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
scrollPane := GeneralScrollPane new
 scrollTarget: (builder
 newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane openInWindow
 setLabel: title;
 extent: 600@400.
scrollPane color: Color transparent].

builder := UITheme builder.
((builder
  newRow: (photos collect:
                   [:aPhoto|
                    (builder
   newButtonFor: clickBlock
   getState: nil
   action: #value:value:
   arguments: {aPhoto value. aPhoto key key}
   getEnabled: nil
   label: ((builder newColumn: {
     builder newImage: aPhoto key value.
     builder newLabel: aPhoto key key})
     cellPositioning: #center;
     layoutInset: 10)
   help: nil)]))
wrapDirection: #topToBottom;
openInWindow)
 setLabel: (xmlDoc firstTagNamed: #title) characterData;
 extent: 700@680.


Regards, Gary

----- Original Message ----- From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos



Excellent!

2010/8/15 laurent laffont <[hidden email]>:
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector
http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
Cheers,
Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

laurent laffont

2010/8/17 Gary Chambers <[hidden email]>
Ask away if you'd like more examples of Morphic/Polymorph things...

I think everybody want to have (lot) more examples ;)

More seriously, on Pharocasts the GUI tab is the most clicked one by far (according to google analytics), so I suppose a lot of people want (including  me) to start by doing a little graphical app.  Polymorph seems cool, but aaarggghhh  almost no documentation. Indeed I'm just starting to feel the logic behind it so I will try to record more screencasts on it.
 
Even for me, that was the first time I used a Block as the model for a button! :-)

And I think that's how it should be for all callbacks: it's far easier to think (for me at least) and design by giving a block to an action than a selector and a model.


Laurent (who is waiting for more examples :)
 

Regards, Gary
----- Original Message -----
Sent: Monday, August 16, 2010 7:31 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos

This example is really interesting, I've just learn a lot of things.

Laurent

On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
            [:item| | title thumbUrl photoUrl |
             title := (item firstTagNamed: #title) characterData.
             thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
             photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
             photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
scrollPane := GeneralScrollPane new
 scrollTarget: (builder
 newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane openInWindow
 setLabel: title;
 extent: 600@400.
scrollPane color: Color transparent].

builder := UITheme builder.
((builder
  newRow: (photos collect:
                   [:aPhoto|
                    (builder
   newButtonFor: clickBlock
   getState: nil
   action: #value:value:
   arguments: {aPhoto value. aPhoto key key}
   getEnabled: nil
   label: ((builder newColumn: {
     builder newImage: aPhoto key value.
     builder newLabel: aPhoto key key})
     cellPositioning: #center;
     layoutInset: 10)
   help: nil)]))
wrapDirection: #topToBottom;
openInWindow)
 setLabel: (xmlDoc firstTagNamed: #title) characterData;
 extent: 700@680.


Regards, Gary

----- Original Message ----- From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos



Excellent!

2010/8/15 laurent laffont <[hidden email]>:
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector
http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
Cheers,
Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

Gary Chambers-4

Well, with the refactoring Stef and I did at CampSmalltalk, blocks (as an action) are now supported for buttons.
I'll have to add some helpers (or make the existing ones agnostic) to TEasilyThemed for convenience though.

Regards, Gary
----- Original Message -----
Sent: Tuesday, August 17, 2010 7:11 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos


2010/8/17 Gary Chambers <[hidden email]>
Ask away if you'd like more examples of Morphic/Polymorph things...

I think everybody want to have (lot) more examples ;)

More seriously, on Pharocasts the GUI tab is the most clicked one by far (according to google analytics), so I suppose a lot of people want (including  me) to start by doing a little graphical app.  Polymorph seems cool, but aaarggghhh  almost no documentation. Indeed I'm just starting to feel the logic behind it so I will try to record more screencasts on it.
 
Even for me, that was the first time I used a Block as the model for a button! :-)

And I think that's how it should be for all callbacks: it's far easier to think (for me at least) and design by giving a block to an action than a selector and a model.


Laurent (who is waiting for more examples :)
 

Regards, Gary
----- Original Message -----
Sent: Monday, August 16, 2010 7:31 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos

This example is really interesting, I've just learn a lot of things.

Laurent

On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
            [:item| | title thumbUrl photoUrl |
             title := (item firstTagNamed: #title) characterData.
             thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
             photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
             photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
scrollPane := GeneralScrollPane new
 scrollTarget: (builder
 newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane openInWindow
 setLabel: title;
 extent: 600@400.
scrollPane color: Color transparent].

builder := UITheme builder.
((builder
  newRow: (photos collect:
                   [:aPhoto|
                    (builder
   newButtonFor: clickBlock
   getState: nil
   action: #value:value:
   arguments: {aPhoto value. aPhoto key key}
   getEnabled: nil
   label: ((builder newColumn: {
     builder newImage: aPhoto key value.
     builder newLabel: aPhoto key key})
     cellPositioning: #center;
     layoutInset: 10)
   help: nil)]))
wrapDirection: #topToBottom;
openInWindow)
 setLabel: (xmlDoc firstTagNamed: #title) characterData;
 extent: 700@680.


Regards, Gary

----- Original Message ----- From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos



Excellent!

2010/8/15 laurent laffont <[hidden email]>:
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector
http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
Cheers,
Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Pharocasts: Display Picasa photos

laurent laffont
2010/8/17 Gary Chambers <[hidden email]>
Well, with the refactoring Stef and I did at CampSmalltalk, blocks (as an action) are now supported for buttons.
I'll have to add some helpers (or make the existing ones agnostic) to TEasilyThemed for convenience though.

May the force be with you !

Laurent
 

Regards, Gary
----- Original Message -----
Sent: Tuesday, August 17, 2010 7:11 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos


2010/8/17 Gary Chambers <[hidden email]>
Ask away if you'd like more examples of Morphic/Polymorph things...

I think everybody want to have (lot) more examples ;)

More seriously, on Pharocasts the GUI tab is the most clicked one by far (according to google analytics), so I suppose a lot of people want (including  me) to start by doing a little graphical app.  Polymorph seems cool, but aaarggghhh  almost no documentation. Indeed I'm just starting to feel the logic behind it so I will try to record more screencasts on it.
 
Even for me, that was the first time I used a Block as the model for a button! :-)

And I think that's how it should be for all callbacks: it's far easier to think (for me at least) and design by giving a block to an action than a selector and a model.


Laurent (who is waiting for more examples :)
 

Regards, Gary
----- Original Message -----
Sent: Monday, August 16, 2010 7:31 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos

This example is really interesting, I've just learn a lot of things.

Laurent

On Mon, Aug 16, 2010 at 2:10 PM, Gary Chambers <[hidden email]> wrote:
Indeed, nice...

Here's an adaptation for Flickr...

| xmlStream xmlDoc photos builder clickBlock |
xmlStream := 'http://api.flickr.com/services/feeds/photos_public.gne?id=12018791@N06&lang=en-us&format=rss_200' asUrl retrieveContents contentStream.
xmlDoc := XMLDOMParser parseDocumentFrom: xmlStream.

photos := OrderedCollection new.
xmlDoc tagsNamed: #item do:
            [:item| | title thumbUrl photoUrl |
             title := (item firstTagNamed: #title) characterData.
             thumbUrl := ((item firstTagNamed: #media:thumbnail) attributeAt: #url) asUrl.
             photoUrl := ((item firstTagNamed: #media:content) attributeAt: #url) asUrl.
             photos add: title -> (Form fromBinaryStream: thumbUrl retrieveContents contentStream) -> photoUrl].

clickBlock := [:url :title | | scrollPane |
scrollPane := GeneralScrollPane new
 scrollTarget: (builder
 newImage: (Form fromBinaryStream: url retrieveContents contentStream)).
scrollPane openInWindow
 setLabel: title;
 extent: 600@400.
scrollPane color: Color transparent].

builder := UITheme builder.
((builder
  newRow: (photos collect:
                   [:aPhoto|
                    (builder
   newButtonFor: clickBlock
   getState: nil
   action: #value:value:
   arguments: {aPhoto value. aPhoto key key}
   getEnabled: nil
   label: ((builder newColumn: {
     builder newImage: aPhoto key value.
     builder newLabel: aPhoto key key})
     cellPositioning: #center;
     layoutInset: 10)
   help: nil)]))
wrapDirection: #topToBottom;
openInWindow)
 setLabel: (xmlDoc firstTagNamed: #title) characterData;
 extent: 700@680.


Regards, Gary

----- Original Message ----- From: "Germán Arduino" <[hidden email]>
To: <[hidden email]>
Cc: "A friendly place where any question about pharo is welcome" <[hidden email]>
Sent: Sunday, August 15, 2010 11:14 PM
Subject: Re: [Pharo-project] Pharocasts: Display Picasa photos



Excellent!

2010/8/15 laurent laffont <[hidden email]>:
Learn:
- how to get data from an URL
- parse XML documents
- build a GUI to display photos with Polymorph
- how to prototype quickly with debugger and inspector
http://pharocasts.blogspot.com/2010/08/see-how-to-get-data-from-url-parse-xml.html
Cheers,
Laurent Laffont

http://pharocasts.blogspot.com/
http://magaloma.blogspot.com/

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project