[Plugin] Ruby Toolbar
-
Ruby Toolbar
About
Ruby Toolbar provides some controls over SketchUp's Ruby Panel (or Console.) It is most useful to people who are writing Ruby plugins.
This is a Windows-only plugin.
The 5 toolbar buttons are shown below.
They are:
[ Show/Hide Ruby Console | Clear Console | Load a .rb | Reload last .rb | Browse Plugins Folder ]
If someone wanted to contribute some good, meaningful icons I'd be grateful.
The position and size of the console is saved to the Windows Registry when the console is hidden using the toolbar, and restored between sessions.
Requirements
- Sketchup
- Windows
- Win32API.so (if not already installed.)
Installation
Download the .zip file, extact the files, and move them into your Plugins directory.
Didier, this is actually an update of the RubyPanelToolbar you have archived on your site.
Download and info here
-
Cool
very VERY VERY useful tool,
Thanks a lot from all the developers !hem hem where's the gem ? (didn't find it at Sketchy Endeavors )
-
Jim,
Am I blind already? Description of your tool is so interesting ... but where is the link
Thanks a lot!Tomasz
-
Oops, that was a major omission. I've added the attachment to the original post.
-
When I extracted your .zip file, KI restarted SketchUp and I`can't find it!!! Will you please Bugfix it?
[Invader ZIM]
-
ZIM - some toolbars need to be activated under the "view" menu. Have a look to see if this is the case.
-
Jim,
I'm having the "blank icons syndrom" (all png's are in Plugins folder)
The line that seems to cause the problem is:imgdir = File.join(File.dirname(FILE), File.basename(FILE, ".rb"))
It returns: ./(eval)
then the icon file location File.join(imgdir, "rubypanel.png") returns: ./(eval)/rubypanel.pngPlease help !
The 'toggle' method doesn't work also. At least in V5.
Question: Is findWindow.call(0,"Ruby Console") rely on language settings of SU ? I mean is "Ruby Console" available just for english versions of SU ? In this case the win32api call will not work with other platforms.P.S.:
UI.openURL("c;\\program files\\google\\google sketchup 6\\plugins")
A non hard-coded command would be handy. Why not get this path from the registry ? Or something like:
su_ver = Sketchup.version.split(".")[0].to_i
if su_ver < 6
devdir = File.dirname(Sketchup.find_support_file("sketchup.exe")) + "\Plugins"
else
devdir = ...
endThis makes the command compatible for SU5 and 6 (I guess), no matter where the user has installed SU.
Regards,
-
@didier bur said:
Jim,
I'm having the "blank icons syndrom" (all png's are in Plugins folder)
The line that seems to cause the problem is:imgdir = File.join(File.dirname(FILE), File.basename(FILE, ".rb"))
It returns: ./(eval)
then the icon file location File.join(imgdir, "rubypanel.png") returns: ./(eval)/rubypanel.pngPlease help !
Didier, I'm, not sure why it works on my computer but not yours. I have updated the script to use a method that will hopefully be more robust. There should be a rubytoolbar folder in which the images are located.
@didier bur said:
The 'toggle' method doesn't work also. At least in V5.
Question: Is findWindow.call(0,"Ruby Console") rely on language settings of SU ? I mean is "Ruby Console" available just for english versions of SU ? In this case the win32api call will not work with other platforms.This could very well be the case. If you have Ruby installed, you could try your local verion of Win32API.so located in C:\ruby\lib\ruby\1.8\i386-mswin32\Win32API.so.
What is the title text of your Ruby Console window? Is it English "Ruby Console", or maybe French? I think findWindow is using the name of the window.
@didier bur said:
P.S.:
UI.openURL("c;\\program files\\google\\google sketchup 6\\plugins")
A non hard-coded command would be handy. Why not get this path from the registry ? Or something like:
su_ver = Sketchup.version.split(".")[0].to_i
if su_ver < 6
devdir = File.dirname(Sketchup.find_support_file("sketchup.exe")) + "\Plugins"
else
devdir = ...
end
This makes the command compatible for SU5 and 6 (I guess), no matter where the user has installed SU.I use the find_support_file method; good idea.
Thank you for the report, and your patience. Please download and try the updates.
-
Hi Jim,
Thanks for the update: icons are there nowShow/Hide console doesn't work (not very important)
Clear console only moves the text in the console 1 line up 8OThe title of the Ruby console window in french is "Console Ruby". This could cause the problem...
But the most important command "Reload script" works OK since the first versionThanks again for this very useful tool,
Regards, -
@didier bur said:
...The title of the Ruby console window in french is "Console Ruby". This could cause the problem...
Thank God I don't need to deal with a "native" version of SU!
-
Everything's OK with the french version now, including toggle
Only minor tweaks were necessary -
@didier bur said:
Everything's OK with the french version now, including toggle
Only minor tweaks were necessaryGreat! But would you mind sharing the minor tweaks so maybe I can make the toolbar more international?
-
Hi Jim,
@unknownuser said:
would you mind sharing the minor tweaks
I'm afraid it would be useless because I simply replaced all the calls to "Ruby Console" by "Console Ruby", but that's only for french. Each version of SU does have a particular name for the Ruby Console, so... Even a call to langhandler.rb (with 'getstring') will not work since this deals with a window name, not a message string or such.
Regards,
-
@didier bur said:
Hi Jim,
@unknownuser said:
would you mind sharing the minor tweaks
I'm afraid it would be useless because I simply replaced all the calls to "Ruby Console" by "Console Ruby", but that's only for french. Each version of SU does have a particular name for the Ruby Console, so... Even a call to langhandler.rb (with 'getstring') will not work since this deals with a window name, not a message string or such.
Regards,
Didier, GetString would work, but since it's only one string, I won't use LangHandler. I've updated the plugin to support FR.
-
Hi Jim,
I love this toolbar. I use it constantly.
Feature request: How about saving the state and position of the console in the registry? So if I close and reopen Sketchup it remembers if the console was open and where it was.
Also If you want I could give you the code to read the console log window. Saving is the only use I can think of. But maybe it could be parsed to some effect.
Chris
-
Thanks Chris,
The version I posted on SketchyUtils isn't up-to-date, I'll remove it. Download the version available in this thread.
The position and size are saved in the registry, but only if the console is closed using the toolbar. Is it possible to save these settings if the console is closed using the X widget?
-
Ah, much better. Yeah I was still using the old one.
I didn't even know this subsection of the forums was here until yesterday.
As far as detecting the window close message. It wouldn't be easy. One thing you could do is just check the position of the window ever 10 sec or so and see if it has moved/closed.
Regards
Chris -
Why put the "ruby console" and not the "Web Console" of Jim Foltz?
Seems it is more easy using?
(but I am totally new beginner in Ruby scriptPS With the Webconsole seems you can't save (bug ?)
-
@unknownuser said:
Why put the "ruby console" and not the "Web Console" of Jim Foltz?
Seems it is more easy using?
(but I am totally new beginner in Ruby scriptPS With the Webconsole seems you can't save (bug ?)
You can save, it just doesn't say that you have the same file open after that. it's weird.
-
Maybe I should combine the 2 plugins into 1?
Advertisement