ruby - How can I use the progress bar in Shoes? -


OK, so I'm not sure about a lot of things in the shoes, but my test and error approach fail me So far on this one

I have got a class which calculates some type which takes a little while, and I want to throw a progress bar to see the user while ending it. I am My computationally formulated method yields its percent full, then passed from a block:

  class MathiStuff def (start) (end) ## is something costly, time consuming method which Yield percentage expensiveMethod def complete (& amp; section) 0.upto (100) | I | 0.upto (100000) do J | K = J; End yield i.to_f / 100; End of End:  

Here I was Like to say in shoes:

  requires' MathyStuff. Rb 'shoes. App @mymathyStuff = MathyStuff.new (); Button ("Talk about expensive matter ...") window () do the progression = progress (); @ MyMathiStuff.expensiveMethod () {| Percentage | @ Progress.fraction = percent;} End And End  

But it does not seem to work I have tried animate (with) without having / with window calls, different ways I have also tried Trying to have conversation through Boot.APPS () [0] .Get / Setprint Methods, I have also called Thread.new and passing this window block; Anything seems to work properly.

Maybe I am not using the progress bar as it is to use it. Again, what would happen to a progress bar? ; Firstly, sharing data between two windows in shoes is a royal pain. I do not recommend it Instead, first hide the contents of the window and bring the progress bar in place of it.

Second, we will come to switch from a block processing to provide a percentage attribute for MathiStuff extension, so we can use the animation thread from:

  class mathithph attr_accessor: percent DEF expensive MethodWrapper @percent = 0.0 expensive fundamental {| X | @ Pant = x} End and Shoes App @ mimethstaff = matthiethaf.New (); @window_slot = Stacking Button ("The expensive mathy thing is ...") Do @ window_slot.toggle @progress_slot = flows @progress = progress work: width = & gt; 1.0 End End Thread.new @myMathiStuff.expensiveMethodWrapper end @animate = animate @progress.fraction = @ myMathiStuff.percent if @ myMathiStuff.percent == 1.0 @ progress_slot.remove @ window_slot.toggle @ end end end end endimate.stop  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -