librelist archives

« back to archive

embedding shoes widgets in html

embedding shoes widgets in html

From:
J. Kaiden
Date:
2012-04-21 @ 04:50
hey all,

  so i'm fooling around with a Shoes app that will generate html
score-cards for baseball games...

  i'm just getting started, and i've made some progress using markaby - but
if you'd take a look at the gist here:

 https://gist.github.com/2433997

  ...i've got some questions too ;)

  using green_shoes, i can take advantage of the Shoes::Shape's #real
method, which returns a Gtk::Image.  From that Gtk::Image, i can grab the
Gdk::Pixbuf, and save it as an image file, which i can later load in the
Markaby::Builder.

  ...that's kind of neat, but what i'd really like to be able to do is pass
the Shoes::Shape directly to the Markaby::Builder, and forego the whole
saving to an image schtick.  what i'd *really* like is to be able to send a
custom Shoes::Widget directly to the Builder - now THAT would be cool.

  anyone know of a way to embed a Shoes object into html via Markaby, or
some other way?  i've tried a few different things, but haven't had luck.
 any ideas would be greatly appreciated...

Shoes On...

 - j

Re: [shoes] embedding shoes widgets in html

From:
Cecil Coupe
Date:
2012-04-21 @ 06:24

> 
>   ...that's kind of neat, but what i'd really like to be able to do is
> pass the Shoes::Shape directly to the Markaby::Builder, and forego the
> whole saving to an image schtick.  what i'd *really* like is to be
> able to send a custom Shoes::Widget directly to the Builder - now THAT
> would be cool.

That would require Markaby know what a Shoes::Shape is which it can't
know unless it was coded to know.

 Ruby has some very rough edges when it comes to dealing with blobs.
They exist in the file system and can be loaded and saved.  There is
nothing in Ruby to convert one blob byte or bit to another byte/bit.
Supposedly there is, but its a death march past encodings and decodings
and memory sucking arrays and hashes. File system would be faster and a
whole lot easier than fixing Markaby or Ruby to know what a Shoes::Shape
is. 

Re: [shoes] embedding shoes widgets in html

From:
Jenna Fox
Date:
2012-04-21 @ 06:29
Maybe the #to_s of some shoes objects could be the image of the object as 
a PNG, in a DataURI?   

—
Jenna


On Saturday, 21 April 2012 at 4:24 PM, Cecil Coupe wrote:

>  
>  
> >  
> > ...that's kind of neat, but what i'd really like to be able to do is
> > pass the Shoes::Shape directly to the Markaby::Builder, and forego the
> > whole saving to an image schtick. what i'd *really* like is to be
> > able to send a custom Shoes::Widget directly to the Builder - now THAT
> > would be cool.
> >  
>  
>  
> That would require Markaby know what a Shoes::Shape is which it can't
> know unless it was coded to know.
>  
> Ruby has some very rough edges when it comes to dealing with blobs.
> They exist in the file system and can be loaded and saved. There is
> nothing in Ruby to convert one blob byte or bit to another byte/bit.
> Supposedly there is, but its a death march past encodings and decodings
> and memory sucking arrays and hashes. File system would be faster and a
> whole lot easier than fixing Markaby or Ruby to know what a Shoes::Shape
> is.  
>  
>  

Re: [shoes] embedding shoes widgets in html

From:
ashbb
Date:
2012-04-21 @ 08:32
Hi J and folks,

Try out the following snippet. You can get three .png files.

require 'green_shoes'
require 'fileutils
Shoes.app do
  extend FileUtils
  oval(0, 0, 20).hide
  mv TMP_PNG_FILE, 'o.png'
  rect(0, 0, 40, 40).hide
  mv TMP_PNG_FILE, 'sq.png'
  star(0, 0, 5, 20, 10).hide
  mv TMP_PNG_FILE, 'st.png'
end

This is not a good spec, though...
Green Shoes is implemented like this for now...

ashbb

Re: [shoes] embedding shoes widgets in html

From:
J. Kaiden
Date:
2012-04-21 @ 11:48
hey all,

  thanks for the input - looks like i'll stick with images for the moment
and avoid re-writing ruby and/or markaby ;)

  @jenna - i'll give the #to_s idea a shot and let you know if i have any
luck with it

  thanks again -

  - j

Re: [shoes] embedding shoes widgets in html

From:
Steve Klabnik
Date:
2012-04-21 @ 15:36
A to_s that returns a non-human-readable string would kinda freak me out...

Re: [shoes] embedding shoes widgets in html

From:
Peter Fitzgibbons
Date:
2012-04-21 @ 15:43
#to_pdf

Peter Fitzgibbons
(847) 859-9550
Email: peter.fitzgibbons@gmail.com
IM GTalk: peter.fitzgibbons
IM AOL: peter.fitzgibbons@gmail.com


On Sat, Apr 21, 2012 at 10:36 AM, Steve Klabnik <steve@steveklabnik.com>wrote:

> A to_s that returns a non-human-readable string would kinda freak me out...
>

Re: [shoes] embedding shoes widgets in html

From:
Eric Watson
Date:
2012-04-21 @ 16:21
#to_png

On Apr 21, 2012, at 10:43 AM, Peter Fitzgibbons 
<peter.fitzgibbons@gmail.com> wrote:

> #to_pdf
> 
> Peter Fitzgibbons
> (847) 859-9550
> Email: peter.fitzgibbons@gmail.com
> IM GTalk: peter.fitzgibbons
> IM AOL: peter.fitzgibbons@gmail.com
> 
> 
> On Sat, Apr 21, 2012 at 10:36 AM, Steve Klabnik <steve@steveklabnik.com> wrote:
> A to_s that returns a non-human-readable string would kinda freak me out...
> 

Re: [shoes] embedding shoes widgets in html

From:
Jenna Fox
Date:
2012-04-21 @ 16:32
to_art (http://en.wikipedia.org/wiki/ART_image_file_format)  

—
Jenna


On Sunday, 22 April 2012 at 2:21 AM, Eric Watson wrote:

> #to_png
>  
> On Apr 21, 2012, at 10:43 AM, Peter Fitzgibbons 
<peter.fitzgibbons@gmail.com (mailto:peter.fitzgibbons@gmail.com)> wrote:
>  
> > #to_pdf
> >  
> > Peter Fitzgibbons
> > (847) 859-9550
> > Email: peter.fitzgibbons@gmail.com (mailto:peter.fitzgibbons@gmail.com)
> > IM GTalk: peter.fitzgibbons
> > IM AOL: peter.fitzgibbons@gmail.com (mailto:peter.fitzgibbons@gmail.com)
> >  
> >  
> > On Sat, Apr 21, 2012 at 10:36 AM, Steve Klabnik 
<steve@steveklabnik.com (mailto:steve@steveklabnik.com)> wrote:
> > > A to_s that returns a non-human-readable string would kinda freak me out...
> >