ashbb / green_shoes

Green Shoes is one of the colorful Shoes written in pure Ruby.
Other
204 stars 37 forks source link

code_box, app resize, alert :title, image accepting RSVG::Handle instead of file #52

Closed translunar closed 12 years ago

translunar commented 12 years ago

Subject says it all -- as discussed.

You might want to reject the gemspec addition. Not sure how to remove this from the pull request. It was mostly so my fork would work as a gem for sciruby.

code_box may work better as a plugin. It requires gtksourceview2, which is just one more lib people have to have installed.

Thanks! John

ashbb commented 12 years ago

Hi John,

Thank you for the pull request. Looks good, but sorry I'm very busy this week. So, please give me a few days to check and merge.

Regards, ashbb

ashbb commented 12 years ago

Hi John,

I reviewed your commits. The following is my two cents.

So, I'm thinking of merging alert title and resize to ashbb/green_shoes master repo.

What do you think? ;-)

ashbb

translunar commented 12 years ago

ashbb,

I hadn't seen the width and height methods. I do now. Thanks for pointing those out to me.

I was aware of your SVG/image commit, but +fb0b78e differs somewhat. It seems to me that in your commit image only takes a string or a filename; but with my commit, it also accepts other types of image objects, like Gtk::Image and Gdk::Pixbuf, and can be quickly extended to take other types as well. See the image_handle function in my commit.

Good to know about rake gemspec. Thanks.

Maybe there's some way to make code_box a plugin? I wasn't quite sure how green shoes plugins worked.

Many thanks. =)

John

PS: Oops, sorry, I hadn't meant to close the request.

ashbb commented 12 years ago

Hi John,

I've looked at your image_handle() method and understood it also accepts Gtk::Image and Gdk::Pixbuf. Good idea. I guess that the method is useful for your sciruby project.

But in general, Green Shoes users use Shoes::Image object only, not use Gtk or Gdg objects directly. And if you want to swap the image with other one, it's better to improve Shoes::Image#path=() method.

Maybe there's some way to make code_box a plugin?

Sure. Oh, and I have a good information. Now gtksourceview2 works well on my Windows 7 with a little patch. So, at first I'll merge your commit for code_box, then make that a plugin. And I'd like to add sv.show_line_numbers = true option to your code_box to show line numbers.

What do you think?

ashbb

translunar commented 12 years ago

So the reason the Shoes::Image#path= method is insufficient is that you cannot generate an image within your program and then display it directly -- you have to save it first. There is no practical reason that this should be the case.

It makes more sense, if you're writing a program that generates an SVG handle, that you should be able to just show the SVG handle within the Shoes API without first saving.

I think adding show_line_numbers would be great. Feel free to make any changes you like. I thought further down the road I would add some arguments that allow the user to set these properties when calling code_box, e.g., code_box :show_line_numbers => true.

ashbb commented 12 years ago

Hi John,

You are right! I've revised the image() method without first saving. Try out the latest commit. Thanks!

Okay now, I'm going to merge your all commits and revise a little bit this weekend.

ashbb

translunar commented 12 years ago

Hey ashbb,

There was one other minor change mixed into the image stuff.

def image
  args = name if name.is_a?(Hash) && args.nil?
  # ...
end

It's not a big deal, but it makes it a little cleaner to call -- you can do image(:data => rsvg_data) instead of image(nil, :data => rsvg_data). It's also consistent with some of the other controls that don't necessarily have names.

Thanks again for including my changes!

John

ashbb commented 12 years ago

Hi John,

it makes it a little cleaner to call

Yes, you are right.

But Green Shoes defines attr_accessor methods for all hash-style options. So, we need to examine adding a hash-style option :data a little more. For now, please use image(rsvg_data) instead of image(:data => rsvg_data).

ashbb