From yohasebe at gmail.com Fri Dec 1 21:54:05 2006 From: yohasebe at gmail.com (Yoichiro Hasebe) Date: Sat, 2 Dec 2006 11:54:05 +0900 Subject: [Wxruby-users] Gauge Problem with XRC? Message-ID: <8bc62e150612011854m7da0a376t46197d8bfdd7dffe@mail.gmail.com> Hi I've just started using wxruby2-preview-0.0.36-i386-mswin32 outsourcing layout part to the external XRC file. Almost everything seems to be fine. Only that I can never retrieve Gauge objects in the main script. What I've been trying is something like this: class MainFrame < Wx::Frame include Wx def initialize(parent) super(nil,-1, "") $xml.load_frame_subclass(self, nil, 'ID_MAINFRAME') @statliclabel = Window.find_window_by_name('ID_SLABEL1') #OK @gauge = Window.find_window_by_name('ID_GAUGE1') #NG ... Hope someone can give me a hint, or is this a bug? Regards, yohasebe From alex at pressure.to Sat Dec 2 07:03:37 2006 From: alex at pressure.to (Alex Fenton) Date: Sat, 02 Dec 2006 12:03:37 +0000 Subject: [Wxruby-users] wxSugar control problem In-Reply-To: References: <91D1B8A2-C03E-49C4-948B-6A5A1E286003@alexspeller.com> <456E2332.2030302@pressure.to> Message-ID: <45716B99.6040700@pressure.to> Alex Speller wrote: > I've gone through most of the controls on the docs index page, and > have come up with these changes: > ... Thanks very much for the fixes. I've applied those to SVN and also added a few other classes that are now available in wxruby2 eg HtmlWindow, PrintDialog. I'll put a release out shortly with these fixes in. > I've been meaning to write some > kind of wxSugar intro / tutorial, simply because it seems so much > easier to pick up if you're used to ruby syntax. > Glad to hear it's doing what it's meant to do... I think an intro would be very welcome. It's on my todo list but stabilising the core wxruby2 is our priority for now alex From alex at pressure.to Sat Dec 2 07:07:05 2006 From: alex at pressure.to (Alex Fenton) Date: Sat, 02 Dec 2006 12:07:05 +0000 Subject: [Wxruby-users] wxSugar control problem In-Reply-To: References: <91D1B8A2-C03E-49C4-948B-6A5A1E286003@alexspeller.com> <456E2332.2030302@pressure.to> Message-ID: <45716C69.4070600@pressure.to> Alex Speller wrote: > Is this not there for a reason (i.e. just creating windows on their > own is a "bad thing")? I've just been using them as an area to draw on A lot of WxWidgets/WxPython code uses Panels rather than Windows to draw on. I think there is a reason for this but I don't know what it is... alex From alex at pressure.to Sat Dec 2 07:10:13 2006 From: alex at pressure.to (Alex Fenton) Date: Sat, 02 Dec 2006 12:10:13 +0000 Subject: [Wxruby-users] Gauge Problem with XRC? In-Reply-To: <8bc62e150612011854m7da0a376t46197d8bfdd7dffe@mail.gmail.com> References: <8bc62e150612011854m7da0a376t46197d8bfdd7dffe@mail.gmail.com> Message-ID: <45716D25.8020206@pressure.to> Hi > I've just started using wxruby2-preview-0.0.36-i386-mswin32 > outsourcing layout part to the external XRC file. Almost everything > seems to be fine. Only that I can never retrieve Gauge objects in the > main script. What I've been trying is something like this: > Thanks for your message - may be a bug. Could you post an xrc file that demonstrates the problem please, as I'm not that familiar with it. alex From yhasebe at mail.doshisha.ac.jp Sat Dec 2 08:02:49 2006 From: yhasebe at mail.doshisha.ac.jp (Yoichiro Hasebe) Date: Sat, 2 Dec 2006 22:02:49 +0900 Subject: [Wxruby-users] Gauge Problem with XRC? In-Reply-To: <45716D25.8020206@pressure.to> References: <8bc62e150612011854m7da0a376t46197d8bfdd7dffe@mail.gmail.com> <45716D25.8020206@pressure.to> Message-ID: <8bc62e150612020502t65eade5icbced30542e22755@mail.gmail.com> I found it quite productive to use wxruby with a xrc designer such as DialogBlocks. Probably Wx::Gauge in wxruby2 has a problem with xrc, though. wxruby (0.6) just works fine with the following code, by the way. Thank you anyway for this excellent GUI toolkit. yohasebe ##### main.rb ##### rrequire 'wx' include Wx class MainFrame < Wx::Frame def initialize() super(nil,-1, "Test") $xml.load_frame_subclass(self, nil, 'ID_FRAME') evt_close(){get_app.exit_main_loop} @slabel = Window.find_window_by_name('ID_SLABEL') @txtctrl = Window.find_window_by_name('ID_TXTCTRL') # The next line will not be successfully executed on wxruby2 @gauge = Window.find_window_by_name('ID_GAUGE') # main.rb:14:in `find_window_by_name': wrong argument # type nil (expected Class) (TypeError) end end class XrcApp < Wx::App def on_init init_all_image_handlers() $xml = XmlResource.get() $xml.init_all_handlers() xrc_file = File.join( File.dirname( __FILE__ ), 'test.xrc' ) $xml.load(xrc_file) $main = MainFrame.new() $main.show(true) end end XrcApp.new().main_loop() ##### end of main.rb ##### ##### test.xrc ##### 200,150 MainFrame wxVERTICAL wxALIGN_CENTER_HORIZONTAL|wxALL|wxADJUST_MINSIZE 5 wxALIGN_CENTER_HORIZONTAL|wxALL 5 wxALIGN_CENTER_HORIZONTAL|wxALL 5 1 100 ##### end of test.xrc ##### From alex at pressure.to Sat Dec 2 20:07:51 2006 From: alex at pressure.to (Alex Fenton) Date: Sun, 03 Dec 2006 01:07:51 +0000 Subject: [Wxruby-users] Gauge Problem with XRC? In-Reply-To: <8bc62e150612020502t65eade5icbced30542e22755@mail.gmail.com> References: <8bc62e150612011854m7da0a376t46197d8bfdd7dffe@mail.gmail.com> <45716D25.8020206@pressure.to> <8bc62e150612020502t65eade5icbced30542e22755@mail.gmail.com> Message-ID: <45722367.8070402@pressure.to> Yoichiro Hasebe wrote: > I found it quite productive to use wxruby with a xrc designer such as > DialogBlocks. That's interesting to know thanks, I have been curious which designers work with wxRuby via xrc. > Probably Wx::Gauge in wxruby2 has a problem with xrc, > though. wxruby (0.6) just works fine with the following code, by the > way. The example works for me on OS X 10.3, trying v0.0.37 and HEAD; the gauge is returned. Hmm. So maybe a problem on windows only, or something recently fixed, but I don't know of any patch recently to fix something like for this. Will try on some other platforms later. alex From alex at pressure.to Sun Dec 3 07:46:42 2006 From: alex at pressure.to (Alex Fenton) Date: Sun, 03 Dec 2006 12:46:42 +0000 Subject: [Wxruby-users] wxsugar 0.1.2 error with SpinCtrl In-Reply-To: <44755A88-0D6A-4052-9902-42EE2CFC6442@alexspeller.com> References: <44755A88-0D6A-4052-9902-42EE2CFC6442@alexspeller.com> Message-ID: <4572C732.1030309@pressure.to> Hi Alex Speller wrote: > I'm using wx_sugar 0.1.2 with wxruby2-preview 0.0.37 on OSX and am > coming up with a strange error when trying to create a SpinCtrl: > > ... > ArgumentError: Error initializing # Sent paramters: [#, -1, #, #, 4, > -1, #, #, 4096, 0, 100, 0] correct parameters are: id (Fixnum) pos > (Wxruby2::Point) size (Wxruby2::Size) style (Fixnum) id (Fixnum) pos > (Wxruby2::Point) size (Wxruby2::Size) style (Fixnum) min (Fixnum) max > (Fixnum) initial (Fixnum) Think this is a same/similar bug in keyword_classes.rb - can you please try with recently released 0.1.3? thanks alex From alex at pressure.to Sun Dec 3 12:38:47 2006 From: alex at pressure.to (Alex Fenton) Date: Sun, 03 Dec 2006 17:38:47 +0000 Subject: [Wxruby-users] wxSugar 0.1.3 released Message-ID: <45730BA7.9000307@pressure.to> WxSugar version 0.1.3 is available from https://rubyforge.org/frs/?group_id=35&release_id=8265 It can be installed via gems, or using 'rake install' from the tar.gz file. == What's new This is mainly a bugfix release, fixing some problems with KeywordConstructors for certain wxruby classes (thanks to Alex Speller for spotting these). It's a recommended upgrade. There are some minor updates to reflect recent wxruby2 progress. ItemData modules are deprecated because the functionality they were covering for is now fixed in wxruby2 core. I doubt anyone was using them. == What's WxSugar? WxSugar is a set of pure-ruby extensions to wxRuby's port of the GUI API. The extensions aim to make writing wxRuby code more expressive and less repetitive by making better use Ruby's syntactic features and conventions. From alex at alexspeller.com Sun Dec 3 13:05:44 2006 From: alex at alexspeller.com (Alex Speller) Date: Sun, 3 Dec 2006 18:05:44 +0000 Subject: [Wxruby-users] wxsugar 0.1.2 error with SpinCtrl In-Reply-To: <4572C732.1030309@pressure.to> References: <44755A88-0D6A-4052-9902-42EE2CFC6442@alexspeller.com> <4572C732.1030309@pressure.to> Message-ID: <624FA525-75A7-40A3-8D71-49CF0AA0AD3C@alexspeller.com> > Alex Speller wrote: >> I'm using wx_sugar 0.1.2 with wxruby2-preview 0.0.37 on OSX and am >> coming up with a strange error when trying to create a SpinCtrl: >> >> > ... >> ArgumentError: Error initializing # Sent paramters: [#, -1, #, #, 4, >> -1, #, #, 4096, 0, 100, 0] correct parameters are: id (Fixnum) pos >> (Wxruby2::Point) size (Wxruby2::Size) style (Fixnum) id (Fixnum) pos >> (Wxruby2::Point) size (Wxruby2::Size) style (Fixnum) min (Fixnum) max >> (Fixnum) initial (Fixnum) > Think this is a same/similar bug in keyword_classes.rb - can you > please > try with recently released 0.1.3? Problem with mailing list (or my email maybe)... Posted this before I posted the original one you responded, and it didn't come through so I posted again. Then this one came through 4 days later - odd. It was solved by your original fix, I'm just about to download 0.1.3 and check that over. Cheers, Alex From ilpuccio.febo at gmail.com Thu Dec 7 05:59:43 2006 From: ilpuccio.febo at gmail.com (Raoul Jean Pierre Bonnal) Date: Thu, 7 Dec 2006 11:59:43 +0100 Subject: [Wxruby-users] Introduce and noob problem require 'wx' Message-ID: <77bcf63d0612070259w6fa99340ya9ee1ff8dbeeaf69@mail.gmail.com> Dear All, my name is Raoul, this is the first time I post here. I'm a computer scientis and I'm working in bioinformatic's filed, we have a lot of tools to analyse the data but no good graphic applications to visualize them. So I'm looking for a good framework for my job. I think your motivations on using wxruby are good, most important for me is the crossplatform feature. I have to provide a good service for avery platform. I'm interested on BioSQL too and probably in these days I'll star to code some bioruby code to extend that library. I hope wxruby2 will become stable as soon as possible. I have installed wxruby2 by gems. then running the minimal application I got this: ruby -rubygems /usr/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.36-i486-linux /samples/minimal/minimal.rb Unable to load wxruby. Searched: /usr/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.36-i486-linux/bin /usr/lib/ruby/gems/1.8/gems/wxruby2- preview-0.0.36-i486-linux/lib /usr/lib/ruby/site_ruby/1.8 /usr/lib/ruby/site_ruby/1.8/i586-linux-gnu /usr/lib/ruby/site_ruby /usr/lib/ruby/1.8 /usr/lib/ruby/1.8/i586-linux-gnu I'm quite sure the error is stupid but I can't see it... Tnx a lot. RJP -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061207/437dfdbd/attachment.html From alex at pressure.to Thu Dec 7 06:23:35 2006 From: alex at pressure.to (Alex Fenton) Date: Thu, 07 Dec 2006 11:23:35 +0000 Subject: [Wxruby-users] Introduce and noob problem require 'wx' In-Reply-To: <77bcf63d0612070259w6fa99340ya9ee1ff8dbeeaf69@mail.gmail.com> References: <77bcf63d0612070259w6fa99340ya9ee1ff8dbeeaf69@mail.gmail.com> Message-ID: <4577F9B7.3000409@pressure.to> Hi Raoul > I have installed wxruby2 by gems. then running the minimal application > I got this: > > ruby -rubygems > /usr/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.36-i486-linux/samples/minimal/minimal.rb > Unable to load wxruby. Searched: > /usr/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.36-i486-linux/bin > /usr/lib/ruby/gems/1.8/gems/wxruby2- preview-0.0.36-i486-linux/lib It looks like ruby is running into a problem when it tries to load the compiled library file which contains the bulk of wxruby2 functionality. Can you first verify this file exists? - according to the output you have shown I think it should be at: /usr/lib/ruby/gems/1.8/gems/wxruby2- preview-0.0.36-i486-linux/lib/wxruby2.so If this file does exist, could you try seeing if it will load on its own: ruby -rubygems -e "require 'wxruby2'" And report any error messages. Could you also let us know what distro you're using, and what GTK2 libraries you have installed on your system, with versions (eg libgtk2.0, libgtk2.0-dev) thanks alex From ilpuccio.febo at gmail.com Thu Dec 7 08:24:01 2006 From: ilpuccio.febo at gmail.com (Raoul Jean Pierre Bonnal) Date: Thu, 7 Dec 2006 14:24:01 +0100 Subject: [Wxruby-users] Introduce and noob problem require 'wx' In-Reply-To: <4577F9B7.3000409@pressure.to> References: <77bcf63d0612070259w6fa99340ya9ee1ff8dbeeaf69@mail.gmail.com> <4577F9B7.3000409@pressure.to> Message-ID: <77bcf63d0612070524k5151e6f2k59a696c0c89060ca@mail.gmail.com> Hi Alex, On 12/7/06, Alex Fenton wrote: > > Can you first verify this file exists? exists ll /usr/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.36-i486-linux/lib/ totale 10472 drwxr-xr-x 2 root root 4096 dic 7 09:52 wx/ -rw-r--r-- 1 root root 775 dic 7 09:52 wx.rb -rw-r--r-- 1 root root 10696656 dic 7 09:52 wxruby2.so If this file does exist, could you try seeing if it will load on its own: > ruby -rubygems -e "require 'wxruby2'" /usr/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.36-i486-linux/lib/wxruby2.so: libtiff.so.4: cannot open shared object file: No such file or directory - /usr/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.36-i486-linux/lib/wxruby2.so (LoadError) from /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in `require' from -e:1 So looking for libtiff library I found installed on my system these: /usr/lib/libtiff.so.3 /usr/lib/libtiff.so /usr/lib/libtiff.so.3.8.2 And report any error messages. Could you also let us know what distro > you're using, Mandriva Linux release 2007.0 (Official) for i586 and what GTK2 libraries you have installed on your system, > with versions (eg libgtk2.0, libgtk2.0-dev) for x in `urpmq -Y -r libgtk`; do echo `rpmquery $x`; done | grep -v "is not installed" libGtkScintilla0-0.8.2-5mdv2007.0 libGtkScintilla0-devel-0.8.2-5mdv2007.0 libgtk+-x11-2.0_0-2.10.3-4mdv2007.0 libgtk+1.2-1.2.10-45mdv2007.0 libgtk+2.0_0-2.10.3-4mdv2007.0 libgtk+2.0_0-devel-2.10.3-4mdv2007.0 libgtk-linux-fb-2.0_0-2.4.14-6mdk libgtkglarea2.0-1.99.0-9mdv2007.0 libgtkglarea5-1.2.3-9mdv2007.0 libgtkhtml-3.8_15-3.12.0-1mdv2007.0 libgtkhtml2_0-2.11.0-2mdv2007.0 libgtkmm2.0_1-2.2.12-3mdv2007.0 libgtkmm2.0_1-devel-2.2.12-3mdv2007.0 libgtkmm2.4_1-2.10.1-1mdv2007.0 libgtksourceview-1.0_0-1.8.0-1mdv2007.0 libgtkspell0-2.0.11-1mdk libgtkspell0-devel-2.0.11-1mdk libgtkxmhtml1-1.4.2-18mdv2007.0 Actually I think my problem is due to tiff library, desn't it ? Best Regards RJP -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061207/0ba36209/attachment.html From alex at pressure.to Thu Dec 7 16:31:52 2006 From: alex at pressure.to (Alex Fenton) Date: Thu, 07 Dec 2006 21:31:52 +0000 Subject: [Wxruby-users] Introduce and noob problem require 'wx' In-Reply-To: <77bcf63d0612070524k5151e6f2k59a696c0c89060ca@mail.gmail.com> References: <77bcf63d0612070259w6fa99340ya9ee1ff8dbeeaf69@mail.gmail.com> <4577F9B7.3000409@pressure.to> <77bcf63d0612070524k5151e6f2k59a696c0c89060ca@mail.gmail.com> Message-ID: <45788848.8080209@pressure.to> Raoul Jean Pierre Bonnal wrote: > > > ruby -rubygems -e "require 'wxruby2'" > > > /usr/lib/ruby/gems/1.8/gems/wxruby2-preview-0.0.36-i486-linux/lib/wxruby2.so: > libtiff.so.4: cannot open shared object file: No such file or > directory - /usr/lib/ruby/gems/1.8/gems/wxruby2- > preview-0.0.36-i486-linux/lib/wxruby2.so (LoadError) > from > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in `require' > from -e:1 > So looking for libtiff library I found installed on my system these: > /usr/lib/libtiff.so.3 > /usr/lib/libtiff.so > /usr/lib/libtiff.so.3.8.2 Yes, this sounds like the problem, but I am not quite sure why. The 'official' builds are supposed to use wxwidget's built-in versions of libtiff, libpng, libjpeg. I wonder if there is a problem b/c you *do* have your own version of libtiff installed, but it isn't compatible for some reason. Sorry I can't check this as away from home so don't have a linux machine. Anyway, we are looking to do a release shortly; if it's OK, I will contact you off list about trying a pre-release compiled linux version. Thanks again for the report alex From ilpuccio.febo at gmail.com Mon Dec 11 08:44:44 2006 From: ilpuccio.febo at gmail.com (Raoul Jean Pierre Bonnal) Date: Mon, 11 Dec 2006 14:44:44 +0100 Subject: [Wxruby-users] Introduce and noob problem require 'wx' In-Reply-To: <45788848.8080209@pressure.to> References: <77bcf63d0612070259w6fa99340ya9ee1ff8dbeeaf69@mail.gmail.com> <4577F9B7.3000409@pressure.to> <77bcf63d0612070524k5151e6f2k59a696c0c89060ca@mail.gmail.com> <45788848.8080209@pressure.to> Message-ID: <77bcf63d0612110544s5f8f938bl9fb88d95603a0e67@mail.gmail.com> On 12/7/06, Alex Fenton wrote: > > Raoul Jean Pierre Bonnal wrote: > Anyway, we are looking to do a release shortly; if it's OK, I will > contact you off list about trying a pre-release compiled linux version. That's fine for me. Bye -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061211/cd7d127f/attachment.html From alex at pressure.to Mon Dec 11 21:09:52 2006 From: alex at pressure.to (Alex Fenton) Date: Tue, 12 Dec 2006 02:09:52 +0000 Subject: [Wxruby-users] Gauge Problem with XRC? In-Reply-To: <8bc62e150612020502t65eade5icbced30542e22755@mail.gmail.com> References: <8bc62e150612011854m7da0a376t46197d8bfdd7dffe@mail.gmail.com> <45716D25.8020206@pressure.to> <8bc62e150612020502t65eade5icbced30542e22755@mail.gmail.com> Message-ID: <457E0F70.2080106@pressure.to> Yoichiro Hasebe wrote: > I found it quite productive to use wxruby with a xrc designer such as > DialogBlocks. Probably Wx::Gauge in wxruby2 has a problem with xrc, > though. wxruby (0.6) just works fine with the following code, by the > way. One other thing - as a workaround for your original issue, you might try putting a placeholder widget in the XRC (any class, really), then replacing it in Ruby code with the real gauge you want to show. Use the detach, insert and layout methods of the sizer which contains the widgets, eg sizer.detach(1) # the index of the placeholder widget gauge = Wx::Gauge.new(...) sizer.insert(1, gauge) sizer.layout hth alex From alex at pressure.to Mon Dec 11 20:07:18 2006 From: alex at pressure.to (Alex Fenton) Date: Tue, 12 Dec 2006 01:07:18 +0000 Subject: [Wxruby-users] Gauge Problem with XRC? In-Reply-To: <8bc62e150612020502t65eade5icbced30542e22755@mail.gmail.com> References: <8bc62e150612011854m7da0a376t46197d8bfdd7dffe@mail.gmail.com> <45716D25.8020206@pressure.to> <8bc62e150612020502t65eade5icbced30542e22755@mail.gmail.com> Message-ID: <457E00C6.6010209@pressure.to> Hello I have now tried your example code on Linux/GTK. I can't reproduce the error you describe - the call to find_window_by_name returns the Wx::Gauge, and methods can be called on it. The bad news is that the frame contents don't display correctly. I get some unusual GTK warnings about Pizza (!) (wxruby:8729): Gtk-WARNING **: Attempting to add a widget with type GtkPizza to a GtkWindow, but as a GtkBin subclass a GtkWindow can only contain one widget at a time; it already contains a widget of type GtkPizza (wxruby:8729): Gdk-CRITICAL **: gdk_drawable_get_depth: assertion `GDK_IS_DRAWABLE (drawable)' failed This makes me wonder if there is something wrong about this layout? Sometimes if you are doing something slightly 'wrong' in the organisation of widgets and sizer, it will work on one platform but not on another. However, although I don't know XRC, what you have sent looks correct to me. Is this the exact code that DialogBlocks generated? If not, it must be a wxruby2-specific bug. Please test on windows with the next release, and if it's still not working, please file a bug on rubyforge and we'll try and look at it for the next release cycle. Thanks alex From roys at mindspring.com Mon Dec 11 22:15:37 2006 From: roys at mindspring.com (Roy Sutton) Date: Mon, 11 Dec 2006 22:15:37 -0500 Subject: [Wxruby-users] Gauge Problem with XRC? In-Reply-To: <457E00C6.6010209@pressure.to> References: <8bc62e150612011854m7da0a376t46197d8bfdd7dffe@mail.gmail.com> <45716D25.8020206@pressure.to> <8bc62e150612020502t65eade5icbced30542e22755@mail.gmail.com> <457E00C6.6010209@pressure.to> Message-ID: <457E1ED9.1030005@mindspring.com> Alex Fenton wrote: > If not, it must be a wxruby2-specific bug. Please test on windows with > the next release, and if it's still not working, please file a bug on > rubyforge and we'll try and look at it for the next release cycle. > > I can confirm this bug exists on Windows with the latest builds I have. I was going to track this down but haven't had any time. Roy From yhasebe at mail.doshisha.ac.jp Mon Dec 11 23:38:21 2006 From: yhasebe at mail.doshisha.ac.jp (Yoichiro Hasebe) Date: Tue, 12 Dec 2006 13:38:21 +0900 Subject: [Wxruby-users] Gauge Problem with XRC? In-Reply-To: <457E00C6.6010209@pressure.to> References: <8bc62e150612011854m7da0a376t46197d8bfdd7dffe@mail.gmail.com> <45716D25.8020206@pressure.to> <8bc62e150612020502t65eade5icbced30542e22755@mail.gmail.com> <457E00C6.6010209@pressure.to> Message-ID: <8bc62e150612112038u1dcb7564u4d789ee2c0df2783@mail.gmail.com> Hi. > One other thing - as a workaround for your original issue, you might try > putting a placeholder widget in the XRC (any class, really), then > replacing it in Ruby code with the real gauge you want to show. Use the > detach, insert and layout methods of the sizer which contains the > widgets, eg Quite interesting. Since I needed to use both xrc and gauge on Windows, I also came up with an ad-hoc workaround along the same line. But yours looks better. I'll give it a try. > This makes me wonder if there is something wrong about this layout? > Sometimes if you are doing something slightly 'wrong' in the > organisation of widgets and sizer, it will work on one platform but not > on another. However, although I don't know XRC, what you have sent looks > correct to me. Is this the exact code that DialogBlocks generated? That was the exact code DialogBlocks generated. I can't say if it's perfectly well-formed or not, though. One strange thing is, when I checked if the xrc from DialogBlocks is compatible with other xrc capable designers XRCed and VisualWx, the former understood it perfectly whereas the latter didn't. Anyway, thank you for the follow-ups. yohasebe From paul.allton at uk.bnpparibas.com Thu Dec 14 05:45:38 2006 From: paul.allton at uk.bnpparibas.com (paul.allton at uk.bnpparibas.com) Date: Thu, 14 Dec 2006 10:45:38 +0000 Subject: [Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow Message-ID: First of all, just wanted to say big thanks for all the great work on wxruby2 .. I've been a user of 0.6 for a long time and its proved very useful over the years. It's great to finally have a multi-platform, gem installable ui toolkit that doesn't suck! Secondly, thanks also for wx-sugar. I was drowning in sizers and started to write my own layout library ... but yours is likely to be far better so I've ditched mine and I'm using sugar from now on. However, I have a couple of issues ... (in both cases, apologies if I'm just not using it correctly) (1) setting foreground and background colours on a Gauge. - on wxruby2-preview (0.0.36) windows, the colours seem to be ignored, i.e. no matter what you change it to, its always blue on grey. - on wxruby2-preview (0.0.37) OS X, the background does change but not the foreground - is this an OS restriction? i.e. is the bar always blue in OS X? (2) expanding SplitterWindow's content in wx-sugar Basically, I need a SplitterWindow with a ListBox and a TextCtrl, the following snippet creates just that, but the contained controls do not expand to fit the splitter's panels (they just appear small). I've tried setting the minsize and proportion when adding them to the panel, i.e @errors = p1.add(ListBox.new(p1), :minsize => true), but then they just disappear altogether. Where am going wrong? arrange_vertically splitter = SplitterWindow.new(self) splitter.minimum_pane_size = 10 p1 = splitter.add(Panel.new(splitter)) do | p1 | @errors = p1.add(ListBox.new(p1)) end p2 = splitter.add(Panel.new(splitter)) do | p2 | @log = p2.add(TextCtrl.new(p2, :style => TE_MULTILINE | TE_READONLY)) end splitter.split_horizontally(p1, p2) add(splitter, :proportion => 1) Many thanks, Paul This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061214/0971c13a/attachment.html From alex at pressure.to Thu Dec 14 20:32:13 2006 From: alex at pressure.to (Alex Fenton) Date: Fri, 15 Dec 2006 01:32:13 +0000 Subject: [Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow In-Reply-To: References: Message-ID: <4581FB1D.2010903@pressure.to> Hi Paul > (1) setting foreground and background colours on a Gauge. > - on wxruby2-preview (0.0.36) windows, the colours seem to be ignored, > i.e. no matter what you change it to, its always blue on grey. > - on wxruby2-preview (0.0.37) OS X, the background does change but not > the foreground - is this an OS restriction? i.e. is the bar always > blue in OS X? I'm not so sure for Windows, but certainly on OS X I would be very surprised if you were allowed to change the colour of the Aqua-style gauge. Underneath wxruby it's implemented by calls to the standard API and from Apple's interface builder there's no setting to alter this colour. I'd probably see this as a platform-native feature - maybe have another look at what you're trying to convey by using a non-standard gauge colour. Perhaps we could suggest a more familiar UI metaphor? > (2) expanding SplitterWindow's content in wx-sugar > Basically, I need a SplitterWindow with a ListBox and a TextCtrl, the > following snippet creates just that, but the contained controls do not > expand to fit the splitter's panels (they just appear small). I've > tried setting the minsize and proportion when adding them to the > panel, i.e @errors = p1.add(ListBox.new(p1), :minsize => true), but > then they just disappear altogether. Where am going wrong? You are telling the splitter window to expand within the frame, by using :proportion => 1 at the end, but you also need to tell the ListBox and TextCtrl to expand within their containing Panels. Otherwise they will appear at the small default size. eg: arrange_vertically splitter = SplitterWindow.new(self) splitter.minimum_pane_size = 10 p1 = splitter.add(Panel) do | p1 | # arrange ... p1.arrange_vertically do # ... and expand @errors = p1.add(ListBox, :proportion => 1) end end p2 = splitter.add(Panel) do | p2 | # ditto p2.arrange_vertically do log_style = TE_MULTILINE|TE_READONLY @log = p2.add(TextCtrl[:style => log_style], :proportion => 1) end end splitter.split_horizontally(p1, p2) add(splitter, :proportion => 1) I 'sugared' your code generally to illustrate that you can just use the class name (or klass[]) within a call to 'add' because the parent is implied. But only the calls to arrange_vertically and the :proportion=> 1 arguments actually needed for your purpose. cheers alex From paul.allton at uk.bnpparibas.com Mon Dec 18 10:31:55 2006 From: paul.allton at uk.bnpparibas.com (paul.allton at uk.bnpparibas.com) Date: Mon, 18 Dec 2006 15:31:55 +0000 Subject: [Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow Message-ID: Hi Alex, Thanks for the quick response ... > I'm not so sure for Windows, but certainly on OS X I would be very > surprised if you were allowed to change the colour of the Aqua-style > gauge. Underneath wxruby it's implemented by calls to the standard API > and from Apple's interface builder there's no setting to alter this colour. > I'd probably see this as a platform-native feature - maybe have another > look at what you're trying to convey by using a non-standard gauge > colour. Perhaps we could suggest a more familiar UI metaphor? You can definitely change the gauge background/foreground colours in windows wxruby 0.6.0, but not in wxruby2preview. For OS X, I agree that it goes against the apple UI guidelines and so seems reasonable not to work. I also agree that its probably not the right UI metaphor and have subsequently ditched the gauge. I'm basically trying to implement a solid red/green status bar, like junit (http://www.junit.org/). Following advice from the OS X junit (see: http://java.sun.com/developer/technicalArticles/JavaLP/JavaToMac2/), I've since tried to implement this using a TextCtrl. This works fine on windows, but on OS X the background is always white. Should this work, or can you suggest another component type that can be coloured in this way? > You are telling the splitter window to expand within the frame, by using > :proportion => 1 at the end, but you also need to tell the ListBox and >TextCtrl to expand within their containing Panels. Otherwise they will > appear at the small default size. eg: ..... (snip) Thanks for the arrangement advice, this works just great now. Also, I didn't know about the ability to just use the class name, that's really nice. I'd hate to have to write a UI without wx-sugar now ;) A couple more questions for you ... - TextCtrl on windows supports the TE_RICH and TE_AUTO_URL styles, but I cannot seem to extract the url from the generated evt_text_url event. Is this not supported or am I just not asking the right question of it? - I'm a big fan of automated UI testing (i.e. driving the UI from some robot API). I appreciate this is potentially a whole new project, but does wxwidgets provide a method of clicking buttons, typing into components ... if so, would it be technically possible to expose this in wxruby. Cheers, Paul This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061218/78b0ae25/attachment-0001.html From alex at pressure.to Mon Dec 18 12:15:00 2006 From: alex at pressure.to (Alex Fenton) Date: Mon, 18 Dec 2006 17:15:00 +0000 Subject: [Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow In-Reply-To: References: Message-ID: <4586CC94.7000107@pressure.to> Hi Paul > You can definitely change the gauge background/foreground colours in > windows wxruby 0.6.0, but not in wxruby2preview. OK, I didn't know that. Feel free to file a bug for it. > I also agree that its probably not the right UI metaphor and have > subsequently ditched the gauge. I'm basically trying to implement a > solid red/green status bar, I wondered if it was something like that. Eclipse + RDT uses it for the unit testing runner. I actually think it reasonable UI device but unfortunately as the link you sent points out it's a Swing thing. > I've since tried to implement this using a TextCtrl. This works fine > on windows, but on OS X the background is always white. Should this > work, or can you suggest another component type that can be coloured > in this way? Are you using set_background_colour or set_default_style? I know that set_style doesn't respect the background colour of a TextAttr on OS X, on 10.3 at least. My investigations suggest that WxWidgets wraps different native OS X controls on different versions, including one that doesn't support bg colour on text. This is a thorn in my side as I need this for an app - so it's something I'm pursuing. In the meantime, possible workarounds might be to place StaticText on a Panel (which definitely can be coloured on OS X), or (really nasty) to use a single-cell Grid and hide the column and row headers. > A couple more questions for you ... I'll reply in new threads... Alex From alex at pressure.to Mon Dec 18 12:26:00 2006 From: alex at pressure.to (Alex Fenton) Date: Mon, 18 Dec 2006 17:26:00 +0000 Subject: [Wxruby-users] getting url from evt_text_url event Message-ID: <4586CF28.3000201@pressure.to> paul.allton at uk.bnpparibas.com wrote: > TextCtrl on windows supports the TE_RICH and TE_AUTO_URL styles, but I cannot seem > to extract the url from the generated evt_text_url event. Is this not supported or am > I just not asking the right question of it? It seems there is a class specifically for this in WxWidgets, called TextUrlEvent, which includes methods for retrieving the URL. Unfortunately, it seems completely undocumented in the 2.6.3 docs for either TextCtrl or CommandEvent, so we've missed it. I've had a look at the WxWidgets include files, and I think it should be straightforward to add. I've added it to the tracker and should be able to do this for our next release (0.0.39) Thanks for the report alex From alex at pressure.to Mon Dec 18 13:06:56 2006 From: alex at pressure.to (Alex Fenton) Date: Mon, 18 Dec 2006 18:06:56 +0000 Subject: [Wxruby-users] unit testing wxruby GUIs Message-ID: <4586D8C0.60905@pressure.to> paul.allton at uk.bnpparibas.com wrote: > I'm a big fan of automated UI testing (i.e. driving the UI from some robot API). I appreciate this > is potentially a whole new project, but does wxwidgets provide a method of clicking buttons, > typing into components ... if so, would it be technically possible to expose this in wxruby. I like automated UI testing too, but don't know of a single solution for now. To exercise the API of a particular component you have written, you can create fast 'headless' tests by creating a host app and frame, but not showing the frame. Take a look at tests/test_item_data.rb in the distribution for an example. But I guess you are also interested in testing a GUI as a whole. There are two routes you might consider: 1) Use the fact that wxruby creates native widgets and drive the GUI using something like AutoIt (http://www.autoitscript.com/autoit3/), using Ruby + Win32OLE as glue (http://wiki.rubygarden.org/Ruby/page/show/AutoIt_For_Windows). There are some options on OS X as well: http://groups-beta.google.com/group/comp.lang.ruby/browse_thread/thread/5423c75db1a53c2d?hl=en The disadvantages are these being single platform solutions. With some shallow experimentation, I also found AutoIt's window handles a bit clumsy to use for testing. The only real advantage I can see is being able to record actions. 2) I think a better way would be to use the wxRuby API to simulate events directly. Event objects are instantiable like any other, and they can then be passed to the app objects for handling by using EvtHandler#process_event or #add_pending_event. A snippet that works for me (OS X, 0.0.38) f = Wx::Frame.new(nil, -1, 'test_app') b = Wx::Button.new(f, -1, 'click') evt_button(b.get_id) { | e | Kernel.raise 'I was clicked' } # I got this 10003 id by calling get_event_type on a real button event test_event = Wx::CommandEvent.new(10003, b.get_id) # simulated event processsing - call the event handler above process_event(test_event) I would be interested in developing a neater API to this. The event type constants (eg 10003 for EVT_TYPE_BUTTON) may be exposed already somewhere in wxruby but I don't know off hand. You might also take a look at an older post on this topic: http://rubyforge.org/pipermail/wxruby-users/2005-January/001091.html cheers alex From alex at pressure.to Tue Dec 19 03:57:37 2006 From: alex at pressure.to (Alex Fenton) Date: Tue, 19 Dec 2006 08:57:37 +0000 Subject: [Wxruby-users] unit testing wxruby GUIs In-Reply-To: <4586D8C0.60905@pressure.to> References: <4586D8C0.60905@pressure.to> Message-ID: <4587A981.2020408@pressure.to> > test_event = Wx::CommandEvent.new(10003, b.get_id) > # simulated event processsing - call the event handler above > process_event(test_event) > > I would be interested in developing a neater API to this. The event type > constants (eg 10003 for EVT_TYPE_BUTTON) may be exposed already > somewhere in wxruby but I don't know off hand. > Just came across them. You could rewrite the above as test_event = Wx::CommandEvent.new(Wx::EVT_COMMAND_BUTTON_CLICKED, b.get_id) You can find all the relevant constants for event types by doing Wx::constants.grep /^EVT_/ The syntax is a bit unwieldy, though event types constants are only needed for command events. This however covers many common UI interactions one might want to simulate, so I'd look to add a 'simulate' API to wxSugar. I'm open to suggestions on what this should look like; maybe simulate(:click, my_button) alex From alex at pressure.to Wed Dec 20 04:59:23 2006 From: alex at pressure.to (Alex Fenton) Date: Wed, 20 Dec 2006 09:59:23 +0000 Subject: [Wxruby-users] wxruby2-preview 0.0.38 released Message-ID: <4589097B.7090103@pressure.to> Hello I'm pleased to say that wxruby2-preview 0.0.38 is now available on Rubyforge and via gems. We're offering source and binaries for Windows, OS X and Linux. == Install gem install wxruby2-preview https://rubyforge.org/frs/?group_id=35 == What's New * HtmlWindow and HtmlEasyPrinting, plus related classes * HelpController and HtmlHelpController for displaying online help * Enhanced internationalisation support for working with languages and encodings, including the Locale class * Fixed the useful item_data family of functions, for associating ruby objects with UI controls * Numerous fixes and enhancements within existing classes * New and updated docs and samples There's a full Changelog on the website. == Important This is still a preview/alpha release. There's still some GC-related crashers, and some platform problems with particular classes. It's not quite suitable for production use. == TODO I'm hoping we can offer a beta release of wxruby2 within the next couple of release cycles. The main tasks outstanding are: - fix known GC and platform bugs - add the Clipboard and Drag'n'Drop classes - a few odd missing classes and methods - update and tidy the samples and documentation You can really help by reporting bugs and missing features on the rubyforge tracker: https://rubyforge.org/tracker/?group_id=35 == Thanks Big thanks to everyone who helped make this release happen - contributors, builders, bug reporters and enthusiasts. Wishing you all a happy and peaceful christmas from the wxruby2 team Alex From paul.allton at uk.bnpparibas.com Wed Dec 20 06:03:26 2006 From: paul.allton at uk.bnpparibas.com (paul.allton at uk.bnpparibas.com) Date: Wed, 20 Dec 2006 11:03:26 +0000 Subject: [Wxruby-users] getting url from evt_text_url event In-Reply-To: <4586CF28.3000201@pressure.to> Message-ID: >It seems there is a class specifically for this in WxWidgets, called >TextUrlEvent, which includes methods for retrieving the URL. >Unfortunately, it seems completely undocumented in the 2.6.3 docs for >either TextCtrl or CommandEvent, so we've missed it. >I've had a look at the WxWidgets include files, and I think it should be >straightforward to add. I've added it to the tracker and should be able >to do this for our next release (0.0.39) Great, thanks for that. I was just about to ask when you were planning to add HtmlWindow support, but I just upgraded to 0.0.38 and noticed that you've already done it ;) BTW, the new documentation is proving really helpful. However, I'm wondering why some classes e.g. Panel, TextCtrl have a 'methods' section (which is very very useful) and others do not, e.g Grid, HtmlWindow. Are the docs auto-generated? p. This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061220/adbeef6a/attachment.html From paul.allton at uk.bnpparibas.com Wed Dec 20 06:26:43 2006 From: paul.allton at uk.bnpparibas.com (paul.allton at uk.bnpparibas.com) Date: Wed, 20 Dec 2006 11:26:43 +0000 Subject: [Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow In-Reply-To: <4586CC94.7000107@pressure.to> Message-ID: > OK, I didn't know that. Feel free to file a bug for it. Done ... #7386 >I wondered if it was something like that. Eclipse + RDT uses it for the >unit testing runner. I actually think it reasonable UI device but >unfortunately as the link you sent points out it's a Swing thing. :) >Are you using set_background_colour or set_default_style? I know that >set_style doesn't respect the background colour of a TextAttr on OS X, >on 10.3 at least. I'm using set_background_colour... >In the meantime, possible workarounds might be to place StaticText on a >Panel (which definitely can be coloured on OS X), or (really nasty) to >use a single-cell Grid and hide the column and row headers. I've tried the Panel option and whilst its definitely colour-able its causing some other problems in my app. I'll try and create a simple test case before elaborating further on that, and I'd also like to test it on the new 0.0.38 build. The Grid option does sound rather nasty, but I'll give it a go ... - how do I hide the column/row headers? - how can I make the single cell grow to fit the entire grid space? - I'd prefer to use the TextCtrl on windows and whatever works on OSX, is there some way to establish at runtime which platform the app is running on? This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061220/f4d37d99/attachment.html From alex at pressure.to Wed Dec 20 07:17:23 2006 From: alex at pressure.to (Alex Fenton) Date: Wed, 20 Dec 2006 12:17:23 +0000 Subject: [Wxruby-users] getting url from evt_text_url event In-Reply-To: References: Message-ID: <458929D3.4010102@pressure.to> paul.allton at uk.bnpparibas.com wrote: > BTW, the new documentation is proving really helpful. However, I'm > wondering why some classes e.g. Panel, TextCtrl have a 'methods' > section (which is very very useful) and others do not, e.g Grid, > HtmlWindow. Are the docs auto-generated? They were originally automatically converted and 'translated' from the WxWidgets latex sources. They're now held in our SVN in Textile format, and hand-edited. Point taken about Grid and HtmlWindow - this is where our latex parser didn't deal with variations in the structure of the originals. Please do point do these out, file a bug, or submit a doc patch as you find them. Thanks alex From alex at pressure.to Wed Dec 20 07:24:49 2006 From: alex at pressure.to (Alex Fenton) Date: Wed, 20 Dec 2006 12:24:49 +0000 Subject: [Wxruby-users] wxruby2-preview Gauge and wx-sugar with SplitterWindow In-Reply-To: References: Message-ID: <45892B91.4050003@pressure.to> Hi > The Grid option does sound rather nasty, but I'll give it a go ... Haven't tested the below today, but from memory: > > - how do I hide the column/row headers? set_col_label_size(0) set_row_label_size(0) > - how can I make the single cell grow to fit the entire grid space? set_col_size(0, get_size[0]) > - I'd prefer to use the TextCtrl on windows and whatever works on OSX, > is there some way to establish at runtime which platform the app is > running on? Test the value of Wx::PLATFORM - should be one of 'WXMSW', 'WXGTK', 'WXMAC' cheers alex From paul.allton at uk.bnpparibas.com Wed Dec 20 10:09:16 2006 From: paul.allton at uk.bnpparibas.com (paul.allton at uk.bnpparibas.com) Date: Wed, 20 Dec 2006 15:09:16 +0000 Subject: [Wxruby-users] wxruby2-preview 0.0.38 released In-Reply-To: <4589097B.7090103@pressure.to> Message-ID: Great work on the release. Unfortunately, I'm experiencing a lot of segmentation faults on the windows build. I havent yet managed to create a 100% repeatable test case, but there seems to be a problem when selecting items in combo boxes (or updates happening thereafter). The message is as follows: C:/dev/ruby/lib/ruby/gems/1.8/gems/wx_sugar-0.1.13/lib/wx_sugar/accessors.rb:53: [BUG] Segmentation fault ruby 1.8.4 (2006-04-14) [i386-mswin32] This application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more information. This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061220/0d841428/attachment.html From alex at pressure.to Wed Dec 20 10:54:16 2006 From: alex at pressure.to (Alex Fenton) Date: Wed, 20 Dec 2006 15:54:16 +0000 Subject: [Wxruby-users] wxruby2-preview 0.0.38 released In-Reply-To: References: Message-ID: <45895CA8.1080609@pressure.to> paul.allton at uk.bnpparibas.com wrote: > Great work on the release. Unfortunately, I'm experiencing a lot of > segmentation faults on the windows build. I hadn't tried the Windows build until I saw your message, but a quick test gives me the same thing on bigdemo. This is definitely a problem with garbage collection. I am able to work around it by placing GC.disable at the start of my scripts. Not ideal but it should allow you to proceed with developing other functionality. This is a top priority fix. Sorry for the inconvenience, but we have a chicken and egg problem with the Windows build - lots of people want to use it, but very few people have a compiler and build environment on that platform. But without getting a build out there, it's hard to home in on bugs. I'm think it will not be too hard to trace the problem to one or two more classes which need a bit of extra handcrafted memory management. Unfortunately you need a debugger to track down the problem classes - the segfault line reports are misleading. If anyone already has something set up on Windows a few stack traces from these crashes would be *very* helpful. Alex From paul.allton at uk.bnpparibas.com Wed Dec 20 11:00:57 2006 From: paul.allton at uk.bnpparibas.com (paul.allton at uk.bnpparibas.com) Date: Wed, 20 Dec 2006 16:00:57 +0000 Subject: [Wxruby-users] unit testing wxruby GUIs In-Reply-To: <4586D8C0.60905@pressure.to> Message-ID: >To exercise the API of a particular component you have written, you can >create fast 'headless' tests by creating a host app and frame, but not >showing the frame. Take a look at tests/test_item_data.rb in the >distribution for an example. >But I guess you are also interested in testing a GUI as a whole. There >are two routes you might consider: Yup, I'm unfortunately at that stage where *unit* testing individual component/models, (while useful) is a minimum requirement. I'd not undertake any project without having acceptance tests for the UI. >1) Use the fact that wxruby creates native widgets and drive the GUI >using something like AutoIt (http://www.autoitscript.com/autoit3/), >using Ruby + Win32OLE as glue >(http://wiki.rubygarden.org/Ruby/page/show/AutoIt_For_Windows). >There are some options on OS X as well: > http://groups-beta.google.com/group/comp.lang.ruby/browse_thread/thread/5423c75db1a53c2d?hl=en >The disadvantages are these being single platform solutions. With some >shallow experimentation, I also found AutoIt's window handles a bit >clumsy to use for testing. The only real advantage I can see is being >able to record actions. Agree, it's gotta be cross platform ... I guess I was originally thinking that it would be something wxWidgets should provide. A simple robot built into the platform (like java's Robot - http://java.sun.com/j2se/1.5.0/docs/api/java/awt/Robot.html) that can be wrapped by whatever platform (wxruby, wxpython etc) or framework requires it. Maybe that's a bit too much to ask. I did stumble over this: http://www.wefi.net/swWxGuiTesting/, which sounds promising - but unfortunately I can't parse c/c++ so I've no ideas if its of any actual use. >2) I think a better way would be to use the wxRuby API to simulate >events directly. Event objects are instantiable like any other, and they >can then be passed to the app objects for handling by using >EvtHandler#process_event or #add_pending_event. >A snippet that works for me (OS X, 0.0.38) > f = Wx::Frame.new(nil, -1, 'test_app') > b = Wx::Button.new(f, -1, 'click') > evt_button(b.get_id) { | e | Kernel.raise 'I was clicked' } > # I got this 10003 id by calling get_event_type on a real button event > test_event = Wx::CommandEvent.new(10003, b.get_id) > # simulated event processsing - call the event handler above > process_event(test_event) Sounds neat, will give this a try. >I would be interested in developing a neater API to this. The event type >constants (eg 10003 for EVT_TYPE_BUTTON) may be exposed already >somewhere in wxruby but I don't know off hand. >You might also take a look at an older post on this topic: >http://rubyforge.org/pipermail/wxruby-users/2005-January/001091.html Also interesting. I'd actually go the other way, personally I want to see the UI up and running during acceptance tests. I want to be able to interact with it when it goes wrong. I also like the watir (http://wtr.rubyforge.org/) style, flashing of components so you can see stuff happening. This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061220/47ffa4f4/attachment.html From paul.allton at uk.bnpparibas.com Wed Dec 20 13:47:36 2006 From: paul.allton at uk.bnpparibas.com (paul.allton at uk.bnpparibas.com) Date: Wed, 20 Dec 2006 18:47:36 +0000 Subject: [Wxruby-users] unit testing wxruby GUIs In-Reply-To: <4587A981.2020408@pressure.to> Message-ID: > Just came across them. You could rewrite the above as > test_event = Wx::CommandEvent.new(Wx::EVT_COMMAND_BUTTON_CLICKED, b.get_id) > You can find all the relevant constants for event types by doing >Wx::constants.grep /^EVT_/ >The syntax is a bit unwieldy, though event types constants are only >needed for command events. This however covers many common UI >interactions one might want to simulate, so I'd look to add a 'simulate' >API to wxSugar. I'm open to suggestions on what this should look like; maybe > simulate(:click, my_button) That looks pretty neat. I think where possible, if the events can be generated by the component rather than having to be hand-crafted then that might save a load of work. Certainly for Button it looks like you'd have to create the CommandEvent, but for example; TextCtrl seems to generate an evt_text whenever the value is set. In terms of API, I'm not too fussy what the low level API looks like, whatever works for you/is simple to implement. There are many ways to do this stuff, I've used a few API's: java.awt.Robot, watir and jemmy ( http://jemmy.netbeans.org/samples.html), they all seem to work pretty well, but IMO suffer from too much complexity, so I usually end up building a higher level API anyway. This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061220/50dbc8e2/attachment.html From paul.allton at uk.bnpparibas.com Wed Dec 20 14:02:30 2006 From: paul.allton at uk.bnpparibas.com (paul.allton at uk.bnpparibas.com) Date: Wed, 20 Dec 2006 19:02:30 +0000 Subject: [Wxruby-users] unit testing wxruby GUIs In-Reply-To: <4587A981.2020408@pressure.to> Message-ID: I did a quick spike of naming some components, finding them and performing some simple actions, based on your earlier example. Button clicking and text entering seems to be okay, but I couldn't get selecting from a Choice to work. Out of interest, is there a difference between component.command(event) and evt_handler.process_event(event)? The documentation for the former suggests that its meant to emulate the user. # the ui FOO = 'foo_frame' BAR = 'bar_button' BAZ = 'baz_text_ctrl' THINGS = 'things_choice' f = Frame.new(nil, -1, 'test_app'); f.name = FOO b = Button.new(f, -1, 'click'); b.name = BAR t = TextCtrl.new(f); t.name = BAZ c = Choice.new(f); ['a', 'b', 'c'].each {|n| c.append(n) }; c.name = THINGS # prove the automation works f.evt_button(b.get_id) {|e| puts 'I was clicked' } f.evt_text(t.get_id) {|e| puts 'my text changed' } f.evt_choice(c.get_id) {|e| puts "my selection changed: #{c.selection}" } # do some stuff click(BAR) type('wibble', into(BAZ)) select('b', from(THINGS)) # a bucket full of sugar def find_component(name) component = Window.find_window_by_name(name) Kernel.raise "cannot find component with name: #{name}" if component.nil? component end def into(name) find_component(name) end def from(name) find_component(name) end def click(name) component = find_component(name) component.command(CommandEvent.new(EVT_COMMAND_BUTTON_CLICKED, component.get_id)) end def type(text, component) #should probably enter 1 char at a time to ensure all events fired component.value = text end def select(value, component) event = CommandEvent.new(EVT_COMMAND_CHOICE_SELECTED, component.get_id) event.string = value component.selection = component.find_string(value) component.command(event) end This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061220/ba148deb/attachment-0001.html From alex at pressure.to Wed Dec 20 15:28:12 2006 From: alex at pressure.to (Alex Fenton) Date: Wed, 20 Dec 2006 20:28:12 +0000 Subject: [Wxruby-users] unit testing wxruby GUIs In-Reply-To: References: Message-ID: <45899CDC.2060000@pressure.to> paul.allton at uk.bnpparibas.com wrote: > I did a quick spike of naming some components, finding them and > performing some simple actions, based on your earlier example. Thank you, very interesting; I like where you're going with this. Are you looking to integrate this with test/unit in the end? Or automating and watching what happens? > Button clicking and text entering seems to be okay, but I couldn't get > selecting from a Choice to work. See below. > Out of interest, is there a difference between > component.command(event) and evt_handler.process_event(event)? The > documentation for the former suggests that its meant to emulate the user. I didn't know about the Wx::Control#command method. I think it, not process_event, is the correct one to use so that the event is routed to the right handler as if a user had performed the action. Some comments on your code: > # the ui > FOO = 'foo_frame' It would be nice not to have to explicitly name every widget you might want to automate. I want to fix the Wx::Window#get_children method soon, which will allow wxruby programs to traverse a widget hierarchy and find un-named widgets. Maybe something like: a_button = a_frame.find(Button) { | b | b.label == 'click' } > c = Choice.new(f); ['a', 'b', 'c'].each {|n| c.append(n) }; c.name = > THINGS with wxsugar, you can just do: c = Choice.new(f, :choices => ['a', 'b', 'c']) or even terser: c = Choice.new(f, :choices => %w|a b c|) > # do some stuff > click(BAR) > type('wibble', into(BAZ)) > select('b', from(THINGS)) Cool - this kind of (overused word) DSL works nicely for an automation/acceptance testing approach. > def select(value, component) > event = CommandEvent.new(EVT_COMMAND_CHOICE_SELECTED, component.get_id) > event.string = value > component.selection = component.find_string(value) Instead of actually setting the selection of the choice widget, we want to say what selection is being set in the simulated event. The wxWidgets docs aren't helpful, but: event.int = component.find_string(value) # (or in non-sugar wxRuby) event.set_int(component.find_string(value)) seems to be the correct method to call and works for me. cheers alex From paul.allton at uk.bnpparibas.com Thu Dec 21 13:50:26 2006 From: paul.allton at uk.bnpparibas.com (paul.allton at uk.bnpparibas.com) Date: Thu, 21 Dec 2006 18:50:26 +0000 Subject: [Wxruby-users] unit testing wxruby GUIs In-Reply-To: <45899CDC.2060000@pressure.to> Message-ID: >Thank you, very interesting; I like where you're going with this. Are >you looking to integrate this with test/unit in the end? Or automating >and watching what happens? Both. I'd prefer to keep the gui driving bit separate from the testing bit, the driver is then useful in its own right. So, I wouldn't expect to see any assertion methods on the robot, but obviously the standard text/unit assertions can be used within the test, i.e: class SpikeTest < Test::Unit::TestCase def test_something click(BAR) type('wibble', into(BAZ)) select('b', from(THINGS)) assert_equal('b', selection(THINGS).selected_value) end end ### more support sugar def selection(name) Selection.new(name) end class Selection def initialize(name) @name = name end def selected_value find_component(@name).string_selection end end ### amended select method following your advice def select(value, component) event = CommandEvent.new(EVT_COMMAND_CHOICE_SELECTED, component.get_id) event.int = component.find_string(value) component.command(event) end >It would be nice not to have to explicitly name every widget you might >want to automate. I want to fix the Wx::Window#get_children method soon, >which will allow wxruby programs to traverse a widget hierarchy and find >un-named widgets. Maybe something like: >a_button = a_frame.find(Button) { | b | b.label == 'click' } I'm actually quite keen on components being found by name as it avoids complication and I don't see naming components too much of a burden. In other frameworks I've used its been very easy to get into a mess with finding by index/xpath expressions etc - these tend to be very brittle. That said, the ability to find by label is definitely useful/reasonable so I'd go for the default find_component to use name/label whichever it finds first maybe. Incidentally, it would be nice if [:name => 'foo'] was a sugared constructor arg :) (slightly off topic ... wx-sugar is great ... but could we have some more examples please .. maybe take some of the bigdemo samples and sugar them up?) >Cool - this kind of (overused word) DSL works nicely for an >automation/acceptance testing approach. FWIW, I've been involved with evolving a testing API in java which looks virtually identical to the above ruby code and seems to work fairly well for testing both rich client and web UI's (using the same language). We've also found its possible to build an even higher level API which makes the above look, er ... low level ... but that may not be to everyone's taste. It really does then become domain specific (but I'd prefer not to use that term ;)). >Instead of actually setting the selection of the choice widget, we want >to say what selection is being set in the simulated event. The wxWidgets >docs aren't helpful, but: >event.int = component.find_string(value) ># (or in non-sugar wxRuby) >event.set_int(component.find_string(value)) Thanks for that. Although it fires the event okay, the resulting selection doesn't change. The test above actually shows the problem .. heres the output: Loaded suite spike Started I was clicked my text changed my selection changed: 0 F Finished in 0.078 seconds. 1) Failure: test_something(SpikeTest) [spike.rb:90]: <"b"> expected but was <"">. For some reason the selection is always 0 and the text is "", any ideas why that might be? At this stage it would be useful to be able to visually show the frame and see what's actually going on, 'f.show' doesn't seem to do anything though, does it need to be wrapped in an app to be shown? p. This message and any attachments (the "message") is intended solely for the addressees and is confidential. If you receive this message in error, please delete it and immediately notify the sender. Any use not in accord with its purpose, any dissemination or disclosure, either whole or partial, is prohibited except formal approval. The internet can not guarantee the integrity of this message. BNP PARIBAS (and its subsidiaries) shall (will) not therefore be liable for the message if modified. ********************************************************************************************** BNP Paribas Private Bank London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Securities Services London Branch is authorised by CECEI & AMF and is regulated by the Financial Services Authority for the conduct of its investment business in the United Kingdom. BNP Paribas Fund Services UK Limited is authorised and regulated by the Financial Services Authority -------------- next part -------------- An HTML attachment was scrubbed... URL: http://rubyforge.org/pipermail/wxruby-users/attachments/20061221/16edfbde/attachment.html From alex at pressure.to Tue Dec 26 06:53:53 2006 From: alex at pressure.to (Alex Fenton) Date: Tue, 26 Dec 2006 11:53:53 +0000 Subject: [Wxruby-users] unit testing wxruby GUIs In-Reply-To: References: Message-ID: <45910D51.9080308@pressure.to> paul.allton at uk.bnpparibas.com wrote: > >a_button = a_frame.find(Button) { | b | b.label == 'click' } > > I'm actually quite keen on components being found by name as it avoids > complication and I don't see naming components too much of a burden. Good, well if it's not a problem, it's not a problem... > In other frameworks I've used its been very easy to get into a mess > with finding by index/xpath expressions etc - these tend to be very > brittle. I agree that's fragile. I think a find_window + block specifying a match is less so, and also more general and ruby-ish than find_window_by_label. But find_window_by_label etc won't be going away - it's part of the core API. > Incidentally, it would be nice if [:name => 'foo'] was a sugared > constructor arg :) Yep. It will be soon. There was an unrelated wxruby2 obstacle to this for control classes, but should be fixed in next release. > (slightly off topic ... wx-sugar is great ... but could we have some > more examples please .. maybe take some of the bigdemo samples and > sugar them up?) Yep, the sugar sample is lame, but it's lower priority than nailing the last bits of wxruby2. There are lots of sugar real-life samples in Weft QDA: http://rubyforge.org/viewvc/trunk/weft-qda/lib/weft/wxgui/?root=weft-qda It's where most of wxSugar germinated. It's a decent sized app, which means it has quite a lot of ruby dependencies to install to run. You can browse the GUI code online - the 'inspectors' might be of interest: http://rubyforge.org/viewvc/trunk/weft-qda/lib/weft/wxgui/?root=weft-qda > FWIW, I've been involved with evolving a testing API in java which > looks virtually identical to the above ruby code and seems to work > fairly well for testing both rich client and web UI's (using the same > language). I've got no experience with Java, and your knowledge of GUI testing with a well-established language has given us excellent insight on this topic. Thanks. > >event.int = component.find_string(value) > > Although it fires the event okay, the resulting selection doesn't > change. The test above actually shows the problem ... heres the output: Hmm - I've just run it again and it definitely works for me (OS X 10.3) > For some reason the selection is always 0 and the text is "", any > ideas why that might be? See below. > At this stage it would be useful to be able to visually show the frame > and see what's actually going on, 'f.show' doesn't seem to do anything > though, does it need to be wrapped in an app to be shown? Don't ever instantiate or show a Window/Frame etc outside of an App.main_loop. It might sort-of work on some platforms, but on others it will fail or even segfault. I suspect that the problem you're seeing with the simulated Choice event might be because it's outside main_loop, and so the event routing and handling isn't set up properly. Apologies - this is a documentation bug in wxruby2. We need to 'translate' and move some of the topic overviews and tutorials from wxWidgets docs and the wxruby wiki into the core wxruby2 docs. Eg: http://wxruby.rubyforge.org/wiki/wiki.pl?Getting_Started cheers alex