Open serialhex opened 13 years ago
sorry, i forgot that the version of green_shoes i was using has a patch that will change the line numbers, here is with the latest version of green_shoes:
[~/src/serialhex/blogophone]$ ruby temp4.rb *[feature/ui][ruby-1.9.2-p180]
/home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/helper_methods.rb:48:in `set_rotate_angle': undefined method `*' for nil:NilClass (NoMethodError)
from /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/app.rb:357:in `rect'
from /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/widget.rb:16:in `block (2 levels) in inherited'
from temp4.rb:6:in `initialize'
from /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/widget.rb:9:in `new'
from /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/widget.rb:9:in `block (2 levels) in inherited'
from /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/widget.rb:16:in `block (2 levels) in inherited'
from temp4.rb:20:in `block in initialize'
from temp4.rb:19:in `each'
from temp4.rb:19:in `initialize'
from /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/widget.rb:9:in `new'
from /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/widget.rb:9:in `block (2 levels) in inherited'
from temp4.rb:30:in `block in <main>'
from /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/main.rb:80:in `instance_eval'
from /home/serialhex/.rvm/gems/ruby-1.9.2-p180/gems/green_shoes-0.233.0/lib/shoes/main.rb:80:in `app'
from temp4.rb:28:in `<main>'
Yes, you are right. Red Shoes can run this code:
class ListCell < Shoes::Widget def initialize(entry) fill black r = rect() r.width= 600 r.height= 27 para entry, :stroke => white r.hover{r.style(:fill => blue)} r.leave{r.style(:fill => black)} r.click{yield entry} end end class ListManager < Shoes::Widget def initialize(array) array.each{|item| list_cell(item) do |name| para name, :stroke => red end } end end Shoes.app do list = %W[aparagus cucumbers leafygreens] manager = list_manager(list) end
But Green Shoes can't. Because r = rect()
style is not acceptable and stack/flow behavior is not the same as Red Shoes. So, please try to do another way like this:
require 'green_shoes' class ListCell < Shoes::Widget def initialize(entry) s = stack width: 600, height: 27 do background black @over = background blue, hidden: true para entry, stroke: white end s.hover{@over.show} s.leave{@over.hide} s.click{yield entry} end end class ListManager < Shoes::Widget def initialize(array) array.each{|item| list_cell(item) do |name| append{para name, stroke: red} end } end end Shoes.app do list = %W[aparagus cucumbers leafygreens] manager = list_manager(list) end
ashbb, thanks for the update. it's good to know there's a workaround, but IMHO the different colored shoes should work ~the same, so one can take progs from one color to another and not worry about wonkyness like that. so, like i said before, i'll see about fixing it when i get a chance, (and hopefully not break anything in the interim) but if someone gets to it before me that's cool too.
MOAR POWER TO THE SHOES!!! I'M VOTING FOR SHOES FOR BENEVOLENT DICTATOR OF THE WORLD!!! :P hex
i was playing with the code from http://librelist.com/browser//shoes/2011/6/8/creating-a-playlist/ and kept getting errors related to not finding the methods 'list_cell' and 'list_manager' turns out they were being named 'listcell' and 'listmanager' respectfully, (i have a small pull req so this is more like red shoes and acts like the former and not the latter) though that's not the problem. when i run it with the proper method names i get this:
i'll probably take a look into it myself in a few days (or weeks), but if anyone wants to take a whack at it beforehand i'll gladly allow them to code up the patch. :D