From lists at ruby-forum.com Mon May 3 02:55:57 2010 From: lists at ruby-forum.com (Wolfgang Kittenberger) Date: Mon, 3 May 2010 08:55:57 +0200 Subject: [wxruby-users] static gem of wxruby 2.0.1 for OS X Snow Leopard In-Reply-To: <43d0f10b7bb80ed573faa5039f64b7fc@ruby-forum.com> References: <80d893c70911110552ye2c5e1ald5cec7b270ebd4b3@mail.gmail.com> <4BA9B9BD.6090602@pressure.to> <43d0f10b7bb80ed573faa5039f64b7fc@ruby-forum.com> Message-ID: <1256d927592dfb30f8f2745e67615cf2@ruby-forum.com> Hello, when requesting 'wx' after installing this static gem I get the following error: /Library/Ruby/Gems/1.8/gems/wxruby-2.0.1-universal-darwin-10/lib/wxruby2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/wxruby-2.0.1-universal-darwin-10/lib/wxruby2.bundle, 9): Symbol not found: __ZN10wxCheckBox13MacControlHitEPvS0_ (LoadError) I am using an Intel Mac Mini with 10.6.3 any idea, what I did wrong? Kittekat -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon May 3 16:09:03 2010 From: lists at ruby-forum.com (=?utf-8?Q?M=c3=a9d=c3=a9ric_Hurier?=) Date: Mon, 3 May 2010 22:09:03 +0200 Subject: [wxruby-users] Application focus In-Reply-To: References: <3123833ce4ed996da355979efcb03f99@ruby-forum.com> Message-ID: <0deb7d250d50e51315dce718ed4a3039@ruby-forum.com> Thanks Mario, it's exacly that's I need ! I've used the Timer class and set it in my main windows. It's work perfectly ! Thanks again for your accurate answer. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed May 5 19:27:33 2010 From: lists at ruby-forum.com (Ross Goodell) Date: Thu, 6 May 2010 01:27:33 +0200 Subject: [wxruby-users] Does stack get unwound when event returns without skip? Message-ID: <460588426eca67ece1baf351681d3180@ruby-forum.com> I'm using a TextCtrl in an editor and in my evt_key_down, evt_key_up, etc. handlers I've been avoiding using event.skip in order to get the behavior I want, but it looks like that is making the stack grow. Can someone tell me if the stack gets unwound when an event handler finishes without using skip? And, if it doesn't, if there is another good way get it unwound before exiting. Any help would be appreciated. Thanks, Ross -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu May 6 13:11:32 2010 From: lists at ruby-forum.com (Tony Meier) Date: Thu, 6 May 2010 19:11:32 +0200 Subject: [wxruby-users] Destroying a Wx::GridTableBase with an active editor Message-ID: <6ac6e2bf94dabf371b21b9d020045926@ruby-forum.com> Hi! I'm getting a strange effect when I exchange the table base while an editor is active. The edit control would stay active and it would be impossible to remove it from the GUI. Here's how my app works: There is a tree structure that allows selection of a group of parameters to display in the grid. When the user clicks an entry in the tree, I run the following code snippet: def on_tree_selection_changed event @grid.begin_batch table = @grid.get_table table.detach if (table and table.respond_to? "detach") # custom method to disconnect the table from the data source table = MyGridTableBase.new @params @grid.set_table table @grid.end_batch event.skip end This works fine in most cases. The strange part happens when the opens a cell editor and, while the editor is open, changes the tree selection. In that case, the grid would change its table base but the open cell editor would remain open until the program quits. My question is, how can I 'automatically' close any open editors on a grid if the user decides to change the underlying table? Thanks in advance, Tony -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri May 7 12:20:18 2010 From: lists at ruby-forum.com (Ross Goodell) Date: Fri, 7 May 2010 18:20:18 +0200 Subject: [wxruby-users] Does stack get unwound when event returns without skip? In-Reply-To: <460588426eca67ece1baf351681d3180@ruby-forum.com> References: <460588426eca67ece1baf351681d3180@ruby-forum.com> Message-ID: <3c87fade14aafbe17b76173deaaaffbd@ruby-forum.com> Ross Goodell wrote: > I'm using a TextCtrl in an editor and in my evt_key_down, evt_key_up, > etc. handlers I've been avoiding using event.skip in order to get the > behavior I want, but it looks like that is making the stack grow. Can > someone tell me if the stack gets unwound when an event handler finishes > without using skip? And, if it doesn't, if there is another good way > get it unwound before exiting. > > Any help would be appreciated. > > Thanks, > Ross Further experimentation has shown me that whatever the problem is, it has nothing to do with not using skip. Ross -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue May 11 10:34:45 2010 From: alex at pressure.to (Alex Fenton) Date: Tue, 11 May 2010 15:34:45 +0100 Subject: [wxruby-users] Destroying a Wx::GridTableBase with an active editor In-Reply-To: <6ac6e2bf94dabf371b21b9d020045926@ruby-forum.com> References: <6ac6e2bf94dabf371b21b9d020045926@ruby-forum.com> Message-ID: <4BE96B05.8010600@pressure.to> hi Tony Sorry been away for a few days... Tony Meier wrote: > The strange part happens when the opens a cell editor and, while the > editor is open, changes the tree selection. > > In that case, the grid would change its table base but the open cell > editor would remain open until the program quits. > > My question is, how can I 'automatically' close any open editors on a > grid if the user decides to change the underlying table? The base class Wx::GridCellEditor has a method #end_edit which IIRC dismisses the current editor - does this help? You may need to track where there is a current editor with the various event hooks in Wx::GRid - eg evt_grid_editor_shown / evt_grid_editor_created a From lists at ruby-forum.com Mon May 17 11:09:36 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Mon, 17 May 2010 17:09:36 +0200 Subject: [wxruby-users] draw in C++ with wxRuby Message-ID: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> Hello, I want to draw using C++ wxWdiget in some windows created using wxRuby. Does anybody know if it is possible ? I tried one thing which is maybe very naive ... but it does not work : 1- I created a Frame using wxRuby 2- i got the field wx_id of this instance of Frame 3- I tried to get the wxWindow in C++ using this id (using FindWindowById of the C++ api of wxWidget) Any help will be very appreciated ! Emmanuel -- Posted via http://www.ruby-forum.com/. From real.sergeych at gmail.com Mon May 17 12:40:55 2010 From: real.sergeych at gmail.com (Sergey Chernov) Date: Mon, 17 May 2010 20:40:55 +0400 Subject: [wxruby-users] draw in C++ with wxRuby In-Reply-To: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> References: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> Message-ID: <31D0F4EF-3068-4A15-9951-28FA72F44A19@gmail.com> Does this work with, say, Canvas properly fitted into the frame? Actually drawing on the frame may not be as good as it looks. Yours, Sergey 17.05.2010, ? 19:09, Emmanuel Emmanuel ??????? (?): > Hello, > > > I want to draw using C++ wxWdiget in some windows created using > wxRuby. > > Does anybody know if it is possible ? > > I tried one thing which is maybe very naive ... but it does not work : > > 1- I created a Frame using wxRuby > 2- i got the field wx_id of this instance of Frame > 3- I tried to get the wxWindow in C++ using this id (using > FindWindowById of the C++ api of wxWidget) > > > Any help will be very appreciated ! > > Emmanuel > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From lists at ruby-forum.com Mon May 17 13:09:03 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Mon, 17 May 2010 19:09:03 +0200 Subject: [wxruby-users] draw in C++ with wxRuby In-Reply-To: <31D0F4EF-3068-4A15-9951-28FA72F44A19@gmail.com> References: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> <31D0F4EF-3068-4A15-9951-28FA72F44A19@gmail.com> Message-ID: <5bbe7646b5e1cde45af875dfeb6c2ac5@ruby-forum.com> Sergey Chernov wrote: > Does this work with, say, Canvas properly fitted into the frame? > Actually drawing on the frame may not be as good as it looks. > > Yours, > Sergey > > 17.05.2010, ? 19:09, Emmanuel Emmanuel ??????? > (?): N? i don t think you understood. In th? example i give, FindWindowById retiens NULL! Emmanuel -- Posted via http://www.ruby-forum.com/. From real.sergeych at gmail.com Mon May 17 16:22:48 2010 From: real.sergeych at gmail.com (Sergey Chernov) Date: Tue, 18 May 2010 00:22:48 +0400 Subject: [wxruby-users] draw in C++ with wxRuby In-Reply-To: <5bbe7646b5e1cde45af875dfeb6c2ac5@ruby-forum.com> References: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> <31D0F4EF-3068-4A15-9951-28FA72F44A19@gmail.com> <5bbe7646b5e1cde45af875dfeb6c2ac5@ruby-forum.com> Message-ID: <718E4613-0C94-4548-8DC9-5345DF255E64@gmail.com> I'd checked whether it happens with non-frame windows. Can't check after migrating on snow leopard it just don't work Yours, Sergey 17.05.2010, ? 21:09, Emmanuel Emmanuel ???????(?): > Sergey Chernov wrote: >> Does this work with, say, Canvas properly fitted into the frame? >> Actually drawing on the frame may not be as good as it looks. >> >> Yours, >> Sergey >> >> 17.05.2010, ? 19:09, Emmanuel Emmanuel >> ??????? >> (?): > > N? i don t think you understood. > In th? example i give, > FindWindowById retiens NULL! > > Emmanuel > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From lists at ruby-forum.com Mon May 17 17:44:46 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Mon, 17 May 2010 23:44:46 +0200 Subject: [wxruby-users] draw in C++ with wxRuby In-Reply-To: <718E4613-0C94-4548-8DC9-5345DF255E64@gmail.com> References: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> <31D0F4EF-3068-4A15-9951-28FA72F44A19@gmail.com> <5bbe7646b5e1cde45af875dfeb6c2ac5@ruby-forum.com> <718E4613-0C94-4548-8DC9-5345DF255E64@gmail.com> Message-ID: Sergey Chernov wrote: > I'd checked whether it happens with non-frame windows. Can't check > after migrating on snow leopard it just don't work > > Yours, > Sergey > > 17.05.2010, ? 21:09, Emmanuel Emmanuel > ???????(?): YOU DID NOT UNDERSTAND !?! Whatever object is created using wxRuby, I want to be able to manipulate the corresponding wxWidget object in C++, how do I do that ? -- Posted via http://www.ruby-forum.com/. From real.sergeych at gmail.com Mon May 17 18:40:21 2010 From: real.sergeych at gmail.com (Sergey Chernov) Date: Tue, 18 May 2010 02:40:21 +0400 Subject: [wxruby-users] draw in C++ with wxRuby In-Reply-To: References: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> <31D0F4EF-3068-4A15-9951-28FA72F44A19@gmail.com> <5bbe7646b5e1cde45af875dfeb6c2ac5@ruby-forum.com> <718E4613-0C94-4548-8DC9-5345DF255E64@gmail.com> Message-ID: it was clear since the beginning. try get_id() on your window, and if it fails try to do it with the regular window - not frame - unless you have to. I'm used to get strange effects with frames sometimes. good luck 18.05.2010, ? 1:44, Emmanuel Emmanuel ???????(?): > Sergey Chernov wrote: >> I'd checked whether it happens with non-frame windows. Can't check >> after migrating on snow leopard it just don't work >> >> Yours, >> Sergey >> >> 17.05.2010, ? 21:09, Emmanuel Emmanuel >> ???????(?): > > YOU DID NOT UNDERSTAND !?! > > Whatever object is created using wxRuby, I want to be able to manipulate > the corresponding wxWidget object in C++, how do I do that ? > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users Sergey Chernov real.sergeych at gmail.com From lists at ruby-forum.com Tue May 18 03:07:36 2010 From: lists at ruby-forum.com (Maciej Szatanik) Date: Tue, 18 May 2010 09:07:36 +0200 Subject: [wxruby-users] Preserve selections Message-ID: <517caa9fcc169397f0d15c9bb4b48624@ruby-forum.com> hi, could any1 help me to figure out how to preserve selections in extended listbox please? f.e. i have a button to move up/down selected item(s), but after i click it and selection goes up or down i loose selections. i'd like to create an array which would hold those selections via get_selections(), but i dont see any method to select an item in a listbox. Best regards M.Szatanik -- Posted via http://www.ruby-forum.com/. From penguinroad at gmail.com Tue May 18 04:12:56 2010 From: penguinroad at gmail.com (hendra kusuma) Date: Tue, 18 May 2010 15:12:56 +0700 Subject: [wxruby-users] Preserve selections In-Reply-To: <517caa9fcc169397f0d15c9bb4b48624@ruby-forum.com> References: <517caa9fcc169397f0d15c9bb4b48624@ruby-forum.com> Message-ID: If you really needs selection, perhaps you can use checklistbox ? On Tue, May 18, 2010 at 2:07 PM, Maciej Szatanik wrote: > hi, > > could any1 help me to figure out how to preserve selections in extended > listbox please? > > f.e. i have a button to move up/down selected item(s), but after i click > it and selection goes up or down i loose selections. > > i'd like to create an array which would hold those selections via > get_selections(), but i dont see any method to select an item in a > listbox. > > Best regards > M.Szatanik > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Suka linux? Kunjungi blog saya http://penguinroad.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Tue May 18 05:12:08 2010 From: lists at ruby-forum.com (Maciej Szatanik) Date: Tue, 18 May 2010 11:12:08 +0200 Subject: [wxruby-users] Preserve selections In-Reply-To: References: <517caa9fcc169397f0d15c9bb4b48624@ruby-forum.com> Message-ID: <837df6e690b1c38f2945edc013d6e811@ruby-forum.com> will thought it over, at least its a solution :) thx a lot. -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue May 18 08:10:43 2010 From: alex at pressure.to (Alex Fenton) Date: Tue, 18 May 2010 13:10:43 +0100 Subject: [wxruby-users] Preserve selections In-Reply-To: <517caa9fcc169397f0d15c9bb4b48624@ruby-forum.com> References: <517caa9fcc169397f0d15c9bb4b48624@ruby-forum.com> Message-ID: <4BF283C3.1000102@pressure.to> On 18/05/2010 08:07, Maciej Szatanik wrote: > could any1 help me to figure out how to preserve selections in extended > listbox please? > > f.e. i have a button to move up/down selected item(s), but after i click > it and selection goes up or down i loose selections. > > i'd like to create an array which would hold those selections via > get_selections(), but i dont see any method to select an item in a > listbox. > The method you want is select() - ListBox inherits it from Wx::ControlWithItems. alex From lists at ruby-forum.com Tue May 18 08:22:16 2010 From: lists at ruby-forum.com (Maciej Szatanik) Date: Tue, 18 May 2010 14:22:16 +0200 Subject: [wxruby-users] Preserve selections In-Reply-To: <4BF283C3.1000102@pressure.to> References: <517caa9fcc169397f0d15c9bb4b48624@ruby-forum.com> <4BF283C3.1000102@pressure.to> Message-ID: <85105da0880d5a614d8dc279a7efb152@ruby-forum.com> Alex Fenton wrote: > On 18/05/2010 08:07, Maciej Szatanik wrote: >> could any1 help me to figure out how to preserve selections in extended >> listbox please? >> >> f.e. i have a button to move up/down selected item(s), but after i click >> it and selection goes up or down i loose selections. >> >> i'd like to create an array which would hold those selections via >> get_selections(), but i dont see any method to select an item in a >> listbox. >> > The method you want is select() - ListBox inherits it from > Wx::ControlWithItems. > > alex thx a lot :* will check it out right away. from now on i will always check those damn parents :P -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue May 18 09:25:46 2010 From: lists at ruby-forum.com (Maciej Szatanik) Date: Tue, 18 May 2010 15:25:46 +0200 Subject: [wxruby-users] Preserve selections In-Reply-To: <85105da0880d5a614d8dc279a7efb152@ruby-forum.com> References: <517caa9fcc169397f0d15c9bb4b48624@ruby-forum.com> <4BF283C3.1000102@pressure.to> <85105da0880d5a614d8dc279a7efb152@ruby-forum.com> Message-ID: <175086c80d809d731ad55eeb92c3a294@ruby-forum.com> Maciej Szatanik wrote: > Alex Fenton wrote: >> On 18/05/2010 08:07, Maciej Szatanik wrote: >>> could any1 help me to figure out how to preserve selections in extended >>> listbox please? >>> >>> f.e. i have a button to move up/down selected item(s), but after i click >>> it and selection goes up or down i loose selections. >>> >>> i'd like to create an array which would hold those selections via >>> get_selections(), but i dont see any method to select an item in a >>> listbox. >>> >> The method you want is select() - ListBox inherits it from >> Wx::ControlWithItems. >> >> alex > > thx a lot :* will check it out right away. > from now on i will always check those damn parents :P yup, it works, thanks again. An example if any1 is interested. Array.each do |cell| @listbox.select(cell) end -- Posted via http://www.ruby-forum.com/. From real.sergeych at gmail.com Tue May 18 10:05:03 2010 From: real.sergeych at gmail.com (Sergey Chernov) Date: Tue, 18 May 2010 18:05:03 +0400 Subject: [wxruby-users] gem for snow leopard? Message-ID: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> Does anybody plan to post binary rem for SL? Id'love to rely on its availability in the installation script... As wx included in installation package makes it huge... Sergey Chernov real.sergeych at gmail.com From mario at ruby-im.net Tue May 18 14:09:55 2010 From: mario at ruby-im.net (Mario Steele) Date: Tue, 18 May 2010 14:09:55 -0400 Subject: [wxruby-users] gem for snow leopard? In-Reply-To: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> References: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> Message-ID: Our next Binary Release of wxRuby should hopefully be ported to Snow Leopard. But the one who does the building for Mac OS X, is Alex, so he will notify everyone if this will be possible or not. I still need to find a way to get myself a Mac Intel so that I can get me a copy of OS X SL for myself. On Tue, May 18, 2010 at 10:05 AM, Sergey Chernov wrote: > Does anybody plan to post binary rem for SL? Id'love to rely on its > availability in the installation script... As wx included in installation > package makes it huge... > > Sergey Chernov > real.sergeych at gmail.com > > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From real.sergeych at gmail.com Tue May 18 18:53:07 2010 From: real.sergeych at gmail.com (Sergey Chernov) Date: Wed, 19 May 2010 02:53:07 +0400 Subject: [wxruby-users] gem for snow leopard? In-Reply-To: References: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> Message-ID: <64651C3A-D53C-413F-8ADF-A7429D5B0091@gmail.com> thanks! Just tried to build 2.9 in 64 bit mode (I really need it as need ruby 1.9 in 64-bit mode) on the SL like this: ./configure -with-osx_cocoa --disable-shared --disable-compat24 --enable-unicode CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" got an error: /Users/sergey/Downloads/wxWidgets-2.9.0/bk-deps g++ -mmacosx-version-min=10.4 -c -o corelib_printmac.o -I./.pch/wxprec_corelib -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/sergey/Downloads/wxWidgets-2.9.0/src/tiff/libtiff -I./src/tiff/libtiff -I./src/jpeg -I./src/png -I./src/regex -DwxUSE_BASE=0 -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -D_FILE_OFFSET_BITS=64 -I/Users/sergey/Downloads/wxWidgets-2.9.0/lib/wx/include/osx_cocoa-unicode-release-static-2.9 -I./include -DWX_PRECOMP -O2 -fno-strict-aliasing -fno-common ./src/osx/core/printmac.cpp ./src/osx/core/printmac.cpp: In member function ?virtual bool wxOSXPrintData::TransferFrom(const wxPrintData&)?: ./src/osx/core/printmac.cpp:142: error: ?PMPaperCreate? was not declared in this scope make: *** [corelib_printmac.o] Error 1 did anybody build it on the SL? Any success stories? Btw I can try to help a little with Mac. 18.05.2010, ? 22:09, Mario Steele ???????(?): > Our next Binary Release of wxRuby should hopefully be ported to Snow Leopard. But the one who does the building for Mac OS X, is Alex, so he will notify everyone if this will be possible or not. I still need to find a way to get myself a Mac Intel so that I can get me a copy of OS X SL for myself. > > On Tue, May 18, 2010 at 10:05 AM, Sergey Chernov wrote: > Does anybody plan to post binary rem for SL? Id'love to rely on its availability in the installation script... As wx included in installation package makes it huge... > > Sergey Chernov > real.sergeych at gmail.com > > > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > > > > -- > Mario Steele > Lieutenant 3 - Geo 99 > XO - STO IFT Fleet > Chief Engineer - Second Life > http://www.iftcommand.com > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users Sergey Chernov real.sergeych at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From alex at pressure.to Tue May 18 19:00:57 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 19 May 2010 00:00:57 +0100 Subject: [wxruby-users] gem for snow leopard? In-Reply-To: References: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> Message-ID: <4BF31C29.7010401@pressure.to> Thanks Mario - I have done a bit of messing around with Snow Leopard but haven't yet got to a working gem. The addition of 64-bit arch as default makes things complicated. I'm going to be away for a few weeks, but will have another go when back. a On 18/05/2010 19:09, Mario Steele wrote: > Our next Binary Release of wxRuby should hopefully be ported to Snow > Leopard. But the one who does the building for Mac OS X, is Alex, so > he will notify everyone if this will be possible or not. I still need > to find a way to get myself a Mac Intel so that I can get me a copy of > OS X SL for myself. From alex at pressure.to Tue May 18 19:33:19 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 19 May 2010 00:33:19 +0100 Subject: [wxruby-users] draw in C++ with wxRuby In-Reply-To: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> References: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> Message-ID: <4BF323BF.2010208@pressure.to> On 17/05/2010 16:09, Emmanuel Emmanuel wrote: > I tried one thing which is maybe very naive ... but it does not work : > > 1- I created a Frame using wxRuby > 2- i got the field wx_id of this instance of Frame > 3- I tried to get the wxWindow in C++ using this id (using > FindWindowById of the C++ api of wxWidget) > I don't think this is naive - it looks like the right way to do this. The return value of wx_id should simply be a ruby Fixnum representation of the C++ int. You don't say exactly what is going wrong here, but in your later messages you suggest that you're getting NULL back in C++ when you try wxWindow::FindWindowById. Can you provide some more detail about how you're passing the value from Ruby to your C++ library, and how you call FindWindowById in C++? One test might be to find the object in C++ by GetChildren, inspecting its pointer address and comparing to what you have in Ruby - for debugging, you can access the C++ pointer address of a Wx::Window with the method ptr_addr. The advice to draw upon a Panel, rather than directly on a Frame, is sound and in line with standard Wx techniques. PS - don't SHOUT on this list. The support offered here works wholly on the basis of good-will. alex From alex at pressure.to Tue May 18 19:40:49 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 19 May 2010 00:40:49 +0100 Subject: [wxruby-users] Does stack get unwound when event returns without skip? In-Reply-To: <460588426eca67ece1baf351681d3180@ruby-forum.com> References: <460588426eca67ece1baf351681d3180@ruby-forum.com> Message-ID: <4BF32581.9040905@pressure.to> Hi Ross On 06/05/2010 00:27, Ross Goodell wrote: > I'm using a TextCtrl in an editor and in my evt_key_down, evt_key_up, > etc. handlers I've been avoiding using event.skip in order to get the > behavior I want, but it looks like that is making the stack grow. Can > someone tell me if the stack gets unwound when an event handler finishes > without using skip? And, if it doesn't, if there is another good way > get it unwound before exiting. > I'm not totally sure what you mean by "unwound" here. It sounds like you're concerned that the Event object isn't getting released and garbage collected, and so the total world of Ruby objects is growing and consuming memory. As your later post suggests, skip() shouldn't affect this - it just signals whether the event should be passed on to other handlers for processing. There is some special and careful handling of Events in the wxRuby interface to C++, so if you've found a memory leak, I'd be really grateful if you could provide a simple example which demonstrates. thanks alex From lists at ruby-forum.com Tue May 18 21:12:54 2010 From: lists at ruby-forum.com (Ross Goodell) Date: Wed, 19 May 2010 03:12:54 +0200 Subject: [wxruby-users] Does stack get unwound when event returns without skip? In-Reply-To: <4BF32581.9040905@pressure.to> References: <460588426eca67ece1baf351681d3180@ruby-forum.com> <4BF32581.9040905@pressure.to> Message-ID: Alex Fenton wrote: > Hi Ross > > On 06/05/2010 00:27, Ross Goodell wrote: >> I'm using a TextCtrl in an editor and in my evt_key_down, evt_key_up, >> etc. handlers I've been avoiding using event.skip in order to get the >> behavior I want, but it looks like that is making the stack grow. Can >> someone tell me if the stack gets unwound when an event handler finishes >> without using skip? And, if it doesn't, if there is another good way >> get it unwound before exiting. >> > > I'm not totally sure what you mean by "unwound" here. It sounds like > you're concerned that the Event object isn't getting released and > garbage collected, and so the total world of Ruby objects is growing and > consuming memory. > > As your later post suggests, skip() shouldn't affect this - it just > signals whether the event should be passed on to other handlers for > processing. There is some special and careful handling of Events in the > wxRuby interface to C++, so if you've found a memory leak, I'd be really > grateful if you could provide a simple example which demonstrates. > > thanks > alex Thanks Alex. By not getting "unwound" I meant that the stack that was displayed when I gave the "w" command in the Ruby debugger continued to show entries for methods called by an exception handler, e.g. rescue NameError => noMethodErrorObj during the processing for an event handler such as evt_key_up, after the exception handler had completed. (Also by using the "up" command in the Ruby debugger I found that the old stacked local variables really were still available.) Further experiments since I made that last post suggested to me that at least much of it was caused by my using logic in Ruby rescue clauses to complete the processing and assuming that the subsequent return from the method would "unwind" the stack in the same way as a normal method return. Some experimentation seemed to indicate that I need to use retry if I want to get the stack "unwound" normally. I'm now in the process of making that change everywhere I need to and seeing if that solves my problem. My hypothesis in this is that rescue must be intended only for logic that will terminate the program unless retry is given. If that's wrong and there is a problem in wxRuby, I will certainly get a simple example together and pass it on to you. However, I'm about to go on vacation, so it may be a few weeks before I get it done. Thanks very much for your response, Ross -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed May 19 02:01:51 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Wed, 19 May 2010 08:01:51 +0200 Subject: [wxruby-users] draw in C++ with wxRuby In-Reply-To: <4BF323BF.2010208@pressure.to> References: <4810fb412402d4694481d6815160aaa6@ruby-forum.com> <4BF323BF.2010208@pressure.to> Message-ID: Alex Fenton wrote: > On 17/05/2010 16:09, Emmanuel Emmanuel wrote: >> I tried one thing which is maybe very naive ... but it does not work : >> >> 1- I created a Frame using wxRuby >> 2- i got the field wx_id of this instance of Frame >> 3- I tried to get the wxWindow in C++ using this id (using >> FindWindowById of the C++ api of wxWidget) >> > > I don't think this is naive - it looks like the right way to do this. > The return value of wx_id should simply be a ruby Fixnum representation > of the C++ int. > > You don't say exactly what is going wrong here, but in your later > messages you suggest that you're getting NULL back in C++ when you try > wxWindow::FindWindowById. Can you provide some more detail about how > you're passing the value from Ruby to your C++ library, and how you call > FindWindowById in C++? > > One test might be to find the object in C++ by GetChildren, inspecting > its pointer address and comparing to what you have in Ruby - for > debugging, you can access the C++ pointer address of a Wx::Window with > the method ptr_addr. > > The advice to draw upon a Panel, rather than directly on a Frame, is > sound and in line with standard Wx techniques. > > PS - don't SHOUT on this list. The support offered here works wholly on > the basis of good-will. > > alex Hello, first.... sorry for "shouting" .. I should not have....:-) And it is indeed very nice of both of you to take time trying to help me. I really appreciate! Yes, The problem was not that I could not draw in the window but that FindWindowById returned NULL. ... now I just solved it (yes!) .... I was not properly linking my C++ code to build the dynamic library.. It is all working now ..... Thank you very much (and sorry!) again Emmanuel -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed May 19 02:47:36 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Wed, 19 May 2010 08:47:36 +0200 Subject: [wxruby-users] need some advice : scientific scripting language project Message-ID: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> Hello, Ok, I am writing a (pretty big) project trying to use ruby as the main scripting language for performing math computation, scientific display and display interaction. Here is roughly what I want - a terminal window with a ruby interpreter in it (I want to be able to control all the completions/editions capabilities) - a bench of ruby classes to manipulate signals/images,etc... - I want everything to be really really fast (I'll be manipulating huge signals/images) - simple commands to display instances of these classes - graphic (programable) interaction on these displays (e.g. moving the mouse on a such a window should display image values, clicking should zoom, etc.... Now my questions are the following - Should I use irb ? Can I wrap it easily in a wxWidget window ? Can I reprogram some new capabilities (e.g., history completion, multi-line history commands...) - A unix terminal window displays output text really really fast.. what object should I use in wxRuby to display text as fast (wxTextCtrl is pretty slow, even if I use a buffer) - I want to be able to interrupt long computations (clicking on a stop button or typing ctrl-c on the terminal window) ==> I should be able to send SIGINT signal to the interpreter. Should I use 2 processes : one for the terminal and one for the rest ? The problem if I do that is that both processes will have a wxMainLoop... now what will be the best way for them to communicate ? Thank you very much Emmanuel -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed May 19 07:08:17 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 19 May 2010 12:08:17 +0100 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> Message-ID: <4BF3C6A1.5080100@pressure.to> Hi Emmanuel On 19/05/2010 07:47, Emmanuel Emmanuel wrote: > Ok, I am writing a (pretty big) project trying to use ruby as the main > scripting language for performing math computation, scientific display > and display interaction. > Sounds like a big and interesting project. I originally got interested in wxRuby building research tools (for sociology) so I'd certainly be interested to hear your progress. > Here is roughly what I want > > - a terminal window with a ruby interpreter in it (I want to be able to > control all the completions/editions capabilities) > readline? > - a bench of ruby classes to manipulate signals/images,etc... > - I want everything to be really really fast (I'll be manipulating huge > signals/images) > ruby/gsl? r-ruby? > - simple commands to display instances of these classes > - graphic (programable) interaction on these displays (e.g. moving the > mouse on a such a window should display image values, clicking should > zoom, etc.... > wxRuby is well suited to this sort of application. > Now my questions are the following > > - Should I use irb ? Can I wrap it easily in a wxWidget window ? Can I > reprogram some new capabilities (e.g., history completion, multi-line > history commands...) > I don't know of any examples of wrapping IRB in wxRuby, although it does provide a library interface. You might look into Wx::StyledTextCtrl which offers syntax highlighting and other more sophisticated support for programming code text. > - A unix terminal window displays output text really really fast.. what > object should I use in wxRuby to display text as fast (wxTextCtrl is > pretty slow, even if I use a buffer) > The text display classes are Wx::TextCtrl, Wx::LogTextCtrl, Wx::StyledTextCtrl, Wx::RichTextCtrl and Wx::HtmlControl. I'd expect simple TextCtrl or StyledTextCtrl to be fastest, but I've never tested. Judicious use of #freeze and #thaw might help to manage updates on screen. Generally Ruby is fairly slow, and wxRuby's bridge to C++ adds additional overhead to each Wx method call, so you might improve speed by batching calls to the Wx API to update the TextCtrl's context. > - I want to be able to interrupt long computations (clicking on a stop > button or typing ctrl-c on the terminal window) ==> I should be able to > send SIGINT signal to the interpreter. Should I use 2 processes : one > for the terminal and one for the rest ? > The problem if I do that is that both processes will have a > wxMainLoop... now what will be the best way for them to communicate ? > You have a couple of options: - if the computational task can be broken down into small discrete elements, you can execute these in an evt_idle handler, which runs when the GUI isn't doing anything else. This is the easiest route because you can allow interruptions using normal wxRuby event handling techniques. - you could use Ruby threads and run the computation in a slave thread. This is somewhat more complex because the slave thread should not directly update the GUI, but should signal its state by posting Wx events to the main GUI thread. A class that does this sort of thing is here (afraid it's embedded in a fairly complex Wx app): http://weft-qda.rubyforge.org/svn/trunk/weft-qda/lib/weft/wxgui/gui_subscriber.rb If you use wxRuby and threads in Ruby 1.8 you need to explicitly allocate time to the slave thread - there are numerous discussions of this in the list archives. - you could fork / pipe and run the computation as a separate process. There is no need for this to be a GUI process, I presume, so you don't need to worry about a separate GUI main_loop. One good thing about this route is that it will take advantage of multiple cores if they're available, and will separate the GUI and analytic code. But it'll involve working out how to pass data to the subsidiary process (eg popen3?) and manage and signal to it (SIGINT etc?). Given Ruby's unix background, managing a child process is easier if you only need the program to work on *nix platforms, not Windows. hth alex From alex at pressure.to Wed May 19 07:26:34 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 19 May 2010 12:26:34 +0100 Subject: [wxruby-users] Does stack get unwound when event returns without skip? In-Reply-To: References: <460588426eca67ece1baf351681d3180@ruby-forum.com> <4BF32581.9040905@pressure.to> Message-ID: <4BF3CAEA.7010004@pressure.to> On 19/05/2010 02:12, Ross Goodell wrote: > Thanks Alex. By not getting "unwound" I meant that the stack that was > displayed when I gave the "w" command in the Ruby debugger continued to > show entries for methods called by an exception handler, e.g. rescue > NameError => noMethodErrorObj during the processing for an event handler > such as evt_key_up, after the exception handler had completed. (Also by > using the "up" command in the Ruby debugger I found that the old stacked > local variables really were still available.) > That's interesting to know. From debugging on the C++ side, how I think it should look is that a wxRuby app is constantly within a main_loop method. Within that it's sequentially in a series of event handlers, which are called Procs. So perhaps if the next event hasn't started, the old stack context is still there, even if practically it's finished. > Further experiments since I made that last post suggested to me that at > least much of it was caused by my using logic in Ruby rescue clauses to > complete the processing and assuming that the subsequent return from the > method would "unwind" the stack in the same way as a normal method > return. Some experimentation seemed to indicate that I need to use > retry if I want to get the stack "unwound" normally. I'm now in the > process of making that change everywhere I need to and seeing if that > solves my problem. > What's the problem that it's causing for your app? I would limit using rescue/retry to genuine Ruby exception conditions; there should be a more straightforward way to do it if it's ordinary event processing. PS - I expect you've already noted this, but never hold a reference to a Wx::Event object (eg in an @instance_variable). wxRuby is likely to delete the object from under you causing crashes or other problems. > My hypothesis in this is that rescue must be intended only for logic > that will terminate the program unless retry is given. If that's wrong > and there is a problem in wxRuby, I will certainly get a simple example > together and pass it on to you. However, I'm about to go on vacation, > so it may be a few weeks before I get it done. > Rescue should work as in "normal" ruby; it's just that all the code running in a GUI app is the event handling code, with the main_loop as the root context of the stack. Hope you have a good holiday, please get in touch if further questions come up. a From lists at ruby-forum.com Wed May 19 09:10:14 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Wed, 19 May 2010 15:10:14 +0200 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: <4BF3C6A1.5080100@pressure.to> References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> Message-ID: First of all, Thank you Alex for all your interesting comments ! >Alex Fenton wrote: > Hi Emmanuel > > Sounds like a big and interesting project. I originally got interested > in wxRuby building research tools (for sociology) so I'd certainly be > interested to hear your progress. > I will let you know. Actually I already wrote a script language (called LastWave, http://www.cmap.polytechnique.fr/~bacry/LastWave/index.html) that has been quite used by a lot of persons... I started it a long time ago, so I did not use the modern script language (python or ruby)... it is version 3.0 now and using wxWidget.... but it clearly needs to be rewritten using a good scripting language... it needs to be entirely redesigned.... However I learned a lot, and I am pretty clear about some of the issues (memory, speed, some graphics issue). I know there exist some language such as Matlab ($$$) or R (free), but I do think these languages suffer from some drawbacks (I could develop that point but it is not the subject!). Moreover, if I write such a soft using Ruby for instance, I could benefit from both Matlab an R (there are libraries to encapsulate their engine)..... >> Here is roughly what I want >> >> - a terminal window with a ruby interpreter in it (I want to be able to >> control all the completions/editions capabilities) >> > > readline? I am not sure to understand... I want a window in which I can redirect any key being hit so that I can implement multi-line editing commands, history completion and so on ..... readline is a library ? > >> - a bench of ruby classes to manipulate signals/images,etc... >> - I want everything to be really really fast (I'll be manipulating huge >> signals/images) >> > > ruby/gsl? r-ruby? nope and this is clear from my experience.... I know pretty precisely what I want ... and it is not on the market... I'll have to do it (I alredy started and it is not the hardes part at all). But yes, I want my soft to be able to communicate with the libraries that deal with the Matlab engine and the R engine > >> - simple commands to display instances of these classes >> - graphic (programable) interaction on these displays (e.g. moving the >> mouse on a such a window should display image values, clicking should >> zoom, etc.... >> > > wxRuby is well suited to this sort of application. Yes I know it is, since LastWave has been done fully on wxWidget ! > >> Now my questions are the following >> >> - Should I use irb ? Can I wrap it easily in a wxWidget window ? Can I >> reprogram some new capabilities (e.g., history completion, multi-line >> history commands...) >> > > I don't know of any examples of wrapping IRB in wxRuby, although it does > provide a library interface. You might look into Wx::StyledTextCtrl > which offers syntax highlighting and other more sophisticated support > for programming code text. Is there a irb documentation (of the class I mean) anywhere on the web ? I could not find it! >> - A unix terminal window displays output text really really fast.. what >> object should I use in wxRuby to display text as fast (wxTextCtrl is >> pretty slow, even if I use a buffer) >> > > The text display classes are Wx::TextCtrl, Wx::LogTextCtrl, > Wx::StyledTextCtrl, Wx::RichTextCtrl and Wx::HtmlControl. I'd expect > simple TextCtrl or StyledTextCtrl to be fastest, but I've never tested. No wxTextCtrl is what I used on LastWave and I have been doing some test on wxRuby recently. It is fast, but really nothing compared to a unix terminal.... > > Judicious use of #freeze and #thaw might help to manage updates on > screen. There are methods of which class ? > Generally Ruby is fairly slow, and wxRuby's bridge to C++ adds > additional overhead to each Wx method call, so you might improve speed > by batching calls to the Wx API to update the TextCtrl's context. Yes I agree and plan to do that (though I heard ruby 1.9 is much faster! Do you think I should use python instead?) >> - I want to be able to interrupt long computations (clicking on a stop >> button or typing ctrl-c on the terminal window) ==> I should be able to >> send SIGINT signal to the interpreter. Should I use 2 processes : one >> for the terminal and one for the rest ? >> The problem if I do that is that both processes will have a >> wxMainLoop... now what will be the best way for them to communicate ? >> > > You have a couple of options: > > - if the computational task can be broken down into small discrete > elements, you can execute these in an evt_idle handler, which runs when > the GUI isn't doing anything else. This is the easiest route because you > can allow interruptions using normal wxRuby event handling techniques. No, what you call the "comoutational part" is not only computational.... It has graphics drawing (that must be fast) ... I want to write something "a la matlab" so there is not a clear cut in between terminal/graphics and computations > > - you could use Ruby threads and run the computation in a slave thread. > This is somewhat more complex because the slave thread should not > directly update the GUI, but should signal its state by posting Wx > events to the main GUI thread. A class that does this sort of thing is > here (afraid it's embedded in a fairly complex Wx app): > > http://weft-qda.rubyforge.org/svn/trunk/weft-qda/lib/weft/wxgui/gui_subscriber.rb > > If you use wxRuby and threads in Ruby 1.8 you need to explicitly > allocate time to the slave thread - there are numerous discussions of > this in the list archives. Yes I tried (maybe too naively) doing threads.... but it slowed down the computations a lot .. again I maight have done it the wrong way ! > > - you could fork / pipe and run the computation as a separate process. > There is no need for this to be a GUI process, I presume, so you don't > need to worry about a separate GUI main_loop. One good thing about this > route is that it will take advantage of multiple cores if they're > available, and will separate the GUI and analytic code. But it'll > involve working out how to pass data to the subsidiary process (eg > popen3?) and manage and signal to it (SIGINT etc?). Given Ruby's unix > background, managing a child process is easier if you only need the > program to work on *nix platforms, not Windows. I want to work on ALL platforms. You think I sould not use 2 processes then ? Now how would the 2 processes communicate if they are both running wxMainLoop (one for the terminal and the other one for all other graphics...) ? There is one thing VERY important for me : I need to be able to stop a computation if the user decides it's taking too long for instance... and I don't want the soft to crash ! Thank you again Emmanuel > > hth > alex -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed May 19 10:45:33 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 19 May 2010 15:45:33 +0100 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> Message-ID: <4BF3F98D.6040201@pressure.to> On 19/05/2010 14:10, Emmanuel Emmanuel wrote: > I will let you know. Actually I already wrote a script language (called > LastWave, http://www.cmap.polytechnique.fr/~bacry/LastWave/index.html) > that has been quite used by a lot of persons... I started it a long time > ago, so I did not use the modern script language (python or ruby)... > it is version 3.0 now and using wxWidget.... but it clearly needs to be > rewritten using a good scripting language... it needs to be entirely > redesigned... > Looks good, although I don't understand the topic of analysis ;) >>> Here is roughly what I want >>> >>> - a terminal window with a ruby interpreter in it (I want to be able to >>> control all the completions/editions capabilities) >>> >>> >> readline? >> > I am not sure to understand... I want a window in which I can redirect > any key being hit so that I can implement multi-line editing commands, > history completion and so on ..... > readline is a library ? > I was wondering if the library could be used to provide command-completion and history features - but on looking now maybe it's quite tied to the terminal which hosts it. >> ruby/gsl? r-ruby? >> > nope and this is clear from my experience.... I know pretty precisely > what I want ... and it is not on the market... I'll have to do it (I > alredy started and it is not the hardes part at all). > But yes, I want my soft to be able to communicate with the libraries > that deal with the Matlab engine and the R engine > I'd be really interested to hear how you find the Ruby-R bindings, as I've been doing increasing amounts of stat analysis with R over the past year. >> I don't know of any examples of wrapping IRB in wxRuby, although it does >> provide a library interface. You might look into Wx::StyledTextCtrl >> which offers syntax highlighting and other more sophisticated support >> for programming code text. >> > Is there a irb documentation (of the class I mean) anywhere on the web ? > I could not find it! > I can't find anything either - it doesn't appear on ruby-doc.org even though it's part of the standard library. I think when I did a bit of work extending it I just relied on the source files. The 1.9 module structure and method listing is here: http://ruby-doc.org/ruby-1.9/classes/IRB.html >>> - A unix terminal window displays output text really really fast.. what >>> object should I use in wxRuby to display text as fast (wxTextCtrl is >>> pretty slow, even if I use a buffer) >>> >>> >> The text display classes are Wx::TextCtrl, Wx::LogTextCtrl, >> Wx::StyledTextCtrl, Wx::RichTextCtrl and Wx::HtmlControl. I'd expect >> simple TextCtrl or StyledTextCtrl to be fastest, but I've never tested. >> > No wxTextCtrl is what I used on LastWave and I have been doing some test > on wxRuby recently. It is fast, but really nothing compared to a unix > terminal.... > No, I imagine not. Like to know whether there is a perceptible speed difference between wxTextCtrl (C++) and Wx::TextCtrl (Ruby) performing a comparable task. >> Judicious use of #freeze and #thaw might help to manage updates on >> screen. >> > There are methods of which class ? > Wx::Window, so applies to all things that are drawn on screen. >> Generally Ruby is fairly slow, and wxRuby's bridge to C++ adds >> additional overhead to each Wx method call, so you might improve speed >> by batching calls to the Wx API to update the TextCtrl's context. >> > Yes I agree and plan to do that (though I heard ruby 1.9 is much faster! > Do you think I should use python instead?) > Ruby 1.9 brought particular speed improvements to some numeric operations, which might be relevant to your project. Python?! I don't know. It probably is faster. But it's not so much faster that it should outweigh your preference of language, and tools. wxPython is of course very well established, with a longer history than wxRuby. > No, what you call the "comoutational part" is not only computational.... > It has graphics drawing (that must be fast) ... I want to write > something "a la matlab" so there is not a clear cut in between > terminal/graphics and computations > It sounds like you have a decomposable task - ie there are interim or partial results from part of the whole computation. So any option is open to you. It's a question of what's fast enough, and how it's most comfortable to pass data (results) back to the GUI layer to be drawn on screen. >> If you use wxRuby and threads in Ruby 1.8 you need to explicitly >> allocate time to the slave thread - there are numerous discussions of >> this in the list archives. >> > Yes I tried (maybe too naively) doing threads.... but it slowed down the > computations a lot .. again I maight have done it the wrong way ! > Yes, it'll be pretty inefficient because the Ruby thread scheduler is being forced to jump (rather clumsily) between the GUI event loop and the computational task in the slave thread. You might test evt_idle to see if it processes the same task faster. >> - you could fork / pipe and run the computation as a separate process. >> There is no need for this to be a GUI process, I presume, so you don't >> need to worry about a separate GUI main_loop. One good thing about this >> route is that it will take advantage of multiple cores if they're >> available, and will separate the GUI and analytic code. But it'll >> involve working out how to pass data to the subsidiary process (eg >> popen3?) and manage and signal to it (SIGINT etc?). Given Ruby's unix >> background, managing a child process is easier if you only need the >> program to work on *nix platforms, not Windows. >> > I want to work on ALL platforms. You think I sould not use 2 processes > then ? > Ordinary ruby will not take advantage of more than one core - but if you spawn a separate process it may run on a different core. This may be a big advantage for your use case. > Now how would the 2 processes communicate if they are both running > wxMainLoop (one for the terminal and the other one for all other > graphics...) ? > You could perhaps open a subprocess with IO#popen (http://ruby-doc.org/core/classes/IO.html#M002242), write the data to be processed to the process's STDIN, and then read the results back as they're available on the process's STDOUT (and do any graphical display that's wanted). > There is one thing VERY important for me : I need to be able to stop a > computation if the user decides it's taking too long for instance... and > I don't want the soft to crash ! > Several ways - perhaps just closing the pipes to the subprocess will kill it; you could send it a system signal; or kill it with Process. Afraid I don't know what is needed to make this portable to Windows. a From alex at pressure.to Wed May 19 13:13:23 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 19 May 2010 18:13:23 +0100 Subject: [wxruby-users] gem for snow leopard? In-Reply-To: <64651C3A-D53C-413F-8ADF-A7429D5B0091@gmail.com> References: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> <64651C3A-D53C-413F-8ADF-A7429D5B0091@gmail.com> Message-ID: <4BF41C33.9010601@pressure.to> Hi Sergey On 18/05/2010 23:53, Sergey Chernov wrote: > thanks! Just tried to build 2.9 in 64 bit mode (I really need it as > need ruby 1.9 in 64-bit mode) on the SL like this: I think this is one problem - wxRuby targets the stable version of wxWidgets (2.8.10) not 2.9, which is a development release with substantial API changes. > ./configure -with-osx_cocoa --disable-shared --disable-compat24 > --enable-unicode CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" > CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" > OBJCXXFLAGS="$arch_flags" I used this configure line to wxWidgets (though I don't know if this is building with 64-bit support). Note I'm building a shared debug for development. ../configure --enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk --with-macosx-version-min=10.5 --enable-shared --enable-unicode --enable-static --enable-debug --enable-catch_segvs --enable-graphics_ctx --enable-mediactrl --with-opengl --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=builtin --with-expat=builtin --enable-gui --enable-xrc --enable-mdi --enable-gif --enable-pcx --enable-iff --enable-pnm --enable-xpm I changed two lines in wxRuby's rake/rakemacosx.rb to target 10.5 instead of 10.4, which fixed a compile error (patch attached). I haven't got GLCanvas sorted yet, so I just skipped this bit of the build by doing rake WXRUBY_EXCLUDED=GLCanvas,GLContext But now I'm stuck with a conflicting typedef of 'ID' betwen Ruby's headers and the 10.6 Framework headers, which I don't know how to resolve - suggestions welcome. /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/AIFF.h:79: error: conflicting declaration 'typedef UInt32 ID' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/ruby.h:87: error: 'ID' has a previous declaration as 'typedef long unsigned int ID' hth alex -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: rakeosx.patch URL: From lists at ruby-forum.com Wed May 19 15:06:53 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Wed, 19 May 2010 21:06:53 +0200 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: <4BF3F98D.6040201@pressure.to> References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> Message-ID: Thanks again for teh time you spend answering me ! > I'd be really interested to hear how you find the Ruby-R bindings, as > I've been doing increasing amounts of stat analysis with R over the past > year. Ok, let me go into it further and I'll develop that in an other post. > No, I imagine not. Like to know whether there is a perceptible speed > difference between wxTextCtrl (C++) and Wx::TextCtrl (Ruby) performing a > comparable task. No there is none >>> Judicious use of #freeze and #thaw might help to manage updates on >>> screen. >>> >> There are methods of which class ? >> > > Wx::Window, so applies to all things that are drawn on screen. thanks ! > Ruby 1.9 brought particular speed improvements to some numeric > operations, which might be relevant to your project. > > Python?! I don't know. It probably is faster. But it's not so much > faster that it should outweigh your preference of language, and tools. > wxPython is of course very well established, with a longer history than > wxRuby. ok >> Yes I tried (maybe too naively) doing threads.... but it slowed down the >> computations a lot .. again I maight have done it the wrong way ! >> > > Yes, it'll be pretty inefficient because the Ruby thread scheduler is > being forced to jump (rather clumsily) between the GUI event loop and > the computational task in the slave thread. You might test evt_idle to > see if it processes the same task faster. I'll try! >> I want to work on ALL platforms. You think I sould not use 2 processes >> then ? >> > > Ordinary ruby will not take advantage of more than one core - but if you > spawn a separate process it may run on a different core. This may be a > big advantage for your use case. > >> Now how would the 2 processes communicate if they are both running >> wxMainLoop (one for the terminal and the other one for all other >> graphics...) ? >> > > You could perhaps open a subprocess with IO#popen > (http://ruby-doc.org/core/classes/IO.html#M002242), write the data to be > processed to the process's STDIN, and then read the results back as > they're available on the process's STDOUT (and do any graphical display > that's wanted). yes, so for that, the receiving process should have idle events reading the stdin right to wait for inputs right? Do you know if this works well on Windows platform ? >> There is one thing VERY important for me : I need to be able to stop a >> computation if the user decides it's taking too long for instance... and >> I don't want the soft to crash ! >> > > Several ways - perhaps just closing the pipes to the subprocess will > kill it; you could send it a system signal; or kill it with Process. > Afraid I don't know what is needed to make this portable to Windows. This is the signal thing you are afraid it might be not portable or even more than that ? Emmanuel -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Wed May 19 17:53:07 2010 From: alex at pressure.to (Alex Fenton) Date: Wed, 19 May 2010 22:53:07 +0100 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> Message-ID: <4BF45DC3.8000000@pressure.to> Emmanuel Emmanuel wrote: > Thanks again for teh time you spend answering me ! > You're welcome. >> No, I imagine not. Like to know whether there is a perceptible speed >> difference between wxTextCtrl (C++) and Wx::TextCtrl (Ruby) performing a >> comparable task. >> > No there is none > That's useful to know, thanks. > yes, so for that, the receiving process should have idle events reading > the stdin right to wait for inputs right? > Something like that, yes. Use evt_idle if possible since you can directly update the GUI state in that handler. Dealing with threads, posting events, synchronisation etc is much more hassle. > Do you know if this works well on Windows platform ? > IIRC Ruby's own fork, popen and popen3 DON'T work on Windows. However there are definitely libraries which provide comparable functionality and similar API through the Win32 API. > This is the signal thing you are afraid it might be not portable or even > more than that ? I'm not sure but I think SIGINT / SIGKILL are *nix specific. Just having the pipe might be enough to control the slave process and terminate when needed. Otherwise there are various other options for communicating between processes - have a search for 'ruby IPC'. best alex From mario at ruby-im.net Wed May 19 19:10:39 2010 From: mario at ruby-im.net (Mario Steele) Date: Wed, 19 May 2010 19:10:39 -0400 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: <4BF45DC3.8000000@pressure.to> References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> Message-ID: Not to jump in and ruin the discussion, quite good stuff. I just have one thing to comment on: popen3/popen/etc/etc. When I was working on my Ruby IDE, I found the limitation of popen/popen3, and the very many different implementations of how to properly utilize the API to do what you wanted. So I created my own Library, called xprocess. It utilizes the same methods that are used across all platforms, and provides a singular, unified API, that is consistent, and the same across all platform. I don't have any Gem build of it, or published on RubyForge, as I only had the need for the library at the time. It will need to be compiled on any platform you wish to implement it on, but you can get it from http://repos.ruby-im.net/xprocess There is currently no documentation for it, but you can look in the test directory, and see a couple of samples of how to use it. hth, Mario -- Mario Steele Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From real.sergeych at gmail.com Wed May 19 22:09:28 2010 From: real.sergeych at gmail.com (Sergey Chernov) Date: Thu, 20 May 2010 06:09:28 +0400 Subject: [wxruby-users] gem for snow leopard? In-Reply-To: <4BF41C33.9010601@pressure.to> References: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> <64651C3A-D53C-413F-8ADF-A7429D5B0091@gmail.com> <4BF41C33.9010601@pressure.to> Message-ID: <09325311-BC5D-4866-A2E0-C9BA0D71A069@gmail.com> 19.05.2010, ? 21:13, Alex Fenton ???????(?): > Hi Sergey > > On 18/05/2010 23:53, Sergey Chernov wrote: >> thanks! Just tried to build 2.9 in 64 bit mode (I really need it as need ruby 1.9 in 64-bit mode) on the SL like this: > > I think this is one problem - wxRuby targets the stable version of wxWidgets (2.8.10) not 2.9, which is a development release with substantial API changes. > >> ./configure -with-osx_cocoa --disable-shared --disable-compat24 --enable-unicode CFLAGS="$arch_flags" CXXFLAGS="$arch_flags" CPPFLAGS="$arch_flags" LDFLAGS="$arch_flags" OBJCFLAGS="$arch_flags" OBJCXXFLAGS="$arch_flags" > > I used this configure line to wxWidgets (though I don't know if this is building with 64-bit support). Note I'm building a shared debug for development. > > ../configure --enable-universal_binary --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk --with-macosx-version-min=10.5 --enable-shared --enable-unicode --enable-static --enable-debug --enable-catch_segvs --enable-graphics_ctx --enable-mediactrl --with-opengl --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=builtin --with-expat=builtin --enable-gui --enable-xrc --enable-mdi --enable-gif --enable-pcx --enable-iff --enable-pnm --enable-xpm Well the prblem is, I need 64-bit wxwidgets as I use 64-bit ruby (1.9.1). And AFAIK there is no carbon support in 64 bit mode. This config yields 32bit mode - 10.5 sdk provides nothing but 32bit. > > I changed two lines in wxRuby's rake/rakemacosx.rb to target 10.5 instead of 10.4, which fixed a compile error (patch attached). > > I haven't got GLCanvas sorted yet, so I just skipped this bit of the build by doing > > rake WXRUBY_EXCLUDED=GLCanvas,GLContext > > But now I'm stuck with a conflicting typedef of 'ID' betwen Ruby's headers and the 10.6 Framework headers, which I don't know how to resolve - suggestions welcome. > > /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/CarbonCore.framework/Headers/AIFF.h:79: error: conflicting declaration 'typedef UInt32 ID' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/universal-darwin10.0/ruby.h:87: error: 'ID' has a previous declaration as 'typedef long unsigned int ID' That could be probably corrected by building 64-bit version of wxWidgets - it wouldn't use carbon stuff. The config for it should look like ./configure --with-macosx-sdk=/Developer/SDKs/MacOSX10.6.sdk --with-macosx-version-min=10.6 --enable-shared --enable-unicode --enable-static --enable-debug --enable-catch_segvs --enable-graphics_ctx --enable-mediactrl --with-opengl --with-libjpeg=builtin --with-libpng=builtin --with-libtiff=builtin --with-expat=builtin --enable-gui --enable-xrc --enable-mdi --enable-gif --enable-pcx --enable-iff --enable-pnm --enable-xpm --with-osx-cocoa Unfortunately, it fails in the cocoa bindings /Users/sergey/Downloads/wxWidgets-2.9.0/bk-deps g++ -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -c -o coredll_osx_cocoa_textctrl.o -I./.pch/wxprec_coredll -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/sergey/Downloads/wxWidgets-2.9.0/src/tiff/libtiff -I./src/tiff/libtiff -I./src/jpeg -I./src/png -I./src/regex -I./src/expat/lib -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -D__WXDEBUG__ -I/Users/sergey/Downloads/wxWidgets-2.9.0/lib/wx/include/osx_cocoa-unicode-debug-2.9 -I./include -g -O0 -fvisibility=hidden -fvisibility-inlines-hidden ./src/osx/cocoa/textctrl.mm ./src/osx/cocoa/textctrl.mm: In function ?void -[wxNSTextFieldEditor keyDown:](wxNSTextFieldEditor*, objc_selector*, NSEvent*)?: ./src/osx/cocoa/textctrl.mm:144: error: no matching function for call to ?wxWidgetImpl::FindFromWXWidget(objc_object*)? ./include/wx/osx/core/private.h:261: note: candidates are: static wxWidgetImpl* wxWidgetImpl::FindFromWXWidget(NSView*) ./src/osx/cocoa/textctrl.mm: In function ?void -[wxNSTextFieldEditor keyUp:](wxNSTextFieldEditor*, objc_selector*, NSEvent*)?: ./src/osx/cocoa/textctrl.mm:153: error: no matching function for call to ?wxWidgetImpl::FindFromWXWidget(objc_object*)? ./include/wx/osx/core/private.h:261: note: candidates are: static wxWidgetImpl* wxWidgetImpl::FindFromWXWidget(NSView*) ./src/osx/cocoa/textctrl.mm: In function ?void -[wxNSTextFieldEditor flagsChanged:](wxNSTextFieldEditor*, objc_selector*, NSEvent*)?: ./src/osx/cocoa/textctrl.mm:160: error: no matching function for call to ?wxWidgetImpl::FindFromWXWidget(objc_object*)? ./include/wx/osx/core/private.h:261: note: candidates are: static wxWidgetImpl* wxWidgetImpl::FindFromWXWidget(NSView*) ./src/osx/cocoa/textctrl.mm: In function ?void -[wxNSTextFieldEditor insertText:](wxNSTextFieldEditor*, objc_selector*, objc_object*)?: ./src/osx/cocoa/textctrl.mm:173: error: no matching function for call to ?wxWidgetImpl::FindFromWXWidget(objc_object*)? ./include/wx/osx/core/private.h:261: note: candidates are: static wxWidgetImpl* wxWidgetImpl::FindFromWXWidget(NSView*) ./src/osx/cocoa/textctrl.mm: In constructor ?wxNSTextViewControl::wxNSTextViewControl(wxTextCtrl*, NSView*)?: ./src/osx/cocoa/textctrl.mm:321: warning: class 'NSView' does not implement the 'NSTextViewDelegate' protocol ./src/osx/cocoa/textctrl.mm: In constructor ?wxNSTextFieldControl::wxNSTextFieldControl(wxTextCtrl*, NSView*)?: ./src/osx/cocoa/textctrl.mm:436: warning: class 'NSView' does not implement the 'NSTextFieldDelegate' protocol make: *** [coredll_osx_cocoa_textctrl.o] Error 1 looks like its time to consult wxwidgets guys. > > hth > alex > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users Sergey Chernov real.sergeych at gmail.com From Andrew.Dunlop at roke.co.uk Thu May 20 03:57:55 2010 From: Andrew.Dunlop at roke.co.uk (Dunlop, Andrew) Date: Thu, 20 May 2010 08:57:55 +0100 Subject: [wxruby-users] Keyboard only menus Message-ID: <2181C5F19DD0254692452BFF3EAF1D6805BFD365@rsys005a.comm.ad.roke.co.uk> Hello all, I have a popup menu which I want to only be controllable using keyboard (actually it's a games controller mapped to key presses, but that's not important). I'm not sure it would be possible to restrict menus like that but thought I would ask the question just in case. Thanks, Andrew ------------------------------------------------------------------------ Andrew Dunlop MEng(Hons) MIET Engineer Tel: +44 (0)1794 833441 andrew.dunlop at roke.co.uk -- Roke Manor Research Ltd, Romsey, Hampshire, SO51 0ZN, United Kingdom A Siemens company Registered in England & Wales at: Siemens plc, Faraday House, Sir William Siemens Square, Frimley, Camberley, GU16 8QD. Registered No: 267550 ------------------------------------------------------------------------ Visit our website at www.roke.co.uk ------------------------------------------------------------------------ The information contained in this e-mail and any attachments is proprietary to Roke Manor Research Ltd and must not be passed to any third party without permission. This communication is for information only and shall not create or change any contractual relationship. ------------------------------------------------------------------------ Please consider the environment before printing this email ~ -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu May 20 05:42:17 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Thu, 20 May 2010 11:42:17 +0200 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> Message-ID: Ok, let me describe what I have done and working very well on a macos X.... I am going to sum up the code ... (just have in mind that the goal is to get an interaction between a terminal window and computations/graphics in the "same" way as R for instance). I still have a few questions (to both of you !) and any comments will be great ! ===== The father process opens a child process (using popen mode "r+") and opens a window with a TextCtrl in it and just waits with wxMainLoop. This process has basically two possible status : i) we are typing in a command (so this is a basic line-editor program) and as soon as we hit a return key, this command is sent to the child process using pipe.puts (pipe is the object returned by the popen command for now) and then it switches to the ii) waiting mode. In this last mode, the process (every 10ms) reads the stdout of the child process (pipe.read_nonblock) and prints in the terminal window whatever is in it as long as a specific character sequence is found indicating that the command has been executed by the child process ==> return to the command mode i) ===== The child process is very simple : a wxMainLoop (again!) and every 10ms an Idle procedure is ran. It reads the $stdin using $stdin.read_nonblock. If there is something then it corresponds to a command that will be executed, e.g., $ans = eval(command,TOPLEVEL_BINDING) (I take care of eventual errors of course) And then, it just $stdout.puts the specific character sequence that indicates command execution is over and $stdout.flush Notice that this process can open windows, draw graphics, handle interactions with these graphics ... ++++++++++++++ That's it. In this way, the display on the terminal is really fast (never got something as fast). Be aware that the (ruby) command that is executed with eval can use puts ... and it will print on the terminal. The output buffering system is the one of the system....! So for instance 100000.times {|i| puts i} takes less that 2 seconds ! Which is really fast. Moreover if a ctrl-C is typed in the terminal window I can send a SIGINT to the child process (I do it using C raise) which interrupts the execution of the ruby command !?! I was really happy... till I realized that, it will not work on Windows XP! ==> First I looked on the web to see if there is anything that could replace the popen. I found popen4.. BUT a- You have to pass a block (at the end of the block the process dies)... which is not good for me since I want the child process to live through the wxMainLoop b- (which is related to a- I think) I want to do a read_nonblock (so I don't reach the eof ... ) ==> MARIO : does your library will help me ? Does it manage the stdin/stdout of the child process in a standard way (buffering and all)? Is it non blocking ? Can I read and write (non blocking) alternatively without closing the process ? ==> Do you have any other idea (Alex, I guess you understand exactly what I want to do since you know R) Thank you for everything !! Emmanuel -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu May 20 05:47:41 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Thu, 20 May 2010 11:47:41 +0200 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> Message-ID: <6d04f735267ec1d784bebdf0de8531c2@ruby-forum.com> ouups : ==> what about using wxProcess (i.e., creating a process using wxWigets API) ?? E. -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Thu May 20 14:36:12 2010 From: mario at ruby-im.net (Mario Steele) Date: Thu, 20 May 2010 14:36:12 -0400 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: <6d04f735267ec1d784bebdf0de8531c2@ruby-forum.com> References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> <6d04f735267ec1d784bebdf0de8531c2@ruby-forum.com> Message-ID: Hello Emmanuel, The XProcess library I developed, is asynchronous, and has methods in which to detect if there is data available on a pipe object or not. I setup the library specifically for the need to be able to be async to keep the GUI responsive while the sub-process is being executed. As I said before, there are many different methods across Windows, Linux, and OS X, in which to create a pipe to a sub-process, and Windows lacks the major feature in which to allow sub-proceses naturally in ruby, which is Fork. What I have done, is created a single API interface in which to be able to create processes, and send and receive data from the sub-process, without blocking the wxWidgets API. I did think about wrapping wxProcess, but after looking through the documentation for it, I felt that it would just be simpler to create the API myself in another class, then to go through the trouble of trying to wrap wxProcess. The simplest way I can explain the API for XProcess, is that you initialize the class with the executable you wish to run. EG: xproc = XProcess.new("ruby") Then you use the method execute to pass along command line arguments to the sub-process, such as -e, -v, or whatever command line arguments your sub-process needs. Then the xproc object has 4 attributes, pid, which is the process id, in, out, and err, which are the representations of STDIN, STDOUT, and STDERR for the sub-process. You can get output from the process by doing: if xproc.out.is_data_avail? data = xproc.out.gets puts "Received: #{data}" end The method is_data_avail? on STDOUT and STDERR will not block the process, it will either return true, or false. If you want to see if the process has closed either STDOUT or STDERR, you simply check by using the eof? method on the STDOUT or STDERR. if xproc.out.eof? puts "The process has closed STDOUT" end XProcess doesn't close the IO handles for input, output or error, so you will need to close them yourself, if you don't want to use them. And if you want to kill the process if it's taking to long, simply call the kill method. I will need to write up some documentation for the XProcess library, but it's fairly straight forward, and simple to use. I try to keep things simplified, and unified across all platforms. I have had confirmation that this library works on all 3 platforms, but if you find any bugs, please feel free to let me know, off list, and I will see what I can do to fix the problems. hth, Mario -- Mario Steele Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu May 20 15:36:54 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Thu, 20 May 2010 21:36:54 +0200 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> <6d04f735267ec1d784bebdf0de8531c2@ruby-forum.com> Message-ID: Thanks Mario for this long answer ! Few questions 1- Is there also a way to read a maximum number of bytes (non blocking, knowing that there are some data available) ? (the equivalent of .read_nonblock() 2- Is it working with ruby 1.9 ? 3- How do I install it, is there a small doc ? Thanks Emmanuel -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu May 20 16:48:18 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Thu, 20 May 2010 22:48:18 +0200 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> <6d04f735267ec1d784bebdf0de8531c2@ruby-forum.com> Message-ID: Okay Mario, I did install it, it seems to work .... except that, I am doing something wrong maybe, but in order to send to the child process some strings into the stdin, I do cmd.in.puts(string) Now, when the child process finds a string in the stdin, it processes it .... and really weired... but this cmd.in.puts is blocking as long as the child process has finished its processing ??? I really don't understand what's hapenning here Could you help me ? Emmanuel -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu May 20 17:22:46 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Thu, 20 May 2010 23:22:46 +0200 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> <6d04f735267ec1d784bebdf0de8531c2@ruby-forum.com> Message-ID: ouups sorry for this message (again!) I was wrong in my last post... it is not blocking. Something really weired happens. As I already explained both processes run a wxMainLoop and both have wxTimers that wake up the process regularly. So when the child process is processing the stdin the parent process does not receive any alarm from its timer any more ??! -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Thu May 20 18:57:09 2010 From: mario at ruby-im.net (Mario Steele) Date: Thu, 20 May 2010 18:57:09 -0400 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> <6d04f735267ec1d784bebdf0de8531c2@ruby-forum.com> Message-ID: Hey Emmanuel, First off, I haven't really tested Ruby 1.9, so if it's working for you, that's great. Second off, once any output to stdin is executed, it should automatically return, without any delays. I will have to investigate this more, unless it's this third thing. Third, are you using Ruby 1.9, Wx::Timer, and Threads in the setup? Cause, if your using Ruby 1.9, there is no need to utilize Wx::Timer, to wake up your application, as Ruby 1.9 has native Thread support, which is compatible with wxWidgets thread utilization setup. The only problem you would have, is attempting to update the GUI from any other thread, outside the Main Thread. Which is the base level thread, that your app runs in. If you attempt to update the GUI from any other thread, wxWidgets will panic, and seg-fault on you, or lock your program up. I will be in IRC, if you wish to discuss more about my library. irc:// irc.freenode.net:6667/#wxruby hth, Mario On Thu, May 20, 2010 at 5:22 PM, Emmanuel Emmanuel wrote: > ouups sorry for this message (again!) > > I was wrong in my last post... it is not blocking. Something really > weired happens. > As I already explained both processes run a wxMainLoop and both have > wxTimers that wake up the process regularly. > > So when the child process is processing the stdin the parent process > does not receive any alarm from its timer any more ??! > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri May 21 06:01:50 2010 From: lists at ruby-forum.com (Emmanuel Emmanuel) Date: Fri, 21 May 2010 12:01:50 +0200 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> <6d04f735267ec1d784bebdf0de8531c2@ruby-forum.com> Message-ID: <6ff5e44a330f717b08675730df294ab2@ruby-forum.com> Hello Mario, I identified the problem (first of all no I am NOT using ruby 1.9.. I was just asking ...) : When the child process is writing quickly to the stdout then the call (from the main process) to cmd.out.data_avail? basically waits for the child process to have finished writing.... --- Example : parent process runs Idle every 10ms. Idle looks at the stdout of the child process and prints on a textCtrl whatever is in it child process runs 100000.times {|i| puts i} ==> The whole thing takes 3 seconds to run (macos X) but the flush is done just once ! (Idle is called once and blocks at cmd.out.data_avail?, wait for child process to finish writing and then displays all the numbers at once) Let's note that if I put a sleep after the puts then the display is updated very often during the loop.... Emmanuel -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Fri May 21 08:44:18 2010 From: alex at pressure.to (Alex Fenton) Date: Fri, 21 May 2010 13:44:18 +0100 Subject: [wxruby-users] need some advice : scientific scripting language project In-Reply-To: References: <9beb1616e6da4df84ed3722bd33d61e4@ruby-forum.com> <4BF3C6A1.5080100@pressure.to> <4BF3F98D.6040201@pressure.to> <4BF45DC3.8000000@pressure.to> Message-ID: <4BF68022.2000209@pressure.to> hi Glad you're making progress; not surprised to hear that Windows is the sticking point. Mario knows a lot more than me about using pipes etc with wxRuby so just a few observations that might or might not be useful: Emmanuel Emmanuel wrote: > The child process is very simple : a wxMainLoop (again!) and every 10ms > an Idle procedure is ran. > Are you sure child process needs to be a wx program at all? I would expect it to be a simple Ruby non-GUI program if it just uses STDIN and STDOUT to communicate in an efficient format. With that you can test different options, eg - a long-running server to handle many jobs (which starts up and then enters an endless "loop do ... end") vs a per-job new process. If it's like R, the overhead of starting a new process per-job is insignificant against the overall job computation time. And you can close the write pipe on each job and then read data incrementally, rather than the more complex popen3 model. - I wonder if Drb (distributed ruby) might work? I have used it with some success in attaching a wxRuby GUI to an application running separately. One other bonus of this is it would then be easy to move to a client/server model on different pcs if wanted in the future. > Notice that this process can open windows, draw graphics, handle > interactions with these graphics ... > Is this in the child process? That seems an unusual arrangement but of course there might be very good reasons for this... > ++++++++++++++ > > That's it. > In this way, the display on the terminal is really fast (never got > something as fast). Great. I'm away on hols for a few weeks now so won't be picking up, but best of luck with the project alex From alex at pressure.to Fri May 21 08:53:21 2010 From: alex at pressure.to (Alex Fenton) Date: Fri, 21 May 2010 13:53:21 +0100 Subject: [wxruby-users] gem for snow leopard? In-Reply-To: <09325311-BC5D-4866-A2E0-C9BA0D71A069@gmail.com> References: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> <64651C3A-D53C-413F-8ADF-A7429D5B0091@gmail.com> <4BF41C33.9010601@pressure.to> <09325311-BC5D-4866-A2E0-C9BA0D71A069@gmail.com> Message-ID: <4BF68241.2080906@pressure.to> Sergey Chernov wrote: > Well the prblem is, I need 64-bit wxwidgets as I use 64-bit ruby (1.9.1). And AFAIK there is no carbon support in 64 bit mode. This config yields 32bit mode - 10.5 sdk provides nothing but 32bit. > Indeed - wx 2.8 Mac uses Carbon, Carbon isn't 64 bit, so wx 2.9 Mac is switching to Cocoa. But wxRuby 2.0 only targets the current stable 2.8. So even if you get 2.9 built, wxRuby won't compile against it. I'd think the way out (and how wxPython works on 10.6 currently) is to use a 32-bit ruby 1.9.1 (building your own if necessary with the arch explicitly declared), and then build wxRuby against this and wx 2.8. > /Users/sergey/Downloads/wxWidgets-2.9.0/bk-deps g++ -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -c -o coredll_osx_cocoa_textctrl.o -I./.pch/wxprec_coredll -D__WXOSX_COCOA__ -DWXBUILDING Yep -D__WXOSX_COCOA__ is the tag for the new Cocoa-based 2.9. All of wxRuby's Mac support is for __WXMAC__. > looks like its time to consult wxwidgets guys. They have a very good dev team, led by Stephan Csomor for OS X. Well documented bugs, compile errors and patches are welcome, I've found. best alex From alex at pressure.to Fri May 21 08:59:48 2010 From: alex at pressure.to (Alex Fenton) Date: Fri, 21 May 2010 13:59:48 +0100 Subject: [wxruby-users] Keyboard only menus In-Reply-To: <2181C5F19DD0254692452BFF3EAF1D6805BFD365@rsys005a.comm.ad.roke.co.uk> References: <2181C5F19DD0254692452BFF3EAF1D6805BFD365@rsys005a.comm.ad.roke.co.uk> Message-ID: <4BF683C4.9060602@pressure.to> hi Andrew Dunlop, Andrew wrote: > > I have a popup menu which I want to only be controllable using > keyboard (actually it?s a games controller mapped to key presses, but > that?s not important). > > I?m not sure it would be possible to restrict menus like that but > thought I would ask the question just in case. > Not sure I understand 100% - but Wx::AcceleratorTable offers a concise way to define keyboard shortcuts for a Frame etc. But using a normal desktop context menu would kind of imply control by mouse or keyboard, no? Unless you hide the mouse pointer, somehow? cheers alex From lists at ruby-forum.com Sun May 23 12:51:15 2010 From: lists at ruby-forum.com (Ivo Roupa) Date: Sun, 23 May 2010 18:51:15 +0200 Subject: [wxruby-users] Import data from a txt.file to a trichtextbox - Help Message-ID: <87500ef7060b84789f64efaf7b603b04@ruby-forum.com> Hi all, I created a simple application with one button and one richtextbox. The purpose of the button is to open a FileDialog Common Dialogs to choose a .txt file: I created the button event: evt_button(@button.get_id()){|event| open_file(event)} the FileDialog widget @file_dialog = Wx::FileDialog.new(@panel, message = "Choose a file", defaultDir = "", defaultFile = "", wildcard = "*.*", style = DD_DEFAULT_STYLE, pos = DEFAULT_POSITION, sz = DEFAULT_SIZE, name = "filedlg") and the code to run the File.Dialog def open_file(event) @file_dialog.show_modal end What I don't know is how can I import data from that file in order to appear in my richtextbox, although I know that I must pass values to richtextbox with rich_text_box.value = ..... If someone can explain that to me I would be very thankfull Thanks in advance Ivo Roupa -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Sun May 23 13:11:33 2010 From: mario at ruby-im.net (Mario Steele) Date: Sun, 23 May 2010 13:11:33 -0400 Subject: [wxruby-users] Import data from a txt.file to a trichtextbox - Help In-Reply-To: <87500ef7060b84789f64efaf7b603b04@ruby-forum.com> References: <87500ef7060b84789f64efaf7b603b04@ruby-forum.com> Message-ID: Hello Ivo, There's several methods in which to load a file into a RichTextCtrl. The first method is to use File.read, as such: def open_file(event) if @file_dialog.show_modal == Wx::ID_OK @mytextbox.value = File.read(@file_dialog.filename) end end The second method, is to use the builtin function from RichTextCtrl to load the file def open_file(event) if @file_dialog.show_modal == Wx::ID_OK @mytextbox.load_file(@file_dialog.filename) end end The second method is quicker, and easier, if your just wanting to load a simple file into the buffer. If you want to do custom highlighting, then you would probably be best to load the file through the first method, but instead of storing the value directly into @mytextbox.value, you would probably do it through storing the data from the text file in a variable, and parse it, using the RichTextCtrl functions to do the colorizing/formatting/what have ya. hth, Mario P.S. Take a look at http://wxruby.rubyforge.org/doc for our current API. Most functions can be looked up there for basic handling of GUI elements. On Sun, May 23, 2010 at 12:51 PM, Ivo Roupa wrote: > Hi all, > > I created a simple application with one button and one richtextbox. The > purpose of the button is to open a FileDialog Common Dialogs to choose a > .txt file: > > I created the button event: > > evt_button(@button.get_id()){|event| open_file(event)} > > the FileDialog widget > > @file_dialog = Wx::FileDialog.new(@panel, > message = "Choose a file", > defaultDir = "", > defaultFile = "", > wildcard = "*.*", > style = DD_DEFAULT_STYLE, > pos = DEFAULT_POSITION, > sz = DEFAULT_SIZE, > name = "filedlg") > > and the code to run the File.Dialog > > def open_file(event) > @file_dialog.show_modal > end > > What I don't know is how can I import data from that file in order to > appear in my richtextbox, although I know that I must pass values to > richtextbox with rich_text_box.value = ..... > > If someone can explain that to me I would be very thankfull > > Thanks in advance > > Ivo Roupa > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Sun May 23 17:45:14 2010 From: lists at ruby-forum.com (Ivo Roupa) Date: Sun, 23 May 2010 23:45:14 +0200 Subject: [wxruby-users] Import data from a txt.file to a trichtextbox - Help In-Reply-To: References: <87500ef7060b84789f64efaf7b603b04@ruby-forum.com> Message-ID: <94281f6ca00f20757839373814b06c47@ruby-forum.com> Hello Mario On first post I forgot to refer some things, like my OS (Windows), Ruby version (1.9 - OneClickInstaller) and wxRuby version (2.0.1.) Erroneus I also refer that I want to import data to a textbox but it's not. It's for a RichTextbox (I'm not sure if it's very important but at least it make me change some method names...). def open_file(event) if @file_dialog.show_modal == Wx::ID_OK @rich_text_box.load_file(@file_dialog.get_filename, type = RICHTEXT_TYPE_ANY) end end The problem is that when I try to load the file I get an error message: File couldn't be loaded. And when I ask to see the details the following message appears: Can't open file "ENA.txt"(error 2. the system cannot find the file specified.) File couldn't be loaded I don't understand why this happens because the file actually exists... And if it's not too much..Can you explain why do I need to use this piece of code (== Wx::ID_OK)? Thanks in advance Ivo Roupa -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Mon May 24 05:07:50 2010 From: mario at ruby-im.net (Mario Steele) Date: Mon, 24 May 2010 05:07:50 -0400 Subject: [wxruby-users] Import data from a txt.file to a trichtextbox - Help In-Reply-To: <94281f6ca00f20757839373814b06c47@ruby-forum.com> References: <87500ef7060b84789f64efaf7b603b04@ruby-forum.com> <94281f6ca00f20757839373814b06c47@ruby-forum.com> Message-ID: Hello Ivo, On Sun, May 23, 2010 at 5:45 PM, Ivo Roupa wrote: > Hello Mario > > On first post I forgot to refer some things, like my OS (Windows), Ruby > version (1.9 - OneClickInstaller) and wxRuby version (2.0.1.) > > Erroneus I also refer that I want to import data to a textbox but it's > not. It's for a RichTextbox (I'm not sure if it's very important but at > least it make me change some method names...). > > def open_file(event) > if @file_dialog.show_modal == Wx::ID_OK > @rich_text_box.load_file(@file_dialog.get_filename, type = > RICHTEXT_TYPE_ANY) > end > end > > The problem is that when I try to load the file I get an error message: > > File couldn't be loaded. > > And when I ask to see the details the following message appears: > > Can't open file "ENA.txt"(error 2. the system cannot find the > file specified.) > File couldn't be loaded > > I don't understand why this happens because the file actually exists... > My Apologizes, it should actually be, @rich_text_box.load_file(@file_dialog.get_path()) Not @rich_text_box.load_file(@file_dialog.get_filename()) The difference, is that get_filename() returns only the name of the file, in this case ENA.txt, where as get_path() will return the full path, such as C:\ENA.txt And if it's not too much..Can you explain why do I need to use this > piece of code (== Wx::ID_OK)? The check for Wx::ID_OK is to ensure that the user actually hit OK, cause the user can still cancel a File Dialog, or close it without selecting a file, which the return from show_modal will be Wx::ID_CANCEL. Hence why there's the check for Wx::ID_OK, to ensure that it is alright to progress further. Lastly, you don't need to use type in the load_file method. If you need to specify a specific format, such as RTF, or something, you would use that, but the default value for type, is Wx::RICHTEXT_TYPE_ANY, which means it will load any file type that is available. > Thanks in advance > Not a problem, and my apologizes for the mistake in the method to use on the FileDialog. > Ivo Roupa > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > hth, Mario -- Mario Steele Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Mon May 24 17:52:24 2010 From: lists at ruby-forum.com (Adi Mou) Date: Mon, 24 May 2010 23:52:24 +0200 Subject: [wxruby-users] My first wxRuby app doesn't work, please help! In-Reply-To: <61d939bf1daebea5a0b97410b60a0b56@ruby-forum.com> References: <915bb26bf7eebbf31db68da1939dfc7f@ruby-forum.com> <61d939bf1daebea5a0b97410b60a0b56@ruby-forum.com> Message-ID: <5e413e221922380493a6a527fcaf2394@ruby-forum.com> Hi, On error in your code : evt_button(@my_button.get_id()) { |event| my_button_click(event)} The correct : evt_button(@button.get_id()) { |event| my_button_click(event)} Good luck -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Tue May 25 09:32:23 2010 From: lists at ruby-forum.com (Andrew Dunlop) Date: Tue, 25 May 2010 15:32:23 +0200 Subject: [wxruby-users] Keyboard only menus In-Reply-To: <4BF683C4.9060602@pressure.to> References: <2181C5F19DD0254692452BFF3EAF1D6805BFD365@rsys005a.comm.ad.roke.co.uk> <4BF683C4.9060602@pressure.to> Message-ID: Alex Fenton wrote: > hi Andrew > > Dunlop, Andrew wrote: >> >> I have a popup menu which I want to only be controllable using >> keyboard (actually it?s a games controller mapped to key presses, but >> that?s not important). >> >> I?m not sure it would be possible to restrict menus like that but >> thought I would ask the question just in case. >> > > Not sure I understand 100% - but Wx::AcceleratorTable offers a concise > way to define keyboard shortcuts for a Frame etc. But using a normal > desktop context menu would kind of imply control by mouse or keyboard, > no? Unless you hide the mouse pointer, somehow? > > cheers > alex I am using a pointer mapped to a controller joystick and then when the menu pops up I want to navigate the menu using the D-pad as this is easier. -- Posted via http://www.ruby-forum.com/. From c_snufkin at yahoo.com Tue May 25 13:27:42 2010 From: c_snufkin at yahoo.com (Yonatan Elhanan) Date: Tue, 25 May 2010 10:27:42 -0700 (PDT) Subject: [wxruby-users] Grid#set_cell_size is missing Message-ID: <150828.8931.qm@web50102.mail.re2.yahoo.com> Why is there no Grid#set_cell_size method? I want to create cells spanning several rows/columns. I get a method_missing error and it's not on the docs. require 'wx' class GridFrame < Wx::Frame def initialize super(nil, -1, "Grid Cell Size") grid = Wx::Grid.new(self, -1) grid.create_grid(10, 10) grid.set_cell_size(1,1, 2, 2) sizer = Wx::BoxSizer.new(Wx::VERTICAL) sizer.add(grid) set_sizer(sizer) end end class GridCellSizeApp < Wx::App def on_init frame = GridFrame.new frame.show end end GridCellSizeApp.new.main_loop From lists at ruby-forum.com Wed May 26 20:32:02 2010 From: lists at ruby-forum.com (Ivo Roupa) Date: Thu, 27 May 2010 02:32:02 +0200 Subject: [wxruby-users] Import data from a txt.file to a trichtextbox - Help In-Reply-To: References: <87500ef7060b84789f64efaf7b603b04@ruby-forum.com> <94281f6ca00f20757839373814b06c47@ruby-forum.com> Message-ID: Hello Mario, Thanks for your help.... The code it's working fine and it's exactly what I wanted. But know I get a doubt: I have read on Ruby Cookbook that when I list a dir I must write on my code "object_name.rewind" otherwise I can?t run more methods on that object. Does this also apply in this case? Because after I load the file to the textbox Enter key stops working. And about your mistake, it allow me to learn one more thinh :) Thanks in advance Ivo Roupa -- Posted via http://www.ruby-forum.com/. From real.sergeych at gmail.com Thu May 27 13:55:41 2010 From: real.sergeych at gmail.com (Sergey Chernov) Date: Thu, 27 May 2010 21:55:41 +0400 Subject: [wxruby-users] gem for snow leopard? In-Reply-To: <4BF68241.2080906@pressure.to> References: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> <64651C3A-D53C-413F-8ADF-A7429D5B0091@gmail.com> <4BF41C33.9010601@pressure.to> <09325311-BC5D-4866-A2E0-C9BA0D71A069@gmail.com> <4BF68241.2080906@pressure.to> Message-ID: <8242C8F6-54ED-461A-8498-F1FB3C0B35BE@gmail.com> Well, thanks. Are there any plans on switching to wx 2.9? I actually hate the idea to build ruby, postgres and bloody lot of everything back to 32 bit. Actually I did a stupid thing on relying on fast 64bit integer math :) well looks like future isn't yet there ;) Yours, Sergey 21.05.2010, ? 16:53, Alex Fenton ???????(?): > Sergey Chernov wrote: >> Well the prblem is, I need 64-bit wxwidgets as I use 64-bit ruby >> (1.9.1). And AFAIK there is no carbon support in 64 bit mode. This >> config yields 32bit mode - 10.5 sdk provides nothing but 32bit. >> > > Indeed - wx 2.8 Mac uses Carbon, Carbon isn't 64 bit, so wx 2.9 Mac > is switching to Cocoa. But wxRuby 2.0 only targets the current > stable 2.8. So even if you get 2.9 built, wxRuby won't compile > against it. > > I'd think the way out (and how wxPython works on 10.6 currently) is > to use a 32-bit ruby 1.9.1 (building your own if necessary with the > arch explicitly declared), and then build wxRuby against this and wx > 2.8. > >> /Users/sergey/Downloads/wxWidgets-2.9.0/bk-deps g++ -isysroot / >> Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -c -o >> coredll_osx_cocoa_textctrl.o -I./.pch/wxprec_coredll - >> D__WXOSX_COCOA__ -DWXBUILDING > > Yep -D__WXOSX_COCOA__ is the tag for the new Cocoa-based 2.9. All of > wxRuby's Mac support is for __WXMAC__. > >> looks like its time to consult wxwidgets guys. > > They have a very good dev team, led by Stephan Csomor for OS X. Well > documented bugs, compile errors and patches are welcome, I've found. > > best > alex > > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users From mario at ruby-im.net Thu May 27 17:37:48 2010 From: mario at ruby-im.net (Mario Steele) Date: Thu, 27 May 2010 17:37:48 -0400 Subject: [wxruby-users] gem for snow leopard? In-Reply-To: <8242C8F6-54ED-461A-8498-F1FB3C0B35BE@gmail.com> References: <343F378E-D65F-4108-8BB7-EA8E5D3CC266@gmail.com> <64651C3A-D53C-413F-8ADF-A7429D5B0091@gmail.com> <4BF41C33.9010601@pressure.to> <09325311-BC5D-4866-A2E0-C9BA0D71A069@gmail.com> <4BF68241.2080906@pressure.to> <8242C8F6-54ED-461A-8498-F1FB3C0B35BE@gmail.com> Message-ID: Our next 2.x line, or possibly our 3.x line, will be syncing with the wxWidgets latest code. Our future plans, is involving a match up with wxWidget's versioning system, with our versioning system, that way you can compare wxRuby's major and minor level's, and see which major and minor version to work with on wxWidgets. Amongst other things, we will also be looking to modularize the wxRuby core .so library, to hopefully match up with the wxWidget's .so libraries, though we haven't officially worked much on that setup. It's been something that we had been talking about, and another of that being hopefully to reduce the swig bloat, that is compounding the wxRuby.so file. We have lots of ideas, it's just we're trying to get synced with wxWidgets, and ourselves, and trying to get classes wrapped, and such. We hear that 3.0 of wxWidgets is going to be better, and easier for us to wrap in Ruby. We will wait and see. hth, Mario 2010/5/27 Sergey Chernov > Well, thanks. > > Are there any plans on switching to wx 2.9? > > I actually hate the idea to build ruby, postgres and bloody lot of > everything back to 32 bit. Actually I did a stupid thing on relying on fast > 64bit integer math :) well looks like future isn't yet there ;) > > Yours, > Sergey > > 21.05.2010, ? 16:53, Alex Fenton ???????(?): > > > Sergey Chernov wrote: >> >>> Well the prblem is, I need 64-bit wxwidgets as I use 64-bit ruby (1.9.1). >>> And AFAIK there is no carbon support in 64 bit mode. This config yields >>> 32bit mode - 10.5 sdk provides nothing but 32bit. >>> >>> >> Indeed - wx 2.8 Mac uses Carbon, Carbon isn't 64 bit, so wx 2.9 Mac is >> switching to Cocoa. But wxRuby 2.0 only targets the current stable 2.8. So >> even if you get 2.9 built, wxRuby won't compile against it. >> >> I'd think the way out (and how wxPython works on 10.6 currently) is to use >> a 32-bit ruby 1.9.1 (building your own if necessary with the arch explicitly >> declared), and then build wxRuby against this and wx 2.8. >> >> /Users/sergey/Downloads/wxWidgets-2.9.0/bk-deps g++ -isysroot >>> /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6 -c -o >>> coredll_osx_cocoa_textctrl.o -I./.pch/wxprec_coredll -D__WXOSX_COCOA__ >>> -DWXBUILDING >>> >> >> Yep -D__WXOSX_COCOA__ is the tag for the new Cocoa-based 2.9. All of >> wxRuby's Mac support is for __WXMAC__. >> >> looks like its time to consult wxwidgets guys. >>> >> >> They have a very good dev team, led by Stephan Csomor for OS X. Well >> documented bugs, compile errors and patches are welcome, I've found. >> >> best >> alex >> >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele Lieutenant 3 - Geo 99 XO - STO IFT Fleet Chief Engineer - Second Life http://www.iftcommand.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri May 28 06:58:35 2010 From: lists at ruby-forum.com (Maciej Szatanik) Date: Fri, 28 May 2010 12:58:35 +0200 Subject: [wxruby-users] STC encoding Message-ID: <89c5ab34ca9f3ad8d62286f1295f3c03@ruby-forum.com> i'd like to use StyledTextCtrl in my aplication, to edit Watir tests. But i have a great problem with encoding, i work on windows xp (unfortunately) and all tests i have had been written in utf-8, in NetBeans. When i open a file in my own editor i see characters like "u??y" instead of polish characters. When i type in my own editor i can use polish characters, and they are displayed good. When i edit a file and save it, i see "??" instead of polish characters. I have tried a lot of combinations with: @sci.style_set_character_set(STC_STYLE_DEFAULT, 0) @sci.set_code_page(65001) @sci.style_set_font_encoding(STC_STYLE_DEFAULT, FONTENCODING_UTF8) Font.set_default_encoding(FONTENCODING_UTF8) but it didnt help if i use File.new to create a file and File.puts contents inside of it, and load this script into my editor i see wrongly displayed polish characters, but when i run a test i get correct characters in output, so the problem is when i write sth and save it. --code for load and save-- evt_button(@button_edit_bottom.get_id()){ |event| file_to_edit = @listbox_added.get_selections() file_to_edit = file_to_edit[0] file_to_edit = $tests[file_to_edit] @sci.load_file("#{file_to_edit}") @input_edit_save.set_value("#{file_to_edit}") } evt_button(@button_edit_save.get_id()){ |event| edited_file_to_save = @input_edit_save.get_line_text(0) if edited_file_to_save != "" f = File.new("#{edited_file_to_save}","w") if File.exists?("#{edited_file_to_save}") == false @sci.save_file("#{edited_file_to_save}") file_to_reedit = @input_edit_save.get_line_text(0) @sci.load_file("#{file_to_reedit}") @input_edit_save.set_value("#{file_to_reedit}") else @mdialog_input_edit_save = MessageDialog.new(@my_panel, "Name the file please", "Oops!", OK, DEFAULT_POSITION) @mdialog_input_edit_save.show_modal() end } -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri May 28 09:14:34 2010 From: lists at ruby-forum.com (Maciej Szatanik) Date: Fri, 28 May 2010 15:14:34 +0200 Subject: [wxruby-users] STC encoding In-Reply-To: <89c5ab34ca9f3ad8d62286f1295f3c03@ruby-forum.com> References: <89c5ab34ca9f3ad8d62286f1295f3c03@ruby-forum.com> Message-ID: <8d4d5d769c145ebf1a3cdc6e39855d5c@ruby-forum.com> the problem seams to be related to load_file and save_file. f = File.new("#{edited_file_to_save}","w+") f.each do |line| line.delete end contents_to_save = @sci.get_text#tu f.puts contents_to_save f.close works for me -- Posted via http://www.ruby-forum.com/.