From matma.rex at gmail.com Wed Feb 1 13:09:34 2012 From: matma.rex at gmail.com (=?UTF-8?Q?Bartosz_Dziewo=C5=84ski?=) Date: Wed, 1 Feb 2012 19:09:34 +0100 Subject: [fxruby-users] New fxruby version and maintenance In-Reply-To: References: <1600803.YIpcr7Hto9@netzbuch> Message-ID: Just reporting that the Windows binary gem works and my old apps still seem to run. Thanks! -- Matma Rex From watobo at siberas.de Wed Feb 15 02:10:48 2012 From: watobo at siberas.de (watobo) Date: Wed, 15 Feb 2012 08:10:48 +0100 Subject: [fxruby-users] fxruby maintenance Message-ID: <4F3B5A78.4000709@siberas.de> Hi everybody, I'm glad to see that Lars is the new maintainer of fxruby :) regards, andy From watobo at siberas.de Wed Feb 15 02:27:50 2012 From: watobo at siberas.de (watobo) Date: Wed, 15 Feb 2012 08:27:50 +0100 Subject: [fxruby-users] FXText update within threads Message-ID: <4F3B5E76.7020102@siberas.de> Hi fxruby-users, I want to set the text (setText/appendText) of an FXText widget out of a thread. As soon as the scroll bar appears in the widget the gui is not responsive anymore. This behaviour only occurs under windows (Win7-64). Under Linux it just works fine. Using FXDataTarget is not possible because it produces a big delay on updating the widget. Additionally, if I use an FXDataTarget it seems that all my other message handlers disapear. Here's the sample code which triggers the behaviour: -------------8<-------------------- #!/usr/bin/env ruby require 'rubygems' require 'fox16' include Fox class MyWorker @@pool_mutex = Mutex.new def subscribe(event, &callback) (@event_dispatcher_listeners[event] ||= []) << callback end def notify(event, *args) if @event_dispatcher_listeners[event] @@pool_mutex.synchronize do @event_dispatcher_listeners[event].each do |m| m.call(*args) if m.respond_to? :call end end end end def run progress = {} @total.times do |i| Thread.new(i) { |ii| msg = "#{@name}: #{ii}\n" puts msg + " - running ..." notify(:logger, msg) sleep 1 puts msg + " - finished!" } end end def initialize(name, total = 100) @event_dispatcher_listeners = {} @total = total @name = name end end class MTTextTest < FXMainWindow @@textMutex = Mutex.new def initialize(app) # Call base class initializer first super(app, "Producer Test", :width => 800, :height => 600) frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) @textbox = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_AUTOSCROLL) showButton = FXButton.new(frame, "&Thread", :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT) showButton.connect(SEL_COMMAND) do # @textbox.hide @tl = [] 10.times do |x| # print "\n* starting worker #{x}..." name = "w#{x}" worker = MyWorker.new(name, x*3) worker.subscribe(:logger) { |msg| begin @@textMutex.synchronize do @textbox.appendText( msg, false ) end rescue => bang puts bang puts bang.backtrace end } worker.run end # @textbox.appendText "ALL WORKERS STARTED !!!\n" # @tl.each do |t| t.join; end end end # Create and show the main window def create super # Create the windows show(PLACEMENT_SCREEN) # Make the main window appear end end if __FILE__ == $0 # Construct the application object application = FXApp.new('Multi-Thread-Producer Test', 'FoxTest') # Construct the main window scribble = MTTextTest.new(application) # Create the application application.create application.run end -------------8<-------------------- C:\Users\andy>ruby -e "require 'fox16'; puts \"Ruby: #{RUBY_VERSION}\nFox: #{Fox .fxversion}\"" Ruby: 1.9.2 Fox: 1.6.44 Does anybody know what's wrong here? Thanks, Andy From rmelton at ball.com Wed Feb 15 10:53:05 2012 From: rmelton at ball.com (Melton, Ryan) Date: Wed, 15 Feb 2012 08:53:05 -0700 Subject: [fxruby-users] FXText update within threads In-Reply-To: <4F3B5E76.7020102@siberas.de> References: <4F3B5E76.7020102@siberas.de> Message-ID: <2EC28B773AF39E47850AC45765483C2C15F0E13C@AEROMSG2.AERO.BALL.COM> You're not allowed to interact with the GUI from threads. You need to put any GUI function calls inside of a timeout handler so that they execute in the main thread. Ryan -----Original Message----- From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of watobo Sent: Wednesday, February 15, 2012 12:28 AM To: fxruby-users at rubyforge.org Subject: [fxruby-users] FXText update within threads Hi fxruby-users, I want to set the text (setText/appendText) of an FXText widget out of a thread. As soon as the scroll bar appears in the widget the gui is not responsive anymore. This behaviour only occurs under windows (Win7-64). Under Linux it just works fine. Using FXDataTarget is not possible because it produces a big delay on updating the widget. Additionally, if I use an FXDataTarget it seems that all my other message handlers disapear. Here's the sample code which triggers the behaviour: -------------8<-------------------- #!/usr/bin/env ruby require 'rubygems' require 'fox16' include Fox class MyWorker @@pool_mutex = Mutex.new def subscribe(event, &callback) (@event_dispatcher_listeners[event] ||= []) << callback end def notify(event, *args) if @event_dispatcher_listeners[event] @@pool_mutex.synchronize do @event_dispatcher_listeners[event].each do |m| m.call(*args) if m.respond_to? :call end end end end def run progress = {} @total.times do |i| Thread.new(i) { |ii| msg = "#{@name}: #{ii}\n" puts msg + " - running ..." notify(:logger, msg) sleep 1 puts msg + " - finished!" } end end def initialize(name, total = 100) @event_dispatcher_listeners = {} @total = total @name = name end end class MTTextTest < FXMainWindow @@textMutex = Mutex.new def initialize(app) # Call base class initializer first super(app, "Producer Test", :width => 800, :height => 600) frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) @textbox = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_AUTOSCROLL) showButton = FXButton.new(frame, "&Thread", :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT) showButton.connect(SEL_COMMAND) do # @textbox.hide @tl = [] 10.times do |x| # print "\n* starting worker #{x}..." name = "w#{x}" worker = MyWorker.new(name, x*3) worker.subscribe(:logger) { |msg| begin @@textMutex.synchronize do @textbox.appendText( msg, false ) end rescue => bang puts bang puts bang.backtrace end } worker.run end # @textbox.appendText "ALL WORKERS STARTED !!!\n" # @tl.each do |t| t.join; end end end # Create and show the main window def create super # Create the windows show(PLACEMENT_SCREEN) # Make the main window appear end end if __FILE__ == $0 # Construct the application object application = FXApp.new('Multi-Thread-Producer Test', 'FoxTest') # Construct the main window scribble = MTTextTest.new(application) # Create the application application.create application.run end -------------8<-------------------- C:\Users\andy>ruby -e "require 'fox16'; puts \"Ruby: #{RUBY_VERSION}\nFox: #{Fox .fxversion}\"" Ruby: 1.9.2 Fox: 1.6.44 Does anybody know what's wrong here? Thanks, Andy _______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. From lars at greiz-reinsdorf.de Wed Feb 15 14:31:56 2012 From: lars at greiz-reinsdorf.de (Lars Kanis) Date: Wed, 15 Feb 2012 20:31:56 +0100 Subject: [fxruby-users] FXText update within threads In-Reply-To: <2EC28B773AF39E47850AC45765483C2C15F0E13C@AEROMSG2.AERO.BALL.COM> References: <4F3B5E76.7020102@siberas.de> <2EC28B773AF39E47850AC45765483C2C15F0E13C@AEROMSG2.AERO.BALL.COM> Message-ID: Hi watobo, > You're not allowed to interact with the GUI from threads. ? You need to put any GUI function calls inside of a timeout handler so that they execute in the main thread. That's right, fxruby isn't thread safe. You could use a Queue object to collect blocks with the GUI calls and execute them from a timeout method. -- Regards, Lars From watobo at siberas.de Wed Feb 15 15:18:44 2012 From: watobo at siberas.de (Andreas Schmidt) Date: Wed, 15 Feb 2012 21:18:44 +0100 Subject: [fxruby-users] FXText update within threads In-Reply-To: <2EC28B773AF39E47850AC45765483C2C15F0E13C@AEROMSG2.AERO.BALL.COM> References: <4F3B5E76.7020102@siberas.de> <2EC28B773AF39E47850AC45765483C2C15F0E13C@AEROMSG2.AERO.BALL.COM> Message-ID: <4F3C1324.3010705@siberas.de> Hi Ryan, why not? Even in the groupbox.rb example a thread is used to update the clock. I've often used threads to control widgets and it worked all the time with Ruby 1.8. In Ruby 1.9 a lot of the thread managment changed, you can use threads to control FXTables, FXLabel or FXProgressBar without any problems. But I experienced this problem with FXText widget and I don't understand where this problem lies. Is it a problem of FXRuby or of the Fox-Toolkit? thanks, -andy Am 15.02.2012 16:53, schrieb Melton, Ryan: > You're not allowed to interact with the GUI from threads. You need to put any GUI function calls inside of a timeout handler so that they execute in the main thread. > > Ryan > > -----Original Message----- > From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of watobo > Sent: Wednesday, February 15, 2012 12:28 AM > To: fxruby-users at rubyforge.org > Subject: [fxruby-users] FXText update within threads > > Hi fxruby-users, > > I want to set the text (setText/appendText) of an FXText widget out of a > thread. As soon as the scroll bar appears in the widget the gui is not > responsive anymore. This behaviour only occurs under windows (Win7-64). Under > Linux it just works fine. > > Using FXDataTarget is not possible because it produces a big delay on > updating the widget. Additionally, if I use an FXDataTarget it seems that all my other message handlers disapear. > > Here's the sample code which triggers the behaviour: > > -------------8<-------------------- > > #!/usr/bin/env ruby > require 'rubygems' > require 'fox16' > > include Fox > > class MyWorker > > @@pool_mutex = Mutex.new > > def subscribe(event, &callback) > (@event_dispatcher_listeners[event] ||= []) << callback > end > > def notify(event, *args) > if @event_dispatcher_listeners[event] > @@pool_mutex.synchronize do > @event_dispatcher_listeners[event].each do |m| > m.call(*args) if m.respond_to? :call > end > end > end > end > > def run > progress = {} > @total.times do |i| > Thread.new(i) { |ii| > msg = "#{@name}: #{ii}\n" > puts msg + " - running ..." > > notify(:logger, msg) > > sleep 1 > puts msg + " - finished!" > } > end > > end > > def initialize(name, total = 100) > @event_dispatcher_listeners = {} > @total = total > @name = name > end > end > > class MTTextTest < FXMainWindow > @@textMutex = Mutex.new > def initialize(app) > # Call base class initializer first > super(app, "Producer Test", :width => 800, :height => 600) > frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) > > @textbox = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_AUTOSCROLL) > > showButton = FXButton.new(frame, "&Thread", :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT) > > showButton.connect(SEL_COMMAND) do > # @textbox.hide > @tl = [] > 10.times do |x| > > # print "\n* starting worker #{x}..." > name = "w#{x}" > worker = MyWorker.new(name, x*3) > > worker.subscribe(:logger) { |msg| > begin > > @@textMutex.synchronize do > @textbox.appendText( msg, false ) > end > > rescue => bang > puts bang > puts bang.backtrace > end > > } > worker.run > end > # @textbox.appendText "ALL WORKERS STARTED !!!\n" > # @tl.each do |t| t.join; end > end > > end > > # Create and show the main window > def create > super # Create the windows > show(PLACEMENT_SCREEN) # Make the main window appear > end > end > > if __FILE__ == $0 > # Construct the application object > application = FXApp.new('Multi-Thread-Producer Test', 'FoxTest') > > # Construct the main window > scribble = MTTextTest.new(application) > > # Create the application > application.create > > application.run > end > > -------------8<-------------------- > > C:\Users\andy>ruby -e "require 'fox16'; puts \"Ruby: #{RUBY_VERSION}\nFox: #{Fox > .fxversion}\"" > Ruby: 1.9.2 > Fox: 1.6.44 > > > Does anybody know what's wrong here? > > Thanks, > > Andy > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > > > > This message and any enclosures are intended only for the addressee. Please > notify the sender by email if you are not the intended recipient. If you are > not the intended recipient, you may not use, copy, disclose, or distribute this > message or its contents or enclosures to any other person and any such actions > may be unlawful. Ball reserves the right to monitor and review all messages > and enclosures sent to or from this email address. > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users From rmelton at ball.com Wed Feb 15 17:18:24 2012 From: rmelton at ball.com (Melton, Ryan) Date: Wed, 15 Feb 2012 15:18:24 -0700 Subject: [fxruby-users] FXText update within threads In-Reply-To: <4F3C1324.3010705@siberas.de> References: <4F3B5E76.7020102@siberas.de><2EC28B773AF39E47850AC45765483C2C15F0E13C@AEROMSG2.AERO.BALL.COM> <4F3C1324.3010705@siberas.de> Message-ID: <2EC28B773AF39E47850AC45765483C2C15F0E4BE@AEROMSG2.AERO.BALL.COM> Most GUI frameworks (including FOX) are designed to the reactor pattern http://en.wikipedia.org/wiki/Reactor_pattern much like the EventMachine library (ie. one thread that services events) and are not thread safe. What that means is that things may work sometimes, but not always if you touch the GUI outside of the main thread. Due to Ruby 1.9 using native threads, problems jump out a lot faster when running 1.9, but they still existed in 1.8. I've learned this the hard way with some very subtle and "spurious" failures in applications I have written. Note that code that is not thread safe will work just fine across threads as long as a context switch does not occur while it is executing. Calls that take a long time, like calls to FXText, are much more likely to have a context switch occur while they are executing. If any of the example code touches the GUI from a Thread.new, then it is a BAD example. May work sometimes, or even most of the time, but othertimes you will get a nice "spurious" crash. :) Ryan -----Original Message----- From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Andreas Schmidt Sent: Wednesday, February 15, 2012 1:19 PM To: fxruby-users at rubyforge.org Subject: Re: [fxruby-users] FXText update within threads Hi Ryan, why not? Even in the groupbox.rb example a thread is used to update the clock. I've often used threads to control widgets and it worked all the time with Ruby 1.8. In Ruby 1.9 a lot of the thread managment changed, you can use threads to control FXTables, FXLabel or FXProgressBar without any problems. But I experienced this problem with FXText widget and I don't understand where this problem lies. Is it a problem of FXRuby or of the Fox-Toolkit? thanks, -andy Am 15.02.2012 16:53, schrieb Melton, Ryan: > You're not allowed to interact with the GUI from threads. You need to put any GUI function calls inside of a timeout handler so that they execute in the main thread. > > Ryan > > -----Original Message----- > From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of watobo > Sent: Wednesday, February 15, 2012 12:28 AM > To: fxruby-users at rubyforge.org > Subject: [fxruby-users] FXText update within threads > > Hi fxruby-users, > > I want to set the text (setText/appendText) of an FXText widget out of a > thread. As soon as the scroll bar appears in the widget the gui is not > responsive anymore. This behaviour only occurs under windows (Win7-64). Under > Linux it just works fine. > > Using FXDataTarget is not possible because it produces a big delay on > updating the widget. Additionally, if I use an FXDataTarget it seems that all my other message handlers disapear. > > Here's the sample code which triggers the behaviour: > > -------------8<-------------------- > > #!/usr/bin/env ruby > require 'rubygems' > require 'fox16' > > include Fox > > class MyWorker > > @@pool_mutex = Mutex.new > > def subscribe(event, &callback) > (@event_dispatcher_listeners[event] ||= []) << callback > end > > def notify(event, *args) > if @event_dispatcher_listeners[event] > @@pool_mutex.synchronize do > @event_dispatcher_listeners[event].each do |m| > m.call(*args) if m.respond_to? :call > end > end > end > end > > def run > progress = {} > @total.times do |i| > Thread.new(i) { |ii| > msg = "#{@name}: #{ii}\n" > puts msg + " - running ..." > > notify(:logger, msg) > > sleep 1 > puts msg + " - finished!" > } > end > > end > > def initialize(name, total = 100) > @event_dispatcher_listeners = {} > @total = total > @name = name > end > end > > class MTTextTest < FXMainWindow > @@textMutex = Mutex.new > def initialize(app) > # Call base class initializer first > super(app, "Producer Test", :width => 800, :height => 600) > frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) > > @textbox = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_AUTOSCROLL) > > showButton = FXButton.new(frame, "&Thread", :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT) > > showButton.connect(SEL_COMMAND) do > # @textbox.hide > @tl = [] > 10.times do |x| > > # print "\n* starting worker #{x}..." > name = "w#{x}" > worker = MyWorker.new(name, x*3) > > worker.subscribe(:logger) { |msg| > begin > > @@textMutex.synchronize do > @textbox.appendText( msg, false ) > end > > rescue => bang > puts bang > puts bang.backtrace > end > > } > worker.run > end > # @textbox.appendText "ALL WORKERS STARTED !!!\n" > # @tl.each do |t| t.join; end > end > > end > > # Create and show the main window > def create > super # Create the windows > show(PLACEMENT_SCREEN) # Make the main window appear > end > end > > if __FILE__ == $0 > # Construct the application object > application = FXApp.new('Multi-Thread-Producer Test', 'FoxTest') > > # Construct the main window > scribble = MTTextTest.new(application) > > # Create the application > application.create > > application.run > end > > -------------8<-------------------- > > C:\Users\andy>ruby -e "require 'fox16'; puts \"Ruby: #{RUBY_VERSION}\nFox: #{Fox > .fxversion}\"" > Ruby: 1.9.2 > Fox: 1.6.44 > > > Does anybody know what's wrong here? > > Thanks, > > Andy > > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > > > > This message and any enclosures are intended only for the addressee. Please > notify the sender by email if you are not the intended recipient. If you are > not the intended recipient, you may not use, copy, disclose, or distribute this > message or its contents or enclosures to any other person and any such actions > may be unlawful. Ball reserves the right to monitor and review all messages > and enclosures sent to or from this email address. > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users _______________________________________________ fxruby-users mailing list fxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/fxruby-users This message and any enclosures are intended only for the addressee. Please notify the sender by email if you are not the intended recipient. If you are not the intended recipient, you may not use, copy, disclose, or distribute this message or its contents or enclosures to any other person and any such actions may be unlawful. Ball reserves the right to monitor and review all messages and enclosures sent to or from this email address. From natarajsn at gmail.com Thu Feb 16 01:33:17 2012 From: natarajsn at gmail.com (Nataraj S Narayan) Date: Thu, 16 Feb 2012 12:03:17 +0530 Subject: [fxruby-users] fxruby on framebuffer , without X Message-ID: Hi I fell in love with fxruby while coding it on an Arm-linux handheld, 200Mhz Arm board with a modest 64M memory. It was on an Angstrom Linux distro. Worked like a song in whipping up apps fast and worked without a glitch. Overtime, my company gave up on Angstrom distro and switch to an Xwindow less setup on the handheld, running Qt apps on framebuffer device (compiled , of course). I am missing my fxruby days on the handheld. Any way to get fxruby work on the framebuffer device, by passing X window system? Any libs like DirectFb , which might be used in compiling Fox-toolkit with? Warm regards Nataraj From watobo at siberas.de Thu Feb 16 02:18:31 2012 From: watobo at siberas.de (Andreas Schmidt) Date: Thu, 16 Feb 2012 08:18:31 +0100 Subject: [fxruby-users] FXText update within threads In-Reply-To: <2EC28B773AF39E47850AC45765483C2C15F0E4BE@AEROMSG2.AERO.BALL.COM> References: <4F3B5E76.7020102@siberas.de><2EC28B773AF39E47850AC45765483C2C15F0E13C@AEROMSG2.AERO.BALL.COM> <4F3C1324.3010705@siberas.de> <2EC28B773AF39E47850AC45765483C2C15F0E4BE@AEROMSG2.AERO.BALL.COM> Message-ID: <4F3CADC7.9030601@siberas.de> Hi Ryan, thanks a lot for this detailed explanation. But I don't like the answer because it means a lot of work ;) After all, I should have read this earlier: http://www.fox-toolkit.net/faq#TOC-Is-FOX-thread-safe-Can-I-write-mult -andy Am 15.02.2012 23:18, schrieb Melton, Ryan: > Most GUI frameworks (including FOX) are designed to the reactor pattern http://en.wikipedia.org/wiki/Reactor_pattern much like the EventMachine library (ie. one thread that services events) and are not thread safe. What that means is that things may work sometimes, but not always if you touch the GUI outside of the main thread. Due to Ruby 1.9 using native threads, problems jump out a lot faster when running 1.9, but they still existed in 1.8. I've learned this the hard way with some very subtle and "spurious" failures in applications I have written. > > Note that code that is not thread safe will work just fine across threads as long as a context switch does not occur while it is executing. Calls that take a long time, like calls to FXText, are much more likely to have a context switch occur while they are executing. > > If any of the example code touches the GUI from a Thread.new, then it is a BAD example. May work sometimes, or even most of the time, but othertimes you will get a nice "spurious" crash. :) > > Ryan > > -----Original Message----- > From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of Andreas Schmidt > Sent: Wednesday, February 15, 2012 1:19 PM > To: fxruby-users at rubyforge.org > Subject: Re: [fxruby-users] FXText update within threads > > Hi Ryan, > > why not? Even in the groupbox.rb example a thread is used to update the > clock. I've often used threads to control widgets and it worked all the > time with Ruby 1.8. In Ruby 1.9 a lot of the thread managment changed, > you can use threads to control FXTables, FXLabel or FXProgressBar > without any problems. But I experienced this problem with FXText widget > and I don't understand where this problem lies. Is it a problem of > FXRuby or of the Fox-Toolkit? > > thanks, > -andy > > > Am 15.02.2012 16:53, schrieb Melton, Ryan: >> You're not allowed to interact with the GUI from threads. You need to put any GUI function calls inside of a timeout handler so that they execute in the main thread. >> >> Ryan >> >> -----Original Message----- >> From: fxruby-users-bounces at rubyforge.org [mailto:fxruby-users-bounces at rubyforge.org] On Behalf Of watobo >> Sent: Wednesday, February 15, 2012 12:28 AM >> To: fxruby-users at rubyforge.org >> Subject: [fxruby-users] FXText update within threads >> >> Hi fxruby-users, >> >> I want to set the text (setText/appendText) of an FXText widget out of a >> thread. As soon as the scroll bar appears in the widget the gui is not >> responsive anymore. This behaviour only occurs under windows (Win7-64). Under >> Linux it just works fine. >> >> Using FXDataTarget is not possible because it produces a big delay on >> updating the widget. Additionally, if I use an FXDataTarget it seems that all my other message handlers disapear. >> >> Here's the sample code which triggers the behaviour: >> >> -------------8<-------------------- >> >> #!/usr/bin/env ruby >> require 'rubygems' >> require 'fox16' >> >> include Fox >> >> class MyWorker >> >> @@pool_mutex = Mutex.new >> >> def subscribe(event, &callback) >> (@event_dispatcher_listeners[event] ||= []) << callback >> end >> >> def notify(event, *args) >> if @event_dispatcher_listeners[event] >> @@pool_mutex.synchronize do >> @event_dispatcher_listeners[event].each do |m| >> m.call(*args) if m.respond_to? :call >> end >> end >> end >> end >> >> def run >> progress = {} >> @total.times do |i| >> Thread.new(i) { |ii| >> msg = "#{@name}: #{ii}\n" >> puts msg + " - running ..." >> >> notify(:logger, msg) >> >> sleep 1 >> puts msg + " - finished!" >> } >> end >> >> end >> >> def initialize(name, total = 100) >> @event_dispatcher_listeners = {} >> @total = total >> @name = name >> end >> end >> >> class MTTextTest < FXMainWindow >> @@textMutex = Mutex.new >> def initialize(app) >> # Call base class initializer first >> super(app, "Producer Test", :width => 800, :height => 600) >> frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) >> >> @textbox = FXText.new(frame, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y|TEXT_AUTOSCROLL) >> >> showButton = FXButton.new(frame, "&Thread", :opts => FRAME_THICK|FRAME_RAISED|LAYOUT_FILL_X|LAYOUT_TOP|LAYOUT_LEFT) >> >> showButton.connect(SEL_COMMAND) do >> # @textbox.hide >> @tl = [] >> 10.times do |x| >> >> # print "\n* starting worker #{x}..." >> name = "w#{x}" >> worker = MyWorker.new(name, x*3) >> >> worker.subscribe(:logger) { |msg| >> begin >> >> @@textMutex.synchronize do >> @textbox.appendText( msg, false ) >> end >> >> rescue => bang >> puts bang >> puts bang.backtrace >> end >> >> } >> worker.run >> end >> # @textbox.appendText "ALL WORKERS STARTED !!!\n" >> # @tl.each do |t| t.join; end >> end >> >> end >> >> # Create and show the main window >> def create >> super # Create the windows >> show(PLACEMENT_SCREEN) # Make the main window appear >> end >> end >> >> if __FILE__ == $0 >> # Construct the application object >> application = FXApp.new('Multi-Thread-Producer Test', 'FoxTest') >> >> # Construct the main window >> scribble = MTTextTest.new(application) >> >> # Create the application >> application.create >> >> application.run >> end >> >> -------------8<-------------------- >> >> C:\Users\andy>ruby -e "require 'fox16'; puts \"Ruby: #{RUBY_VERSION}\nFox: #{Fox >> .fxversion}\"" >> Ruby: 1.9.2 >> Fox: 1.6.44 >> >> >> Does anybody know what's wrong here? >> >> Thanks, >> >> Andy >> >> _______________________________________________ >> fxruby-users mailing list >> fxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/fxruby-users >> >> >> >> This message and any enclosures are intended only for the addressee. Please >> notify the sender by email if you are not the intended recipient. If you are >> not the intended recipient, you may not use, copy, disclose, or distribute this >> message or its contents or enclosures to any other person and any such actions >> may be unlawful. Ball reserves the right to monitor and review all messages >> and enclosures sent to or from this email address. >> _______________________________________________ >> fxruby-users mailing list >> fxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/fxruby-users > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users > > > > This message and any enclosures are intended only for the addressee. Please > notify the sender by email if you are not the intended recipient. If you are > not the intended recipient, you may not use, copy, disclose, or distribute this > message or its contents or enclosures to any other person and any such actions > may be unlawful. Ball reserves the right to monitor and review all messages > and enclosures sent to or from this email address. > _______________________________________________ > fxruby-users mailing list > fxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/fxruby-users From lars at greiz-reinsdorf.de Thu Feb 16 15:20:32 2012 From: lars at greiz-reinsdorf.de (Lars Kanis) Date: Thu, 16 Feb 2012 21:20:32 +0100 Subject: [fxruby-users] fxruby-1.6.22.pre4 Message-ID: Hi fxruby-users, I just pushed "fxruby-1.6.22.pre4.gem" to rubygems.org. You can install it with "gem install fxruby --pre". This release solves all segfault issues I'm aware of. The test suite now passes with --gc-stress and without invalid memory accesses monitored with valgrind. It is certainly still possible to write code that crashes ruby (like using nil as parent window), but correct code shouldn't crash. The only new feature is proper pixel based access in FXImage and derived classes. You can now easily load jpegs as textures in OpenGL and vice versa save rendered images back into jpegs. I'll release 1.6.22 after the weekend, if no one complains... Changes: * Allow better access to raw pixel data of FXImage and derivatives * Add alias FXApp#modalWindow, as described in rdoc * Add quality parameter to FXJPGImage and FXJPGIcon * Fix invalid memory access in final GC call when using FXMenuCommand with acckey * Fix double referenced foxObj when borrowed object registration is triggered from C++ * Fix Segfault while GC'ing FXWindows * Fix 'object allocation not allowed while garbage collection' bug * Fix clipboard handling on windows -- Kind regards, Lars From kb9agt at gmail.com Fri Feb 24 20:10:28 2012 From: kb9agt at gmail.com (Douglas Allen) Date: Fri, 24 Feb 2012 20:10:28 +0000 (UTC) Subject: [fxruby-users] Invitation to connect on LinkedIn Message-ID: <1474617487.4697139.1330114228715.JavaMail.app@ela4-bed82.prod> LinkedIn ------------ I'd like to add you to my professional network on LinkedIn. - Douglas Douglas Allen Independent Consumer Electronics Professional Greater Chicago Area Confirm that you know Douglas Allen: https://www.linkedin.com/e/-1sdaja-gz1no3c8-6z/isd/6057559159/xAJnT-nG/?hs=false&tok=03abSNwdrWgR81 -- You are receiving Invitation to Connect emails. Click to unsubscribe: http://www.linkedin.com/e/-1sdaja-gz1no3c8-6z/xHcu9PUYH6LO6lbZRIP6bPU3F0zh2wjC4-x-iWuS/goo/fxruby-users%40rubyforge%2Eorg/20061/I2105260253_1/?hs=false&tok=0VmqMmx-7WgR81 (c) 2012 LinkedIn Corporation. 2029 Stierlin Ct, Mountain View, CA 94043, USA. -------------- next part -------------- An HTML attachment was scrubbed... URL: