WebDialog.set_html fails under Safari 5.0.6
-
-
I'm finding no way to get anything to trigger when OSX exits. onDelete model triggers when you close a model, but not upon exit. It's like all Ruby callbacks are stopped when SU exits under OSX.
-
sorry if I'm barking up the wrong tree, but this bit of code overwrites an existing file.
could something similar not work for .html's@sfile = "/Library/Application\ Support/Google\ SketchUp\ 8/SketchUp/plugins/audit_mac_ruby/audit.txt " @debug_file = File.new(@sfile, "w")
john
-
@thomthom said:
I got lots of Fredo tracelogs in my Window folder...
Normally LibFredo6 keeps the last 10 or 15 log files (purge is done above).
This is to allow consulting traces from previous sessions.Fredo
-
@thomthom said:
Cursed - this is more troublesome than I thought.
Under Windows I can clean up all temps by usingAppObserver.onQuit
- but under OSX it appear to never trigger.You should not worry too much with the temporary file.
You create it with a unique name and then delete it when you close the dialog box (I guess you have a hook in the on_close() event).
And if there are a few files remaining, the user or the system will purge them at some points.The question I had on temp file is whether the html file should absolutely be in the ENV["TMPDIR"] folder or in any folder (like /tmp)
Fredo
-
@unknownuser said:
@thomthom said:
The question I had on temp file is whether the html file should absolutely be in the ENV["TMPDIR"] folder or in any folder (like /tmp)
Fredo
I just did a test and
@tempfile = File.join( "/Library/Application Support/Google\ SketchUp\ 8/SketchUp/plugins/TT_Lib2/webdialog", filename )
runs the same as the former, but I can find it easier...
-
I'm thinking I might not need temp files at all. I just need to send the HTML to the webdialog via
.execute_script
to a proxy HTML document that replaces the content. -
another thing...
I decided to check the html temp files from both paths to see if they where identical (they are)
I also get this identical message when opening in TextWrangler.
never seen that for any other html files, so I checked Fredo's tmp htmls as well and they are fine.
here's the other file, contents is the same
EDIT- it may be this <title>CleanUpďż˝ unidentified character(in TextWrangler) -
@driven said:
@unknownuser said:
@thomthom said:
The question I had on temp file is whether the html file should absolutely be in the ENV["TMPDIR"] folder or in any folder (like /tmp)
Fredo
I just did a test and
@tempfile = File.join( "/Library/Application Support/Google\ SketchUp\ 8/SketchUp/plugins/TT_Lib2/webdialog", filename )
runs the same as the former, but I can find it easier...
If the file is in the system temp then it's more likely that stray files will be removed.
@driven said:
another thing...
I decided to check the html temp files from both paths to see if they where identical (they are)
I also get this identical message when opening in TextWrangler.
temp_file_message.png
temp_file_message.png (47.92 KiB) Viewed 4 timesnever seen that for any other html files, so I checked Fredo's tmp htmls as well and they are fine.
That's because I have sent a Âł character in ANSI format instead of UTF-8. It's nothing important.
-
if your proxy is in your webdialog folder, all your links are then relative... I'd vote for that... if I can
-
@unknownuser said:
@thomthom said:
Cursed - this is more troublesome than I thought.
Under Windows I can clean up all temps by usingAppObserver.onQuit
- but under OSX it appear to never trigger.You should not worry too much with the temporary file.
You create it with a unique name and then delete it when you close the dialog box (I guess you have a hook in the on_close() event).w = WebDialogPatch.new( 'Hello World' ) w.show w.set_html( 'Lorem Ipsum' ) w.close w.show # HTML file would now be missing...
-
@driven said:
if your proxy is in your webdialog folder, all your links are then relative... I'd vote for that... if I can
-
@thomthom said:
I'm thinking I might not need temp files at all. I just need to send the HTML to the webdialog via
.execute_script
to a proxy HTML document that replaces the content.I remember that execute_script suffered from a string size limitation on Mac?
Maybe this is fine now.Fredo
-
@thomthom said:
I'm thinking I might not need temp files at all. I just need to send the HTML to the webdialog via
.execute_script
to a proxy HTML document that replaces the content.by proxy HTML document I assumed you meant a html file that is basically populated by your current window.html + ruby, which is then sent to web dialog and is then updated via ruby.
if that's what you mean, and it lived beside window.html can't all your links then be relative i.e. href=css/ui.css, src=js/base.js, etc...
john
-
@unknownuser said:
@thomthom said:
I'm thinking I might not need temp files at all. I just need to send the HTML to the webdialog via
.execute_script
to a proxy HTML document that replaces the content.I remember that execute_script suffered from a string size limitation on Mac?
Maybe this is fine now.Fredo
Arrgh - yea I've heard rumors about that. Cursed how troublesome the WebDialog should be under OSX!
@driven said:
if that's what you mean, and it lived beside window.html can't all your links then be relative i.e. href=css/ui.css, src=js/base.js, etc...
Yes. In fact, I made them relative in 2.5.5 because they relied on the BASE tag in the header which pointed everything to the root dir of the webdialog.
-
@unknownuser said:
I remember that execute_script suffered from a string size limitation on Mac?
Well there's always injecting a external script file.
dlg.execute_script %[ var xx = document.createElement('script'); xx.type = 'text/javascript'; xx.src = "file;//some/path/to/script.js"; document.getElementsByTagName('head')[0].appendChild(xx) ]
-
@dan rathbun said:
@unknownuser said:
I remember that execute_script suffered from a string size limitation on Mac?
Well there's always injecting a external script file.
dlg.execute_script %[ > var xx = document.createElement('script'); > xx.type = 'text/javascript'; > xx.src = "file;//some/path/to/script.js"; > document.getElementsByTagName('head')[0].appendChild(xx) > ]
But we wanted to send the HTML itself to the webdialog for replacement as a way to avoid temp files.
-
Right ok.. same kind of deal.
assume you have a block of html text in Ruby
htmltext
-
You open the dialog with a blank body template using
set_file()
-
Then create a Js var called bodytext (as above)
-
Successively...
... take chucks ofhtmltext
and assign tohtmlpart
... and useexecute_script("body_text += '#{htmlpart}'")
.. or similar until all the Ruby-side text has been transfered. -
then call
execute_script("document.body.innerHtml=body_text;")
-
-
Yea, I was planning on adding a large data pump to my library anyway. But I need to work out what the data limit is... Hopefully I can just send a very large string from ruby and compare it in JS.
-
Actually, what I really hope for is that
at_exit
works under OSX.
Advertisement