Web page loaded while ruby processes?
-
Hey, I thought I would be able to pop open a webpage with an animated gif on it while ruby was doing some processing in the background. But I am only getting a blank webpage until the processing stops, then it loads.
Is this expected? Is it not possible to have an animated gif showing on a webpage while ruby is doing something else? Or did I probably just implement it wrong?
-
If you load all of your html/js code and 'show' the dialog before starting a Ruby process then the dialog should show as it was at the moment ruby started processing?
Alternatively if you run the webdialog inside an animation or timer then its process is independent of the main SUp process.
I think Todd was looking at a new progressbar that worked like this...
Without seeing how you've coded this it's difficult to tell what's up... -
I hadn't really done anything special. It during a model import. I think I open the webdialog and then go starting into the sketchup importer. Maybe I could add a callback to the webdialog that waits for the onload to complete so the gif gets loaded first, then tells SketchUp to go into the import process.
I'll give that a shot.
-
dialog.show{ self.populate(dialog) self.do_import(file) }
ORdialog.show_modal{}
if you want it in front etc -
WebDialog will suffer from whiteout like SU.
-
@thomthom said:
WebDialog will suffer from whiteout like SU.
because the dialog opens as a child of the SketchUp main window, so no Ruby work-around can solve it?
-
Can't you open the webdialog inside a timer-block or an animation... so it then runs outside the main process?
Then kill the timer once the main processing is done ?? -
@tig said:
Can't you open the webdialog inside a timer-block or an animation... so it then runs outside the main process?
Then kill the timer once the main processing is done ??Timers doesn't run outside the main process. If any heavy work is done inside it blocks the main script. If the main scrip does some heavy work it blocks the timer. Even threads doesn't work in SU Ruby.
It's why we haven't gotten any progressbar alternatives that doesn't block. (Fredo uses timers to slice up the work, but it makes the total processing time a lot slower.)
-
@thomthom said:
Fredo uses timers to slice up the work, but it makes the total processing time a lot slower.
Actually the overhead is reasonably small. The goal of this mechanism is just to give back control to the UI, in case the user has clicked or typed a key. This is not to perform heavy stuff while the script is itself busy with computation.
Fredo
Advertisement