More icon fun.

Could I have more fun? Yes I could. Shoes 3.2.19 has two new methods. See if you can spot them in the following test script:

# test.rb :title => "The Wizard says" do
para "test"
set_window_title "Yield to Maturity"
para name
para Dir.getwd
set_window_icon_path File.join(Dir.getwd,"ytm.png")

Congratulations if you say “where is ‘name’ set”? The short story is not all methods of are documented. And they might work is mysterious ways. For example there is a name= that you might think does the same thing as set_window_title. It doesn’t. Perhaps you think, “I can change the title of the window on the call just like you did. What’s the point of a new set_window_title method?” Mostly, there’s no point unless you need to change the title later.

The new set_window_icon_path method is a way to associate an new icon with your script instead of the Shoes Federales icon. If you have a task bar with the Shoes Manual and your app, separate icons could be handy. Plus, some people really like icons.

Beware the Bewares for they are many

  1. The method names may change if the Shoes 4 folks don’t like it.
  2. The OS or Theme may not change anything. It’s only a request that the OS or theme may decline to do and your script won’t know nor can it do anything about it.
  3. You have to create an icon and be able to find it. Png 128*128 works for Linux and Windows but downscaling by the OS or theme may not show the love you expect. Black letters on a transparent background can be hard to see in some themes
  4. I haven’t written the code for OSX. It might be different or not work..On OSX it doesn’t change the finder name but the dock looks nice.
  5. It does NOT change the icon of a packaged script. Read that again. This changes the icon after your script starts. It does not change the icon of the file. I hope to have a different facility for that. Linux doesn’t have custom icons for a file so that won’t happen and Windows and OSX only have them for executables and they are .ico and .icns formats, not png.
  6. Did I mention this is a work in progress and even if the set_window_icon_path succeeds nothing may change?
  7. It’s kind of a neat feature. If you want to package up your script for Linux and make it look better you should add the set_window_icon_path call and provide an png icon in your .shy.
  8. You don’t have Shoes 3.2.19 because it’s not released. So you’ll have time to create an icon. Make some ico and icns too.

Other than that, it’s kind of neat but bit weird, OS wise.

Leave a Reply

Your email address will not be published. Required fields are marked *