Xrcise not working


#1

Hi. I’m back. Unfortunately I can’t get xrcise working. Here is the
sample xrc file and the resulting error messages:

=============== TestWxFb.xrc =========================================

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>


wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL
500,300
Minimal

wxVERTICAL

0
wxALL|wxALIGN_CENTER_HORIZONTAL
5

Test



1
wxEXPAND
5

wxHORIZONTAL

0
wxALL
5

Username



0
wxALL
5


0





1
wxEXPAND
5

wxHORIZONTAL

0
wxALL
5

MyLabel



0
wxALL
5


0






xxx:~/Desktop/Eyes$ xrcise -o TestWxFb.rb TestWxFb.xrc
/home/myhome/gems/gems/wx_sugar-0.1.22/lib/wx_sugar/xrc/outputter.rb:46:in
clean_id_attr_readers': undefined methodeach’ for #String:0x859ff44
(NoMethodError)
from (erb):16:in output' from /opt/lib/ruby1.9/1.9.1/erb.rb:753:ineval’
from /opt/lib/ruby1.9/1.9.1/erb.rb:753:in result' from /home/myhome/gems/gems/wx_sugar-0.1.22/lib/wx_sugar/xrc/outputter.rb:19:inoutput’
from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:126:in block (2 levels) in <top (required)>' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:125:ineach’
from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:125:in block in <top (required)>' from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:124:inopen’
from /home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise:124:in <top (required)>' from /home/myhome/gems/bin/xrcise:19:inload’
from /home/myhome/gems/bin/xrcise:19:in `’

wxFormbuilder 3.0
wx_sugar version 0.1.22
wxruby-ruby19-2.0.1-x86-linux
wx_sugar-0.1.22
Ubuntu version 9.10 (Karmic Koala)

=============== .bashrc file ========================================

PATH=/opt/bin:/home/myhome/gems/bin:$PATH
LD_LIBRARY_PATH=/opt/lib:$LD_LIBRARY_PATH
export GEM_HOME=/home/myhome/gems

How do I make xrcise work properly? Thanks.

  • Philip

#2

Hello Philip,

The problem you are having, is the fact that Ruby 1.9 String standard
class
no longer implements the each method on it. Which basically, for
string,
each splits the lines at the \n terminator, returning each line to the
block, so you need to create a library file, and have it included, as
follows:

string_each.rb:

class String
def each
self.split("\n").each do |line|
yield line
end
end
end

Then there’s two ways you can work this, either on the command line, do
the
following:

xrcise -rstring_each -o TestWxFb.rb TestWxFb.xrc

Or, modify the xrcise script itself, found in
/home/myhome/gems/gems/wx_sugar-0.1.22/bin/xrcise

And add a require ‘string_each’ before any other require. I will see
about
fixing this bug, and doing a new release of wx_sugar to fix this problem
with Ruby 1.9, along with any other outstanding bugs that I can find in
regards to wx_sugar.

hth,

Mario