From sutniuq at gmx.net Tue Oct 5 12:46:40 2010 From: sutniuq at gmx.net (Quintus) Date: Tue, 05 Oct 2010 18:46:40 +0200 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 Message-ID: <4CAB5670.1000809@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi there, A few days ago I compiled wxRuby on Ubuntu 10.04 Lucid Lynx and came over some issues not mentioned at http://wxruby.rubyforge.org/wiki/wiki.pl?BuildingOnTopOfLinuxDistroPackages First and most importantly, even though I though I had all necessary packages installed, I was presented many errors about ld not finding lgtk-x11-2.0 and other important libs as pango. I figured out that for whatever reason, these files didn't exist on my Ubuntu installation: /usr/lib/libgtk-x11-2.0.so /usr/lib/libgdk-x11-2.0.so /usr/lib/libatk-1.0.so /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libpangoxft-1.0.so /usr/lib/libpangox-1.0.so /usr/lib/libpango-1.0.so Searching for similar named files turned up that I had files ending in ".so.0" in the /usr/lib/ directory. I'm not sure if I was correct in doing so, but I just symlinked them to the needed file names: /usr/lib/libgtk-x11-2.0.so.0 -> /usr/lib/libgtk-x11-2.0.so /usr/lib/libgdk-x11-2.0.so.0 -> /usr/lib/libgdk-x11-2.0.so /usr/lib/libatk-1.0.so.0 -> /usr/lib/libatk-1.0.so /usr/lib/libgdk_pixbuf-2.0.so.0 -> /usr/lib/libgdk_pixbuf-2.0.so /usr/lib/libpangoxft-1.0.so -> /usr/lib/libpangoxft-1.0.so /usr/lib/libpangox-1.0.so.0 -> /usr/lib/libpangox-1.0.so /usr/lib/libpango-1.0.so.0 -> /usr/lib/libpango-1.0.so After figuering this out, the compilation process complained about missing gl, glu and glut headers which I thought were optional. Maybe I missed some compile option to ommit them and if so I'd appreciate it if someone could enlighten me about that, but installing the freeglut3-dev package did the trick for me. I'm not sure about the StyledTextCtrl's dependencies--maybe I just have the necessary headers on my system as I tend to install many development packages on compiling problems (not only with wxRuby). Does wxRuby complain on compilation if they're missing? In short here are my questions: * What's about that wrongly named shared object files? Is something wrong with my system? * How to instruct rake not to build gl, glu, glut and the StyledTextControl extensions if the necessary development headers are not available for whatever reason? * What are the development headers needed for StyledTextCtrl? Ah, and last but not least, why is the http://wxruby.rubyforge.org/wiki/wiki.pl?BuildingOnTopOfLinuxDistroPackages page not linked anywhere on the wxRuby homepage? It is only findable by searching for it. There should be a link to it on http://wxruby.rubyforge.org/wiki/wiki.pl?InstallingFromSource I suggest. Marvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMq1ZtAAoJEGrS0YjAWTKVVrYH/0L8NKbGUrD5sqCcEJsfa16R PRRDMnYRBKyRim5UEaj05dJ1vouOyEJ+bxX8+ZidNRCnTdVpkHXemEQcayT1vXhX rLX69l6VYn3bwN4g8I8xSaIT273gz7aDXZwZB/381nmMjHpdmi2CK2b7RQl3SBxa X0UyEvFHHGodoMHmw6oz5R5ZHvVVFaIYr8qxARfTnTEyJ8oFPqO0VB5X1VJgCwPK AHItQWYhAa/0z+TfClKdmVzgPdNTO4N/onaE5XtSd2xbvQPfa903T2GGV+3TIXYW I1D/7O/tF4KSUWCRiqgGccgVCMoFx26U7+j2XWCG7sNZW6ANaiRQx0r3wJrNmu8= =dw8X -----END PGP SIGNATURE----- From mario at ruby-im.net Wed Oct 6 03:38:19 2010 From: mario at ruby-im.net (Mario Steele) Date: Wed, 6 Oct 2010 03:38:19 -0400 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 In-Reply-To: <4CAB5670.1000809@gmx.net> References: <4CAB5670.1000809@gmx.net> Message-ID: Hello Marvin, On Tue, Oct 5, 2010 at 12:46 PM, Quintus wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Hi there, > > A few days ago I compiled wxRuby on Ubuntu 10.04 Lucid Lynx and came > over some issues not mentioned at > http://wxruby.rubyforge.org/wiki/wiki.pl?BuildingOnTopOfLinuxDistroPackages > > First and most importantly, even though I though I had all necessary > packages installed, I was presented many errors about ld not finding > lgtk-x11-2.0 and other important libs as pango. I figured out that for > whatever reason, these files didn't exist on my Ubuntu installation: > > /usr/lib/libgtk-x11-2.0.so > /usr/lib/libgdk-x11-2.0.so > /usr/lib/libatk-1.0.so > /usr/lib/libgdk_pixbuf-2.0.so > /usr/lib/libpangoxft-1.0.so > /usr/lib/libpangox-1.0.so > /usr/lib/libpango-1.0.so > > Searching for similar named files turned up that I had files ending in > ".so.0" in the /usr/lib/ directory. I'm not sure if I was correct in > doing so, but I just symlinked them to the needed file names: > > /usr/lib/libgtk-x11-2.0.so.0 -> /usr/lib/libgtk-x11-2.0.so > /usr/lib/libgdk-x11-2.0.so.0 -> /usr/lib/libgdk-x11-2.0.so > /usr/lib/libatk-1.0.so.0 -> /usr/lib/libatk-1.0.so > /usr/lib/libgdk_pixbuf-2.0.so.0 -> /usr/lib/libgdk_pixbuf-2.0.so > /usr/lib/libpangoxft-1.0.so -> /usr/lib/libpangoxft-1.0.so > /usr/lib/libpangox-1.0.so.0 -> /usr/lib/libpangox-1.0.so > /usr/lib/libpango-1.0.so.0 -> /usr/lib/libpango-1.0.so > > After figuering this out, the compilation process complained about > missing gl, glu and glut headers which I thought were optional. Maybe I > missed some compile option to ommit them and if so I'd appreciate it if > someone could enlighten me about that, but installing the freeglut3-dev > package did the trick for me. > I'm not sure about the StyledTextCtrl's dependencies--maybe I just have > the necessary headers on my system as I tend to install many development > packages on compiling problems (not only with wxRuby). Does wxRuby > complain on compilation if they're missing? > > In short here are my questions: > > * What's about that wrongly named shared object files? Is something > wrong with my system? > First off, doing the symlink is the correct procedure. I found that from Ubuntu 9.04 onwards, they stop putting the symlinks in for the libraries, and therefore when trying to compile, it fails. Symlinking was the correct procedure here to compile. > * How to instruct rake not to build gl, glu, glut and the > StyledTextControl extensions if the necessary development headers are > not available for whatever reason? > StyledTextControl by default should be detected on weither it's installed or compiled or not into the wxWidgets library, if it isn't compiled, then Rake should detect that, and not attempt to compile StyledTextControl. If you want StyledTextControl, then you need to ensure StyledTextControl is either installed (I believe it should be by default with the Ubuntu repository packages), or going into contrib/stc/ and running make + make install to build and install StyledTextControl. As for gl/glu/glut ignore, I believe that you need to do something like this: EXCLUDED_CLASSES=GLCanvas rake This basically tells Rake, to ignore GLCanvas. I could be wrong, as I've never tried to compile wxRuby without GL, even though I don't use it personally myself. > * What are the development headers needed for StyledTextCtrl? > There shouldn't be any dependancies you need to install for StyledTextCtrl, as it's generally compiled into the wxWidgets library, if you build yourself, you would need to go into contrib/stc/ and run make/make install to build the STC code, and wxRuby will automatically detect if it is there, or not, and compile based upon the detection of it being there for you. Ah, and last but not least, why is the > http://wxruby.rubyforge.org/wiki/wiki.pl?BuildingOnTopOfLinuxDistroPackages > page not linked anywhere on the wxRuby homepage? It is only findable by > searching for it. There should be a link to it on > http://wxruby.rubyforge.org/wiki/wiki.pl?InstallingFromSource I suggest. > I didn't even know that page was there, someone probably added it last year, and forgot to make the necessary changes. The Wiki is in pretty bad shape, and needs to be fixed. > Marvin > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJMq1ZtAAoJEGrS0YjAWTKVVrYH/0L8NKbGUrD5sqCcEJsfa16R > PRRDMnYRBKyRim5UEaj05dJ1vouOyEJ+bxX8+ZidNRCnTdVpkHXemEQcayT1vXhX > rLX69l6VYn3bwN4g8I8xSaIT273gz7aDXZwZB/381nmMjHpdmi2CK2b7RQl3SBxa > X0UyEvFHHGodoMHmw6oz5R5ZHvVVFaIYr8qxARfTnTEyJ8oFPqO0VB5X1VJgCwPK > AHItQWYhAa/0z+TfClKdmVzgPdNTO4N/onaE5XtSd2xbvQPfa903T2GGV+3TIXYW > I1D/7O/tF4KSUWCRiqgGccgVCMoFx26U7+j2XWCG7sNZW6ANaiRQx0r3wJrNmu8= > =dw8X > -----END PGP SIGNATURE----- > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > hth, Mario -- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From penguinroad at gmail.com Fri Oct 8 04:18:15 2010 From: penguinroad at gmail.com (hendra kusuma) Date: Fri, 8 Oct 2010 16:18:15 +0800 Subject: [wxruby-users] ask gridtablebase In-Reply-To: References: <4CA1E8F7.1050909@pressure.to> Message-ID: On Wed, Sep 29, 2010 at 11:41 PM, hendra kusuma wrote: > > > On Tue, Sep 28, 2010 at 9:09 PM, Alex Fenton wrote: > >> hi hendra >> >> >> On 28/09/2010 13:58, hendra kusuma wrote: >> >>> Due to my assumption, if I create a gridtablebase object and connect >>> it to a grid object, the grid should display what's in gridtablebase >>> object >>> >> >> yes, but ... >> >> >> until now it works fine, but then I tried to add data to Gridtablebase_ds >>> object >>> >>> @ds.append_data ['3', 'McGyver'] >>> >>> but the grid doesn't change >>> >> >> ... there is no automatic trigger to update the visual display when the >> underlying table changes. call @grid.refresh if you need to. >> > > Thanks Alex > I already done that and it is not working > well, I found the answer from archive email anyway > back then somebody asked the same thing and the conclusion was > wxgrid seems to copy the gridtablebase object. > I guess there is no direct connection between gridtablebase object and the > one wxgrid copy > and due to my experiment, > I can't even modify the object with get_table method > something like wxgrid.get_table.add_data(['3', 'McGyver']) also does not > work > > I think it was you who said that it is the behaviour of wxwidget, so it > will stay like that. > But perhaps I am wrong > > I end up making a datasource object to handle the situation and > refresh the grid my remaking the gridtablebase object and re-set the grid > table > > Thanks > > I was wrong. You're right Alex, it is possible to update grid with @grid.refresh I rewrite my gridtablebase object and now it can handle @grid.refresh here is my code require 'rubygems' require 'wx' class Dataset_h < Wx::GridTableBase def initialize(par={}) super() if par[:colnames] then @colnames = par[:colnames] else @colnames = [] end if par[:keys] then @keys = par[:keys] else @keys = [] end if par[:rs] then set_rs(par[:rs]) else @rs = [] end @display_data = @rs @rows = @display_data.size @cols = @keys.size end def get_number_rows @rows rescue 0 end def get_number_cols @cols rescue 0 end def get_value(row, col) ((@display_data[row])[@keys[col].to_sym]).to_s rescue "" end def get_attr(row, col, attr_kind) Wx::GridCellAttr.new end def is_empty_cell(row, col) true end def get_col_label_value(col) @colnames[col] rescue "" end def set_keys(keys=[]) @keys = keys end def set_rs(rs) @rs = [] rs.each do |key, value| @rs << value end end def auto_rs(rs) set_rs(rs) @display_data = @rs @keys = rs.keys @colnames = [] @keys.each do |key| @colnames << key.gsub('_', ' ').capitalize end end def filter(par) tmp = [] @rs.each do |row| par.each do |key, value| if row[key.to_sym] == value tmp << row end end end @display_data = tmp.uniq @rows = @display_data.size end def filter_like(par) tmp = [] @rs.each do |row| par.each do |key, value| if row[key.to_sym].to_s.index(value) tmp << row end end end @display_data = tmp.uniq @rows = @display_data.size end def add(data) @rs << data end def delete(row) @rs[row] = nil @rs.compact end def all @display_data = @rs end def first @display_data.first end def last @display_data.last end end but then I found another problem I want this object to be a memory storage, where I can add, update, or delete and filter rows. but when I modify data in gridtablebase object, grid is updated, but not quite perfectly the grid does not update its row number (and perhaps col number, I have not tried that) so when I filtered, there is empty row below last row even worse when I add data, if gridtablebase data row counts more than grid row grid will not append rows is there a way to handle this? since this is so close to what I need, I really hope there is a way to handle this problem Thank you -- Suka linux? Kunjungi blog saya http://penguinroad.blogspot.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri Oct 8 11:07:16 2010 From: lists at ruby-forum.com (Rob Doug) Date: Fri, 8 Oct 2010 17:07:16 +0200 Subject: [wxruby-users] TextCtrl#set_selection problem.. need help, please Message-ID: <01787628f4951990e46de9f11077ced9@ruby-forum.com> Can't get this function working, does any body know where I'm wrong ? @term = Wx::TextCtrl.new(@skin, -1, 'Paste URL Here', :pos => [25,100], :size => [300,20]) #, :style => Wx::NO_BORDER) @term.evt_set_focus() {|event| on_term_focus(event) } def on_term_focus(event) if @term.get_value == "Paste URL Here" @term.set_value("") else @term.set_selection(-1,-1) #<---- DON'T WORK end end -- Posted via http://www.ruby-forum.com/. From fabio.petrucci at gmail.com Fri Oct 8 12:35:46 2010 From: fabio.petrucci at gmail.com (Fabio Petrucci) Date: Fri, 8 Oct 2010 18:35:46 +0200 Subject: [wxruby-users] TextCtrl#set_selection problem.. need help, please In-Reply-To: <01787628f4951990e46de9f11077ced9@ruby-forum.com> References: <01787628f4951990e46de9f11077ced9@ruby-forum.com> Message-ID: try to skip: def on_term_focus(event) if @term.get_value == "Paste URL Here" @term.set_value("") else @term.set_selection(-1,-1) end evt.skip() end hth bio. On Fri, Oct 8, 2010 at 5:07 PM, Rob Doug wrote: > Can't get this function working, does any body know where I'm wrong ? > > @term = Wx::TextCtrl.new(@skin, -1, 'Paste URL Here', :pos => [25,100], > :size => [300,20]) #, :style => Wx::NO_BORDER) > @term.evt_set_focus() {|event| on_term_focus(event) } > > def on_term_focus(event) > if @term.get_value == "Paste URL Here" > @term.set_value("") > else > @term.set_selection(-1,-1) #<---- DON'T WORK > end > end > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From fabio.petrucci at gmail.com Fri Oct 8 12:37:10 2010 From: fabio.petrucci at gmail.com (Fabio Petrucci) Date: Fri, 8 Oct 2010 18:37:10 +0200 Subject: [wxruby-users] TextCtrl#set_selection problem.. need help, please In-Reply-To: References: <01787628f4951990e46de9f11077ced9@ruby-forum.com> Message-ID: sorry event.skip() On Fri, Oct 8, 2010 at 6:35 PM, Fabio Petrucci wrote: > try to skip: > > > def on_term_focus(event) > if @term.get_value == "Paste URL Here" > @term.set_value("") > else > @term.set_selection(-1,-1) > end > evt.skip() > end > > hth > bio. > > > On Fri, Oct 8, 2010 at 5:07 PM, Rob Doug wrote: > >> Can't get this function working, does any body know where I'm wrong ? >> >> @term = Wx::TextCtrl.new(@skin, -1, 'Paste URL Here', :pos => [25,100], >> :size => [300,20]) #, :style => Wx::NO_BORDER) >> @term.evt_set_focus() {|event| on_term_focus(event) } >> >> def on_term_focus(event) >> if @term.get_value == "Paste URL Here" >> @term.set_value("") >> else >> @term.set_selection(-1,-1) #<---- DON'T WORK >> end >> end >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri Oct 8 13:38:42 2010 From: lists at ruby-forum.com (Rob Doug) Date: Fri, 8 Oct 2010 19:38:42 +0200 Subject: [wxruby-users] TextCtrl#set_selection problem.. need help, please In-Reply-To: References: <01787628f4951990e46de9f11077ced9@ruby-forum.com> Message-ID: Fabio Petrucci wrote: > sorry event.skip() Unfortunately it didn't help -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Oct 11 20:06:08 2010 From: lists at ruby-forum.com (Chase Wilson) Date: Tue, 12 Oct 2010 02:06:08 +0200 Subject: [wxruby-users] evt_media_loaded not working on vista/windows 7 Message-ID: For some reason the evt_media_loaded is not being triggered on windows 7 and windows vista. However, the same code on windows xp works just fine. Anybody have any ideas? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Oct 11 20:39:58 2010 From: lists at ruby-forum.com (Chase Wilson) Date: Tue, 12 Oct 2010 02:39:58 +0200 Subject: [wxruby-users] evt_media_loaded not working on vista/windows 7 In-Reply-To: References: Message-ID: <27e4cd81dbb9da0403cf4f23398bedac@ruby-forum.com> For some reason the evt_media_loaded is not being triggered on windows 7 and windows vista. However, the same code on windows xp works just fine. Anybody have any ideas? -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Mon Oct 11 20:41:26 2010 From: lists at ruby-forum.com (Chase Wilson) Date: Tue, 12 Oct 2010 02:41:26 +0200 Subject: [wxruby-users] evt_media_loaded not working on vista/windows 7 In-Reply-To: References: Message-ID: <6db3fe72e7752db96a0c792090985ca7@ruby-forum.com> For some reason the evt_media_loaded is not being triggered on windows 7 and windows vista. However, the same code on windows xp works just fine. Anybody have any ideas? What I'm trying to do is auto play audio once it has loaded. My solution right now has been to just user a static timer and hope that the audio loads within that time. Once the timer counts down it will try to play the audio. However, if the audio is not done loading it will not work correctly -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Tue Oct 12 04:56:14 2010 From: alex at pressure.to (Alex Fenton) Date: Tue, 12 Oct 2010 09:56:14 +0100 Subject: [wxruby-users] evt_media_loaded not working on vista/windows 7 In-Reply-To: <6db3fe72e7752db96a0c792090985ca7@ruby-forum.com> References: <6db3fe72e7752db96a0c792090985ca7@ruby-forum.com> Message-ID: <4CB422AE.8030308@pressure.to> HI Chase On 12/10/2010 01:41, Chase Wilson wrote: > For some reason the evt_media_loaded is not being triggered on windows 7 > and windows vista. However, the same code on windows xp works just fine. > Anybody have any ideas? It appears to be a bug in wxWidgets: http://trac.wxwidgets.org/ticket/10958 We will have to wait for a fix in the underlying library - I don't have Windows 7 so unfortunately I can't look into it myself. > What I'm trying to do is auto play audio once it > has loaded. My solution right now has been to just user a static timer > and hope that the audio loads within that time. Once the timer counts > down it will try to play the audio. However, if the audio is not done > loading it will not work correctly There is some discussion on this page - but it sounds like the final workaround is similar, ie call sleep(1) after load. http://forums.wxwidgets.org/viewtopic.php?t=18761 alex From lists at ruby-forum.com Tue Oct 12 15:31:52 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Tue, 12 Oct 2010 21:31:52 +0200 Subject: [wxruby-users] wxRuby + wxFormBuilder Message-ID: Hello. I have a problems. Can you help me? I create GUI-program, based on wxWidgets, in wxFormBuilder. 1.jpg) I create a form in wxFormBuilder, it will see as left part of image. If i test it on View->XRC WIndow, it see as the right part of 1.jpg. What is it? 2.jpg) I generated code and start compilize it. But it failed. Why? Thanks in advance -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Wed Oct 13 02:49:38 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Wed, 13 Oct 2010 08:49:38 +0200 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: References: Message-ID: <274ad99a4c9caa022d1e2c973ba60627@ruby-forum.com> Else one problem. 3) I create an application by Ctrl-C from one of lessons: -------- require 'wx' include Wx class MyFrame < Frame def initialize() super(nil, -1, 'My Frame Title') # First create the controls @my_panel = Panel.new(self) @my_label = StaticText.new(@my_panel, -1, 'My Label Text', DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER) @my_textbox = TextCtrl.new(@my_panel, -1, 'Default Textbox Value') @my_combo = ComboBox.new(@my_panel, -1, 'Default Combo Text', DEFAULT_POSITION, DEFAULT_SIZE, ['Item 1', 'Item 2', 'Item 3']) @my_button = Button.new(@my_panel, -1, 'My Button Text') # Bind controls to functions evt_button(@my_button.get_id()) { |event| my_button_click(event)} # Now do the layout @my_panel_sizer = BoxSizer.new(VERTICAL) @my_panel.set_sizer(@my_panel_sizer) @my_panel_sizer.add(@my_label, 0, GROW|ALL, 2) @my_panel_sizer.add(@my_textbox, 0, GROW|ALL, 2) @my_panel_sizer.add(@my_combo, 0, GROW|ALL, 2) @my_panel_sizer.add(@my_button, 0, GROW|ALL, 2) show() end def my_button_click(event) # Your code here end end class MyApp < App def on_init MyFrame.new end end MyApp.new.main_loop() ------- I run it, but it window doesn't open. In command prompt all work fint, but doesn't open. What's matter? -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Wed Oct 13 04:12:57 2010 From: mario at ruby-im.net (Mario Steele) Date: Wed, 13 Oct 2010 04:12:57 -0400 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: <274ad99a4c9caa022d1e2c973ba60627@ruby-forum.com> References: <274ad99a4c9caa022d1e2c973ba60627@ruby-forum.com> Message-ID: Hello Misha, First off, welcome to wxRuby community. I'll answer your other question in a few, first we'll cover this one. On Wed, Oct 13, 2010 at 2:49 AM, Misha Ognev wrote: > Else one problem. > > 3) I create an application by Ctrl-C from one of lessons: > > -------- > > require 'wx' > include Wx > > class MyFrame < Frame > def initialize() > super(nil, -1, 'My Frame Title') > # First create the controls > @my_panel = Panel.new(self) > @my_label = StaticText.new(@my_panel, -1, 'My Label Text', > DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER) > @my_textbox = TextCtrl.new(@my_panel, -1, 'Default Textbox > Value') > @my_combo = ComboBox.new(@my_panel, -1, 'Default Combo Text', > DEFAULT_POSITION, DEFAULT_SIZE, ['Item 1', 'Item 2', 'Item 3']) > @my_button = Button.new(@my_panel, -1, 'My Button Text') > # Bind controls to functions > evt_button(@my_button.get_id()) { |event| > my_button_click(event)} > # Now do the layout > @my_panel_sizer = BoxSizer.new(VERTICAL) > @my_panel.set_sizer(@my_panel_sizer) > @my_panel_sizer.add(@my_label, 0, GROW|ALL, 2) > @my_panel_sizer.add(@my_textbox, 0, GROW|ALL, 2) > @my_panel_sizer.add(@my_combo, 0, GROW|ALL, 2) > @my_panel_sizer.add(@my_button, 0, GROW|ALL, 2) > show() > end > > def my_button_click(event) > # Your code here > end > > end > > class MyApp < App > def on_init > MyFrame.new end > end > > MyApp.new.main_loop() > > ------- > > I run it, but it window doesn't open. In command prompt all work fint, > but doesn't open. What's matter? > > First off, this is correct in the code, till you get to your on_init method. I can tell you, that your Window is being created, and everything, but your not showing it to the user. There's two ways in which you can do this. The first, is to simply do: MyFrame.new.show() Which will show your frame to the user, after it is created. The second, is to store the instance of your Window in a variable, and call show in it, like this: myframe = MyFrame.new myframe.show In both cases, you need to call the show method on your Frame, in order to have your frame actually be displayed. It isn't done automatically, cause there may be times, where you want to create a window, but not show it, in such cases as having a Tray Icon on Windows / Linux, and a Dock Icon on OS X (EG The Bottom bar.) hth with this one, Mario -- Mario Steele -------------- next part -------------- An HTML attachment was scrubbed... URL: From mario at ruby-im.net Wed Oct 13 04:20:05 2010 From: mario at ruby-im.net (Mario Steele) Date: Wed, 13 Oct 2010 04:20:05 -0400 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: References: Message-ID: Hello Again Misha, On Tue, Oct 12, 2010 at 3:31 PM, Misha Ognev wrote: > Hello. I have a problems. Can you help me? > > I create GUI-program, based on wxWidgets, in wxFormBuilder. > > 1.jpg) I create a form in wxFormBuilder, it will see as left part of > image. If i test it on View->XRC WIndow, it see as the right part of > 1.jpg. What is it? > 1.jpg) This is the cause of the fact that in your XRC Design, you do not have a root Layout manager, meaning that the window needs to have a VerticalSizer or a HorizontalSizer as the root item, in order to manage layouts of all the controls in your window, otherwise, you have to do the management of the layout yourself, meaning you need to keep tabs on the window sizes, and control positions, and re-positioning your controls yourself. This also means that wxWidgets will not manage the window size, and therefore, will allocate the minimal size for your window, which gives you the issues you are seeing in 1.jpg. > > 2.jpg) I generated code and start compilize it. But it failed. Why? > This is an issue with Ruby 1.9.1, they made String where it is no longer Enumerable, meaning that there is no .each method, that will parse through each actual line of text in the code, as is done in Ruby 1.8. I will see about getting a new gem built, with a patch to fix that soon. > Thanks in advance > > -- > 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 Steele -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu Oct 14 07:50:09 2010 From: lists at ruby-forum.com (Felipe Rojas) Date: Thu, 14 Oct 2010 13:50:09 +0200 Subject: [wxruby-users] TextCtrl#set_selection problem need help, please In-Reply-To: <01787628f4951990e46de9f11077ced9@ruby-forum.com> References: <01787628f4951990e46de9f11077ced9@ruby-forum.com> Message-ID: > @term.set_selection(-1,-1) #<---- DON'T WORK > Hi Rob, I have the same problem with a ListCtrl Object, and the solution for me is to REFRESH the ListCtrl after the selection: > ListCtrl#set_item_state( ) > ListCtrl#refresh_items( ) I hope it helps FELIPE -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Oct 14 12:36:45 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Thu, 14 Oct 2010 18:36:45 +0200 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: References: Message-ID: Thanks. Now I'm a new wx'er. BTW, Misha on russian equivalent Michael in english :) How you do the letters green? 1) I create forms now in DialogBlocks 4.39 (next - DB). If I do not create a menubar, it's OK. If I add it, I need to change a PLATFORM value on it from any to some. It's normal? 2) Conversion is normal in DB - in my opinion, the question is closed. 3) I copy code, but it not works: ------ require 'wx' include Wx class MyFrame < Frame def initialize() super(nil, -1, 'My Frame Title') # First create the controls @my_panel = Panel.new(self) @my_label = StaticText.new(@my_panel, -1, 'My Label Text', DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER) @my_textbox = TextCtrl.new(@my_panel, -1, 'Default Textbox Value') @my_combo = ComboBox.new(@my_panel, -1, 'Default Combo Text', DEFAULT_POSITION, DEFAULT_SIZE, ['Item 1', 'Item 2', 'Item 3']) @my_button = Button.new(@my_panel, -1, 'My Button Text') # Bind controls to functions evt_button(@my_button.get_id()) { |event| my_button_click(event)} # Now do the layout @my_panel_sizer = BoxSizer.new(VERTICAL) @my_panel.set_sizer(@my_panel_sizer) @my_panel_sizer.add(@my_label, 0, GROW|ALL, 2) @my_panel_sizer.add(@my_textbox, 0, GROW|ALL, 2) @my_panel_sizer.add(@my_combo, 0, GROW|ALL, 2) @my_panel_sizer.add(@my_button, 0, GROW|ALL, 2) show() end def my_button_click(event) # Your code here end end class MyApp < App def on_init MyFrame.new end end MyApp.new.main_loop() myframe = MyFrame.new.show() --------- There isn't a .xrc file in this folder. It's only .rb file. It doesn't work... Can you give me some working simple window code to Copy-Paste in .rb file as example of ruby-GUI-application. Sorry for my english, Misha. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Thu Oct 14 18:32:47 2010 From: lists at ruby-forum.com (Nicholas e. Rabenau) Date: Fri, 15 Oct 2010 00:32:47 +0200 Subject: [wxruby-users] undefined method `register_hot_key' for Wx::Window Message-ID: Hi, I am trying to register a global hotkey using wxruby on Windows XP SP3. The documentation at http://wxruby.rubyforge.org/doc/window.html#Window_registerhotkey says that register_hot_key is available (although I don't quite understand the comment there about Windows CE). Anyway, here is the smallest piece of code I could come up with for reproducing the problem: require 'wx' frame = Wx::Frame.new frame.register_hot_key(100, Wx::MOD_ALT, Wx::K_F1) => NoMethodError: undefined method `register_hot_key' for # Wx::Frame inherits from Wx::Window, so I would expect that method to be there. Any ideas on why this doesn not work? Am I doing something wrong? I am using wxruby (2.0.1 x86-mingw32). Fine regards Nicholas -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sat Oct 16 18:58:16 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Sun, 17 Oct 2010 00:58:16 +0200 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: References: Message-ID: <61826cac3f09dad8b1bcf68b584a73fd@ruby-forum.com> Why everyone is silent? -- Posted via http://www.ruby-forum.com/. From fabio.petrucci at gmail.com Sun Oct 17 06:28:14 2010 From: fabio.petrucci at gmail.com (Fabio Petrucci) Date: Sun, 17 Oct 2010 12:28:14 +0200 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: References: Message-ID: > > Can you give me some working simple window code to Copy-Paste in .rb > file as example of ruby-GUI-application. > > Into the installation of wxruby gem, you can find many examples to try on. bio. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Sun Oct 17 13:16:37 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Sun, 17 Oct 2010 19:16:37 +0200 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: References: Message-ID: This code: #!/usr/bin/env ruby require 'rubygems' require 'wx' class MyApp < Wx::App def on_init @frame = Wx::Frame.new( nil, -1, "Application" ) @frame.show end end app = MyApp.new app.main_loop app.show Doesn't work. It show only command prompt with ruby, which close after working code. I didn't see GUI window. Why? Maybe I don't install something? What I must install to wxruby gui start to work? -- Posted via http://www.ruby-forum.com/. From alex at pressure.to Sun Oct 17 15:23:01 2010 From: alex at pressure.to (Alex Fenton) Date: Sun, 17 Oct 2010 20:23:01 +0100 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: References: Message-ID: <4CBB4D15.1090209@pressure.to> On 17/10/2010 18:16, Misha Ognev wrote: > This code: ... > Doesn't work. It show only command prompt with ruby, which close after > working code. I didn't see GUI window. Why? Run it in a command prompt and *post the error message*, then we can help. There is a sample called 'minimal.rb' in the distribution that you can use as a basis for testing and the starting point for your own apps. a From lists at ruby-forum.com Sun Oct 17 17:25:34 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Sun, 17 Oct 2010 23:25:34 +0200 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: References: Message-ID: <313bae8f49a29c44c21f56ca3ae36b50@ruby-forum.com> Piture is error message. This is testing of my application. Attachments: http://www.ruby-forum.com/attachment/5212/3.jpg -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Oct 17 18:07:44 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Mon, 18 Oct 2010 00:07:44 +0200 Subject: [wxruby-users] wxRuby + wxFormBuilder In-Reply-To: References: Message-ID: <13620a025d5b6b89529fca74bb04cc1c@ruby-forum.com> My friend talk me what was the problem. Now it's cloded. Thanks for your helps to me. Michael -- Posted via http://www.ruby-forum.com/. From sutniuq at gmx.net Mon Oct 18 05:33:11 2010 From: sutniuq at gmx.net (Quintus) Date: Mon, 18 Oct 2010 11:33:11 +0200 Subject: [wxruby-users] Compiling wxWidgets/wxRuby on Ubuntu 10.10 Maverick Message-ID: <4CBC1457.6030301@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi there, Three days ago I updated my Ubuntu Lucid to a Maverick box and got to know that this bug: https://bugs.launchpad.net/ubuntu/+source/wxwidgets2.8/+bug/632984 makes it impossible to compile wxRuby. I then tried to compile wxWidgets myself, and it seemed to work, but today I started serious developing - I got plenty of segmentation faults. I decided to follow the guidelines at the wxRuby wiki ( http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets ) *exactly*, but it didn't work out[1] either, I'm still getting segfaults when using more complex controls than the StaticText widget. For example running the minimal.rb sample from the wxRuby gem and clicking the "File" menu results in this: http://pastie.org/1229483 So, what is the correct way to comile wxWidgets on Ubuntu in order to make it work with wxRuby? Vale, Marvin [1]Btw. the step "cd contrib/stc" is not possible, that has to be "cd contrib/src/stc" or just "cd contrib" (which builds all contributions and was what I did). -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMvBQVAAoJEGrS0YjAWTKVQVcH/2wlDQIM4C7E5iOfVZI/amSx 6QCuPrNl8re10eq0C2rVj+ZTQYcPsnek0Zlo1EwbJa13nRfLq6fcn7bYbId6jyPf 1NVt7Rn3Kq9k6/184HtLP8VJTSU9RmXwMV7bctGcMLwzFqov/sZNQaLlsZn4Pn9t xNt19/MNMs4fLo+rcGEOGBFihUeWfPFUKAac7FqONYYpyljnwCBSChm8ULQpzRi1 cibWckTkw9PTnTzCURnmNIPdPNZ7m1dp+typySzjJspyvXs3OMYJzIlsMoOHvvh4 6pywi+fhv2hdcAKNdT1wll2YLwcxc7SKgzOKu/fb9HOKxuyEyaitxhGQEuyZ63A= =H2VH -----END PGP SIGNATURE----- From lists at ruby-forum.com Mon Oct 18 19:43:24 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Tue, 19 Oct 2010 01:43:24 +0200 Subject: [wxruby-users] wxRuby by wxSugar Message-ID: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> Hello. I have a ruby 1.9 and create a file trap.xrc in DialogBlocks. Later I create a trap.rb: xrcise -o trap.rb trap.xrc ... All good. But late I create a file ed.rb: ------- require 'wx' require 'trap' class Exsys < wxFrame def initialize super end end Wx::App.run do Exsys.new.show end ------- It doesn't work! Why? Please open attached image 'xx.jpg', here wrote error. Attachments: http://www.ruby-forum.com/attachment/5223/xx.jpg -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Mon Oct 18 21:27:52 2010 From: mario at ruby-im.net (Mario Steele) Date: Mon, 18 Oct 2010 21:27:52 -0400 Subject: [wxruby-users] wxRuby by wxSugar In-Reply-To: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> References: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> Message-ID: I believe your using Ruby 1.9.2, and if so, it no longer references the current directory, or rather the directory from where the script is launched from, as a path in which to look for files to require in. You can do one of two things, you can either do: require 'wx' require './trap' or you could do: $:.unshift "." requrie 'wx' require 'trap' Either of these methods will work to get trap.rb to load up under 1.9.2. This isn't so much a wxRuby Problem, as it is a design change by Ruby 1.9 core. hth, Mario On Mon, Oct 18, 2010 at 7:43 PM, Misha Ognev wrote: > Hello. > > I have a ruby 1.9 and create a file trap.xrc in DialogBlocks. > > Later I create a trap.rb: xrcise -o trap.rb trap.xrc ... All good. > > But late I create a file ed.rb: > > ------- > > require 'wx' > require 'trap' > > class Exsys < wxFrame > def initialize > super > end > end > > Wx::App.run do > Exsys.new.show > end > > ------- > > It doesn't work! Why? > > Please open attached image 'xx.jpg', here wrote error. > > Attachments: > http://www.ruby-forum.com/attachment/5223/xx.jpg > > > -- > 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 Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Tue Oct 19 05:54:36 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Tue, 19 Oct 2010 11:54:36 +0200 Subject: [wxruby-users] wxRuby by wxSugar In-Reply-To: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> References: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> Message-ID: <4513e986e6043ab73ad0216a2cfd4056@ruby-forum.com> Thanks, Mario! Now I have else three problems. 1) I create an XRC file with a label, combobox and button ---------- XRC 640,480 FFF 1 wxVERTICAL wxALIGN_CENTER_HORIZONTAL|wxTOP 220 wxALIGN_CENTER_HORIZONTAL|wxALL 5 100,-1 USA Canada wxALIGN_CENTER_HORIZONTAL|wxALL 5 # HERE ----------- RB # -*- coding: utf-8 -*- require 'wx' require './trap' class Exsys < TFB def initialize super evt_button (next_btn) {next_go} # HERE end end def next_go # Many Testing Code end Wx::App.run do Exsys.new.show() end -------- I need to start an def next_go, if I click button next_btn (see HERE places in the code). It doesn't work, see the attached image. 2) How I can read a value from ComboBox? 3) How I can disable and enable Sizer? Attachments: http://www.ruby-forum.com/attachment/5227/xxy.jpg -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Tue Oct 19 07:10:17 2010 From: mario at ruby-im.net (Mario Steele) Date: Tue, 19 Oct 2010 07:10:17 -0400 Subject: [wxruby-users] wxRuby by wxSugar In-Reply-To: <4513e986e6043ab73ad0216a2cfd4056@ruby-forum.com> References: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> <4513e986e6043ab73ad0216a2cfd4056@ruby-forum.com> Message-ID: Hello Michael, On Tue, Oct 19, 2010 at 5:54 AM, Misha Ognev wrote: > Thanks, Mario! Now I have else three problems. > > 1) I create an XRC file with a label, combobox and button > > ---------- XRC > > > > > > 640,480 > FFF > 1 > > wxVERTICAL > > wxALIGN_CENTER_HORIZONTAL|wxTOP > 220 > > > > > > wxALIGN_CENTER_HORIZONTAL|wxALL > 5 > > 100,-1 > > > USA > Canada > > > > > wxALIGN_CENTER_HORIZONTAL|wxALL > 5 > # HERE > > > > > > > > ----------- RB > > # -*- coding: utf-8 -*- > require 'wx' > require './trap' > > class Exsys < TFB > def initialize > super > evt_button (next_btn) {next_go} # HERE > end > end > > > def next_go > # Many Testing Code > end > > > Wx::App.run do > Exsys.new.show() > end > > -------- > > I need to start an def next_go, if I click button next_btn (see HERE > places in the code). It doesn't work, see the attached image. > The next_btn should actually be accessable through @next_btn, since you are inheriting the TFB class in your Exsys class. Try doing: evt_button(@next_btn) { next_go } > 2) How I can read a value from ComboBox? > See http://wxruby.rubyforge.org/doc/combobox.html Specifically #get_value and #get_current_selection. Since ComboBox has a TextEntry and a Choice setup with it, you need to compare between the TextEntry and Choice to ensure you are getting the correct value out of it. > 3) How I can disable and enable Sizer? > First you need to get the sizer, by using Window#get_containing_sizer, then you can use Window#hide, or Window#show to hide/show a Sizer, and Window#disable or Window#enable to disable/enable a set of controls. There's no physical way to disable a Sizer to prevent the sizer from resizing in the window. You can only either hide / show it, or enable/disable the controls within it. > Attachments: > http://www.ruby-forum.com/attachment/5227/xxy.jpg > > > -- > 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 Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Tue Oct 19 12:41:16 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Tue, 19 Oct 2010 18:41:16 +0200 Subject: [wxruby-users] wxRuby by wxSugar In-Reply-To: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> References: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> Message-ID: <75a886699153cc34b92a2b3f24e3d834@ruby-forum.com> Mario, I do what you say. This is new error in 1): see attached please. Attachments: http://www.ruby-forum.com/attachment/5228/yy.jpg -- Posted via http://www.ruby-forum.com/. From sutniuq at gmx.net Tue Oct 19 13:48:01 2010 From: sutniuq at gmx.net (Quintus) Date: Tue, 19 Oct 2010 19:48:01 +0200 Subject: [wxruby-users] Compiling wxWidgets/wxRuby on Ubuntu 10.10 Maverick In-Reply-To: <4CBC1457.6030301@gmx.net> References: <4CBC1457.6030301@gmx.net> Message-ID: <4CBDD9D1.8040507@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 18.10.2010 11:33, schrieb Quintus: > Hi there, > > Three days ago I updated my Ubuntu Lucid to a Maverick box and got to > know that this bug: > https://bugs.launchpad.net/ubuntu/+source/wxwidgets2.8/+bug/632984 makes > it impossible to compile wxRuby. I then tried to compile wxWidgets > myself, and it seemed to work, but today I started serious developing - > I got plenty of segmentation faults. > I decided to follow the guidelines at the wxRuby wiki ( > http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets ) > *exactly*, but it didn't work out[1] either, I'm still getting segfaults > when using more complex controls than the StaticText widget. For example > running the minimal.rb sample from the wxRuby gem and clicking the > "File" menu results in this: http://pastie.org/1229483 > So, what is the correct way to comile wxWidgets on Ubuntu in order to > make it work with wxRuby? > > Vale, > Marvin > > [1]Btw. the step "cd contrib/stc" is not possible, that has to be "cd > contrib/src/stc" or just "cd contrib" (which builds all contributions > and was what I did). Anyone ever compiled wxWidgets and got it to work with wxRuby? Vale, Marvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMvdnIAAoJEGrS0YjAWTKVULUIAI19fpZgdpTcX3F+WsY+8E0K 22hSDh5+BGcO8DP4gIbe3FrI2OpPb/0WCF15JvK8lFR59wGd/Lmm5zmpyls1VDzK dvrgJnrSVuncqafHc+JRDtFfKKVcgUe8Aj08mMfJSGv40Rx5VZySL1TE+bH+Ivd4 Z+aEiNblnkIsfRPLN5btWisQBzeUGHsDxbh8ZVOUIu3XhZGZMbSL/zUIMfo8cpEL JkecTHa4hOR+fwYxa/DNam3ecQZQIt0Zthz+IeF0Ky2Qloh5r/Vivyo8QFnbSmvK 7o6Q+eRHzhzPra1CZO4utRtF+4tIfA8zoE/7xWfTZ4zjMypuLccASvHrE2VZ3GY= =o2U0 -----END PGP SIGNATURE----- From sutniuq at gmx.net Thu Oct 21 04:52:45 2010 From: sutniuq at gmx.net (Quintus) Date: Thu, 21 Oct 2010 10:52:45 +0200 Subject: [wxruby-users] Compiling wxWidgets/wxRuby on Ubuntu 10.10 Maverick In-Reply-To: <4CBDD9D1.8040507@gmx.net> References: <4CBC1457.6030301@gmx.net> <4CBDD9D1.8040507@gmx.net> Message-ID: <4CBFFF5D.9060404@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 19.10.2010 19:48, schrieb Quintus: > Am 18.10.2010 11:33, schrieb Quintus: >> Hi there, > >> Three days ago I updated my Ubuntu Lucid to a Maverick box and got to >> know that this bug: >> https://bugs.launchpad.net/ubuntu/+source/wxwidgets2.8/+bug/632984 makes >> it impossible to compile wxRuby. I then tried to compile wxWidgets >> myself, and it seemed to work, but today I started serious developing - >> I got plenty of segmentation faults. >> I decided to follow the guidelines at the wxRuby wiki ( >> http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets ) >> *exactly*, but it didn't work out[1] either, I'm still getting segfaults >> when using more complex controls than the StaticText widget. For example >> running the minimal.rb sample from the wxRuby gem and clicking the >> "File" menu results in this: http://pastie.org/1229483 >> So, what is the correct way to comile wxWidgets on Ubuntu in order to >> make it work with wxRuby? > >> Vale, >> Marvin > >> [1]Btw. the step "cd contrib/stc" is not possible, that has to be "cd >> contrib/src/stc" or just "cd contrib" (which builds all contributions >> and was what I did). > > Anyone ever compiled wxWidgets and got it to work with wxRuby? > > Vale, > Marvin This stupid thing prevents me from continuing developing. Do I really have to go back to Ubuntu Lucid to get wxWidgets/wxRuby to work?! Vale, Marvin _______________________________________________ wxruby-users mailing list wxruby-users at rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMv/9cAAoJEGrS0YjAWTKVCmwH/iUx+peqKDqiqPVrP7i6qw4i UqYEYCQE4XW0FjwAFc/umhMsZC6/g8V27DnF7Jt3CaIDBe3nBVRhPQa/Gb/584oV nOCx4Ile1pIupVDSQdj5Gkw5YclTcTyyZT8lRnnplf0BBhClMPE8MaxIQmlfXJVp NsgOl8j9/iawYdPOtvPwhKch2lLVc88sF+mtEfqi7h08at+gZXfodBgbcewnRZIj WEAwtOQuOnOkX7xyIdJkoySWlDfoRBXItQWvuJ6kBYy6usm5XY3nuyHBCaNH1Dji bkK2wkU4MjGgDIu/ishkQkUS8X6tuWoZDKQ/0w4Gg0olf2gJoNJEeZBPoNB9FQI= =tUC4 -----END PGP SIGNATURE----- From lists at ruby-forum.com Thu Oct 21 17:49:52 2010 From: lists at ruby-forum.com (Philip Stephens) Date: Thu, 21 Oct 2010 23:49:52 +0200 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 In-Reply-To: <4CAB5670.1000809@gmx.net> References: <4CAB5670.1000809@gmx.net> Message-ID: <41909ba4313dd433d2118196c73ca0ff@ruby-forum.com> Ok I tried unsuccessfully to get wxRuby2.0.1 to work with either ruby1.8 or ruby1.9 and Ubuntu 10.04 by compiling according to the instructions previously mentioned. Does someone have a gem that works? Do I have to remove all traces of wxruby first? What do I need to do to get wxruby working again? Thanks -Philip -- Posted via http://www.ruby-forum.com/. From sutniuq at gmx.net Fri Oct 22 04:09:11 2010 From: sutniuq at gmx.net (Quintus) Date: Fri, 22 Oct 2010 10:09:11 +0200 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 In-Reply-To: <41909ba4313dd433d2118196c73ca0ff@ruby-forum.com> References: <4CAB5670.1000809@gmx.net> <41909ba4313dd433d2118196c73ca0ff@ruby-forum.com> Message-ID: <4CC146A7.8040005@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 21.10.2010 23:49, schrieb Philip Stephens: > Ok I tried unsuccessfully to get wxRuby2.0.1 to work with either ruby1.8 > or ruby1.9 and Ubuntu 10.04 by compiling according to the instructions > previously mentioned. > > Does someone have a gem that works? Do I have to remove all traces of > wxruby first? What do I need to do to get wxruby working again? > > Thanks > > -Philip > On Ubuntu 10.04 it should work with the wxWidgets packages without problems. Do a $ sudo apt-get install libwxgtk2.8-dev freeglut3-dev then set the symlinks I mentioned in my previous post. Afterwards install SWIG 1.3.38 (newer versions won't work) and ensure the SWIG and Ruby executables are in your PATH. Now unpack wxRuby and $ cd wxruby-2.0.1 $ rake $ strip -x lib/wxruby2.so $ rake gem and you should be done. Works for both 1.8 and for 1.9. But not on Ubuntu Maverick, because a bug was introduced that makes it impossible to compile wxRuby (see another thread of mine a few days ago). Note however that I do not use the Ruby provided by Ubuntu. I think they compile it without the --enable-shared flag wich is required by wxRuby and apart from that the Ruby provided by the Ubuntu packagers is a bit out of date. Therefore I compiled Ruby myself into /opt/rubies/ruby-1.9.2-p0. If you want to that as well, I recommend you to $ sudo apt-get install libssl-dev zlib1g-dev libreadline5-dev libyaml-dev before, otherwise your're missing some important C extensions (mainly ZLib: Rubygems depends on it). Vale, Marvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMwUamAAoJEGrS0YjAWTKV31wIAImPlUHMZc4rqpSIDgZFe7N+ 1wsJFh083IRXtV+e+42qrt4C9nGpZlZPiR1FYTG0eBTKjhH8cWQkx5DhW+h1QUPB KkhzWNXuSxROCQjDMFguHzIeVmAAZBG0R++YTrkacCLATH5wynROqWXTkd7cxBhc R0iEg5+kAw/WN4DVtYjFeH0szbjARiLqUjVIyTyMZBHMs3XKYlANARlriYQEd3j0 Rb/14JfADLrkpQfv9hZY6OaVSAaC1D5OEiVWr8ZQNtgrtPLyW/hQJ/+izvVCpytS X0WZvXux8c9xob8T8q6eBIXTmD23MjgY8CKWkVsH+90g/YcAoOi2HDcKLpSVFKE= =c2t7 -----END PGP SIGNATURE----- From sutniuq at gmx.net Fri Oct 22 04:41:56 2010 From: sutniuq at gmx.net (Quintus) Date: Fri, 22 Oct 2010 10:41:56 +0200 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 Message-ID: <4CC14E54.3070901@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 21.10.2010 23:49, schrieb Philip Stephens: > Ok I tried unsuccessfully to get wxRuby2.0.1 to work with either ruby1.8 > or ruby1.9 and Ubuntu 10.04 by compiling according to the instructions > previously mentioned. > > Does someone have a gem that works? Do I have to remove all traces of > wxruby first? What do I need to do to get wxruby working again? > > Thanks > > -Philip > On Ubuntu 10.04 it should work with the wxWidgets packages without problems. Do a $ sudo apt-get install libwxgtk2.8-dev freeglut3-dev g++ then set the symlinks I mentioned in my previous post. Afterwards install SWIG 1.3.38 (newer versions won't work) and ensure the SWIG and Ruby executables are in your PATH. Now unpack wxRuby and $ cd wxruby-2.0.1 $ rake $ strip -x lib/wxruby2.so $ rake gem and you should be done. Works for both 1.8 and for 1.9. But not on Ubuntu Maverick, because a bug was introduced that makes it impossible to compile wxRuby (see another thread of mine a few days ago). Note however that I do not use the Ruby provided by Ubuntu. I think they compile it without the --enable-shared flag wich is required by wxRuby and apart from that the Ruby provided by the Ubuntu packagers is a bit out of date. Therefore I compiled Ruby myself into /opt/rubies/ruby-1.9.2-p0. If you want to that as well, I recommend you to $ sudo apt-get install libssl-dev zlib1g-dev libreadline5-dev libyaml-dev before, otherwise your're missing some important C extensions (mainly ZLib: Rubygems depends on it). Vale, Marvin PS: Sorry if this appears twice. Somehow my mail seems to have vanished. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMwU4zAAoJEGrS0YjAWTKVcIUH/iWcTUDpwUrXApxZSuOGKBFZ wI8YQXua8OQBiWoLUcE7dWlbZgPFbfFMCKpL76sseki4/WxKrYxg/UI/8l7lEa3J G3sPxQYuwWCwR9UsiIWLjvVuufcI1SD33dga64BLJR9crrYVMlT3pR/MeFyl/XQx /rgCGlDxMwfPCj8M9iWAdeflKh3TngVZ1lgu7UuFwhOAcdn0afnzeU2cR1pAA1cW JoxPGoMREiz0RfLlSlehIamkWM04FVHJ76mITlpSCvIwsPyfRd5huVynR38lu2Pq s5NzRHN4L4OHKG1cZyViSu3jJv8GkCoyBgJ2Te+VSOTbTz6b3qjiBzu6dk3f1DU= =m/Yg -----END PGP SIGNATURE----- From lists at ruby-forum.com Fri Oct 22 05:16:58 2010 From: lists at ruby-forum.com (Ron Shadow) Date: Fri, 22 Oct 2010 11:16:58 +0200 Subject: [wxruby-users] Already Initialized Constant THE_APP Message-ID: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> Hello everyone. First time here. I'm posting a debug question because I've searched google all over and I can't find any other instances of this occurring. And even though it may be a common error due to a stupid mistake by me, who is just learning ruby and wx, for some odd reason the internet seems devoid of a solution. I've even searched this forum and the error message is not here either. What happens is, the script brings up the login/create window just fine the first time, but if the user enters too short a password and the script tries to bring the same window up a second time for another chance at input, the program crashes with exception "Already Initialized Constant THE_APP". I've tried rewriting it multiple ways, even the basic App.run do method. Still no luck. It seems like I'm not doing something that is needed to completely destroy the instance of App, as the second time I call it no matter what it always crashes with the exception. What's funny is, I had this login/create window already done using the TK library and since I had an old version of the library, it had a bug in PMW which basically caused the same kind of behavior as this bug is causing. I could only bring up one instance of anything, if another was ever created, even after all other instances had been destroyed, the program would crash and tell me that a constant was already initialized. Without a way to fix it, I moved on to shoes, which I quickly dismissed because it was WAY too hard to try and get shoes to work from within my ruby script instead of as a script-launcher. Then I spent a good 5 hours researching a way to make "require 'wx'" work, turns out ubuntu 10.04 needs some special installation procedures. Finally got that working, only to find out that, yep, I can only create one instance of a window per program run......... again.... XD I realize that I can just handle the string check in the button code to avoid this one occurrence. However, that won't fix the problem if I need to be able to reopen a window later in the program. The real problem is that later on I will be developing a lot of GUI windows for this client that will need to be opened, then closed, then reopened, then closed, then reopened, over and over and over again, in order for players to build. If I can't do it with the first window, it's not worth building all the subsequent windows or even continuing on the project until I can find a GUI that allows me to create a second instance of a particular window sometime after the first instance had been destroyed. Here's the contents of obtainlogin.rb. This file is required in the main ruby script. I'm using Ubuntu 10.04 Lucid and Ruby 1.8 Error: "Already Initialized Constant THE_APP" upon second run of App. class LoginFrame < Frame def initialize() super(nil, -1, 'Login Or Create') # First create the controls @my_panel = Panel.new(self) @userid_label = StaticText.new(@my_panel, -1, 'User ID:', DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER) @userid_textbox = TextCtrl.new(@my_panel, -1, '') @password_label = StaticText.new(@my_panel, -1, 'Password:', DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER) @password_textbox = TextCtrl.new(@my_panel, -1, '', :style => TE_PASSWORD) @connect_but = Button.new(@my_panel, -1, 'Connect') # Bind controls to functions evt_button(@connect_but.get_id()) { |event| connect_but_click(event)} # Now do the layout @my_panel_sizer = BoxSizer.new(VERTICAL) @my_panel.set_sizer(@my_panel_sizer) @my_panel_sizer.add(@userid_label, 0, GROW|ALL, 2) @my_panel_sizer.add(@userid_textbox, 0, GROW|ALL, 2) @my_panel_sizer.add(@password_label, 0, GROW|ALL, 2) @my_panel_sizer.add(@password_textbox, 0, GROW|ALL, 2) @my_panel_sizer.add(@connect_but, 0, GROW|ALL, 2) show() end def connect_but_click(event) $userid = @userid_textbox.get_value $password = @password_textbox.get_value close end end class LoginApp < App def on_init LoginFrame.new end end def areThereIllegalCharactersInLoginInfo tBool = false for i in (0...$userid.length) if $userid[i] < 32 or $userid[i] > 126 tBool = true end end for i in (0...$password.length) if $password[i] < 32 or $password[i] > 126 tBool = true end end return tBool end def obtainLoginInfo passBool = false while passBool == false #LoginApp.new.main_loop() # This was the original line, I changed it to try and fix the problem. tApp = LoginApp.new tApp.main_loop() tApp = nil # I added this line to try and fix the problem, it does not help at all. passBool = true if $userid.length < 4 or $userid.length > 20 or $password.length < 4 or $password.length > 20 passBool = false puts "Please provide a User ID and Password which are at least 4 characters long and at most 20 characters long." end if areThereIllegalCharactersInLoginInfo == true passBool = false puts "Please provide a User ID and Password which contain only standard characters. Special characters are not permitted." end end end -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Fri Oct 22 09:13:47 2010 From: mario at ruby-im.net (Mario Steele) Date: Fri, 22 Oct 2010 09:13:47 -0400 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> Message-ID: Hello Ron, First off, welcome to wxRuby. Your lucky I'm up this early, as I should have been in bed an hour ago, but you know how it goes. lol The answer to your solution, is to intercept a evt_close on your window class, to prevent the window from being destroyed. What is happening, is when you run your script, the App instance is initialized with Wx::App.run method. And the thing is, there can only ever be one instance of Wx::App at any run time of your script. So if you exit out of the Main Loop for Wx::App, then it's going to fail, when you try to re-initialize / re-create your App / Window. Mainly cause your trying to re-create your Window, after wxWidgets has already released the App Instance. The solution to your problem, is two fold. First off, move your logical handling code into your Window class. This will ensure that your code is executed, and allow wxWidgets to continue operating for you. You should never exit the Wx::App main loop, unless your actually exiting the program itself. Second, if you want your window to dis-appear, but the app to remain running, you need to do two things. One, ensure that Wx::App, doesn't exit when the Main Window Instance (The first / Only instance of a Wx::Frame) is destroyed. This can be done with Wx::App#set_exit_on_frame_destroy() method (Referenced here). This will ensure that if there are no other Window instances available, that wxWidgets will not close out the app, and de-reference the main instance of the App. The second part, is that there are two ways to handle getting rid of a Window. The first, obviously being the close method, which will close the window, and Destroy the reference to the Window. Which will require you to re-create a new instance of the Window. The second method, is to simply hide the window. This is different from minimize, you just use the hide method on the Frame itself, and it will make the window dis-appear, looking as though it had been closed, but the Window instance will not be destroyed, and you will have it available, to re-display to the end user, should you need to use the window again. I hope that this helps you understand what is going on. L8ers, Mario On Fri, Oct 22, 2010 at 5:16 AM, Ron Shadow wrote: > Hello everyone. First time here. > > I'm posting a debug question because I've searched google all over and I > can't find any other instances of this occurring. And even though it may > be a common error due to a stupid mistake by me, who is just learning > ruby and wx, for some odd reason the internet seems devoid of a > solution. I've even searched this forum and the error message is not > here either. > > What happens is, the script brings up the login/create window just fine > the first time, but if the user enters too short a password and the > script tries to bring the same window up a second time for another > chance at input, the program crashes with exception "Already Initialized > Constant THE_APP". I've tried rewriting it multiple ways, even the basic > App.run do method. Still no luck. > > It seems like I'm not doing something that is needed to completely > destroy the instance of App, as the second time I call it no matter what > it always crashes with the exception. > > What's funny is, I had this login/create window already done using the > TK library and since I had an old version of the library, it had a bug > in PMW which basically caused the same kind of behavior as this bug is > causing. I could only bring up one instance of anything, if another was > ever created, even after all other instances had been destroyed, the > program would crash and tell me that a constant was already initialized. > Without a way to fix it, I moved on to shoes, which I quickly dismissed > because it was WAY too hard to try and get shoes to work from within my > ruby script instead of as a script-launcher. Then I spent a good 5 hours > researching a way to make "require 'wx'" work, turns out ubuntu 10.04 > needs some special installation procedures. Finally got that working, > only to find out that, yep, I can only create one instance of a window > per program run......... again.... XD > > I realize that I can just handle the string check in the button code to > avoid this one occurrence. However, that won't fix the problem if I need > to be able to reopen a window later in the program. The real problem is > that later on I will be developing a lot of GUI windows for this client > that will need to be opened, then closed, then reopened, then closed, > then reopened, over and over and over again, in order for players to > build. If I can't do it with the first window, it's not worth building > all the subsequent windows or even continuing on the project until I can > find a GUI that allows me to create a second instance of a particular > window sometime after the first instance had been destroyed. > > Here's the contents of obtainlogin.rb. This file is required in the main > ruby script. > > I'm using Ubuntu 10.04 Lucid and Ruby 1.8 > > Error: "Already Initialized Constant THE_APP" upon second run of App. > > > > class LoginFrame < Frame > def initialize() > super(nil, -1, 'Login Or Create') > # First create the controls > @my_panel = Panel.new(self) > @userid_label = StaticText.new(@my_panel, -1, 'User ID:', > DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER) > @userid_textbox = TextCtrl.new(@my_panel, -1, '') > @password_label = StaticText.new(@my_panel, -1, 'Password:', > DEFAULT_POSITION, DEFAULT_SIZE, ALIGN_CENTER) > @password_textbox = TextCtrl.new(@my_panel, -1, '', :style => > TE_PASSWORD) > @connect_but = Button.new(@my_panel, -1, 'Connect') > # Bind controls to functions > evt_button(@connect_but.get_id()) { |event| > connect_but_click(event)} > # Now do the layout > @my_panel_sizer = BoxSizer.new(VERTICAL) > @my_panel.set_sizer(@my_panel_sizer) > @my_panel_sizer.add(@userid_label, 0, GROW|ALL, 2) > @my_panel_sizer.add(@userid_textbox, 0, GROW|ALL, 2) > @my_panel_sizer.add(@password_label, 0, GROW|ALL, 2) > @my_panel_sizer.add(@password_textbox, 0, GROW|ALL, 2) > @my_panel_sizer.add(@connect_but, 0, GROW|ALL, 2) > show() > end > > def connect_but_click(event) > $userid = @userid_textbox.get_value > $password = @password_textbox.get_value > close > end > > end > > class LoginApp < App > def on_init > LoginFrame.new > end > end > > def areThereIllegalCharactersInLoginInfo > tBool = false > for i in (0...$userid.length) > if $userid[i] < 32 or $userid[i] > 126 > tBool = true > end > end > for i in (0...$password.length) > if $password[i] < 32 or $password[i] > 126 > tBool = true > end > end > return tBool > end > > def obtainLoginInfo > passBool = false > while passBool == false > #LoginApp.new.main_loop() # This was the original line, I changed it > to try and fix the problem. > tApp = LoginApp.new > tApp.main_loop() > tApp = nil # I added this line to try and fix the problem, it does > not help at all. > > passBool = true > if $userid.length < 4 or $userid.length > 20 or $password.length < 4 > or $password.length > 20 > passBool = false > puts "Please provide a User ID and Password which are at least 4 > characters long and at most 20 characters long." > end > if areThereIllegalCharactersInLoginInfo == true > passBool = false > puts "Please provide a User ID and Password which contain only > standard characters. Special characters are not permitted." > end > end > end > > -- > 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 Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri Oct 22 15:36:45 2010 From: lists at ruby-forum.com (Ron Shadow) Date: Fri, 22 Oct 2010 21:36:45 +0200 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> Message-ID: Hey Mario, thanks for your quick reply. Incredibly informative too, now I have a lot of options to deal with the login screen. I am a little confused though. I still don't see a way to have more than one window in the entire ruby script. "And the thing is, there can only ever be one instance of Wx::App at any run time of your script." "You should never exit the Wx::App main loop, unless your actually exiting the program itself." >From what you say here it almost sounds as if every ruby script can have only one window and no other. What if I needed to use app to show a login screen first, then after that a main game window, etc? I could still have the main script running while the main_loop is running if I gave the window its own thread, but that would still be the only allowable instance of the app in the entire program? If there can only ever be one occurence of app in the code, and to create two different windows from two different classes one would need two occurences of app in the code... XD doesn't that mean each rubyscript can only ever have one window? I see how the hide method can be useful for the login screen, and I can certainly place the string verification code into the frame class. Definitely a solution for the exception on the login screen. But I still need to have the same ruby script create a main game window after the login screen is finished/hidden. Is there perhaps a way to create a second window and show that one within the execution of the same main_loop? I could automate control of the main_loop in its own thread through global variables. Is there any way at all to have two different windows in the same ruby program? I'm thinking that if instead of requiring obtainlogin.rb I could perhaps execute it as a separate process from the main script, and then I could launch another process later for the main game window, but then global variables wouldn't be shared with the main script. Would have to mess with pipes to do that? Also, if it's impossible to have more than one window with wxRuby, is there another rubygem GUI library that anyone knows about which would allow two different windows to be opened in the same ruby script? Somehow it seems like I must be missing something because I wouldn't expect such a large robust library to be limited to one-window-per-program. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Oct 22 16:49:07 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Fri, 22 Oct 2010 22:49:07 +0200 Subject: [wxruby-users] wxRuby by wxSugar In-Reply-To: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> References: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> Message-ID: Why everybody silent? -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Sat Oct 23 02:44:39 2010 From: mario at ruby-im.net (Mario Steele) Date: Sat, 23 Oct 2010 02:44:39 -0400 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> Message-ID: Hello Ron, On Fri, Oct 22, 2010 at 3:36 PM, Ron Shadow wrote: > Hey Mario, thanks for your quick reply. Incredibly informative too, now > I have a lot of options to deal with the login screen. > Your Welcome. > I am a little confused though. I still don't see a way to have more than > one window in the entire ruby script. Okay, I understand where your confusion is below, I'll just skip down below all this, and explain it in better detail. > "And the thing is, there can only ever be one instance of Wx::App at any > run time of your script." > "You should never exit the Wx::App main loop, unless your actually > exiting the program itself." > >From what you say here it almost sounds as if every ruby script can have > only one window and no other. What if I needed to use app to show a > login screen first, then after that a main game window, etc? I could > still have the main script running while the main_loop is running if I > gave the window its own thread, but that would still be the only > allowable instance of the app in the entire program? If there can only > ever be one occurence of app in the code, and to create two different > windows from two different classes one would need two occurences of app > in the code... XD doesn't that mean each rubyscript can only ever > have one window? > > I see how the hide method can be useful for the login screen, and I can > certainly place the string verification code into the frame class. > Definitely a solution for the exception on the login screen. But I still > need to have the same ruby script create a main game window after the > login screen is finished/hidden. > > Is there perhaps a way to create a second window and show that one > within the execution of the same main_loop? I could automate control of > the main_loop in its own thread through global variables. > > Is there any way at all to have two different windows in the same ruby > program? > > I'm thinking that if instead of requiring obtainlogin.rb I could perhaps > execute it as a separate process from the main script, and then I could > launch another process later for the main game window, but then global > variables wouldn't be shared with the main script. Would have to mess > with pipes to do that? > > Also, if it's impossible to have more than one window with wxRuby, is > there another rubygem GUI library that anyone knows about which would > allow two different windows to be opened in the same ruby script? > Somehow it seems like I must be missing something because I wouldn't > expect such a large robust library to be limited to > one-window-per-program. Alright, with all that out of the way, the first thing you will need to realize, is that Wx::App, isn't a Window Class, and is not sub-classed of a Wx::Window or Wx::Frame. If you goto the API reference documentation, http://wxruby.rubyforge.org/doc/app.html, and look for the Sub-Section of Derived From, you'll see that Wx::App descends from Wx::EvtHandler and Object. I don't know what kind of programming background you have, but to look at wxRuby in the fashion of a MVC (Model - View - Controller) setup, Wx::App would be the Controller setup. It's your Main Entry Point into running your program, and deciding where to go. Wx::App.run, or Wx::App#on_init is your Main Entry point, into your entire program, all your windows will either be created from here, or be setup to be ready to be created from the rest of your program. All your initialization of library functions, and data stores you need, would be done from this method. The View Part, actually falls under the class of Wx::Frame. There's a common mis-conception when first dealing with wxWidgets in general, the difference between Window, and Frame. Mainly cause of Microsoft Windows, and how their API is setup, Window means Window. An actual window displayed to the user, that has a minimize, maximize, and close button on it. Where as with wxWidgets, what is considered a window, is actually considered a Frame, with a minimize, a maximize, and a close button on it. A Window in wxWidgets is actually considered any control that can be displayed on the screen. You'll find if you go through the API Documentation, and look at the sub-section Derived From, a good 90 percent of them, have the Window class in it. The exception to the rule, is of course Sizers, Menus, AuiManager, etc, etc, where these are basically internal data structures, that wxWidgets utilizes, to create the necessary UI Elements on Linux, Windows, and Mac OS X. Each Platform, and basically each GUI Toolkit has different methods in which to handle the above cases of items, or may not have them at all (As with Sizers aren't native to Windows, but is available on Linux with GTK and on OS X with NSView, and with Menus, Windows and Linux with GTK have Menu Items, where as OS X has Data Entries to Represent Menu Items.) So, let's say with your Example, your wanting to do a Development of a Game, where you have a Login, and a Main Display Window, where the Login is a User Prompt to ask for Login information to get into the game, and the Main Display Window, is where all actual game play occurs. I'll give you a very basic design to show you how it works, and explain it further with comments. I'm writing the code as I go, so it may not be 100 percent correct, but you should be able to run the code, without any problems. -- CODE BEGINS HERE -- #!/usr/bin/env ruby # Here we are loading wxRuby by any possible means, either by a system # install, or by a Ruby Gems install. If we can't find a system install, then we # will try to load through RubyGems, if available, and if that fails, we'll just # return the original error, saying that we can't load wxRuby, as it's probably not # installed. begin require 'wx' rescue e => LoadError begin require 'rubygems' require 'wx' rescue LoadError raise e end end # This is the window that will be the Main Display Window class GameWindow < Wx::Frame def initialize # The parent of this window is desktop, so nil is used # We don't need a specific ID for this window, so -1 is used # Our Title for our new Window is "Game Window" super(nil,-1,"Game Window") # Here we create all of our stuff needed to play the game, # such as UI Elements, and stuff that needs to be displayed in # The game Window. No other window controls are created here. @te = Wx::TextCtrl.new(self,-1,:pos=>[0,0],:size=>[200,20],:style=>Wx::TE_RICH2|Wx::TE_AUTO_URL|Wx::TE_PROCESS_ENTER) # After we create our controls, we setup our event handlers, for gathering events. evt_text_enter @te, :input_handle_enter end # This is where we define our Logical methods, to handle game def input_handle_enter Wx::MessageDialog.new(self,"You entered: #{@te.get_value}","User Input", Wx::OK) end end # Now we setup our Login Window, which will be displayed first, then will pass off to # the Main Display Window to continue running. class LoginWindow < Wx::Frame def initialize super(nil,-1,"Login") table = Wx::GridSizer.new(3,2,0,0) table.add(Wx::StaticText.new(self,-1,"Username:"),0,Wx::ALIGN_LEFT) table.add(@user = Wx::TextCtrl.new(self,-1,""),1,Wx::EXPAND|Wx::ALL) table.add(Wx::StaticText.new(self,-1,"Password:"),0,Wx::ALIGN_LEFT) table.add(@pass = Wx::TextCtrl.new(self,-1,"",:style=>Wx::TE_PASSWORD),1,WX::EXPAND|Wx::ALL) table.add_spacer table.add(@login = Wx::Button.new(self,-1,"Login >"),1,Wx::EXPAND|Wx::ALL) self.set_sizer(table) evt_button @login, :on_login_push end def on_login_push uname = @user.get_value upass = @pass.get_value unless uname.empty? AND upass.empty? # Attempt to login here, and process success or failure. if success gw = GameWindow.new gw.show self.hide end end end class MyGameApp < Wx::App def on_init lw = LoginWindow.new lw.show end end MyGameApp.new.main_loop -- CODE ENDS HERE -- As you can see, I create the Login Window, which handles the login process, and if it's successful, then will create the game window, and hide itself. The App is still running, and never exits, and your windows will continue to display, and run, and you won't get any Pesky THE_APP already initialized segfaults. Now, keep in mind, if you want to call methods on your App class, you can simply use the method Wx::get_app(), or you can use Wx::THE_APP to get the instance of your main App, and execute the method on it. Though, it's strongly suggested that you don't put game loops and such that require access to your Game Window, in your App, as your crossing between objects, and the self reference changes between Objects, when you get to that point. EG: Calling a Method on your App class, means self refers to the instance of the App class itself, where as calling a method on your Window class, means self refers to the instance of the Window class. And by that, instance variables will be different between the two, or non-existent between the two. I hope this makes things clearer. Mario -- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From mario at ruby-im.net Sat Oct 23 02:46:03 2010 From: mario at ruby-im.net (Mario Steele) Date: Sat, 23 Oct 2010 02:46:03 -0400 Subject: [wxruby-users] wxRuby by wxSugar In-Reply-To: References: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> Message-ID: Sorry Michael, I tend to not get much time to respond to emails, as I'm trying to run through everything. Could you send me attached a copy of your XRC, and Ruby Source files, so I can see where the problem may be in the code? Thanks, Mario On Fri, Oct 22, 2010 at 4:49 PM, Misha Ognev wrote: > Why everybody silent? > > -- > 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 Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From plusgforce at gmail.com Sat Oct 23 19:58:22 2010 From: plusgforce at gmail.com (Philip Stephens) Date: Sat, 23 Oct 2010 17:58:22 -0600 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 Message-ID: I tried following your instructions and everything was going ok until I got to the following step: > From: Quintus > Now unpack wxRuby and > $ cd wxruby-2.0.1 > $ rake src/BitmapButton.cpp:3771: warning: format not a string literal and no format arguments rake aborted! Command failed with status (1): [g++ -c -I/usr/local/lib/wx/include/gtk2-...] /usr/local/lib/ruby/1.9.1/rake.rb:993:in `block in sh' /usr/local/lib/ruby/1.9.1/rake.rb:1008:in `call' /usr/local/lib/ruby/1.9.1/rake.rb:1008:in `sh' /usr/local/lib/ruby/1.9.1/rake.rb:1092:in `sh' .../wxruby-2.0.1/rake/rakewx.rb:155:in `block in ' /usr/local/lib/ruby/1.9.1/rake.rb:632:in `call' /usr/local/lib/ruby/1.9.1/rake.rb:632:in `block in execute' /usr/local/lib/ruby/1.9.1/rake.rb:629:in `each' /usr/local/lib/ruby/1.9.1/rake.rb:629:in `execute' /usr/local/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain' /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' /usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain' /usr/local/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites' /usr/local/lib/ruby/1.9.1/rake.rb:602:in `each' /usr/local/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites' /usr/local/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain' /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' /usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain' /usr/local/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites' /usr/local/lib/ruby/1.9.1/rake.rb:602:in `each' /usr/local/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites' /usr/local/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain' /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' /usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain' /usr/local/lib/ruby/1.9.1/rake.rb:581:in `invoke' /usr/local/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task' /usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level' /usr/local/lib/ruby/1.9.1/rake.rb:2019:in `each' /usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level' /usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' /usr/local/lib/ruby/1.9.1/rake.rb:2013:in `top_level' /usr/local/lib/ruby/1.9.1/rake.rb:1992:in `run' /usr/local/bin/rake:31:in `
' Am I missing something? Thanks. -Philip -------------- next part -------------- An HTML attachment was scrubbed... URL: From j831526 at gmail.com Sat Oct 23 23:59:46 2010 From: j831526 at gmail.com (Charles Parker) Date: Sat, 23 Oct 2010 23:59:46 -0400 Subject: [wxruby-users] Cannot get started Message-ID: <1C1EC0FD-009F-4D2D-88D3-FB43D766D5B5@gmail.com> I'm sure I've done something basic wrong, but I don't see it. I'm running MAC OSX 10.6.4 I installed using ruby gems: [Charles-Parkers-iMac:~] charlesparker% sudo gem install wxruby Password: Successfully installed wxruby-1.9.3-universal-darwin 1 gem installed Installing ri documentation for wxruby-1.9.3-universal-darwin... Installing RDoc documentation for wxruby-1.9.3-universal-darwin... I created the initial test program which seemed to need the require rubygems line: require "rubygems" require "wx" include Wx class MinimalApp < App def on_init Frame.new(nil, -1, "The Bare Minimum").show() end end MinimalApp.new.main_loop And I tried to run it: [Charles-Parkers-iMac:~/Code] charlesparker% ruby ./wxruby-test.rb /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle, 9): no suitable image found. Did find: (LoadError) /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle: no matching architecture in universal wrapper - /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' from /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wx.rb:12 from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require' from ./wxruby-test.rb:2 [Charles-Parkers-iMac:~/Code] charlesparker% Any help would be greatly appreciated! Thanx - Charlie From lists at ruby-forum.com Sun Oct 24 02:28:36 2010 From: lists at ruby-forum.com (Ron Shadow) Date: Sun, 24 Oct 2010 08:28:36 +0200 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> Message-ID: <254200fe252e219c599c1963d1b6b5a7@ruby-forum.com> Yes, that is much clearer. Thanks for taking the time to write the code and show me. I realize I probably seem like a Ruby noob. I've been learning Ruby for almost two weeks and so far I love it. I've coded games in VB6 and PHP/MySQL and Flash Actionscript, and I've coded other kinds of programs in C++. Ruby is definitely different but I can see a lot of good qualities from different languages packed together into Ruby. I found Rubygame library and it looks great for the graphical combat screen, but has absolutely no utilities like buttons/textboxes/etc, so it's great that Wx can still be used. I also see what you mean by having to put all the code of the client into the Wx classes. I'd prefer if possible to leave things like the connection protocol, socket communication, macro key functions, sound effect calls, etc, outside of the frame classes and the main_loop. If I wanted to keep handling connection events from the main script while the main_loop was executing, I could use a separate thread for the main_loop, but would there be a way to hide/show a frame from a thread outside the main_loop? Like 'def methodX; self.hide; end' in one of the frame classes, and '$loginFrame.methodX' from outside the main_loop thread? Or $loginFrame.hide? I know I can call methods defined by the main-thread from spawned-thread blocks so it ought to work the same way in reverse if I use global variables for all the frame instances? -- Posted via http://www.ruby-forum.com/. From sutniuq at gmx.net Sun Oct 24 03:53:37 2010 From: sutniuq at gmx.net (Quintus) Date: Sun, 24 Oct 2010 09:53:37 +0200 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 In-Reply-To: References: Message-ID: <4CC3E601.80207@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 24.10.2010 01:58, schrieb Philip Stephens: > I tried following your instructions and everything was going ok until I got > to the following step: > >> From: Quintus >> Now unpack wxRuby and >> $ cd wxruby-2.0.1 >> $ rake > > src/BitmapButton.cpp:3771: warning: format not a string literal and no > format arguments > rake aborted! > Command failed with status (1): [g++ -c > -I/usr/local/lib/wx/include/gtk2-...] > /usr/local/lib/ruby/1.9.1/rake.rb:993:in `block in sh' > /usr/local/lib/ruby/1.9.1/rake.rb:1008:in `call' > /usr/local/lib/ruby/1.9.1/rake.rb:1008:in `sh' > /usr/local/lib/ruby/1.9.1/rake.rb:1092:in `sh' > .../wxruby-2.0.1/rake/rakewx.rb:155:in `block in ' > /usr/local/lib/ruby/1.9.1/rake.rb:632:in `call' > /usr/local/lib/ruby/1.9.1/rake.rb:632:in `block in execute' > /usr/local/lib/ruby/1.9.1/rake.rb:629:in `each' > /usr/local/lib/ruby/1.9.1/rake.rb:629:in `execute' > /usr/local/lib/ruby/1.9.1/rake.rb:595:in `block in invoke_with_call_chain' > /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' > /usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain' > /usr/local/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites' > /usr/local/lib/ruby/1.9.1/rake.rb:602:in `each' > /usr/local/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites' > /usr/local/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain' > /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' > /usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain' > /usr/local/lib/ruby/1.9.1/rake.rb:605:in `block in invoke_prerequisites' > /usr/local/lib/ruby/1.9.1/rake.rb:602:in `each' > /usr/local/lib/ruby/1.9.1/rake.rb:602:in `invoke_prerequisites' > /usr/local/lib/ruby/1.9.1/rake.rb:594:in `block in invoke_with_call_chain' > /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' > /usr/local/lib/ruby/1.9.1/rake.rb:588:in `invoke_with_call_chain' > /usr/local/lib/ruby/1.9.1/rake.rb:581:in `invoke' > /usr/local/lib/ruby/1.9.1/rake.rb:2041:in `invoke_task' > /usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level' > /usr/local/lib/ruby/1.9.1/rake.rb:2019:in `each' > /usr/local/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level' > /usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' > /usr/local/lib/ruby/1.9.1/rake.rb:2013:in `top_level' > /usr/local/lib/ruby/1.9.1/rake.rb:1992:in `run' > /usr/local/bin/rake:31:in `
' > > Am I missing something? Thanks. > > -Philip > Your post is missing the actual error. The string literal warning occurs many times during compilation and shouldn't lead to an interruption. Did you compile wxWidgets yourself? I'm wondering, because your include path shows /usr/local/lib/wx, which should be /usr/lib/wx I think. What is the output of $ ruby -rrbconfig -ve 'puts RbConfig::CONFIG["configure_args"]' $ dpkg -L libwxgtk2.8-dev $ which wx-config ? -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMw+YAAAoJEGrS0YjAWTKV+RkH/i7omyXw2d5j+oyez8hCkL6B qbH7RkTtx3D5erLFPirB8UpSN1tuSigZq7pPX6uVSNvFN3F9vuLTDzzWXKz+zdWA 6SyDErzGjo8p4UatdUcKAaLpvsPUIduxSZeW2R21+iB2UhJ15+pcu5MIeRcM6wKb KpHF/tqQexrLxCrr8Kwx3mKEEGgShntw+CaI03nigXk1KDhGwkweexcH4CyJ6ReI 90OgqOgPfcABKtQ/SQxwMjIYLwllApETwqDQbgtZ3M8xJnzri8T0zJDdDhyMB84F oLJvmdXumguBmEjGxEB2ABCgfWqi2wsO/tqBiNN2a9QS9FB1hNyEwPInfLlnPGs= =xQy9 -----END PGP SIGNATURE----- From j831526 at gmail.com Sun Oct 24 11:30:29 2010 From: j831526 at gmail.com (Charles Parker) Date: Sun, 24 Oct 2010 11:30:29 -0400 Subject: [wxruby-users] Cannot get started In-Reply-To: <1C1EC0FD-009F-4D2D-88D3-FB43D766D5B5@gmail.com> References: <1C1EC0FD-009F-4D2D-88D3-FB43D766D5B5@gmail.com> Message-ID: When I search with Finder, I cannot find ANY files (other than my test program) with wxruby or wx_ruby in the file name. Does this mean the gem didn't install the ruby bindings? The install appeared to work. Thanx - Charlie On Oct 23, 2010, at 11:59 PM, Charles Parker wrote: > I'm sure I've done something basic wrong, but I don't see it. I'm running MAC OSX 10.6.4 > > I installed using ruby gems: > [Charles-Parkers-iMac:~] charlesparker% sudo gem install wxruby > Password: > Successfully installed wxruby-1.9.3-universal-darwin > 1 gem installed > Installing ri documentation for wxruby-1.9.3-universal-darwin... > Installing RDoc documentation for wxruby-1.9.3-universal-darwin... > > I created the initial test program which seemed to need the require rubygems line: > require "rubygems" > require "wx" > include Wx > > > class MinimalApp < App > def on_init > Frame.new(nil, -1, "The Bare Minimum").show() > end > end > > > MinimalApp.new.main_loop > > And I tried to run it: > [Charles-Parkers-iMac:~/Code] charlesparker% ruby ./wxruby-test.rb > /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle, 9): no suitable image found. Did find: (LoadError) > /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle: no matching architecture in universal wrapper - /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wxruby2.bundle > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require' > from /Library/Ruby/Gems/1.8/gems/wxruby-1.9.3-universal-darwin/lib/wx.rb:12 > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require' > from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require' > from ./wxruby-test.rb:2 > [Charles-Parkers-iMac:~/Code] charlesparker% > > > Any help would be greatly appreciated! > > Thanx - Charlie From sutniuq at gmx.net Sun Oct 24 13:39:54 2010 From: sutniuq at gmx.net (Quintus) Date: Sun, 24 Oct 2010 19:39:54 +0200 Subject: [wxruby-users] Compiling wxWidgets/wxRuby on Ubuntu 10.10 Maverick In-Reply-To: <4CBFFF5D.9060404@gmx.net> References: <4CBC1457.6030301@gmx.net> <4CBDD9D1.8040507@gmx.net> <4CBFFF5D.9060404@gmx.net> Message-ID: <4CC46F6A.1050408@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 21.10.2010 10:52, schrieb Quintus: > > This stupid thing prevents me from continuing developing. Do I really > have to go back to Ubuntu Lucid to get wxWidgets/wxRuby to work?! > > Vale, > Marvin OK guys, I'm one step nearer to the goal of a usable wxRuby on Ubuntu Maverick... I decided to give the distro packages another try and thought the the missing libwx_gtk2u_media-2.8.so.0 shared object file should only affect the MediaCtrl. I tried to exclude MediaCtrl from compilation via the WXRUBY_EXCLUDE variable, but I got to know that the INSTALL file contains a fatal typo: After looking through wxRuby's Rakefiles I found the variable is actually named WXRUBY_EXCLUDED (note the letter *D* at the end). So I tried ===================== $ export WXRUBY_EXCLUDED=MediaCtrl $ rake and it compiled successfully! So I continued: $ strip -x lib/wxruby2.so $ rake gem ===================== But nope: ===================== (...) Cannot build a package without a version being specified Create a version by running rake with WXRUBY_VERSION=x.x.x (...) ===================== OK, not that hard. ===================== $ rake gem WXRUBY_VERSION=2.0.1 rake aborted! can't modify frozen string (...) ===================== Uh! What's that? Following the backtrace, I found it was line 22 in rakepackage.rb which caused the error. I changed it from ===================== spec.version = WXRUBY_VERSION ===================== to ===================== spec.version = WXRUBY_VERSION.dup ===================== and finally, I got my gem file! ===================== $ rake gem WXRUBY_VERSION=2.0.1 (in /home/quintus/Downloads/wxruby-2.0.1) Enabling DYNAMIC build Enabling RELEASE build Enabling UNICODE build The following wxWidgets features are not available and will be skipped: MediaCtrl MediaCtrl MediaEvent PrinterDC Successfully built RubyGem Name: wxruby-ruby19 Version: 2.0.1 File: wxruby-ruby19-2.0.1-x86_64-linux.gem ===================== It's interesting that MediaCtrl shows up twice in the list of skipped features. Without the WXRUBY_EXCLUDED variable set, it appeared once, but nevertheless wxRuby failed to compile saying libwx_gtk2u_media-2.8.so couldn't be found. I had to explicitely exclude the MediaCtrl class to get rid of that dependency. Now I continued with installation of the gem (which went just fine; I even removed my previous wxruby-ruby19 gem to avoid conflicts) and tried to run the minimal sample: ===================== >> quintus at kerberos => /opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86_64-linux/samples/minimal $ ruby minimal.rb (wxruby:27876): Gtk-WARNING **: Error parsing gtk-icon-sizes string: 'panel-menu=24,24 panel=20,20 gtk-button=18,18 gtk-large-toolbar=24,24' /opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86_64-linux/lib/wx/classes/app.rb:16: [BUG] Segmentation fault ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux] - -- control frame ---------- c:0006 p:---- s:0017 b:0017 l:000016 d:000016 CFUNC :on_run c:0005 p:---- s:0015 b:0015 l:000014 d:000014 CFUNC :main_loop c:0004 p:0053 s:0012 b:0012 l:000011 d:000011 METHOD /opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86_64-linux/lib/wx/classes/app.rb:16 c:0003 p:0062 s:0006 b:0006 l:000e98 d:001c78 EVAL minimal.rb:73 c:0002 p:---- s:0004 b:0004 l:000003 d:000003 FINISH c:0001 p:0000 s:0002 b:0002 l:000e98 d:000e98 TOP - --------------------------- - -- Ruby level backtrace information ---------------------------------------- minimal.rb:73:in `
' /opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86_64-linux/lib/wx/classes/app.rb:16:in `run' /opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86_64-linux/lib/wx/classes/app.rb:16:in `main_loop' /opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86_64-linux/lib/wx/classes/app.rb:16:in `on_run' - -- C level backtrace information ------------------------------------------- /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_vm_bugreport+0x5f) [0x7f46f390248f] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(+0x5fff6) [0x7f46f37eaff6] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_bug+0xb3) [0x7f46f37eb193] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(+0x109285) [0x7f46f3894285] /lib/libpthread.so.0(+0xfb40) [0x7f46f357db40] /usr/lib/libpixman-1.so.0(pixman_image_composite32+0x668) [0x7f46e62b79e8] /usr/lib/libcairo.so.2(+0x29463) [0x7f46e91a3463] /usr/lib/libcairo.so.2(+0x2a61c) [0x7f46e91a461c] /usr/lib/libcairo.so.2(+0x2c31d) [0x7f46e91a631d] /usr/lib/libcairo.so.2(+0x2c55e) [0x7f46e91a655e] /usr/lib/libcairo.so.2(+0x49f56) [0x7f46e91c3f56] /usr/lib/libcairo.so.2(+0x2243e) [0x7f46e919c43e] /usr/lib/libcairo.so.2(cairo_fill_preserve+0x1d) [0x7f46e919343d] /usr/lib/librsvg-2.so.2(+0x29f8e) [0x7f46def3df8e] /usr/lib/librsvg-2.so.2(+0x248a0) [0x7f46def388a0] /usr/lib/librsvg-2.so.2(+0x1d258) [0x7f46def31258] /usr/lib/librsvg-2.so.2(+0x1eb53) [0x7f46def32b53] /usr/lib/librsvg-2.so.2(+0x1f093) [0x7f46def33093] /usr/lib/librsvg-2.so.2(+0x1eb53) [0x7f46def32b53] /usr/lib/librsvg-2.so.2(+0x1ef64) [0x7f46def32f64] /usr/lib/librsvg-2.so.2(+0x1eb53) [0x7f46def32b53] /usr/lib/librsvg-2.so.2(rsvg_handle_render_cairo_sub+0xca) [0x7f46def3eb1a] /usr/lib/librsvg-2.so.2(rsvg_handle_get_pixbuf_sub+0x105) [0x7f46def3f065] /usr/lib/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-svg.so(+0xd6b) [0x7f46df149d6b] /usr/lib/libgdk_pixbuf-2.0.so.0(gdk_pixbuf_loader_close+0xf9) [0x7f46edcde889] /usr/lib/libgdk_pixbuf-2.0.so.0(+0x89a6) [0x7f46edcdc9a6] /usr/lib/libgdk_pixbuf-2.0.so.0(gdk_pixbuf_new_from_stream_at_scale+0x81) [0x7f46edcdcb01] /usr/lib/libgtk-x11-2.0.so.0(+0x104eec) [0x7f46ee4c3eec] /usr/lib/libgtk-x11-2.0.so.0(gtk_icon_info_load_icon+0x72) [0x7f46ee4c4612] /usr/lib/libgtk-x11-2.0.so.0(gtk_icon_theme_load_icon+0x13f) [0x7f46ee4c685f] /usr/lib/libgtk-x11-2.0.so.0(gtk_icon_set_render_icon+0x5ea) [0x7f46ee4c0faa] /usr/lib/libgtk-x11-2.0.so.0(gtk_widget_render_icon+0xea) [0x7f46ee61834a] /usr/lib/libgtk-x11-2.0.so.0(+0x1185d4) [0x7f46ee4d75d4] /usr/lib/libgtk-x11-2.0.so.0(+0x1185f9) [0x7f46ee4d75f9] /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0xa9) [0x7f46ed4399b9] /usr/lib/libgobject-2.0.so.0(+0x23da1) [0x7f46ed44eda1] /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6) [0x7f46ed450996] /usr/lib/libgobject-2.0.so.0(g_signal_emit_by_name+0x208) [0x7f46ed450ce8] /usr/lib/libgtk-x11-2.0.so.0(+0x1a5138) [0x7f46ee564138] /usr/lib/libgtk-x11-2.0.so.0(+0x11ae2f) [0x7f46ee4d9e2f] /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0xa9) [0x7f46ed4399b9] /usr/lib/libgobject-2.0.so.0(+0x23da1) [0x7f46ed44eda1] /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6) [0x7f46ed450996] /usr/lib/libgobject-2.0.so.0(g_signal_emit_by_name+0x208) [0x7f46ed450ce8] /usr/lib/libgtk-x11-2.0.so.0(+0x1a5138) [0x7f46ee564138] /usr/lib/libgtk-x11-2.0.so.0(+0x1422af) [0x7f46ee5012af] /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e) [0x7f46ed439a6e] /usr/lib/libgobject-2.0.so.0(+0x23da1) [0x7f46ed44eda1] /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6) [0x7f46ed450996] /usr/lib/libgobject-2.0.so.0(g_signal_emit_by_name+0x208) [0x7f46ed450ce8] /usr/lib/libgtk-x11-2.0.so.0(+0x1a5138) [0x7f46ee564138] /usr/lib/libgtk-x11-2.0.so.0(+0x13c080) [0x7f46ee4fb080] /usr/lib/libgtk-x11-2.0.so.0(gtk_menu_popup+0x1eb) [0x7f46ee4fca7b] /usr/lib/libgtk-x11-2.0.so.0(+0x1445a7) [0x7f46ee5035a7] /usr/lib/libgtk-x11-2.0.so.0(+0x1446b9) [0x7f46ee5036b9] /usr/lib/libgtk-x11-2.0.so.0(+0x146d1e) [0x7f46ee505d1e] /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e) [0x7f46ed439a6e] /usr/lib/libgobject-2.0.so.0(+0x23da1) [0x7f46ed44eda1] /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x7e6) [0x7f46ed450996] /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83) [0x7f46ed450f53] /usr/lib/libgtk-x11-2.0.so.0(gtk_menu_item_select+0x50) [0x7f46ee504930] /usr/lib/libgtk-x11-2.0.so.0(+0x14a382) [0x7f46ee509382] /usr/lib/libgtk-x11-2.0.so.0(+0x14b2ca) [0x7f46ee50a2ca] /usr/lib/libgtk-x11-2.0.so.0(+0x13a9d8) [0x7f46ee4f99d8] /usr/lib/libgobject-2.0.so.0(g_closure_invoke+0x15e) [0x7f46ed439a6e] /usr/lib/libgobject-2.0.so.0(+0x24120) [0x7f46ed44f120] /usr/lib/libgobject-2.0.so.0(g_signal_emit_valist+0x62b) [0x7f46ed4507db] /usr/lib/libgobject-2.0.so.0(g_signal_emit+0x83) [0x7f46ed450f53] /usr/lib/libgtk-x11-2.0.so.0(+0x2536df) [0x7f46ee6126df] /usr/lib/libgtk-x11-2.0.so.0(gtk_propagate_event+0xc3) [0x7f46ee4f1e73] /usr/lib/libgtk-x11-2.0.so.0(gtk_main_do_event+0x2eb) [0x7f46ee4f2f4b] /usr/lib/libgdk-x11-2.0.so.0(+0x5c74c) [0x7f46ee16c74c] /lib/libglib-2.0.so.0(g_main_context_dispatch+0x1f2) [0x7f46ecd80342] /lib/libglib-2.0.so.0(+0x442a8) [0x7f46ecd842a8] /lib/libglib-2.0.so.0(g_main_loop_run+0x195) [0x7f46ecd847b5] /usr/lib/libgtk-x11-2.0.so.0(gtk_main+0xa7) [0x7f46ee4f33e7] /usr/lib/libwx_gtk2u_core-2.8.so.0(_ZN11wxEventLoop3RunEv+0x48) [0x7f46ef336578] /usr/lib/libwx_gtk2u_core-2.8.so.0(_ZN9wxAppBase8MainLoopEv+0x4b) [0x7f46ef3bbb0b] /opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86_64-linux/lib/wxruby2.so(+0x202108) [0x7f46f0e30108] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(+0x16de46) [0x7f46f38f8e46] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_funcall+0x115) [0x7f46f38f9785] /opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86_64-linux/lib/wxruby2.so(_ZN16SwigDirector_App5OnRunEv+0x2d) [0x7f46f0e320dd] /usr/lib/libwx_baseu-2.8.so.0(_Z7wxEntryRiPPw+0x85) [0x7f46eea66695] /opt/rubies/ruby-1.9.2-p0/lib/ruby/gems/1.9.1/gems/wxruby-ruby19-2.0.1-x86_64-linux/lib/wxruby2.so(+0x201ff0) [0x7f46f0e2fff0] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(+0x172948) [0x7f46f38fd948] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(+0x165329) [0x7f46f38f0329] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(+0x16c4aa) [0x7f46f38f74aa] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(rb_iseq_eval_main+0x280) [0x7f46f38f78d0] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(+0x647b2) [0x7f46f37ef7b2] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(ruby_exec_node+0x1d) [0x7f46f37ef7dd] /opt/rubies/ruby-1.9.2-p0/lib/libruby.so.1.9(ruby_run_node+0x1e) [0x7f46f37f125e] ruby(main+0x4b) [0x40094b] /lib/libc.so.6(__libc_start_main+0xfe) [0x7f46f2941d8e] ruby() [0x400839] [NOTE] You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports are welcome. For details: http://www.ruby-lang.org/bugreport.html Aborted ===================== ARRRGH. Everything for the cat, as we Germans say ("Alles f?r die Katz'"), i.e. all my efforts for nothing. Does someone probably have ANY idea? Vale, Marvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMxG9oAAoJEGrS0YjAWTKVbeYH/301PdktlJSuW7nFsye0CjNs BVVq8tMCBfJvFjLsMxTstBoiH+4ZrxfR94Xm9JQoKZrnmWQzid6r86Y1VLIre1+c t38vFRAHlGuFmAAWOuF4s6WjKc9qW9LK2hn43R94auGAsm9zLktKsJn/+gcpg/QH jJU5jp+WsPfhsgFbRVtlRPYQViImZrwPibQILEscdwPaDvy3KOVzTqFXeTnIhaUj /NzVqz8SCU0+pvLAp47OjWj1P9CTdta++/C05C/u9Z7+UGjNaWMglW2DYDxN4gYK DyIWJTs4/6Sk6OlYYp67lN0iRMLNZdjC+wGIMO5YZRsvTSnowPz15RqakpeQtBU= =/8FO -----END PGP SIGNATURE----- From lists at ruby-forum.com Sun Oct 24 15:37:31 2010 From: lists at ruby-forum.com (Charles P.) Date: Sun, 24 Oct 2010 21:37:31 +0200 Subject: [wxruby-users] Cannot get started In-Reply-To: <1C1EC0FD-009F-4D2D-88D3-FB43D766D5B5@gmail.com> References: <1C1EC0FD-009F-4D2D-88D3-FB43D766D5B5@gmail.com> Message-ID: I found my problem; I had to use the 32 bit instead of the 64 bit architecture, and the sample program works. Out of curiosity, why do I need the "require rubygems" line before the "require wx" line? Thanx - Charlie -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Oct 24 23:27:54 2010 From: lists at ruby-forum.com (Philip Stephens) Date: Mon, 25 Oct 2010 05:27:54 +0200 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 In-Reply-To: <4CC3E601.80207@gmx.net> References: , <4CC3E601.80207@gmx.net> Message-ID: <9e71e1fd9955274e03674eb2d22af126@ruby-forum.com> Marvin G??lker wrote in post #956682: > Your post is missing the actual error. The string literal warning occurs > many times during compilation and shouldn't lead to an interruption. > Did you compile wxWidgets yourself? I'm wondering, because your include > path shows /usr/local/lib/wx, which should be /usr/lib/wx I think. > What is the output of > > $ ruby -rrbconfig -ve 'puts RbConfig::CONFIG["configure_args"]' > $ dpkg -L libwxgtk2.8-dev > $ which wx-config > > ? $ruby -rrbconfig -ve 'puts RbConfig::CONFIG["configure_args"]' ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux] '--enable-shared' $ dpkg -L libwxgtk2.8-dev /. /usr /usr/lib /usr/lib/wx /usr/lib/wx/include /usr/lib/wx/include/gtk2-unicode-release-2.8 /usr/lib/wx/include/gtk2-unicode-release-2.8/wx /usr/lib/wx/include/gtk2-unicode-release-2.8/wx/setup.h /usr/lib/wx/config /usr/lib/wx/config/gtk2-unicode-release-2.8 /usr/share /usr/share/doc /usr/share/doc/libwxgtk2.8-dev /usr/share/doc/libwxgtk2.8-dev/changelog.gz /usr/share/doc/libwxgtk2.8-dev/copyright /usr/share/doc/libwxgtk2.8-dev/changelog.Debian.gz /usr/lib/libwx_gtk2u_adv-2.8.so /usr/lib/libwx_gtk2u_aui-2.8.so /usr/lib/libwx_gtk2u_core-2.8.so /usr/lib/libwx_gtk2u_fl-2.8.so /usr/lib/libwx_gtk2u_gizmos-2.8.so /usr/lib/libwx_gtk2u_gizmos_xrc-2.8.so /usr/lib/libwx_gtk2u_gl-2.8.so /usr/lib/libwx_gtk2u_html-2.8.so /usr/lib/libwx_gtk2u_media-2.8.so /usr/lib/libwx_gtk2u_ogl-2.8.so /usr/lib/libwx_gtk2u_plot-2.8.so /usr/lib/libwx_gtk2u_qa-2.8.so /usr/lib/libwx_gtk2u_richtext-2.8.so /usr/lib/libwx_gtk2u_stc-2.8.so /usr/lib/libwx_gtk2u_svg-2.8.so /usr/lib/libwx_gtk2u_xrc-2.8.so $ which wx-config /usr/local/bin/wx-config -- Posted via http://www.ruby-forum.com/. From sutniuq at gmx.net Mon Oct 25 08:28:45 2010 From: sutniuq at gmx.net (Quintus) Date: Mon, 25 Oct 2010 14:28:45 +0200 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 In-Reply-To: <9e71e1fd9955274e03674eb2d22af126@ruby-forum.com> References: , <4CC3E601.80207@gmx.net> <9e71e1fd9955274e03674eb2d22af126@ruby-forum.com> Message-ID: <4CC577FD.2060707@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 25.10.2010 05:27, schrieb Philip Stephens: > Marvin G??lker wrote in post #956682: > >> Your post is missing the actual error. The string literal warning occurs >> many times during compilation and shouldn't lead to an interruption. >> Did you compile wxWidgets yourself? I'm wondering, because your include >> path shows /usr/local/lib/wx, which should be /usr/lib/wx I think. >> What is the output of >> >> $ ruby -rrbconfig -ve 'puts RbConfig::CONFIG["configure_args"]' >> $ dpkg -L libwxgtk2.8-dev >> $ which wx-config >> >> ? > > $ruby -rrbconfig -ve 'puts RbConfig::CONFIG["configure_args"]' > ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux] > '--enable-shared' > > $ dpkg -L libwxgtk2.8-dev > /. > /usr > /usr/lib > /usr/lib/wx > /usr/lib/wx/include > /usr/lib/wx/include/gtk2-unicode-release-2.8 > /usr/lib/wx/include/gtk2-unicode-release-2.8/wx > /usr/lib/wx/include/gtk2-unicode-release-2.8/wx/setup.h > /usr/lib/wx/config > /usr/lib/wx/config/gtk2-unicode-release-2.8 > /usr/share > /usr/share/doc > /usr/share/doc/libwxgtk2.8-dev > /usr/share/doc/libwxgtk2.8-dev/changelog.gz > /usr/share/doc/libwxgtk2.8-dev/copyright > /usr/share/doc/libwxgtk2.8-dev/changelog.Debian.gz > /usr/lib/libwx_gtk2u_adv-2.8.so > /usr/lib/libwx_gtk2u_aui-2.8.so > /usr/lib/libwx_gtk2u_core-2.8.so > /usr/lib/libwx_gtk2u_fl-2.8.so > /usr/lib/libwx_gtk2u_gizmos-2.8.so > /usr/lib/libwx_gtk2u_gizmos_xrc-2.8.so > /usr/lib/libwx_gtk2u_gl-2.8.so > /usr/lib/libwx_gtk2u_html-2.8.so > /usr/lib/libwx_gtk2u_media-2.8.so > /usr/lib/libwx_gtk2u_ogl-2.8.so > /usr/lib/libwx_gtk2u_plot-2.8.so > /usr/lib/libwx_gtk2u_qa-2.8.so > /usr/lib/libwx_gtk2u_richtext-2.8.so > /usr/lib/libwx_gtk2u_stc-2.8.so > /usr/lib/libwx_gtk2u_svg-2.8.so > /usr/lib/libwx_gtk2u_xrc-2.8.so > > $ which wx-config > /usr/local/bin/wx-config > It seems you have two wxWidgets installations, one in /usr (that's that one from the Ubuntu repos) and one in /usr/local (probably self-compiled?). /usr/local/bin comes first in PATH, therefore the wxWidgets installation there is used by wxRuby. Try this: $ wx-config --prefix $ /usr/local/bin/wx-config --prefix #Same as above $ /usr/bin/wxconfig --prefix and two different wxWidgets prefixes will eventually be shown. Building on "top of the distro packages" should work fine, so I suggest you to uninstall the wxWidgets in /usr/local/ either by running $ sudo make uninstall in the source directory of the compiled wxWidgets, or, if you don't have that source directory anymore, a $ cd /usr/local $ find -regex '.*libwx.*' -or -regex '.*/wx-.*' -or -name wxrc *should* list all wxWidgets files under /usr/local. Deleting those *should* result in a complete deletion of the wxWidgets installation in /usr/local. However, do review the list of found files; deleting something non-wxish unintentionally can cause problems (as you might imagine). For instance, on my system this shows some Python files: $ find -regex '.*libwx.*' -or -regex '.*/wx-.*' -or -name wxrc | grep py ./include/wx-2.8/wx/wxPython/pytree.h ./include/wx-2.8/wx/wxPython/pyistream.h ./include/wx-2.8/wx/wxPython/pydrawxxx.h ./include/wx-2.8/wx/wxPython/pyclasses.h ./share/doc/libwxgtk2.8-dev/copyright ./share/doc/libwxbase2.8-dev/copyright ./share/doc/libwxbase2.8-0/copyright ./share/doc/libwxgtk2.8-0/copyright Vale, Marvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMxXf8AAoJEGrS0YjAWTKV3NQH/1bfYpXOVl3G7cQnBSk2h6gc +ekR7qKav4B/wSLs3nUH5LxTFm1c1w+lonv1doTrQ/k9/wJsPO75JAgRihyEOijW NYYXTHsbP+Z8ghDoiMd1COj4wG96+MsGlqPOk3oIkde4H0VzNOdCA48kH6AT7R6X vwbLrgZ8RjEvrOfOlS+sgSZcbeseEWg/rLTavmxQWBXLhRDlpv9cF2rRvn6PCxaQ Kmt4gXnibwRFr+xTNJAfqMCFbXoY5FxeLYREPpGsbIXvxvEdHAR5se89Z6Rv9Wfh snxNtzvo0dfv7DCwINNYh2veKjDaWCBue9Y4bG5HEdUKjoxU1Z11EoFqvXPFuLY= =Fk/f -----END PGP SIGNATURE----- From lists at ruby-forum.com Mon Oct 25 17:33:55 2010 From: lists at ruby-forum.com (=?UTF-8?B?w4XCgXVrYXN6?= Korecki) Date: Mon, 25 Oct 2010 23:33:55 +0200 Subject: [wxruby-users] Cannot get started In-Reply-To: References: <1C1EC0FD-009F-4D2D-88D3-FB43D766D5B5@gmail.com>, Message-ID: Charles P. wrote in post #956758: > I found my problem; I had to use the 32 bit instead of the 64 bit > architecture, and the sample program works. > > Out of curiosity, why do I need the "require rubygems" line before the > "require wx" line? Because you've used the "gem" command to install wxruby, it's as simple as that :-) One thing to note though: >> Successfully installed wxruby-1.9.3-universal-darwin >> 1 gem installed This is an old version of wxRuby - it's better if you grab the latest from here: http://rubyforge.org/frs/?group_id=35 ( For OSX 10.6: http://rubyforge.org/frs/download.php/63386/wxruby-2.0.1-universal-darwin-9.gem) For some reason this package isn't available via gem command. Once you download the file just run: gem install wxruby-2.0.1-universal-darwin-9.gem (make sure you uninstall the 1.9.3 wxruby first). Hope that helps. ?ukasz -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Tue Oct 26 14:15:36 2010 From: mario at ruby-im.net (Mario Steele) Date: Tue, 26 Oct 2010 14:15:36 -0400 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 In-Reply-To: <4CC577FD.2060707@gmx.net> References: <4CC3E601.80207@gmx.net> <9e71e1fd9955274e03674eb2d22af126@ruby-forum.com> <4CC577FD.2060707@gmx.net> Message-ID: Hello All, Due to some issues with the setup of 10.10, I've been working on getting a new version of the wxRuby gems setup, and ready for you all. Currently, since it was the one requested by Phillip Stephens, I've posted a Ruby 1.9 Gem which can be downloaded from http://www.trilake.net/wxRuby/wxruby-ruby19-2.0.1-x86-linux.gem This version of the gem, has been compiled to work without wxMediaCtrl compiled in with the main wxWidgets Library. I will be setting up a new distro in my Apt repository to upload new versions of the wxRuby library for i386 and x86_64, specifically for Maverick Meerkat. I will be setting up my 64bit install of Ubuntu to host a VM for Lucid Lynx, to get installs for both 32bit and 64bit versions for 10.04. I apologize for the lateness in this post, but I was just able to get everything compiled, and uploaded. Please bear with me, as I get the repositories setup, and going with proper authentication of the source packages, and such. hth, Mario P.S. Installation instructions in a Copy & Paste Method for the Gem: wget http://www.trilake.net/wxRuby/wxruby-ruby19-2.0.1-x86-linux.gem sudo gem install wxruby-ruby19-2.0.1-x86-linux.gem On Mon, Oct 25, 2010 at 8:28 AM, Quintus wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Am 25.10.2010 05:27, schrieb Philip Stephens: > > Marvin G??lker wrote in post #956682: > > > >> Your post is missing the actual error. The string literal warning occurs > >> many times during compilation and shouldn't lead to an interruption. > >> Did you compile wxWidgets yourself? I'm wondering, because your include > >> path shows /usr/local/lib/wx, which should be /usr/lib/wx I think. > >> What is the output of > >> > >> $ ruby -rrbconfig -ve 'puts RbConfig::CONFIG["configure_args"]' > >> $ dpkg -L libwxgtk2.8-dev > >> $ which wx-config > >> > >> ? > > > > $ruby -rrbconfig -ve 'puts RbConfig::CONFIG["configure_args"]' > > ruby 1.9.2p0 (2010-08-18 revision 29036) [i686-linux] > > '--enable-shared' > > > > $ dpkg -L libwxgtk2.8-dev > > /. > > /usr > > /usr/lib > > /usr/lib/wx > > /usr/lib/wx/include > > /usr/lib/wx/include/gtk2-unicode-release-2.8 > > /usr/lib/wx/include/gtk2-unicode-release-2.8/wx > > /usr/lib/wx/include/gtk2-unicode-release-2.8/wx/setup.h > > /usr/lib/wx/config > > /usr/lib/wx/config/gtk2-unicode-release-2.8 > > /usr/share > > /usr/share/doc > > /usr/share/doc/libwxgtk2.8-dev > > /usr/share/doc/libwxgtk2.8-dev/changelog.gz > > /usr/share/doc/libwxgtk2.8-dev/copyright > > /usr/share/doc/libwxgtk2.8-dev/changelog.Debian.gz > > /usr/lib/libwx_gtk2u_adv-2.8.so > > /usr/lib/libwx_gtk2u_aui-2.8.so > > /usr/lib/libwx_gtk2u_core-2.8.so > > /usr/lib/libwx_gtk2u_fl-2.8.so > > /usr/lib/libwx_gtk2u_gizmos-2.8.so > > /usr/lib/libwx_gtk2u_gizmos_xrc-2.8.so > > /usr/lib/libwx_gtk2u_gl-2.8.so > > /usr/lib/libwx_gtk2u_html-2.8.so > > /usr/lib/libwx_gtk2u_media-2.8.so > > /usr/lib/libwx_gtk2u_ogl-2.8.so > > /usr/lib/libwx_gtk2u_plot-2.8.so > > /usr/lib/libwx_gtk2u_qa-2.8.so > > /usr/lib/libwx_gtk2u_richtext-2.8.so > > /usr/lib/libwx_gtk2u_stc-2.8.so > > /usr/lib/libwx_gtk2u_svg-2.8.so > > /usr/lib/libwx_gtk2u_xrc-2.8.so > > > > $ which wx-config > > /usr/local/bin/wx-config > > > > It seems you have two wxWidgets installations, one in /usr (that's that > one from the Ubuntu repos) and one in /usr/local (probably > self-compiled?). /usr/local/bin comes first in PATH, therefore the > wxWidgets installation there is used by wxRuby. Try this: > > $ wx-config --prefix > $ /usr/local/bin/wx-config --prefix #Same as above > $ /usr/bin/wxconfig --prefix > > and two different wxWidgets prefixes will eventually be shown. Building > on "top of the distro packages" should work fine, so I suggest you to > uninstall the wxWidgets in /usr/local/ either by running > > $ sudo make uninstall > > in the source directory of the compiled wxWidgets, or, if you don't have > that source directory anymore, a > > $ cd /usr/local > $ find -regex '.*libwx.*' -or -regex '.*/wx-.*' -or -name wxrc > > *should* list all wxWidgets files under /usr/local. Deleting those > *should* result in a complete deletion of the wxWidgets installation in > /usr/local. However, do review the list of found files; deleting > something non-wxish unintentionally can cause problems (as you might > imagine). For instance, on my system this shows some Python files: > > $ find -regex '.*libwx.*' -or -regex '.*/wx-.*' -or -name wxrc | grep py > ./include/wx-2.8/wx/wxPython/pytree.h > ./include/wx-2.8/wx/wxPython/pyistream.h > ./include/wx-2.8/wx/wxPython/pydrawxxx.h > ./include/wx-2.8/wx/wxPython/pyclasses.h > ./share/doc/libwxgtk2.8-dev/copyright > ./share/doc/libwxbase2.8-dev/copyright > ./share/doc/libwxbase2.8-0/copyright > ./share/doc/libwxgtk2.8-0/copyright > > Vale, > Marvin > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.4.10 (GNU/Linux) > Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ > > iQEcBAEBAgAGBQJMxXf8AAoJEGrS0YjAWTKV3NQH/1bfYpXOVl3G7cQnBSk2h6gc > +ekR7qKav4B/wSLs3nUH5LxTFm1c1w+lonv1doTrQ/k9/wJsPO75JAgRihyEOijW > NYYXTHsbP+Z8ghDoiMd1COj4wG96+MsGlqPOk3oIkde4H0VzNOdCA48kH6AT7R6X > vwbLrgZ8RjEvrOfOlS+sgSZcbeseEWg/rLTavmxQWBXLhRDlpv9cF2rRvn6PCxaQ > Kmt4gXnibwRFr+xTNJAfqMCFbXoY5FxeLYREPpGsbIXvxvEdHAR5se89Z6Rv9Wfh > snxNtzvo0dfv7DCwINNYh2veKjDaWCBue9Y4bG5HEdUKjoxU1Z11EoFqvXPFuLY= > =Fk/f > -----END PGP SIGNATURE----- > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users > -- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From mario at ruby-im.net Tue Oct 26 14:32:12 2010 From: mario at ruby-im.net (Mario Steele) Date: Tue, 26 Oct 2010 14:32:12 -0400 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: <254200fe252e219c599c1963d1b6b5a7@ruby-forum.com> References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> <254200fe252e219c599c1963d1b6b5a7@ruby-forum.com> Message-ID: Hello again Ron, On Sun, Oct 24, 2010 at 2:28 AM, Ron Shadow wrote: > Yes, that is much clearer. Thanks for taking the time to write the code > and show me. > Not a problem, and I'm glad that you can finally understand where this is. > I realize I probably seem like a Ruby noob. I've been learning Ruby for > almost two weeks and so far I love it. I've coded games in VB6 and > PHP/MySQL and Flash Actionscript, and I've coded other kinds of programs > in C++. Ruby is definitely different but I can see a lot of good > qualities from different languages packed together into Ruby. > Ruby is Unique in the fact that it's pure Object Oriented, and therefore, fits many encapsulations of elements within a program. > I found Rubygame library and it looks great for the graphical combat > screen, but has absolutely no utilities like buttons/textboxes/etc, so > it's great that Wx can still be used. > ... > I also see what you mean by having to put all the code of the client > into the Wx classes. I'd prefer if possible to leave things like the > connection protocol, socket communication, macro key functions, sound > effect calls, etc, outside of the frame classes and the main_loop. > I understand, I'll get a bit more indepth here in a moment.... > If I wanted to keep handling connection events from the main script > while the main_loop was executing, I could use a separate thread for the > main_loop, but would there be a way to hide/show a frame from a thread > outside the main_loop? Like 'def methodX; self.hide; end' in one of the > frame classes, and '$loginFrame.methodX' from outside the main_loop > thread? Or $loginFrame.hide? > > I know I can call methods defined by the main-thread from spawned-thread > blocks so it ought to work the same way in reverse if I use global > variables for all the frame instances? Threads are a tricky business, especially when you get into Multiple Threads, and that you also need to realize something else. Depending upon what version of the Ruby Interpreter your using, you have to deal with another layer of trouble. In Ruby 1.8, it is designed at the core, to use Green Threads. Which basically means, that a Thread is created internally in the Interpreter that is basically an Emulated Thread, but not a true native thread. This basically means that Ruby is handling all the scheduling and such for each of the threads, instead of the OS itself. Ruby 1.9 on the other hand, actually implements Native threads, where the OS is handling the Threads itself, and not Ruby. What this means to you, is that if you were to use Ruby 1.8 Threads, and you have something like wxWidget's main_loop running, 99.9999 percent of the time will be spent on main_loop, giving ruby extremely little chance to run any other threads. If at all. Where as Ruby 1.9, it handles Threads natively, which allows main_loop to run in it's own native thread, and allows you to create other threads, in which to actually run simultaneously as the Main Thread. Which brings me to Thread Safety. The main thing you want to be careful about with dealing with Threads, is using them safely. Thread Safety basically entails using a Mutex, or Semaphore to get a global lock within your program, and allow a certain thread to have exclusive access to the variable data, including updating it with new information, while preventing other threads from having access for the time that your updating the data. If all your doing is Reading Variables, and not assigning to them from another thread, then you should be fine. But if your assigning data from other threads, then you need to create a Mutex, lock it for the period that your updating the data, then unlock it when your finished. If you don't, then you could get those nice little fatal errors, about access violation of memory addresses. I'm sure with your C++ background, you probably have a good idea what I mean by this. Lastly, another thing you will need to be careful of, is the whole usage of two different libraries, that utilize a tight end Main Loop. RubyGame utilizies a tight end Main Loop to allow processing of drawing, events, and so on, while wxWidgets also has it's own tight end Main Loop, to handle the same things. Attempting to use these two in conjunction, requires a bit of advanced programming to get to work properly. Not to say that it can't be done, it can, but it will be hard to do, as you will need to write a sort of merged main loop, that will handle wxRuby events, and handle RubyGame events at the same exact time, to keep both libraries running smoothly, as if they were separate. Thankfully, wxRuby allows you to write your own main_loop function, if you were to sub-class Wx::App. and using Wx::App#pending to see if there are any wxWidgets events pending, and if there are, using Wx::App#dispatch to dispatch events to be executed. Using this in concert with RubyGame, or any other library's own way of processing their own events, may help you utilize what you want to keep things running smoothly. I do hope that this helps you out, and progresses you further in developing your application / game. L8ers, Mario > -- > 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 Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From sutniuq at gmx.net Tue Oct 26 16:52:30 2010 From: sutniuq at gmx.net (Quintus) Date: Tue, 26 Oct 2010 22:52:30 +0200 Subject: [wxruby-users] Compiling wxRuby on Ubuntu 10.04 In-Reply-To: References: <4CC3E601.80207@gmx.net> <9e71e1fd9955274e03674eb2d22af126@ruby-forum.com> <4CC577FD.2060707@gmx.net> Message-ID: <4CC73F8E.7070004@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Am 26.10.2010 20:15, schrieb Mario Steele: > Hello All, > > Due to some issues with the setup of 10.10, I've been working on getting a > new version of the wxRuby gems setup, and ready for you all. Currently, > since it was the one requested by Phillip Stephens, I've posted a Ruby 1.9 > Gem which can be downloaded from > http://www.trilake.net/wxRuby/wxruby-ruby19-2.0.1-x86-linux.gem > > This version of the gem, has been compiled to work without wxMediaCtrl > compiled in with the main wxWidgets Library. I will be setting up a new > distro in my Apt repository to upload new versions of the wxRuby library for > i386 and x86_64, specifically for Maverick Meerkat. I will be setting up my > 64bit install of Ubuntu to host a VM for Lucid Lynx, to get installs for > both 32bit and 64bit versions for 10.04. I apologize for the lateness in > this post, but I was just able to get everything compiled, and uploaded. I'm really interested in how you managed to do a successful compile on Ubuntu Maverick. I've been trying to do that for more than a week now and still no success (see my previous posts on this lists, e.g. here: http://www.ruby-forum.com/topic/260671 ). Even if compilation was done without problems, I was bombed with segfaults when trying to use wxRuby, even with the minimal sample a click on the "File" menu made Ruby crash. Could you post some instructions on how to get that working (maybe in a new thread, as this is not what the OP is trying to do)? Vale, Marvin > Please bear with me, as I get the repositories setup, and going with proper > authentication of the source packages, and such. > > hth, > > Mario > > P.S. Installation instructions in a Copy & Paste Method for the Gem: > > wget http://www.trilake.net/wxRuby/wxruby-ruby19-2.0.1-x86-linux.gem > sudo gem install wxruby-ruby19-2.0.1-x86-linux.gem -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMxz+NAAoJEGrS0YjAWTKVKKwH/2GwpoSvR3ur0ZUdi7JjLlhY iteTvnFlxUXYBJDCIgZkNZUZdRHydIy+HAfdXS2tBwFcejjFp+JCt6l0VTl+LrBw HjGogxD82xd6Rq+H8TDL0uJF//qtfJaIF2ikXkLnr5+TLmXf0pSpdNKLFp+SMMTS phPw1zdq5hyli2/gBr79oPPVpGLZzvpDs5VCEsEh7kQMUz40OOeCX5pR1Pe9BH+k HvKTvOBgI2ciJsyTtsM4CagrLgmO1P76TDmXGnyxG6wIccdJUb9RW1m5RM4+Rs4R 92gTiULh8yLCzqYYjazmSm8tcXIJFK01+5tBA9kCiGHoBonGEuaSJQ54JSO/X9g= =vUP2 -----END PGP SIGNATURE----- From rob at echlin.ca Tue Oct 26 18:59:49 2010 From: rob at echlin.ca (Rob Echlin) Date: Tue, 26 Oct 2010 15:59:49 -0700 (PDT) Subject: [wxruby-users] =?utf-8?q?Agile_Ottawa=3A_Nov_9_=E2=80=93_Tips_for?= =?utf-8?q?_a_smoother_running_sprint?= Message-ID: <640754.86233.qm@web59515.mail.ac4.yahoo.com> Location: Adobe?s offices on Preston St, just south of the 417 Time: ? Networking: 6:00-6:30pm ? Presentation: 6:30-8:00pm ? Heart & Crown afterward Presenter: Steffan Surdek Steffan is one of the co-authors of the IBM Press book ?A Practical Guide to Distributed Scrum?. I have read this book and it succinctly covers all the main topics you will need to address with Agile teams in multiple locations. I look forward to meeting Steffan and hearing his presentation. November meeting details and outline of the presentation. Hey, I couldn't make it to the meeting tonight, but I am thinking about you! Rob -- Rob Echlin, B. Eng. 613-266-8311 -? Ottawa, ON Blog: http://talksoftware.wordpress.com/ - I am a software developer and proponent of Agile Software Development processes. - Agile delivers: faster to market, higher quality, what the customer actually needs. More satisfying, more fun! -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Wed Oct 27 06:19:24 2010 From: lists at ruby-forum.com (Misha Ognev) Date: Wed, 27 Oct 2010 12:19:24 +0200 Subject: [wxruby-users] wxRuby by wxSugar In-Reply-To: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> References: <7a7d9eb13b8182ed9ce4b0c30224cd64@ruby-forum.com> Message-ID: Mario, here this files: http://www.sendspace.com/file/q93zj9 The first button, Ctrl-C, must copy text frim label to textctrl. The second button must hide sizer which parent to textctrl on the first click, and in the second show it. Thanks, Michael. -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Thu Oct 28 00:59:13 2010 From: mario at ruby-im.net (Mario Steele) Date: Thu, 28 Oct 2010 00:59:13 -0400 Subject: [wxruby-users] Regards to Building of wxRuby 2.0.1 Message-ID: Hello All, In regards to Ron's post, I have reviewed the gem created by the build process, and attempted to use it, and it is as you said, with Ruby 1.9.2 p0, when attempting to run most of the examples, it will cause a segfault, with a ruby backtrace, and debugging info, suggesting something has gone wrong. I've also attempted to build against Ruby 1.8.7 p302, and it seems that it has issues with rb_intern2 not being found for some reason. I just joined #wxruby on irc.freenode.net, if you are still available, we can research what is going on, and figure out a solution to this problem. -- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu Oct 28 01:27:25 2010 From: lists at ruby-forum.com (Ron Shadow) Date: Thu, 28 Oct 2010 07:27:25 +0200 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com>, <254200fe252e219c599c1963d1b6b5a7@ruby-forum.com>, Message-ID: <42593663367809cc5c4d2d396e07b8d4@ruby-forum.com> Mario Steele wrote in post #957323: I bit the bullet and just went with the flow, coded the app to load/show/hide from within the main_loop. I have a login screen, main screen, and a player creation screen. Although I can't help but load/show the player creation and main screens from the socket thread that is outside the main_loop. Even though it's calling a method from a frame class it's still calling from outside main_loop, etc. It works 10% of the time, but 90% of the time I get a segmentation fault when trying to show the player creation screen (the .show() method). Isolated it down to that line by using puts before and after it. I've searched these forums and found some tips, tried some of them but they haven't helped yet. I don't need to boost GC speed because I am getting the fault in the same place all the time, it's just that 10% of the time it does not occur and the creation screen shows and behaves normally. I tried GC.disable in my script but that didn't solve the problem, so I don't think it's caused by garbage collection. > Green Threads. Which basically means, that a Thread is created > internally > in the Interpreter that is basically an Emulated Thread, but not a true > native thread. This basically means that Ruby is handling all the > scheduling and such for each of the threads, instead of the OS itself. > Ruby > 1.9 on the other hand, actually implements Native threads, where the OS > is > handling the Threads itself, and not Ruby. > What this means to you, is that if you were to use Ruby 1.8 Threads, and > you > have something like wxWidget's main_loop running, 99.9999 percent of the > time will be spent on main_loop, giving ruby extremely little chance to > run > any other threads. If at all. This answers a big question of mine. The client stops communicating with the server when the GUI is shown, until I start moving the mouse. The client only continues to process the socket thread if I continue to move the mouse. So if I run it on ruby1.9.1 that'll take care of that problem? Turns out I can't uninstall ruby1.8 without removing ruby completely. Ruby doesn't run if I have only 1.9.1 installed, oddly enough. So should I just leave ruby1.8 installed and install ruby1.9.1? Will that mean any script I run will automatically use ruby1.9.1? RVM seems to be way too complicated, not sure if I want to use RVM. XD > If all your doing is Reading Variables, and not assigning to them from > another thread, then you should be fine. But if your assigning data > from > other threads, then you need to create a Mutex, lock it for the period > that > your updating the data, then unlock it when your finished. If you > don't, > then you could get those nice little fatal errors, about access > violation of > memory addresses. I'm sure with your C++ background, you probably have > a > good idea what I mean by this. I will definitely need to be modifying the properties of the class instances that are initiated within the main_loop, from outside the main_loop in the socket thread. So it sounds like I'll have to be using locks. Thanks for telling me about that, probably would have taken me a while to find that. Also - this is probably what is causing the segmentation faults? The fact that I don't have synchronized blocks / mutex locks? > Thankfully, wxRuby allows you to write your own main_loop function, if > you > were to sub-class Wx::App. and using Wx::App#pending to see if there > are > any wxWidgets events pending, and if there are, using Wx::App#dispatch > to > dispatch events to be executed. Using this in concert with RubyGame, or > any > other library's own way of processing their own events, may help you > utilize > what you want to keep things running smoothly. What if I don't need to execute any code in the wx main_loop while the Rubygame main_loop is running? I can handle the combat mode using only Rubygame. Does that mean that, instead of rewriting the main_loop, I could just execute the Rubygame main_loop from inside of the wx main_loop? I could tell the wx main_loop to sleep while the Rubygame main_loop is executing, just to make sure it waits for combat to end. > I do hope that this helps you out, and progresses you further in > developing > your application / game. > > L8ers, > > Mario Yeah, you've been incredibly helpful. I don't think I would have got WxWidgets to show multiple windows without your explanation on the main_loop etc. Thanks! :) -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Thu Oct 28 01:35:03 2010 From: mario at ruby-im.net (Mario Steele) Date: Thu, 28 Oct 2010 01:35:03 -0400 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: <42593663367809cc5c4d2d396e07b8d4@ruby-forum.com> References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> <254200fe252e219c599c1963d1b6b5a7@ruby-forum.com> <42593663367809cc5c4d2d396e07b8d4@ruby-forum.com> Message-ID: I am currently in the wxRuby chat room, if you wish to talk with me in person, and I can answer some of these questions for you. On Thu, Oct 28, 2010 at 1:27 AM, Ron Shadow wrote: > Mario Steele wrote in post #957323: > > I bit the bullet and just went with the flow, coded the app to > load/show/hide from within the main_loop. I have a login screen, main > screen, and a player creation screen. Although I can't help but > load/show the player creation and main screens from the socket thread > that is outside the main_loop. Even though it's calling a method from a > frame class it's still calling from outside main_loop, etc. It works 10% > of the time, but 90% of the time I get a segmentation fault when trying > to show the player creation screen (the .show() method). Isolated it > down to that line by using puts before and after it. > > I've searched these forums and found some tips, tried some of them but > they haven't helped yet. I don't need to boost GC speed because I am > getting the fault in the same place all the time, it's just that 10% of > the time it does not occur and the creation screen shows and behaves > normally. I tried GC.disable in my script but that didn't solve the > problem, so I don't think it's caused by garbage collection. > > > Green Threads. Which basically means, that a Thread is created > > internally > > in the Interpreter that is basically an Emulated Thread, but not a true > > native thread. This basically means that Ruby is handling all the > > scheduling and such for each of the threads, instead of the OS itself. > > Ruby > > 1.9 on the other hand, actually implements Native threads, where the OS > > is > > handling the Threads itself, and not Ruby. > > > What this means to you, is that if you were to use Ruby 1.8 Threads, and > > you > > have something like wxWidget's main_loop running, 99.9999 percent of the > > time will be spent on main_loop, giving ruby extremely little chance to > > run > > any other threads. If at all. > > This answers a big question of mine. The client stops communicating with > the server when the GUI is shown, until I start moving the mouse. The > client only continues to process the socket thread if I continue to move > the mouse. So if I run it on ruby1.9.1 that'll take care of that > problem? > > Turns out I can't uninstall ruby1.8 without removing ruby completely. > Ruby doesn't run if I have only 1.9.1 installed, oddly enough. So should > I just leave ruby1.8 installed and install ruby1.9.1? Will that mean any > script I run will automatically use ruby1.9.1? RVM seems to be way too > complicated, not sure if I want to use RVM. XD > > > If all your doing is Reading Variables, and not assigning to them from > > another thread, then you should be fine. But if your assigning data > > from > > other threads, then you need to create a Mutex, lock it for the period > > that > > your updating the data, then unlock it when your finished. If you > > don't, > > then you could get those nice little fatal errors, about access > > violation of > > memory addresses. I'm sure with your C++ background, you probably have > > a > > good idea what I mean by this. > > I will definitely need to be modifying the properties of the class > instances that are initiated within the main_loop, from outside the > main_loop in the socket thread. So it sounds like I'll have to be using > locks. Thanks for telling me about that, probably would have taken me a > while to find that. > > Also - this is probably what is causing the segmentation faults? The > fact that I don't have synchronized blocks / mutex locks? > > > Thankfully, wxRuby allows you to write your own main_loop function, if > > you > > were to sub-class Wx::App. and using Wx::App#pending to see if there > > are > > any wxWidgets events pending, and if there are, using Wx::App#dispatch > > to > > dispatch events to be executed. Using this in concert with RubyGame, or > > any > > other library's own way of processing their own events, may help you > > utilize > > what you want to keep things running smoothly. > > What if I don't need to execute any code in the wx main_loop while the > Rubygame main_loop is running? I can handle the combat mode using only > Rubygame. > > Does that mean that, instead of rewriting the main_loop, I could just > execute the Rubygame main_loop from inside of the wx main_loop? I could > tell the wx main_loop to sleep while the Rubygame main_loop is > executing, just to make sure it waits for combat to end. > > > I do hope that this helps you out, and progresses you further in > > developing > > your application / game. > > > > L8ers, > > > > Mario > > Yeah, you've been incredibly helpful. I don't think I would have got > WxWidgets to show multiple windows without your explanation on the > main_loop etc. Thanks! :) > > -- > 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 Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu Oct 28 01:36:15 2010 From: lists at ruby-forum.com (Ron Shadow) Date: Thu, 28 Oct 2010 07:36:15 +0200 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> Message-ID: require 'thread' $mutex = Mutex.new ... # this method is in class MainScreenFrame < Wx::Frame def showPlayerCreationScreen # this method ends up getting called from the socket thread. $mutex.synchronize { $theCreationScreen = PlayerCreationFrame.new() $theCreationScreen.show # segmentation fault occurs on this line # 10% of the time there will be no segmentation fault and the screen will show/behave fine. } end I've placed puts at the end of the def initialize method in the PlayerCreationFrame class, and the puts always gets shown before the segmentation fault occurs, so it's not occurring with initialization of PlayerCreationFrame (unless it occurs as the initialization method ends?). GC.disable has no effect. -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Thu Oct 28 01:45:51 2010 From: mario at ruby-im.net (Mario Steele) Date: Thu, 28 Oct 2010 01:45:51 -0400 Subject: [wxruby-users] Regards to Building of wxRuby 2.0.1 In-Reply-To: References: Message-ID: After doing a complete wipe clean of the code, and re-swigging and compiling of the code, it looks as though Ruby 1.8.7 p302 has the same issue as Ruby 1.9.2 p0. In the fact that aside from a few configuration errors on our part, with the removal of wxMediaCtrl from the Debian/Ubuntu repository version, that after getting the errors fixed, there's an issue with libpixman, in the function pixman_image_composite32, running through the GDB backtrace. I am therefore going to attempt to custom build wxWidgets myself, in static form, and build wxRuby's so file in static mode, to see if the errors progress, or fix. It may be solvable by using wxWidget's internal graphics libraries over the system's libraries, but I won't know for certain till I run the compile. I'm getting things setup now, to see what happens, and will post on my progress once I get a version built. L8ers, Mario On Thu, Oct 28, 2010 at 12:59 AM, Mario Steele wrote: > Hello All, > > In regards to Ron's post, I have reviewed the gem created by the build > process, and attempted to use it, and it is as you said, with Ruby 1.9.2 p0, > when attempting to run most of the examples, it will cause a segfault, with > a ruby backtrace, and debugging info, suggesting something has gone wrong. > I've also attempted to build against Ruby 1.8.7 p302, and it seems that it > has issues with rb_intern2 not being found for some reason. I just joined > #wxruby on irc.freenode.net, if you are still available, we can research > what is going on, and figure out a solution to this problem. > > -- > Mario Steele > Lieutenant Commander 3 > XO - Geo 99 > XO - STO IFT Fleet > http://www.trekfederation.com > http://geo99.ruby-im.net > > -- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From mario at ruby-im.net Thu Oct 28 01:56:17 2010 From: mario at ruby-im.net (Mario Steele) Date: Thu, 28 Oct 2010 01:56:17 -0400 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com> <254200fe252e219c599c1963d1b6b5a7@ruby-forum.com> <42593663367809cc5c4d2d396e07b8d4@ruby-forum.com> Message-ID: For those of you who don't have an IRC Client, and would like to use a Web Page chat system, you can use the following: http://webchat.freenode.net/?channels=wxruby FreeNode no longer allows Mibbit to work, so this will allow you to get into the wxRuby channel without needing to install an IRC Client, or figuring out which room to go to. ;-) On Thu, Oct 28, 2010 at 1:35 AM, Mario Steele wrote: > I am currently in the wxRuby chat room, if you wish to talk with me in > person, and I can answer some of these questions for you. > > > On Thu, Oct 28, 2010 at 1:27 AM, Ron Shadow wrote: > >> Mario Steele wrote in post #957323: >> >> I bit the bullet and just went with the flow, coded the app to >> load/show/hide from within the main_loop. I have a login screen, main >> screen, and a player creation screen. Although I can't help but >> load/show the player creation and main screens from the socket thread >> that is outside the main_loop. Even though it's calling a method from a >> frame class it's still calling from outside main_loop, etc. It works 10% >> of the time, but 90% of the time I get a segmentation fault when trying >> to show the player creation screen (the .show() method). Isolated it >> down to that line by using puts before and after it. >> >> I've searched these forums and found some tips, tried some of them but >> they haven't helped yet. I don't need to boost GC speed because I am >> getting the fault in the same place all the time, it's just that 10% of >> the time it does not occur and the creation screen shows and behaves >> normally. I tried GC.disable in my script but that didn't solve the >> problem, so I don't think it's caused by garbage collection. >> >> > Green Threads. Which basically means, that a Thread is created >> > internally >> > in the Interpreter that is basically an Emulated Thread, but not a true >> > native thread. This basically means that Ruby is handling all the >> > scheduling and such for each of the threads, instead of the OS itself. >> > Ruby >> > 1.9 on the other hand, actually implements Native threads, where the OS >> > is >> > handling the Threads itself, and not Ruby. >> >> > What this means to you, is that if you were to use Ruby 1.8 Threads, and >> > you >> > have something like wxWidget's main_loop running, 99.9999 percent of the >> > time will be spent on main_loop, giving ruby extremely little chance to >> > run >> > any other threads. If at all. >> >> This answers a big question of mine. The client stops communicating with >> the server when the GUI is shown, until I start moving the mouse. The >> client only continues to process the socket thread if I continue to move >> the mouse. So if I run it on ruby1.9.1 that'll take care of that >> problem? >> >> Turns out I can't uninstall ruby1.8 without removing ruby completely. >> Ruby doesn't run if I have only 1.9.1 installed, oddly enough. So should >> I just leave ruby1.8 installed and install ruby1.9.1? Will that mean any >> script I run will automatically use ruby1.9.1? RVM seems to be way too >> complicated, not sure if I want to use RVM. XD >> >> > If all your doing is Reading Variables, and not assigning to them from >> > another thread, then you should be fine. But if your assigning data >> > from >> > other threads, then you need to create a Mutex, lock it for the period >> > that >> > your updating the data, then unlock it when your finished. If you >> > don't, >> > then you could get those nice little fatal errors, about access >> > violation of >> > memory addresses. I'm sure with your C++ background, you probably have >> > a >> > good idea what I mean by this. >> >> I will definitely need to be modifying the properties of the class >> instances that are initiated within the main_loop, from outside the >> main_loop in the socket thread. So it sounds like I'll have to be using >> locks. Thanks for telling me about that, probably would have taken me a >> while to find that. >> >> Also - this is probably what is causing the segmentation faults? The >> fact that I don't have synchronized blocks / mutex locks? >> >> > Thankfully, wxRuby allows you to write your own main_loop function, if >> > you >> > were to sub-class Wx::App. and using Wx::App#pending to see if there >> > are >> > any wxWidgets events pending, and if there are, using Wx::App#dispatch >> > to >> > dispatch events to be executed. Using this in concert with RubyGame, or >> > any >> > other library's own way of processing their own events, may help you >> > utilize >> > what you want to keep things running smoothly. >> >> What if I don't need to execute any code in the wx main_loop while the >> Rubygame main_loop is running? I can handle the combat mode using only >> Rubygame. >> >> Does that mean that, instead of rewriting the main_loop, I could just >> execute the Rubygame main_loop from inside of the wx main_loop? I could >> tell the wx main_loop to sleep while the Rubygame main_loop is >> executing, just to make sure it waits for combat to end. >> >> > I do hope that this helps you out, and progresses you further in >> > developing >> > your application / game. >> > >> > L8ers, >> > >> > Mario >> >> Yeah, you've been incredibly helpful. I don't think I would have got >> WxWidgets to show multiple windows without your explanation on the >> main_loop etc. Thanks! :) >> >> -- >> 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 Commander 3 > XO - Geo 99 > XO - STO IFT Fleet > http://www.trekfederation.com > http://geo99.ruby-im.net > > -- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Thu Oct 28 03:05:11 2010 From: lists at ruby-forum.com (Ron Shadow) Date: Thu, 28 Oct 2010 09:05:11 +0200 Subject: [wxruby-users] Already Initialized Constant THE_APP In-Reply-To: References: <70409c46fec828bf3fdb58d0f4a8808d@ruby-forum.com>, <254200fe252e219c599c1963d1b6b5a7@ruby-forum.com>, , <42593663367809cc5c4d2d396e07b8d4@ruby-forum.com>, Message-ID: <5349ad2ccdbf175baf19422888de11bf@ruby-forum.com> Mario Steele wrote in post #957691: > I am currently in the wxRuby chat room, if you wish to talk with me in > person, and I can answer some of these questions for you. Awesome, will drop on by. That's an IRC chatroom on freenode, right? #wxruby? Or do you mean another kind of chat room? -- Posted via http://www.ruby-forum.com/. From mario at ruby-im.net Thu Oct 28 06:43:46 2010 From: mario at ruby-im.net (Mario Steele) Date: Thu, 28 Oct 2010 06:43:46 -0400 Subject: [wxruby-users] Regards to Building of wxRuby 2.0.1 In-Reply-To: References: Message-ID: Alright, after running through various self-compilation tests, and switching between 1.8.7 p302 and 1.9.2 p0, I've ended up with the same results, pixmap_image_composite32() for some reason is causing a segfault in wxRuby, no matter the circumstances. I've had it crop up in a good portion of the examples, and been trying to backtrace the issues to their problems. Sadly, it seems that it doesn't matter which class is being used, and it doesn't matter which example is being tried out, it will still cause the same problems. Sometimes it'll wait till the user does an action, such as menu click, or it will crash immediately after the start of the run. And it always crashes on pixmap_image_composite32(). From what I've found of the libpixman library, it's a drawing function that will basically blit an image with a composite form from src, to destination. So it is some kind of drawing function, but somehow it's crashing. And I've tested with various C++ Examples provided with wxWidgets, and they all seem to operate perfectly fine. I'm currently at a lost as to what is causing this. On Thu, Oct 28, 2010 at 1:45 AM, Mario Steele wrote: > After doing a complete wipe clean of the code, and re-swigging and > compiling of the code, it looks as though Ruby 1.8.7 p302 has the same issue > as Ruby 1.9.2 p0. In the fact that aside from a few configuration errors on > our part, with the removal of wxMediaCtrl from the Debian/Ubuntu repository > version, that after getting the errors fixed, there's an issue with > libpixman, in the function pixman_image_composite32, running through the GDB > backtrace. > > I am therefore going to attempt to custom build wxWidgets myself, in static > form, and build wxRuby's so file in static mode, to see if the errors > progress, or fix. It may be solvable by using wxWidget's internal graphics > libraries over the system's libraries, but I won't know for certain till I > run the compile. I'm getting things setup now, to see what happens, and > will post on my progress once I get a version built. > > L8ers, > > Mario > > On Thu, Oct 28, 2010 at 12:59 AM, Mario Steele wrote: > >> Hello All, >> >> In regards to Ron's post, I have reviewed the gem created by the build >> process, and attempted to use it, and it is as you said, with Ruby 1.9.2 p0, >> when attempting to run most of the examples, it will cause a segfault, with >> a ruby backtrace, and debugging info, suggesting something has gone wrong. >> I've also attempted to build against Ruby 1.8.7 p302, and it seems that it >> has issues with rb_intern2 not being found for some reason. I just joined >> #wxruby on irc.freenode.net, if you are still available, we can research >> what is going on, and figure out a solution to this problem. >> >> -- >> Mario Steele >> Lieutenant Commander 3 >> XO - Geo 99 >> XO - STO IFT Fleet >> http://www.trekfederation.com >> http://geo99.ruby-im.net >> >> > > > -- > Mario Steele > Lieutenant Commander 3 > XO - Geo 99 > XO - STO IFT Fleet > http://www.trekfederation.com > http://geo99.ruby-im.net > > -- Mario Steele Lieutenant Commander 3 XO - Geo 99 XO - STO IFT Fleet http://www.trekfederation.com http://geo99.ruby-im.net -------------- next part -------------- An HTML attachment was scrubbed... URL: From sutniuq at gmx.net Thu Oct 28 10:07:18 2010 From: sutniuq at gmx.net (Quintus) Date: Thu, 28 Oct 2010 16:07:18 +0200 Subject: [wxruby-users] Regards to Building of wxRuby 2.0.1 In-Reply-To: References: Message-ID: <4CC98396.2010505@gmx.net> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 > In regards to Ron's post, I have reviewed the gem created by the build > process, and attempted to use it, and it is as you said, with Ruby > 1.9.2 p0, > when attempting to run most of the examples, it will cause a segfault Seems as if you're refering to me, but I'm not Ron. ;-) Am 28.10.2010 07:45, schrieb Mario Steele: > I am therefore going to attempt to custom build wxWidgets myself, in static > form, and build wxRuby's so file in static mode, to see if the errors > progress, or fix. It may be solvable by using wxWidget's internal graphics > libraries over the system's libraries, but I won't know for certain till I > run the compile. I'm getting things setup now, to see what happens, and > will post on my progress once I get a version built. > > L8ers, > > Mario > You may laugh, but I already tried that. Even with a self-compiled wxWidgets in static mode (exact build options I used can be found in the wxRuby wiki at http://wxruby.rubyforge.org/wiki/wiki.pl?HowToBuildWxWidgets ) I got the segfault. I compiled wxWidgets to the /opt/wxWidgets dir and tried to run files like this: $ export LD_LIBRARY_PATH=/opt/wxWidgets/lib $ export PATH=/opt/wxWidgets/bin:$PATH $ ruby -dw However, I might have done something wrong as it was the first time I compiled wxWidgets. Sadly enough, I'm not a C++ developer and don't have any knowledge of SWIG. I've done some C programming, but I think I can't be of much help. If it's any help I've joined the #wxruby IRC channel for now, but I don't have much time. Sorry for the late answer, but normally I'm not at home until 17pm. Except on weekends, of course. Just for information: My time zone is UTC + 2 as I'm living in Germany, next week it will be UTC + 1 when daylight saving time ends. Vale, Marvin -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJMyYOMAAoJEGrS0YjAWTKV4XsH/0l98tbKX4Lq8o/bNDN85snW xMX+dYVdcWtgqDCT8i+IRJZyD7+c7UDPFaej1sYseqbVBppMxx5r2FhZpbxVWity 2mBklu9zVK8/3r9LtufUcBQB+hTzsEallRuhZcz2yUQHQ1sb/7TELC0E7tJCYby3 rVu3LMktAv65KfuqZbXXZuiYUMwHjxgYAfxjZQVomODDSmBZWZQmuPe5qcPmUhGN 4i5bN/d0RdXNZnJoVP4tTJDGJQxFXyUOzon55m95lwILqsN7JW1pb7Wb/Zi8snnP fxjLKtljJQOHbP2wYrvrc79OgucYva5bEiPEYEU7VaCaM2wJMOetV56pKXApvdU= =0e2/ -----END PGP SIGNATURE----- From fabio.petrucci at gmail.com Thu Oct 28 10:47:10 2010 From: fabio.petrucci at gmail.com (Fabio Petrucci) Date: Thu, 28 Oct 2010 16:47:10 +0200 Subject: [wxruby-users] wxruby thread - gui updates Message-ID: Hi all, i've a question about ruby threads and gui update events: My app consist of several folders that needs to be updated depends on what the user do. Actually all the gui updates occurs in response to the user actions into the main wxruby process. It's just fine if the gui update takes short time but, sometimes, the gui update is a long running task and the user get stuck waiting for the process to complete. It would be nice to have gui update running on a separate thread. The first thing i thought was: ok i use the wxThread to update my long running gui task but unfortunately it's not included in wxruby distribution. On the other side, using ruby thread in combination with Thread.pass is good for external process not involving gui updates So, what is the right way to go to update gui interface on a separate thread using wxruby? Any suggestion would greately appreciated. bio. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lists at ruby-forum.com Fri Oct 29 08:06:03 2010 From: lists at ruby-forum.com (Ron Shadow) Date: Fri, 29 Oct 2010 14:06:03 +0200 Subject: [wxruby-users] Uninitialized Constant Wx Message-ID: <30fcdeee3f42fd71ec315859197866da@ruby-forum.com> Hello again. Another problem... I installed RVM, and then installed Ruby 1.9.1. After that I used RVM to make 1.9.1 the default Ruby version, and then I created a new gemset, and then I told RVM to use that new gemset for Ruby 1.9.1. Then I did "rvm gem install wxruby-ruby19". After this, I ran my client script once to test it and it worked just as well as it was working for 1.8. I concluded it worked and went on with more coding. A few hours later when I was going to test the new code, I started getting "Uninitialized Constant Wx" exceptions. So it appears as though the client succeeded in loading Wx one time, and that the client failed to load Wx every time afterward. I tried setting the default version of Ruby to 1.9.1 again, guessing that maybe it got reset to 1.8, but that didn't help. Then I remembered that I ran the WxRuby19 Sample "wxClient.rb" in a terminal after the first test of my client but before the next test of my client. Could it be that running the sample script somehow dislodged my client script from finding the Wx library? I just checked by placing a puts statement immediately after the 'require 'wx'' and 'include Wx' statements and then commented out 'include Wx'. The puts wasn't shown in terminal. Looks like it is the 'require 'wx'' statement that is throwing the exception. I'm also still getting that segfault crash with the boxsizers but I can only deal with one bug at a time XD -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Fri Oct 29 10:30:32 2010 From: lists at ruby-forum.com (Sasha Boutin) Date: Fri, 29 Oct 2010 16:30:32 +0200 Subject: [wxruby-users] Very slow blitting, trying to optimize. Message-ID: Hello, I'm coding a 2D map editor for a small game engine and I'm running into blitting problems. The bigger my map is, the longer it takes to blit a tile on it. sometimes, when I try to draw a tile to fast, it even fails completely at blitting and I have to close and reopen the program for it to work again. I have attached the main drawing methods to this post. How it works: 1) I have a custom cache class that creates and retrieves bitmaps on demand to speed up things a bit. Used especially when using tiles, layers or the whole tilemap bitmap. All get_X_bitmap methods you see are used to retrieve bitmaps from cache. 2) The draw_layer and draw_tilemap methods have a rect argument. When not nil, only the region specified by this rect is redrawn. Again, this is to speed up the whole process. I did some basic speed test using the Time class to see how log it takes to blit a tile depending on the map size, using 32x32 tiles. On a 20x20 map, the whole process takes around 0.032 to 0.041 seconds On a 100x100 map, it can take up to 0.5 seconds The most weird part is when I try to draw tiles to fast on a big map. It starts to blit the first few tiles (with a log of lag) and then it completly fails. Blitting now takes 0.0 seconds and nothing is drawn on screen. Any idea on how I can fix this? And pease tell me if there is not enough imformation or source code, i can provide more.:) Thank you very much! - Sasha Attachments: http://www.ruby-forum.com/attachment/5265/Tilemap_Draw.txt -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Oct 31 03:57:37 2010 From: lists at ruby-forum.com (Galen Laws) Date: Sun, 31 Oct 2010 08:57:37 +0100 Subject: [wxruby-users] wxruby thread - gui updates In-Reply-To: References: Message-ID: <2a5a82315ae10c9fce6d0d44ee26f965@ruby-forum.com> I'm new myself but perhaps you can use EvtHandler#add_pending_event from a standard thread to invoke an event handler in the gui thread. You could pass information with a custom event or set up a shared mutable object beforehand. http://wxruby.rubyforge.org/doc/evthandler.html -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Oct 31 05:02:25 2010 From: lists at ruby-forum.com (Galen Laws) Date: Sun, 31 Oct 2010 10:02:25 +0100 Subject: [wxruby-users] Panel with FlexGridSizer not collapsing correctly Message-ID: I have a custom class extending Panel for drawing lines, which shows an array being sorted. The application does 6 at a time and so there is a Panel ("gridPanel") with a 2x3 GridSizer managing them. Each cell contains another Panel ("arrayBorderPanel") with a 2x1 FlexGridSizer. The top row holds a Panel ("drawPanel" -- a 1x1 GridSizer) with the custom panel centered in it, and the bottom holds several StaticTexts in a Panel ("infoPanel") with 1x3 FlexGridSizer. The column and the top row of each arrayBorderPanel are growable. The infoPanels have growable columns but not rows. The frame expands correctly, with the column of the arrayBorderPanel expanding horizontally but only the top row growing vertically, and the custom panels auto-center. The problem is when the frame is decreased below the original size. In other guis I've used the drawPanels shrink vertically but the infoPanels stay fixed. With WxRuby the infoPanels are the first to disappear. I need these to stay put. Right now both drawPanels and infoPanels are added to sizers with a proportion of 0 and the EXPAND flag. I've tried giving one or the other a proportion of 1 and/or removing the EXPAND flag from the infoPanel sizer but this doesn't change anything. I have tried set_min_size on both the infoPanel and its FlexGridSizer but no change there either. Any help appreciated. -- Posted via http://www.ruby-forum.com/. From lists at ruby-forum.com Sun Oct 31 18:32:04 2010 From: lists at ruby-forum.com (Galen Laws) Date: Sun, 31 Oct 2010 23:32:04 +0100 Subject: [wxruby-users] Panel with FlexGridSizer not collapsing correctly In-Reply-To: References: Message-ID: Oh, I got it. Do everything, call Frame.fit, then set min_height on both sets of Frames. -- Posted via http://www.ruby-forum.com/.