Float toolbar on creation?
-
I was under the impression that youd arrived at the 'no' yourself verdict a while ago after playing around with the relevant registry entries...
-
@remus said:
I was under the impression that youd arrived at the 'no' yourself verdict a while ago after playing around with the relevant registry entries...
Yes, but I've been wrong before and it doesn't hurt to ask.
How about getting a list of the Ruby toolbars?
-
-
@tig said:
Since the Toolbar methods are scant this is not much use, some extra methods like
Toolbars.each
Toolbar.name
Tollbar... etc would be helpful ?Yea - something for the last.
Though - I feel that SU need a new menu and toolbar system. One where authors register their menus and toolbars with SU - providing default position for them and allow the user to rearrange them as fit. I'd rather have that - if they are going to introduce new methods for the toolbar nightmare.
-
You can use
Sketchup.read_default
for ToolbarsUserNN in the registry and find the BarIDand BarNameetc for each one - and a few other relatively useless bits of info...The entry ToolbarsUser-Summary > Bars gives the total number of 'user toolbars' so you can construct a loop to go through to find each one with NN ...
Since the Toolbar methods are scant this is not much use, some extra methods like
Toolbars.each
Toolbar.name
Toolbar... etc would be helpful ? -
hmm...
Just noticed something.
Say that you have a toolbar named
'FooBar'
created by another script.If you from your own script do
t = UI::Toolbar.new('FooBar')
You can then hide and show it, like this:t.hide t.show t.visible?
promising - as now we can emureate the registry to get the toolbar names. (need a solution for OSX)
BUT!Try to add separators or items...
c = UI::Command.new("Tester") { UI.messagebox("Hello World") } t.add_item(c)
Fail!
So close.
But - this does allow us to create a method that returns a list of Ruby created toolbars and control their visibility. Just need that OSX solution. -
hmm...
n = UI::Toolbar.new('FooBar') #<UI::Toolbar:0xd0820a8> n.add_item(c) #<UI::Toolbar:0xd0820a8> n.add_item(c) #<UI::Toolbar:0xd0820a8> n.add_separator #<UI::Toolbar:0xd0820a8> n.add_item(c) #<UI::Toolbar:0xd0820a8> n.show nil n.add_separator #<UI::Toolbar:0xd0820a8> n.add_item(c) #<UI::Toolbar:0xd0820a8>
Even when I have the original toolbar object I can't add items after the toolbar has been shown. The last two items in the above sample where not added to the toolbar. Is it really not possible to add items dynamically afterwards? -
@tig said:
The entry ToolbarsUser-Summary > Bars gives the total number of 'user toolbars' so you can construct a loop to go through to find each one with NN ...
Sketchup.read_default('ToolbarsUser-Summary', 'Bars', nil)
This just returns1
for me. The registry value is49
. -
It should return that value BUT I don't even get
1
- I getnil
??? -
I wonder if
Sketchup.read_default
prevents access to SU's own registry values. Might have to use the Win32 API - or have anyone been able to access any of the other SU registry values?I can only get S
ketchup.read_default
to return correct values for whatSketchup.write_default
has created.thought this could be an easy cross platform method for SU settings...
-
Doing some tests:
require 'C;/Ruby/lib/ruby/1.8/win32/registry.rb' module TT_Test def self.toolbars toolbars = [] begin path_summary = 'Software\\Google\\SketchUp7\\ToolbarsUser-Summary' Win32;;Registry;;HKEY_CURRENT_USER.open(path_summary) { |reg| bars = reg.read_i('Bars') (0..bars-1).each { |i| section = "ToolbarsUser-Bar#{i}" begin path_toolbar = "Software\\Google\\SketchUp7\\#{section}" Win32;;Registry;;HKEY_CURRENT_USER.open(path_toolbar) { |r| r.each { |subkey, type, data| if type == Win32;;Registry;;REG_SZ && subkey == 'BarName' toolbars << data break end } } rescue next end } } return toolbars rescue return nil end end # def end
Gets an array of Ruby Toolbars. Work on PC - but requires registry.rb. Will look into calling the Win32 API directly so it only requires Win32API.
(I'm not sure how to deal with requirements of standard ruby libraries. include the registry.rb with my plugin and load only if it isn't defined?
require 'C:\ruby\lib\ruby\1.8\win32\registry.rb' if defined?(Win32::Registry).nil?
)How do you read settings on OSX? Where are these settings stored?
-
The Mac has 'plist' files like an 'ini' file == the registry...
-
Does OSX have an API to read it, or do you just open it and parse it yourself?
-
I am Macless. I don't know about plist API readers ...
Here is a 'plist' set someone gave me for info - it is 'readable' - just about...MacPlistArchive.zip
Here's another useful link http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/ConfigFiles.html -
There are plist editors available that make the task much simpler by parsing it for you and showing what can be changed etc. eg http://www.macupdate.com/info.php/id/14363
-
I'll check that out. I got an old Mac mini to test on.
-
hmm... the Info.plist file in the Sketchup application package does not contain the same info we see in the Windows registry...
-
I can't seem to get a handle on the Large Tool Set to hide it, any ideas?
i.e. these don't work:
UI.set_toolbar_visible("Large Tool Set", false) UI.set_toolbar_visible("LargeToolSet", false)
-
@jim said:
I can't seem to get a handle on the Large Tool Set to hide it, any ideas?
i.e. these don't work:
UI.set_toolbar_visible("Large Tool Set", false) UI.set_toolbar_visible("LargeToolSet", false)
Yea - it's untouchable.
UI.toolbar_names
["Standard", "Principle", "Camera", "Drawing", "Edit", "Construction", "Walk", "DisplayMode", "StandardViews", "Section", "Google", "GettingStarted", "VCB"]
That's the only ones we can get. And this is on PC. On Mac it's two completely different names. -
I've managed to get a list of Ruby created toolbars on PC.
But on Mac I got some problems.
I found a plist at /Users/<user>/Library/Preferences/One com.google.sketchupfree.plist and one com.google.sketchupfree7.plist
What I'm not sure how to is:
- find the current user so I know the path to the plist
- the name of the plist - which I think is related to the application id. http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/UserPreferences.html#//apple_ref/doc/uid/20002092 Need a way to get the application’s bundle identifier for the Sketchup version the script is running in.
- the toolbar names I get from these files doesn't seem to be 100% complete. think they might only appear if they've been shown at some point.
Advertisement