Re: Gtk2-perl shell (problem with GLib-GObject)




On Jan 18, 2005, at 7:30 AM, Remco Wouts wrote:

muppet wrote:
have you seen
  http://asofyet.org/muppet/software/gtk2-perl/gish.html
or
  http://asofyet.org/muppet/software/gtk2-perl/gws.html
I had seen gish of course ;-).

Perhaps we should combine our efforts.

On my system it uses 99% of the CPU continuously.

Interesting. I'd never paid attention to the CPU usage on it. It looks like Tk::DoOneEvent is getting called constantly with $_[0]=0, and i'm using $_[0] as the "may block" parameter to Glib::MainContext::iteration... so it runs constantly. I just tried again passing true for may block at all times, and the CPU usage goes away, with what appears to be no impact on interactive performance.

After STFW, it appears that DoOneEvent's argument is a bitfield describing which events to process, not a boolean, so that was bug on my part. :-/
Here's an updated version:
http://asofyet.org/muppet/software/gtk2-perl/gish-0.3

That is why I decided to use Term::Readline::Gnu. Also I wanted to use history and completion.

The reason i made the evil custom Tk package hack was that i didn't have Term::ReadLine::Gnu available on all of my systems; i require only Term::ReadLine, any implementation will work. I do think your version is cleaner, and the history recall is definitely much nicer... i just noticed completion was in the TODO section of my version's pod. ;-)


The workaround for this would be to use different type names every time. It would be conceivable to have the bindings generate a new C type name for each package, but this is not desirable for several reasons:
...
Well I don't want to change the types, just the methods when I reread a package, maybe that can be done somehow.

Redefining methods in perl works fine (you can do it trivially when using gws), although i'm not sure there's a way to disable the "subroutine foo redefined at line xx" warning (perhaps turning off strict? i can't remember).

If you wanted to add or change a signal, signal override override, or property, you'd have to reregister the class with GType, because there's no way to change those without modifying the GTypeClass structure.


2) The subclassed widget itself does not work correctly ie. after the first 'do' it loads but does not display correctly. It does display correctly when you load modify 'gish' to load the package at startup.
What do you mean by "does not display correctly"?
What version of Glib are you using? There's a bugfix in 1.060 related to late loading of Glib::Object::Subclass.
1.042. I'll upgrade

Yeah, you're probably seeing the "too late to run CHECK block" bug; that would cause some important methods not to get set up on your Subclass.

If that doesn't fix it, ask again.

Thanks for looking at this.

no problem.

--
Without treatment, a common cold will last about seven days.
With treatment, it will last about a week.
  -- conventional wisdom




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]