Re: Thread implémentation
- From:
- Régis d'Aubarède
- Date:
- 2011-07-21 @ 23:01
Oups,
this was continuation of this message, wic have disappeared with inscription
______________________________________
Hello,
I continue here a discussion with Ashbb on green-shoes/issue.
So I would like to have a standardized mechanism for Thread access to shoes
object
For example as :
Thread.new {
... some heavy job...
shoes_app_invoke { @log.text="starting test" }
... some heavy job...
shoes_app_invoke { @log.text="end test ok" }
}
Thanks,
Le 21 juillet 2011 19:54, Régis d'Aubarède <regis.aubarede@gmail.com> a
écrit :
> Hello,
> here a implementation of my proposition.
> tested with green_shoes
>
> call define_async_thread_invoker() in a app construction
> call invoke_in_shoes_mainloop() { } in a thread
>
> Example :
>
>
-------------------------------------------------------------------------------------
> require 'green_shoes'
> require './gs_thread_util.rb'
>
> Thread.new {
> 100.times{ |i|
> `ping -w 100 -n 4 1.1.1.1`
> invoke_in_shoes_mainloop {
> @textpara.text = "looping #{i}" ;
> show_app
> }
> }
> }
> Shoes.app :title=>"Shoes Systray", :width=> 400, :height=>300 do
> title "Thread Test ;)"
>
> @textpara= para "..."
> textpara1= para "..."
> define_async_thread_invoker()
> button "Test interactive" do
> textpara1.text = Time.now.to_s
> end
> $win=win
> button "Hide" do
> hide_app
> end
> end
>
>
-------------------------------------------------------------------------------------
>
> and gs_thread_util.rb is at
> https://gist.github.com/1097754
>
> --
>
> - - - - - - - - - - - - - - - - -
>
> __ ___ __ __
> |__) |__ / _` | /__`
> | \ |___ \__> | .__/
>
> - - - - - - - - - - - - - - - - -
>
>
>
--
- - - - - - - - - - - - - - - - -
__ ___ __ __
|__) |__ / _` | /__`
| \ |___ \__> | .__/
- - - - - - - - - - - - - - - - -
Re: [shoes] Re: Thread implémentation
- From:
- ashbb
- Date:
- 2011-07-24 @ 06:26
Hi Régis,
Thank you for sharing your Thread utils.
After edited the following, it works well on my Windows 7 laptop.
define_async_thread_invoker() ===> define_async_thread_invoker(1)
I think you may be interested in this previous discussion: connect Shoes.app
to signals from external class (
http://librelist.com/browser//shoes/2011/6/2/connect-shoes-app-to-signals-from-external-class/
)
Cheers,
ashbb