Xrc loading in xrcise-generated base classes

Just a small suggestion… after generating a dialog base class with
xrcise, I end up having to modify the line to load the xrc file to the
following:

xml.load(File.join(File.dirname(__FILE__),

“progress_dialog_base.xrc”))

in order to make sure the base class can still load the xrc if the
working directory is not the app root - and this also enables me to keep
all of your xrc files and generated classes in a project subdirectory…

Could something like this be added xrcise so this would be the default?
It also might be nice to have xml.load search the ruby $LOAD_PATH if
that is possible…

Cheers,
Tim

Hi Tim

Tim F. wrote:

It’s a good point you raise …

Could something like this be added xrcise so this would be the default?
It also might be nice to have xml.load search the ruby $LOAD_PATH if
that is possible…

… but I’m not sure I’m wild about your exact solution, at least as the
default. I personally to keep XRC files in share/, along with icons,
translations etc, and only .rb files in lib/. It’s just a matter of
preference.

Maybe the solution is a xrcise command-line option - or better, I should
get around to finishing the XRC->pure ruby translator which removes the
need for the XRC file at all at runtime. There’s a heap of code checked
in to do this, I just never got around to hooking it up to the
command-line tool.

alex

Alex F. wrote:

It’s a good point you raise …

… but I’m not sure I’m wild about your exact solution, at least as the
default. I personally to keep XRC files in share/, along with icons,
translations etc, and only .rb files in lib/. It’s just a matter of
preference.

Agreed … and I like the idea of there being flexibility in whatever
way this is approached. To each his own, and all that… :slight_smile:

Maybe the solution is a xrcise command-line option - or better, I should
get around to finishing the XRC->pure ruby translator which removes the
need for the XRC file at all at runtime. There’s a heap of code checked
in to do this, I just never got around to hooking it up to the
command-line tool.

A command line option would be cool … something like “append
(interpolated) path”, maybe…

The thought occurs to me, though, that I could just just wire up the
substitution as part of the rake task that generates the base classes…
I just wasn’t sure if anyone else had a similar request…

As for the translator, do you intend to have it work in both directions
or just from XRC to ruby? Sounds interesting in any case…

Cheers,
Tim

Tim F. wrote:

Maybe the solution is a xrcise command-line option - or better, I should
get around to finishing the XRC->pure ruby translator which removes the
need for the XRC file at all at runtime. There’s a heap of code checked
in to do this, I just never got around to hooking it up to the
command-line tool.

A command line option would be cool … something like “append
(interpolated) path”, maybe…

I’ll give it some thought, definitely in favour of this.

The thought occurs to me, though, that I could just just wire up the
substitution as part of the rake task that generates the base classes…
I just wasn’t sure if anyone else had a similar request…

Actually, that’s probably an easier solution - should only be a few
lines in Rake. You don’t want to see the extensive mangling that the
wxRuby build process does to SWIG’s output.

As for the translator, do you intend to have it work in both directions
or just from XRC to ruby? Sounds interesting in any case…

LOL - just XRC to ruby. Ruby to XRC would be … wild.

alex