Re: Gtk3

2011-05-11 Thread Aristotle Pagaltzis
* Emmanuele Bassi eba...@gmail.com [2011-02-27 20:45]:
 I should be able to devote at least a full day every week to
 work on this.

I see there was moderate activity for a while. What’s the status,
purely out of curiosity?
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: How to get the Class name of an element

2010-04-16 Thread Aristotle Pagaltzis
* Pelle Nilsson pellenils...@fastmail.fm [2010-04-16 13:00]:
 If an object is used in a string context it will return
 something like

 Gtk2::Entry=HASH(0x12cfba8)

 so you can use something like

 if (substr($text, 0, 11) eq 'Gtk2::Entry') {
 print Entry!\n;
 } elsif (substr($text, 0, 14) eq 'Gtk2::ComboBox') {
 print ComboBox!\n;
 }

Wow, this is worthy of DailyWTF. I hope you have never actually
used this technique in any code.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Display HTML Page

2010-01-30 Thread Aristotle Pagaltzis
* Zettai Muri zettaim...@ymail.com [2010-01-26 04:50]:
 Gtk2::WebKit

That is probably your best option.

Avoid gtkhtml*.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Custom TreeModel

2010-01-17 Thread Aristotle Pagaltzis
* Emmanuel Rodriguez emmanuel.rodrig...@gmail.com [2010-01-14 08:35]:
 I see that there's not way to avoid the cache. It's a bit of
 a pity that I can't detect when an iter is no longer needed as
 eventually all nodes will be duplicated into the cache.

 I'm guessing that with a normal (pure Perl) tree model this
 will not be the case as nodes will be already in the model.
 Using XML::LibXML nodes is a bit peculiar as the memory
 management is a bit different. If I'm not mistaken XML::LibXML
 assumes that nodes are attached to the underlying C model and
 that the SVs wrapping them can be easily discarded at anytime
 as long as the original C structure lives.

 I could rewrite this tree model with a pure Perl tree model
 (HTML::Tree) and add it to the Gtk2-Perl examples.

It sounds to me like what you want is to store some kind of
pointer in the iter (eg. an XPath) whereby the same node can be
re-requested from XML::LibXML in the event that it has to.

I think.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Custom TreeModel

2010-01-17 Thread Aristotle Pagaltzis
* Emmanuel Rodriguez emmanuel.rodrig...@gmail.com [2010-01-17 23:00]:
 I'm guessing that the problem occurs because there's no other
 variable that holds a reference to the values stored in
 TreeIter. Once the method that builds the TreeIter returns the
 Perl scalars stored in the iter get reclaimed.

What prevents you from holding onto the strings you pass into the
TreeIter yourself?

 This is why I tend to believe that with a pure Perl tree things
 will work better as the nodes will still have a refcount of 1.

You’re going to swap out the entire DOM, and go to a more memory-
hungry and slower approach, just because the strings aren’t held
onto, and you aren’t willing to hold onto them yourself? That’s
not what I’d do… but suit yourself I guess…

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: setting a transparent color on a pixbuf for Canvas layering

2008-07-02 Thread Aristotle Pagaltzis
* muppet [EMAIL PROTECTED] [2008-07-01 06:25]:
 In perl, it's a bit more difficult to manage a GdkPixbuf's
 image data. You could write some XS to do it in C with speed
 and ease, but then you have XS code to deal with. You could
 write it in perl and deal with a map-reduce and unpack and pack
 and all the fun stuff there, and hope you can get the speed
 reasonable.

 Or, just use GD, which has already solved the problem for you.

Or you can use it as an opportunity to learn PDL, which is what
kids these days would call a DSL, for manipulating just that sort
of data stored linearly in memory with performance much like that
of C, in Perl.

Of course you’ll have to write more code that way, and there’s a
somewhat steep learning curve to climb if you’ve never used PDL
before. For byte-pushers it’s worth the time, though.

Oh, and if you’re not going to do that, you could check out the
Imager module as an alternative to GD which I find a whole lot
nicer than GD in a whole lot of ways.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Putting text with links in a TreeView

2008-06-01 Thread Aristotle Pagaltzis
* Torsten Schoenfeld [EMAIL PROTECTED] [2008-05-31 14:25]:
 Making text blue and underlined is no problem, I assume.

Of course not.

 I think you will have to use motion notify events: […] This
 [example code] will make the whole cell clickable.

Yeah, but that’s not worth much, as I can already do that in
simpler ways with the interface that the TreeView and ListStore
give me out of the box.

 There might be a way to only make the text inside the cell
 clickable via $cell_x and $cell_y, but I don't know how offhand
 -- I assume this won't be possible without a custom cell
 renderer, though.

More specifically it’s not just “the text inside the cell” I am
interested in – it is the *portions* of the text that look like
a link. (And then each such portion individually.)

So I guess what you are saying amounts to telling me that I need
to find out how SexyUrlLabel does it and then duplicate that
logic within a custom cell renderer. I feared that this would be
the answer. Oh well.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Putting text with links in a TreeView

2008-05-30 Thread Aristotle Pagaltzis
* Aristotle Pagaltzis [EMAIL PROTECTED] [2008-05-27 10:25]:
 […]

Warnocked. :-(

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Putting text with links in a TreeView

2008-05-30 Thread Aristotle Pagaltzis
* muppet [EMAIL PROTECTED] [2008-05-31 04:45]:
 Unfortunately, i have no advice.

Do you have an idea how I could emulate SexyUrlLabel then? As in,
duplicate the behaviour that some area of the text can be clicked
to invoke a signal?

(You know, I never ever dreamed that one day while trying to
write a GUI app I would not only baldfacedly but completely
honestly say that HTML and CSS have spoiled me.)

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: application to show to potential users?

2007-08-20 Thread A. Pagaltzis
* zentara [EMAIL PROTECTED] [2007-08-20 14:55]:
 if you want to impress people, Wack is a very lousy name.
 
 I assume you are from a non-US location, but here in the US,
 wack , in common slang,  means fubar. (amoung other things
 :-) )

Errm, it’s a GUI for `ack`, a tool which has a switch called
`--thpppt`. I dunno about you, but “wack” seems like a perfectly
fitting choice.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: application to show to potential users?

2007-08-19 Thread A. Pagaltzis
* Gabor Szabo [EMAIL PROTECTED] [2007-08-19 08:00]:
 wack - a GUI for ack

Awww, that just *begged* for the name “gack”. :-)

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: about scrolling

2007-05-23 Thread A. Pagaltzis
Hi Dimitar,

* Dimitar Kenanov [EMAIL PROTECTED] [2007-05-23 12:50]:
 i have a quation about scrolls. I have a page in a Notebook
 with for example 70 widgets inside. I made a Find function to
 find the widget i want. I find it. But then how can i make so
 that when i find it the page to scroll automaticaly to this
 position.

You ask the widget for its `-allocation`, then go up the tree of
containers, adding their X/Y positions to the widget’s position,
until you get to the ScrolledWindow widget. Thus you get the X/Y
position of the widget within the ScrolledWindow.

To scroll, you need to ask the ScrolledWindow for its HAdjustment
and VAdjustment, then do `-set_value` on them.

However, I don’t know how to ask a ScrolledWindow for how much
virtual area it has, which would need in order to convert from
the X/Y coordinates of the widget to a relative position in the
upper..lower value range of the Adjustments.

At least that’s roughly how it should work. I haven’t written
Gtk2-Perl code in a while, so I’m probably wrong in various
details. However, that should be the right general approach.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Why does my cursor doesn't change

2007-04-04 Thread A. Pagaltzis
* Emmanuele Bassi [EMAIL PROTECTED] [2007-04-03 18:50]:
 On Tue, 2007-04-03 at 11:36 -0500, Kenneth Swanson wrote:
  Are we not telling people the other, quick 'n' dirty way to
  get around this?  That is, that if you have a long block of
  code in a callback or some other code, you can add the line
  
  Gtk2-main_iteration while(Gtk2-events_pending);
  
  to get the GUI to update?  Or does that not work correctly
  anymore?
 
 it's not the kosher solution: forcing the main loop to spin
 it's an hack, and masks the real problem

That’s true, but does it have any *tangible* drawbacks to kick
the mainloop manually? Is there any reason why this shouldn’t be
used even in cases where it would be *much* harder to punt the
processing to a timeout callback (or a forked child)?

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: From Tk to Gtk

2007-03-06 Thread A. Pagaltzis
Hi Judith,

* Judith [EMAIL PROTECTED] [2007-03-05 19:15]:
 Hello every body I'm currently programming under perl Tk, but I
 want to move to perl Gtk, I want to know the diffrences between
 these two and wich is the last version of Gtk, thanks in
 advanced!!

the biggest difference is probably that with Gtk2, you have a
fighting chance of writing tidy code. Tk is really effective at
making the application source code incredibly ugly.

I know that’s not much help :-), but I don’t really have much to
add to what has already been said about the technical differences.

Gtk2 and Tk represent very different ways of doing the same
thing. Tk is easier for small stuff, but it gets nasty very
quickly. Gtk2 has more explicit indirection, so there is more
coding overhead, sometimes a lot more; this is particularly
noticable in small programs. However it makes it easy to divide
the code into pieces that have exactly one responsibility, which
makes it tremendously easier to write large programs with less
code and cleaner code than Tk allows.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: What about Gtk2::Ex in gtk2-perl ?

2007-01-30 Thread A. Pagaltzis
* Zurd [EMAIL PROTECTED] [2007-01-30 03:40]:
 My problem is that I don't want any other dependencies that my
 software has to install

http://search.cpan.org/dist/PAR/

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Gtk2::ComboBox with a dummy entry

2007-01-30 Thread A. Pagaltzis
* Matthew Braid [EMAIL PROTECTED] [2007-01-29 05:05]:
 Essentially, I want the CB to always show 'Choose an extension
 to add', but have a list of valid extensions pop up when its
 clicked that does _not_ include 'Choose an extension to add'
 
Sounds like bad UI design to me. You are aware how badly this
violates user expectations? Is there a really important reason
to make this control behave so gratuitously differently from all
other comboboxes the users have seen before?

“Choose an extension to add” should be a label, not hacked into
the control itself. Actually it would be “Extension to add”,
since “Choose an” is redundant; the fact that there is a combobox
is inherently a prompt to make a choice so this fact needn’t be
pointed out separately.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Gtk::TreeStore insert_with_values weirdness

2007-01-06 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2007-01-04 19:55]:
 Now, perl's looks_like_number() function is implemented like
 this:

 [snip]
 
 It would be interesting to know which of those tests is failing
 here. Are we failing on bad handling of get magic? Does the
 Readonly variable refuse to be coerced into a string?

Coercion generally modifies the scalar in Perl to cache the
coerced value. It sounds quite plausible that Readonly prevents
this and is therefore causing these failures indirectly via that
route. But that’s just a hypothesis.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: SimpleList scroll to end

2007-01-06 Thread A. Pagaltzis
* zentara [EMAIL PROTECTED] [2007-01-06 17:55]:
 I wanted to add a SimpleList to a ScrolledWindow, then auto
 scroll to the end.
 
 What is the best way to force the scrollbar to the end? I have
 a bad hack that works below, but I'm sure I'm overlooking
 something. :-)

You’ll have to experiment some, I think, as I can’t glean the
answer from the docs. Basically tho I see two options: if the
TreeView automatically modifies the `lower`/`upper` properties
of the Adjustment objects it’s associated with, then you can use
the `value-changed` signal of the `vadjustment` property object
of the TreeView to change the Adjustment’s `value` property to
the maximum given in `upper`. Otherwise, you’ll have to see what
the default values for `lower`/`upper` are and change the `value`
property from the ListStore’s `row-inserted`/`row-deleted`
signals. Or some such.

It is really pretty obvious if you keep in mind how Gtk2 is
architected.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Gtk2-show_about_dialog() bug

2006-11-23 Thread A. Pagaltzis
* A. Pagaltzis [EMAIL PROTECTED] [2006-11-24 04:10]:
 Despite the amount of effort I put in it seems I can only
 dredge up mailinglist posts, though, not anything solid, like,
 say, some piece of official documentation.

IRC comes through: it’s in section 5.5 of the GCC 3.3 manual, eg.
http://gcc.gnu.org/onlinedocs/gcc-3.3.6/gcc/Constructing-Calls.html
Reading that, it doesn’t fit the purpose at hand.

libffi doesn’t seem to have more documentation that the README:
http://gcc.gnu.org/viewcvs/trunk/libffi/README?view=markup
And the README explicitly states that it doesn’t support vararg
functions yet.

So no. gtk_show_about_dialog() will have to be reimplemented in
Perl.

Maybe someone can talk to the gtk+ folks about this? They should
consider the “bindability” of things they put in the library,
after all… the varargs function is just for C hacker convenience
after all; it should be a wrapper that calls a function that uses
a plain ol’ data structure, so that C hackers can use what’s
convenient while infrastructure people can bind what’s bindable.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Images from data

2006-10-19 Thread A. Pagaltzis
* Matthew Braid [EMAIL PROTECTED] [2006-10-20 01:45]:
 now it works and in a very similar way to my existing code
 - extra bonus :)

Extra bonus? Is that like superfluous redundancy? :-)

SCNR,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: blocking code after main loop

2006-10-09 Thread A. Pagaltzis
* Sergei Steshenko [EMAIL PROTECTED] [2006-10-09 23:30]:
 Are you sure it's delete-event and not 'delete_event' in

It’s either.

 For some reason Perl gtk2 developers decided to rename foo-bar
 in C into 'foo_bar' in Perl.

No, they support both. That way you can omit the quotes in Perl
when it’s on the left side of a fat comma.

 I always curse - since most of the info is in C gtk2
 documentation, so I have to remember not to forget to do the
 additional transaltion for the code to work.

Curse no more.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Directory/file browser as TreeView

2006-09-30 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2006-09-29 14:16]:
 my $child = $tree_store-append(undef);
 $tree_store-set($child, 0, '/', 1, '/');
 add_to_tree($tree_store, $child, '/', '/');
 
 For shame!  Use File::Spec to manipulate the paths portably!
 :-)

Or Path::Class. 10× nicer than File::Spec and the entourage of
other path manipulation modules. Also has a direct tie-in for
doing I/O. Best module discovery of 2005 for me. Seriously, it’s
ridiculously much better than what we had before.

(Also, the I/O shortcuts API is not insane like IO::All’s. Plus
IO::All doesn’t help you at all with file paths.)


* Ratcliffe, Jeffrey (Peters) [EMAIL PROTECTED] [2006-09-29 14:20]:
   use constant TRUE  = 1;
   use constant FALSE = 0;
 
  use Glib qw(TRUE FALSE);
 
 OK. I had always assumed that this:
 1. loaded Glib, taking time and memory.
 2. amounted to the same thing anyway.

Err. Do you know how big constant.pm actually is? Ironically,
Glib.pm is required for Gtk2.pm and therefore loaded anyway,
whereas a basic Gtk2-Perl program does not load constant.pm. So
your misguided optimisation is actually a pessimisation.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Directory/file browser as TreeView

2006-09-30 Thread A. Pagaltzis
* Ratcliffe, Jeffrey (Peters) [EMAIL PROTECTED] [2006-09-29 14:16]:
 sub add_to_tree {
  my ($tree_store, $parent, $dir, $path) = @_;
  
  my $tree_model = $tree_view-get_model();
 
 # If $parent already has children, then remove them first
  my $child = $tree_model-iter_children ($parent);
  while ($child) {
   $tree_store-remove ($child);
   $child = $tree_model-iter_children ($parent);
  }
  
 # Add children from directory listing
  opendir(DIRHANDLE, $path) || die Cannot open directory: $!\n;
  foreach my $subdir (sort readdir(DIRHANDLE)) {
   if ($subdir ne '.' and $subdir ne '..'
 and -d $path.$subdir and -r 
 $path.$subdir) {
my $child = $tree_store-append($parent);
$tree_store-set($child, 0, $subdir, 1, $path$subdir/);
   }
  }
  closedir(DIRHANDLE);
 }

A better idea would be to install an idle callback that reads one
directory entry per call. This will prevent the program from
becoming unresponsive when the user expands into a subdirectory
with 10,000 files.

You can do this pretty easily by using a lexical directory handle
and hooking up a closure that captures it as the idle callback.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Signal on process end

2006-08-10 Thread A. Pagaltzis
* Ratcliffe, Jeffrey (Peters) [EMAIL PROTECTED] [2006-08-10 14:15]:
 How best do I see when the process has finished?

You try to read from it and get undef.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Threading

2006-08-06 Thread A. Pagaltzis
* Jens Luedicke [EMAIL PROTECTED] [2006-08-06 21:40]:
 any hints?

The simplest (in some way) is if you can peform your long task
piecemeal. Then just do it bit by bit in an idle callback.

Another option might be to fork off a child process to perform
the heavy-duty work and have the parent listen to the child on a
pipe. You can have Glib take care of the asynchronicity for you
by sticking the processing code in an I/O watcher callback.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: SimpleList interline padding and background

2006-07-21 Thread A. Pagaltzis
* Dirk Koopman [EMAIL PROTECTED] [2006-07-21 17:15]:
 Have a screen shot:

That looks perfectly fine. Any less, and I’d find it difficult to
read. Don’t go overriding it with no recourse for a user who
disagrees with your taste – that’s what themes are for. Use a
different one if you think it’s too much.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: [OT] Perl question

2006-06-29 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2006-06-29 14:25]:
 You can avoid the whole issue by using a sandbox, or nonstandard  
 library location.
 
 perl Makefile.PL PREFIX=/some/place
 export PERL5LIB=/some/place/lib/perl5/site_perl

Note that using Module::Build and its `install_base` option
rather than ExtUtils::MakeMaker and its `PREFIX` makes this
easier, since M::B doesn’t install into a funny directory tree
below in the given location, but rather directly to the target
location.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: need help in tutorial(alpha)

2006-05-17 Thread A. Pagaltzis
* Mat Wilson [EMAIL PROTECTED] [2006-05-18 03:10]:
 # We do not have a Glib::CLAMP function, so we provide it here.
 sub clamp ($val, $low, $high)

That is a syntax error in Perl.

 {
   return (($val  $high) ? $high : (($val  $low) ? $low : $val));
 }

use List::Util qw( min max );
# ...
return min $low, max $high, $val;

 I think the error is the lines
 
   # This sets the adjustment and make it emit the changed 
 signal to
   # reconfigure all the widgets that are attached to this signal.
   $set-set_value(clamp ($set-value,
  $set-upper - $set-page_size,
  $set-lower));
 
 to do with the commas

I don’t see any error in there.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: need help in tutorial(alpha)

2006-05-17 Thread A. Pagaltzis
Et tu, muppet? :-)

* muppet [EMAIL PROTECTED] [2006-05-18 05:40]:
 See the Prototypes section in the perlsub manpage for more
 information.

No, please don’t. Instead, read
http://library.n0i.net/programming/perl/articles/fm_prototypes/

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: State variables

2006-05-04 Thread A. Pagaltzis
* Torsten Schoenfeld [EMAIL PROTECTED] [2006-05-04 19:05]:
 If you put a block around a sub, you can declare a lexical
 variable in that scope but outside the sub.  It will then
 behave like a state variable:

Is that really exactly what state variables do? So far, all
explanations about what state variables in Perl 6 are for have
left me confused. I assumed they work the way you outlined, but
all descriptions I’ve seen make them sound much more subtle and
hard to grasp.

Is that really all?

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Progressbar in a statusbar?

2006-03-27 Thread A. Pagaltzis
Hi Mario,

* Mario Ospelt [EMAIL PROTECTED] [2006-03-27 15:30]:
Can a statusbar be divided into several parts, so that in each
part different information can be shown (and in one of them e.g.
a progressbar). Or do I have to use a HBox and create several
statusbars in each of the boxes?

if you check the docs, you will find that GtkStatusbar *is* a
GtkHBox. So you can simply pack widgets into it using the GtkHBox
interface. Be aware that you can only pack them into it to the
right of the status text label widget, though.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: error dialog not centered

2006-03-19 Thread A. Pagaltzis
* Beast [EMAIL PROTECTED] [2006-03-20 05:35]:
i know its personal preference but centered makes balance
spaces, and i guess everybody will agree on this :)

I like asymmetry.

Regarding icon, icon is good as long as its not overused. I saw
that Linux (or GNOME) application are using icons everywhere, it
makes application less elegant than in windows.

That’s your opinion. I like having more icons better; they make
it much easier to use a familiar program.

If you consider this bad, talk to the GNOME Human Interface
Guidelines people.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Programming style: using Classes or inline

2006-03-17 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2006-03-17 15:50]:
I think a require of a file that does not define a package may
behave similarly to what C does.

Sort of. `require`ing a file multiple times won’t load it
multiple times. In Perl, you get that using `do $filename`,
which equates to `eval slurp($filename)` (except that there’s no
builtin `slurp`).

But even that is not the same. An `#include` in C is a purely
textual inclusion, so it does not have any semantics at the
language level. It does not affect scopes, f.ex. Of course, this
is a truism, because `#include` is handled by the preprocessor
long before the compiler even sees the source, so the compiler
actually has no idea what macros or includes where there before.

In Perl, there is no such thing as “does not affect scope,”
unless maybe your main program consists of an elaborate version
of

eval slurp( $file1 ) . slurp( $file2 ) . slurp( $file3 );

which gets you back to the C-ish purely textual processing.

But the Perl way, of course, is much better; and not because Perl
does it that way. It’s the way every language designed with
modularity in mind works. C never was. (Not that I’m dissing C,
mind. C is extremely good at what C is good at.) Not that you
have much choice where Perl is concerned, because Perl is
extremely hard to parse and makes it even harder to safely paste
together pieces of source code programmatically; this makes
preprocessing (eg. source filters) highly buggy and dangerous.

[NB.: this is only half directed at you-as-in-muppet, of course;
half of it is more for the benefit of anyone who does not already
know all this.]

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Requirements for Gtk2::ComboBox?

2006-01-30 Thread A. Pagaltzis
* Kenneth Swanson [EMAIL PROTECTED] [2006-01-30 19:30]:
(I was compiled against 2.0.6).

My condolences.

SCNR :-),
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Requirements for Gtk2::ComboBox?

2006-01-27 Thread A. Pagaltzis
Hi Kenneth,

* Kenneth Swanson [EMAIL PROTECTED] [2006-01-28 01:00]:
My Gtk2 version is 2.6.4, which I think should have it; but
$Gtk2::VERSION is 1.081.  I couldn't figure out whether that was
too old for this widget or not.

the binding has been in Gtk2-Perl for a long time (since 1.040 if
my quick check is correct). But what matters is not which version
of gtk+ and which version of Gtk2-Perl you have, rather the
question is which version of gtk+ your installation of Gtk2-Perl
was compiled against. None of the widgets from gtk+ versions
newer than the one the module was compiled against will be
available.

If in doubt, reinstall Gtk2-Perl.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: gtk2-perl on path to world domination

2006-01-21 Thread A. Pagaltzis
* zentara [EMAIL PROTECTED] [2006-01-21 13:35]:
Well then, that makes muppet our glorious leader. :-)

I prefer “fearless.”

* muppet [EMAIL PROTECTED] [2006-01-21 15:45]:
s/muppet/kaffee/

Ah, that's much better.  ;-)

The puppetmaster never reveals himself, huh?


I for one welcome our new XS-hacking overlords,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Progress bar help

2006-01-20 Thread A. Pagaltzis
Hi Daniel,

* Daniel Davidson [EMAIL PROTECTED] [2006-01-20 17:10]:
However when I go and try to have the function automatically
increment itself every second toward 100%, the bar does nothing
until the function completes and it immediate jumps to 100%.

try clearing pending events every time you send a pulse.

Gtk2-main_iteration while Gtk2-events_pending;

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Signal when the cursor of a GtkTextView is changed

2006-01-18 Thread A. Pagaltzis
Hi Eduardo,

* Eduardo M KALINOWSKI [EMAIL PROTECTED] [2006-01-18 22:40]:
But I could not find a way to do that.

The Text Widget Overview document in the docs says this:

You can think of a mark as an invisible cursor or insertion
point; it floats in the buffer, saving a position. […] Like
tags, marks can be either named or anonymous. There are two
marks built-in to GtkTextBuffer; these are named insert and
selection_bound and refer to the insertion point and the
boundary of the selection which is not the insertion point,
respectively. If no text is selected, these two marks will be
in the same position. You can manipulate what is selected and
where the cursor appears by moving these marks around. [2]

There is a move-cursor signal in GtkTextView, but the docs say
that one should not connect to it. Is there a way to catch
cursor movements in a signal?

Having read the documentation, we find that what you probably
need to do is find a signal which lets you know about changes to
the named mark `insert` in the TextBuffer that your TextView is
connected to.

The documentation for TextBuffer lists a signal `mark-set`.
Sounds promising, so let’s try it:

$buffer-signal_connect( mark_set = sub {
my ( $buffer, $iter, $mark ) = @_;
warn if $mark-get_name eq 'insert';
} );

And what would you know – this produces a warning whenever the
cursor is moved.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: progress, statusbar, update

2006-01-18 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2006-01-18 23:05]:
Even better still would be forking a child to create the PDFs in
the background, uninterrupted and free of bizarre progress
update code, and monitor the life of that child by waiting for
it to hang up on its stdout.

Or have the child produce some output in regular intervals so the
foreground app can twiddle a progress indicator in response.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: packaging for windows

2006-01-12 Thread A. Pagaltzis
* Konovalov, Vadim [EMAIL PROTECTED] [2006-01-12 17:20]:
Unlike Tk, where GUI part is inside extension, perl-Gtk uses
external bindings, so your proposal will end up with including
entire Gtk engine inside ActivePerl distribution? I think this
isn't possible.

Possible, yes; practical, I dunno…

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: what's the name?

2005-12-29 Thread A. Pagaltzis
* Beast [EMAIL PROTECTED] [2005-12-29 11:15]:
 Thanks. But any idea what widget is used in this screen? It
 allow user to select some area which toggle the hours and days.

There’s nothing like that in stock gtk+.

It’s called a “grid view” or something along these lines.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Gnome canvas problem on Ubuntu

2005-12-04 Thread A. Pagaltzis
* Yaakov S (Cygwin Ports) [EMAIL PROTECTED] [2005-12-04 20:30]:
 But why wouldn't it be sufficient just to push a new version
 (which you'll have to do either way) without the custom boxed
 wrapper and require libgnomecanvas-2 = 2.12.0?

Because then it won’t work with older versions?

Regards,
-- 
#Aristotle
*AUTOLOAD=*_;sub _{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Gtk2 apps killing my Perl/Tk apps

2005-11-15 Thread A. Pagaltzis
* zentara [EMAIL PROTECTED] [2005-11-15 20:55]:
 So why does my Perl/Tk app get the _GTK_LOAD_ICONTHEME command?

I assume it’s because gtk2 is broadcasting it to all windows;
which normally should cause no problems.

 Why does my Tk app die, should'nt the Gtk2 app die if the c-lib
 is running over it's memory boundaries?

No memory boundaries are being run over. Tk reacts badly to the
reception of that command (atom? not sure about the X11
terminology).

In other words, this *may* be a bug in gtk2, but it *definitely*
is a bug in Tk.

Just another reason to use gtk2 rather than Tk… :-)

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Threads and Gtk2

2005-10-20 Thread A. Pagaltzis
* zentara [EMAIL PROTECTED] [2005-10-20 18:35]:
 I know goto's are currently out of favor, but it is a pretty
 useful here. 
 
 sub work{ #the thread code block
 $|++;
 while(1){
if($thread{'die'} == 1){goto END }
if ( $thread{'go'} == 1 ){
 
#do your stuff here in a loop and sprinkle the code with
#  if($thread{'go'} == 0){last}
#  if($thread{'die'} == 1){goto END}
#  in case you need to kill the thread or current code run
#  during a long running process
 
   $thread{'go'} = 0; #turn off self before returning   
}else
  { sleep 1 }
 }
 END:
 }

Wouldn’t a simple “return” in place of your “goto END” work just
as well?

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Stocks don't seem

2005-10-17 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2005-10-17 14:15]:
 What still doesn't make sense is how the default could be
 different for perl programs. I don't understand how that
 could be happening, and cannot reproduce it.

I’m pretty convinced that weird like maybe what Suse do is
happening – someone had trouble with that when using my
gtk-chtheme utility. Their gtk+ is configured to look in a gtkrc
in a non-standard location somehow and gets messed with by the
KDE theme manager. (But the oddball location is not reported by
gtk+ if you ask for the gtk_rc_get_default_files either.)

I don’t know (and don’t necessarily think) it’s the same kind of
weirdness here, but something of the sort seems to be what’s
going on.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Stocks don't seem

2005-10-16 Thread A. Pagaltzis
* Peter Simon [EMAIL PROTECTED] [2005-10-16 21:50]:
 I couldn't find any gtkrc file what can turn on this function.

Since you can’t find what’s turning the preferences off, maybe
it would work to could override the setting and turn them back on
explicitly? Ie put something like this in your `~/.gtkrc-2.0`:

   gtk-button-images = 1
   gtk-menu-images = 1

 http://www.gprsec.hu/downloads/gdf/stock04.png

Thank you for listening. :-)

 Because I couldn't find the gtkrc file which can affect showing
 of stocks, as I wrote above, I had to turn on using your
 solution in the program:

Just a note: if you want to distribute this program to other
people, and they have consciously and intentionally turned stock
icons off (because they don’t like them or for whatever reason
they may have), then your program overriding their setting will
annoy them. Don’t override theme-related preferences in your code
unless you have really, *really* good reason.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Stocks don't seem

2005-10-15 Thread A. Pagaltzis
* Peter Simon [EMAIL PROTECTED] [2005-10-14 18:50]:
 I attached a strange screenshot.

Which is bad nettiquette. You don’t send binary attachments to a
list with a few hundred subscribers, of which probably four
people will even look at it. I wasn’t going to say anything, but
then you decided to top it off by sending this thing in
triplicate.

If you want to include an image in a post to a mailinglist,
upload it to a webserver and send a link. Then you can also
afford to save the picture as something more sensible than a
massively compressed JPEG that consists more of artifacts than
actual image content.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Build system

2005-10-13 Thread A. Pagaltzis
* Emmanuele Bassi [EMAIL PROTECTED] [2005-10-13 22:50]:
 4. I don't remember point four, but it'll come to mind
 eventually.

I can supply one: dependency resolution does not work, because
the Makefile.PL in Gtk2 needs modules from Glib to run at all.

I was talking about this with muppet on IRC today, and he
explained this. The problem as it stands is that these modules
need to do various things at build time which are a pain to do
from within the Makefile. Because of complications of the
interplay beteween the Makefile.PL and Makefile, this means the
Makefile.PL absolutely must complete these tasks *before* it can
set up the build process mechanics it is supposed to.
Unfortunately, these tasks require modules provided by the
distribution’s own dependencies, ie. Gtk2 needs to autogenerate
stuff using Glib::CodeGen. Therefore the Makefile.PL cannot run
without the dependencies already being installed. But automatic
dependency resolution requires Makefile.PL to complete its job.

The bottom line is that as things stand, you have to manually
install the distros in the correct order.

I suggested porting the build system to Module::Build.

The advantage would be that in M::B, the Build.PL which is
equivalent to the Makefile.PL script writes a pureperl Build
script, instead of a Makefile. In contrast to the Makefile, Build
is easily customisable and sanely extensible with new actions,
and without any portability headaches. The upshot is that instead
of doing all the work up front in Build.PL, you can put it where
it belonges: in the Build script. Thus, Build.PL itself does not
require any modules from the dependencies of the distribution in
order to run. And thus, dependency resolution can actually work.

Some issues were raised and discussed regarding Module::Build.

• Concern: the gtk2-perl collective does not depend on anything
  non-core.

  Relief: Gtk2, Glib and friends do have build-time dependencies,
  even if they’re all stuff from the gtk2-perl team. It doesn’t
  really matter whom your non-core build-time dependencies come
  from. And M::B would be a build-time-only dependency, so not
  much effectively changes.

• Concern: M::B has a huge list of dependencies.

  Relief: but almost everything is optional, and the only
  optional dependency that you really *should* install is YAML.

• Concern: mainting two parallel build systems is hateful, but
  rushing right in to switch is not a good idea.

  Relief: there’s no need to. This should be done as an
  experimental side project at first. Who knows, maybe M::B
  actually sucks for the task at hand. No need to commit to a
  moving to another build systems up front. (Now that would be a
  crazy notion if I ever heard one.)

muppet suggested that I try my hand at it. Unfortunately, I am
a heavily overcommitted procrastinator, so I really can’t add
anything more to my plate (and neither can he, he said), so he
asked me to post this to the list in the hopes that maybe someone
else is interested and might pick this up. Or at the very least
it can serve as a reference point to go back to when someone gets
around to this.

In closing, here’s a exchange overhead in #gtk-perl:

muppet fetching the window system's file descriptor
 out from under the toolkit is Evil and Wrong.
muppet Fun, but Evil and Wrong.
Om Some people say it's Fun that matters
 [1] aristotle -Ofun ?
muppet hehe
muppet -fomit-morals -Ofun
 aristotle hahaha
Om hahaha

[1]: http://www.oreillynet.com/pub/wlg/7996

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Speedup insert into treestore

2005-10-09 Thread A. Pagaltzis
* Florian Schaefer [EMAIL PROTECTED] [2005-10-09 19:00]:
 I've read about two possibilities: (1) To detach the treestore
 from the view before doing any big changes and (2) to disable
 sorting during this operation.

(3) Do both.

;-)

On another list we just had a case where disabling sorting
reduced the time taken to populate a liststore with a few
thousand entries from 5 to 0.5 seconds.

I suspect that detaching the model gives you a linear speedup
whereas disabling the sort is polynomial; so it’s really a good
idea to do both.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: ANNOUCE: Zim

2005-09-29 Thread A. Pagaltzis
* Jaap Karssenberg [EMAIL PROTECTED] [2005-09-29 09:30]:
 I thought 'gtk-link' was a stock icon, but apparently it is not
 shipped with all gtk instalations. Is there an official list
 of stock icons to use, or should I package stock icons with the
 application ?

The range of available stock icons has expanded with time. F.ex
my Gtk+ 2.0 Change Theme[1] utility contains a “backport” of the
`gtk-about` stock icon which is used if the gtk+ version detected
at compile time is too old ( 2.6) to have that stock icon.

(That is, the version I have on disk. I should push out a release
at some point…)

You can find a list of stock items in the gtk+ documentation[2].
With each item you will find the version of gtk+ in which it was
added. (Unless it has always been there since 2.0.)

In that list I don’t see `gtk-link` at all, even though it
includes the latest icons from 2.8. In fact, Google doesn’t to
have seen this term, ever. So I’d say the likelihood is high that
some other library or component on your system has added it. Or
maybe it’s part of your icon theme? Or something like that. In
any case, it has nothing to do with the canon.

[1]: http://plasmasturm.org/code/gtk-chtheme/
[2]: http://developer.gnome.org/doc/API/2.0/gtk/gtk-Stock-Items.html

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: another Gtk2::Expander Q

2005-09-12 Thread A. Pagaltzis
* Dirk van der Walt [EMAIL PROTECTED] [2005-09-12 16:21]:
 Which will be the correct way?  resize  brings me no joy.

$exp-set_expanded( FALSE ); # ?

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: gtk2-perl tutorial ?

2005-09-11 Thread A. Pagaltzis
* Zach Bean [EMAIL PROTECTED] [2005-09-11 10:55]:
 I still think that the Gtk2 family of bindings are some of the
 most natural, easy-to-use modules I've ever used.

Same here. I would guess that the separating line is whether you
already have a basic grasp of programming GUIs, in which case
gtk+ and particularly Gtk2-Perl is very convenient; or not, in
which case you have to learn event-driven programming in parallel
with gtk+ itself.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Long running DBI queries (gtk2 , threads)

2005-09-02 Thread A. Pagaltzis
* ofey aikon [EMAIL PROTECTED] [2005-09-02 18:00]:
 On 9/1/05, A. Pagaltzis [EMAIL PROTECTED] wrote:
 This seems like bad API design. Instead of requiring the
 programmer to make up a name to refer to the information,
 return an object from the register call that encapsulates all
 the necessary information.
 
 my $threaded_query = $mythread-register_sql( \call_sql, \call_back );
 
 $threaded_query-execute( @some_params );
 
 That looks better. Thanks !

Incidentally, there’s some other module that uses the same model.
I think it’s called DBI or something like that, if memory serves.

:-)

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: imagmap

2005-08-27 Thread A. Pagaltzis
* Gábor Szabó [EMAIL PROTECTED] [2005-08-27 18:25]:
 Is there a way to create a clickable imagemap in GTK+
 (preferably without Gnome so it can run on Windows as well)

Intercepting clicks on an image requires wrapping a GtkImage in
GtkEventBox and handling the `clicked` signal of the EventBox.

If you don’t have hundreds of different clickable spots and
they’re all rectangular, you could simply use a suitable bunch of
GtkEventBoxes.

If you have many or non-rectangular clickable areas, you will use
only a single EventBox covering the entire image, and then you
must bust out the math and manually check whether the X/Y
coordinates of the click fell into a clickable area.

There is no easier solution than this.

There should be, really, since it’s useful enough and requested
frequently enough that having a stock tool for this in the box
would be nice.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Gtk2-Ex-Datasheet-DBI-0.8 and SQLite

2005-08-27 Thread A. Pagaltzis
* Gábor Szabó [EMAIL PROTECTED] [2005-08-27 23:10]:
 On 8/28/05, A. Pagaltzis [EMAIL PROTECTED] wrote:
 $self-{dbh}-column_info

 Where does that come from? I don't see it anywhere in the DBI
 docs.
 
 have you searched http://search.cpan.org/dist/DBI/DBI.pm ?
 
 it is there

I did, but for some reason didn’t find it.

Hmm. Check if it really doesn’t work, then file a bug against
DBD::SQLite?

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Using Gtk2::Helper-add_watch() or Glib::IO-add_watch

2005-08-18 Thread A. Pagaltzis
* ofey aikon [EMAIL PROTECTED] [2005-08-18 07:10]:
 The FAQ however has some minor syntax errors. I found it being
 discussed here
 http://mail.gnome.org/archives/gtk-perl-list/2005-March/msg00107.html

Fixed.

 I am wondering if it has anything to do with the fact that I'm
 on win32.

Probably. I think the pipe-open doesn’t work on native Win32.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Using Gtk2::Helper-add_watch() or Glib::IO-add_watch

2005-08-17 Thread A. Pagaltzis
* ofey aikon [EMAIL PROTECTED] [2005-08-17 08:25]:
 Unfortunately, the docs for these APIs didn't help me too much.
 Google search didn't return much either. Any good samaritan
 here willing to share some code snippets on how to achieve this
 ;) ?

http://live.gnome.org/GTK2_2dPerl_2fFrequentlyAskedQuestions#head-3b88c68683fd189b09455a462d5e41669b7b1142

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Cairo 0.01 (unstable)

2005-08-16 Thread A. Pagaltzis
* Scott Lanning [EMAIL PROTECTED] [2005-08-16 17:25]:
 I see that it's supposed to be a replacement graphics library
 for Mozilla.

Gecko is being ported to run on Cairo, but Cairo is not
Mozilla-specific. It’s a high-level vector graphics API
that started life as part of the freedesktop.org effort.
The Mozilla folk are interested in using it as a basis because
they could get rid of lot of their handrolled rendering and
simultaneously benefit from hardware acceleration on the Cairo
backends that support it.

Regards,
-- 
Aristotle
“If you can’t laugh at yourself, you don’t take life seriously enough.”
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: utf8 not displayed in Gtk2::Entry

2005-08-15 Thread A. Pagaltzis
* Alexandre Jousset [EMAIL PROTECTED] [2005-08-15 12:10]:
 I am working on a Gtk2-Perl project which is an LDAP browser. I
 get utf-8 strings from an LDAP directory and when I set them in
 a Gtk2::Entry, they are not displayed correctly: utf-8 strings
 are shown as the usual wrong characters eg.
 capital_tilde_A-copyright for the accented_e. I thought Gtk2
 used utf-8. Can you tell me what's wrong ?

The strings are probably not marked as UTF-8, in which case Perl
assumes they’re in your local encoding. Use the `Encode` module’s
`decode_utf8` function on the data you get, ie something along
the lines of

use Encode;
$info = decode_utf8( get_info_from_ldap_somehow() );

Although if you are using some sort of module to talk to the LDAP
server, then it really is that module’s job to do this correctly…

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Projects Using Gtk2-Perl

2005-08-13 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2005-08-14 05:40]:
 To date, I've only put things in the Projects using gtk2-perl
 listing when authors suggest them.
 
 Should we list these?

Maybe mail the authors first?

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Event Handling

2005-08-05 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2005-08-04 22:35]:
   sub foo_event {
  my ($item, $event) = @_;
  my $handler = $foo_event_dispatch{$event-type};
  return $handler
   ? $foo_event_dispatch{$event-type}-($item, $event)
   : FALSE;
   }

sub foo_event {
   my ($item, $event) = @_;
   my $handler = $foo_event_dispatch{$event-type};
   return $handler ? $handler-($item, $event) : FALSE;
}

Or even cutely hacked:

sub foo_event {
   my ($item, $event) = @_;
   ($foo_event_dispatch{$event-type} || return FALSE)-($item, $event);
}

Or taking advantage of the fact that you can `goto` a coderef:

sub foo_event {
   my ($item, $event) = @_;
   goto { $foo_event_dispatch{$event-type} || return FALSE };
}

Err, okay, I’ll stop now.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Displaying simple HTML and pod

2005-07-30 Thread A. Pagaltzis
* Gábor Szabó [EMAIL PROTECTED] [2005-07-30 10:10]:
 Is there a widget out there that can display (simple) HTML
 pages?

Gtk2::Html2, Gtk2::MozEmbed.

 Is there a widget that can display pod?

Gtk2::PodViewer.

Regards,
-- 
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
#Aristotle
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: 'wrap'=1 for Gtk2::CheckButton

2005-07-28 Thread A. Pagaltzis
* [EMAIL PROTECTED] [EMAIL PROTECTED] [2005-07-28 16:35]:
 What i mean is: exists a way to change the wrap property on an
 existing CheckButton with an existing Label?

$ckbtn-get_child-set_line_wrap( TRUE );

Most widgets which have -new_with_label() or the like inherit
from GtkBin, a container for a single child. This approach works
for all of them.

Regards,
-- 
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
#Aristotle
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: widget for directory view

2005-07-24 Thread A. Pagaltzis
* Gábor Szabó [EMAIL PROTECTED] [2005-07-24 09:45]:
 I would like to have that nice directory browser that has small
 squares with + signs when the item is expandable and - when it
 is expanded.
 
 Which widget should I use ?

That’s a TreeView. How exactly it looks, whether it uses the
customary triangle expanders or +/- squares, is not up to you,
it’s up to the theme. If you insist on styling the TreeView
yourself, make sure that it does not behave undesirably for users
with an accessibility-aiding theme such as a low- or
high-contrast theme or one with large fonts and controls.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: widget for directory view

2005-07-24 Thread A. Pagaltzis
* Gábor Szabó [EMAIL PROTECTED] [2005-07-24 20:20]:
 So I read twop levels. Now when the user expands one of the
 entries I need to go to all of its subdirectories read them and
 somehow add them to the tree. Is there an example of such code?
 Is my approach good?

The approach is good, and you do it by plugging a custom
TreeModel into the TreeView, one which doesn’t use an in-memory
data structure, but instead reads the filesystem when asked for
anything.

See `perldoc Gtk2::TreeModel` under “CREATING A CUSTOM TREEMODEL”
as well as the various previous threads from the mailinglist:
http://www.google.com/search?q=custom+tree+model+site%3Agnome.org+inurl%3Agtk-perl

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: gui update

2005-07-22 Thread A. Pagaltzis
* Sergio Rodriguez [EMAIL PROTECTED] [2005-07-22 21:40]:
 Any suggestions on how could I solve this?.

Don’t use -put(), use -stor(), which gives you a socket handle
and lets you do the sending yourself. Then do the sending in
small chunks, and poll the GUI queue between them.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: A little fix for Gtk2::Dialog

2005-07-21 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2005-07-21 23:10]:
 That's an oversight.  We have our own producct at
 http://bugzilla.gnome.org . Where's the obvious place on
 gtk2-perl.sf.net to put that link?  Links?

In the navigation to the right, I’d say, not burried somewhere on
a page. Gtk2-Perl is, after all, only really of interest to
developers, so the bugtracker link is not to be hidden away in a
developer area, as it would be with projects writing end-user
stuff. 

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: problem with $liststore-set

2005-07-20 Thread A. Pagaltzis
* Jens Luedicke [EMAIL PROTECTED] [2005-07-20 20:40]:
 is it a known problem that something like this
 
 $liststore-set($iter, 0, $stuff-return_value);
 
 behaves differently than
 
 $val = $stuff-return_value;
 $liststore-set($iter, 0, $val);
 
 !?

That can’t make any difference, unless Gtk2::ListStore-set wants
to modify $val and $stuff-return_value returns a constant or
literal. Other than this, there is no way for -set to tell a
difference. The order of evaluation is the same in both cases.

This looks like something else in your code was acting up, you
changed this piece of the code, then it happened to stop acting
up, and you attributed that to the change.

Please try to reduce your code to a minimal example that still
exhibits the problem, reproducibly, and post that. I’m pretty
sure that in the course of doing so you’ll find the problem was
somewhere else entirely.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: problem with $liststore-set

2005-07-20 Thread A. Pagaltzis
* Jens Luedicke [EMAIL PROTECTED] [2005-07-20 23:45]:
 I looked into Stat::lsMode and the following piece of code from
 format_mode seems to be the problem:
 
   if (wantarray) {
 (@ftype, @permstrs);
   } else {
 join '', @ftype, @permstrs;
   }

Ah, duh. So then you need

$liststore-set($iter, 0, scalar $stuff-return_value);

But of course this has nothing to do with Gtk2.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: How to link expand/compact behavior of two treeviews?

2005-07-19 Thread A. Pagaltzis
* Steve Madsen [EMAIL PROTECTED] [2005-07-19 18:55]:
 Any ideas on how to do this?  In the meantime I'm looking at
 the documentation and searching the archives, but so far
 nothing...

I would think you connect to the respective signals in both
TreeViews (“expand-collapse-cursor-row”, “row-collapsed”, and
“row-expanded” look like candidates) and then use the TreePath to
the item to duplicate the action on the other TreeView.

Be sure to keep the signal handler IDs so you can
`signal_handler_block()` them while you’re copying the actions
from one TreeView to another. (Else you’ll get an infinite loop.)

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: table layout

2005-07-19 Thread A. Pagaltzis
* Scott Lanning [EMAIL PROTECTED] [2005-07-19 17:41]:
 Basically I want a simple form and to be able to control the
 width of the text entries according to how many columns they
 occupy.
 
 ||||||
   Name:  [_]
   Year:  []
   Addr:  [__]
 
 But what I get is either this if I don't use 'expand'
 
   Name: [___]
   Year: [___]
   Addr: [___]
 
 or this if I use 'expand':
 
   Name: [__]
   Year: [__]
   Addr: [__]
 
 What am I doing wrong?

Columns 2 and 3 have nothing that would force any width. You are
saying that column 2 or 3 may be as wide as widgets require, but
at the same time, widgets may be as wide as column 2 or 3
requires. Well, that gets you a width of 0 for columns 2 and 3.

You must force either the columns or the widgets to occupy a
particular width, so that either the widgets or the columns,
respectively, can have their width calculated based on the
respective other constraint.

You, uh, basically need spacer GIFs. If you’ll excuse the HTML
table layout era terminology. Stick invisible dummy widgets with
1px height and a well-defined width into columns 2 and 3 on a row
that doesn’t contain anything else.

Heh, I didn’t think I’d ever use that trick again.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: OT: actual path

2005-07-18 Thread A. Pagaltzis
* Beast [EMAIL PROTECTED] [2005-07-18 08:55]:
 From where I can find out the actual location of GTK_STOCK
 icons and cursors?

At best, in rc files. But icons could also be compiled into
the library (and by all I can tell, the most basic stock icon set
is), and the path can be different for each icon, so there’s
nothing regular that you could rely on about their locations, if
they even have one on the filesystem.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: row selected

2005-07-18 Thread A. Pagaltzis
* Beast [EMAIL PROTECTED] [2005-07-18 08:20]:
 A. Pagaltzis wrote:
 Uhm, the docs for TreeView list a “row-activated.” Didn’t you
 find that? Doesn’t that do what you want?
 
 It only works when row is _double clicked_, what I want is when
 user just clicked the row.

Ah. “cursor-changed” would be my next best guess.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Gtk2::ComboBoxEntry

2005-07-13 Thread A. Pagaltzis
* Jens Luedicke [EMAIL PROTECTED] [2005-07-13 17:40]:
 how can I set some text to the entry widget so that the
 associated changed signal callback isn't called? Same for
 typing in the entry. This makes the box really useless. changed
 should only be be called if I select something from the list
 below.

Where’s the problem? Just call Gtk2::ComboBoxEntry-get_active()
and check if it’s -1. If it is, that means the user typed
something. If it’s a non-negative integer that means the user
selected an entry from the dropdown.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: row limit of SimpleList

2005-07-12 Thread A. Pagaltzis
* Beast [EMAIL PROTECTED] [2005-07-13 05:10]:
 Just corious, is there any limit on how many rows can be put in
 SimpleList?

How much memory you have. Well, you put more by hitting swap, but
that’s going to be *really* unfun.

 Supose I have a program which parse big log file, how many
 lines of log file is still acceptable?

The GUI will probably get sluggish with more than a few ten
or hundred thousand items. I don’t know how performance degrades,
so you’ll need to run tests, but I’ve seen lists with a few
thousand items that were entirely responsive.

A few things that you can do to keep CPU usage down: do not use
column autosizing. And if applicable, set the 'fixed-height-mode'
property on the TreeView to true.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: oot: perl gtk books

2005-07-05 Thread A. Pagaltzis
Hello “Beast,”

* Beast [EMAIL PROTECTED] [2005-07-05 11:15]:
 Any recomendation book to learn perl gtk2? I have some
 knowledge in writting apps using java swing.

I’m not aware of any Gtk2-Perl-specific books, though if you find
anything on gtk+2, most of what you’ll find in it is applicable
more or less directly to the Perl bindings.

Generally, if you have even a modicum of experience with GUI
programming, it’s easy enough to just read through the tutorial,
and then have a browser window permanently open on the online
reference. It’s really not all that complicated.

Regards,
-- 
Aristotle Pagaltzis // http://plasmasturm.org/
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Timers

2005-07-01 Thread A. Pagaltzis
* Juan José 'Peco' San Martín [EMAIL PROTECTED] [2005-07-01 01:35]:
 My issue is that I would like to attach the same timer but to
 other widgets, in order to update many of them at the same
 time. Surely that it's possible but I didn't find the way :-/

That’s nothing to do with Gtk2. You just need to know Perl.
muppet’s suggestion of a Heartbeat object is nice, particularly
if you need to do this kind of thing more than in one place. For
a simple one-off where extensibility is not a concern, you can
just use a closure:

my $timer = Glib::Timeout-add( 1000, sub {
progress_timeout( $label );
do_something_else( $progbar );
spin( $my_beanie );
etc( etc( etc() ) );
} );

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: embedded perl/Gtk dialog

2005-07-01 Thread A. Pagaltzis
* Carl Nygard [EMAIL PROTECTED] [2005-07-01 05:25]:
 a) the first time I run the dialog, it pops up over my app.
 The second and subsequent times, it stays under the app
 
 b) When I hit the cancel button, the dialog stays open.

Those two are obviously related, no? The first time you run it,
it is instantiated and pops up. So far so good, but then it is
never actually destroyed, as far as I understand Glade, only
hidden (and I seem to remember that Glade instantiates widgets
only once, if you destroy them afterwards, they are gone).
Apparently it remembers where it was when it is unhidden, just
like it was there all the time, but invisible.

I’m not sure how to make it pop over the app window – there’s
possibly a method to make it go to the front, though. And I’d say
the solution to your cancel problem is to not destroy the popup,
only hide it.

In any case, I’m only making educated guesses, but what I know
for sure is that you need a better understanding of how Glade
manages its widgets. I could tell you more if I had ever used it
myself, but so far that’s not been the case.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Mixed pixbuf and text

2005-07-01 Thread A. Pagaltzis
* The Saltydog [EMAIL PROTECTED] [2005-07-01 10:35]:
 On 7/1/05, Jan Hudec [EMAIL PROTECTED] wrote:
  Wow, that's complex! Simply running Gtk2-main_iteration
  while Gtk2-events_pending; between reading the lines is
  easier and does the job just as well.
 
 Yes, but I needed the user to be free to start using all
 program features, even while the treeview is growing. So he can
 open trees, doubleclick, use menu items and even stop the scan.

You are programming by coincidence[1]. If you actually understood
how Gtk2 works, you’d know that the loop Jan mentioned enables
exactly the behaviour you want, and you could avoid a lot of
complexity.

By way of an explanation: a GUI program works by having a
mainloop which runs indefinitely and checks whether the user did
anything. For anything the user does, it registers an “event,”
then calls handlers to react to that event. Gtk2-main_iteration
does that for exactly one event. If there was no event pending
processing, it blocks (so you don’t want to call it if there are
none). Gtk2-event_pending checks whether there’s anything in the
queue. That means that the loop Jan mentioned will process any
clicks, redraws, etc which were queued up when the program was
busy, any time it has a moment to spare.

[1] http://www.pragmaticprogrammer.com/ppbook/extracts/coincidence.html

Hope this helps,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: non-blocking loop delay

2005-06-12 Thread A. Pagaltzis
* Grant McLean [EMAIL PROTECTED] [2005-06-13 00:30]:
 You can use both, by taking advantage of Perl closures for the
 'loop' index and the fact that if the routine you schedule with
 Timeout-add returns TRUE, it will be rescheduled:
 
   my $i = 1;
   Glib::Timeout-add(100,
 sub {
   return FALSE if $i  100;
   # do stuff here
   $i++;
   return TRUE
 }
   );

Or maybe a little cleaner,

sub {
# do stuff here
$i++;
return $i  100;
}

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: tooltips on pixbuf

2005-06-07 Thread A. Pagaltzis
* The Saltydog [EMAIL PROTECTED] [2005-06-07 21:55]:
 I have a column of different pixbufs in my SimpleList. Now I am
 in the need of displaying a tooltip each pixbuf, but how can I
 do this as they are not widgets?

Stuff them in an Eventbox? Thats the canonical way to make
non-window things behave like those which are, I think (although
I might be trying to solve all problems with the same
sledgehammer). It might be unwise there are *very* many of them
though.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Executing functions after Gtk2-main is started?

2005-05-25 Thread A. Pagaltzis
* wangxiaohu [EMAIL PROTECTED] [2005-05-26 01:50]:
 I want to execute some functions after Gtk2-main is started,
 without using threading. Any advises?

Schedule them for running using Glib::Timeout-add(). On the
first run return a false value.

See perldoc Glib::MainLoop.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: any Perl bindings for gtk+extra?

2005-05-22 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2005-05-22 17:50]:
 I have one test ported, and it currently segfaults really well.

Hehehe. This reminds me:

Im currently dodging core dumps falling from the sky, but I
think Im running in generally right direction
 Jarkko Hietaniemi

Regards,
-- 
Aristotle
If you cant laugh at yourself, you dont take life seriously enough.
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Programmatically popup a tooltip

2005-05-13 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2005-05-13 21:25]:
 http://bugzilla.gnome.org/show_bug.cgi?id=50619
 http://bugzilla.gnome.org/show_bug.cgi?id=80980
 
 The problem is that it's public API change, and the team is
 being very careful about it.  This discussion has been going on
 for a long time.

Well, it wouldnt break anything, since it can be implemented
purely as an extension that does not affect behaviour in legacy
code. And there doesnt seem to be a lot of lively discussion in
Bugzilla  mostly, it is just taking a very long time for anyone
to get around to it. (Im not whining, just observing. Apparently
noone feels a pressing need for this.)

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: offtopic: libxml

2005-05-01 Thread A. Pagaltzis
* Botjan peti [EMAIL PROTECTED] [2005-05-01 11:20]:
 i am thinking of a wrapper for libxml, that would simply read
 the whole DOM tree into a hash structure... ?

You mean XML::Simple?

Regards,
-- 
Aristotle
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: File Selector

2005-04-14 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2005-04-14 20:05]:
 In general, you and your users will find it more satifying to
 use stock ids for your buttons.

In particular, because it gets you visual identity (the stock
icons help identify the purpose of a widget before even reading
the label) and free localization.

Regards,
-- 
Aristotle
Like punning, programming is a play on words.
Alan J. Perlis, Epigrams in Programming
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: UTF-8 strings as title for TreeViewColumn

2005-04-14 Thread A. Pagaltzis
* Rodrigo Torres [EMAIL PROTECTED] [2005-04-14 20:10]:
 Finally, anybody figured what I'm missing here?

Put use utf8; at the top of your program to tell Perl that the
source file is UTF-8, not some local encoding.

Alternatively, write C\x{F3}digo. Using \x{} you can include
any Unicode codepoint in your strings.

See man perlunicode for further explanation and gory details.

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Steering people away from GtkPerl (was: passing arguments to the)

2005-04-12 Thread A. Pagaltzis
* muppet [EMAIL PROTECTED] [2005-04-12 18:40]:
 On Apr 12, 2005, at 9:13 AM, A. Pagaltzis wrote:
 Further, Patrice le Borgne who offers a french tutorial[4]
 could also be asked.
 
 Patrice has a gtk2-perl tutorial...  linked from 
 http://gtk2-perl.sf.net/links/
 http://perso.wanadoo.fr/gtk2-perl/Gtk2perl_tutoriel.html

Thats nice  now hopefully he could add a notice to the GtkPerl
tutorial that people should not be using this anymore? :-)

 One address came back User Unknown, the other Mailbox
 Inactive.  This is pretty much the same situation as late
 2003.  I can't find any info about him after 2002 with google.
 I wonder if he's okay...

Ugh. With the URL looking like a free webspace providers dig, I
guess the page wont be going away anytime soon either.

 I see the same thing.  Last i recall, the hosting was donated
 (according to the site) and my emails to the webmaster (from
 2003 to this winter) were never answered.

So I guess we can expect it to remain offline.

What about my comments on a hostile takeover of the CPAN distro?

Regards,
-- 
Aristotle
Like punning, programming is a play on words.
Alan J. Perlis, Epigrams in Programming
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Resizing MessageDialog

2005-04-08 Thread A. Pagaltzis
* Stephan Martin [EMAIL PROTECTED] [2005-04-08 08:45]:
 Indeed, looks really like i first should learn reading, and
 then start to ask dumb questions :-(

Dont be too hard on yourself. I didnt notice either when I
wrote the first reply, after all even the best of us make
this kind of boneheaded mistake from time to time.

Regards,
-- 
Aristotle
If you can't laugh at yourself, you don't take life seriously enough.
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Namespace request

2005-04-07 Thread A. Pagaltzis
* Ross McFarland [EMAIL PROTECTED] [2005-04-07 16:05]:
 if the C code is included in your perl module and bound with XS
 then it belongs in the Ex namespace. Ex is for selfcontained
 add on type stuff. non-Ex name spaces are for bindings of
 external modules.

To reiterate the lengthy discussion we kicked off back then, the
intent was for Gtk2::Ex to exist as a place for Perl-specific
Gtk2 extensions, say Gtk2::Ex::Foo, that should be guaranteed
never to collide with any possible future gtk+ widget called
gtkfoo, which would be bound as Gtk2::Foo.

So when you are binding widgets which can be used in programs
written in another language (read: C libraries), they go in
Gtk2::. When you are writing widgets which will only exist in the
form of a Perl module, regardless of whether they involve XS or
not, they go in Gtk2::Ex::.

Regards,
-- 
Aristotle
Like punning, programming is a play on words.
Alan J. Perlis, Epigrams in Programming
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Resizing MessageDialog

2005-04-03 Thread A. Pagaltzis
* Stephan Martin [EMAIL PROTECTED] [2005-04-03 19:05]:
 Nevertheless i encounter my resizing problem with that also.

Ah  sorry! I misunderstood the problem.

 I i use a scrolled window, the dialog box becomes very small
 and im not able to resize the dialog box at all.

Okay, first, of all, (by my reading of the docs anyhow,) setting
a default-size on the scrolled window should help it pick saner
initial dimensions.

 Following the c documentation, i thought, i should be able to
 call $dialog-set_resizeable(1), but that spits out an error so
 it looks like i missed something here.

I was going to say no error for me, works as expected, but then
I noticed that what worked without error for me was

set_resizable()

and not your

set_resizeable()
 ^

You have an extra e in the method name.


HTH,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: drag-and-drop multiple items from a TreeView

2005-03-27 Thread A. Pagaltzis
* Jeff 'japhy' Pinyan [EMAIL PROTECTED] [2005-03-28 02:00]:
 Any ideas?

It doesn't seem to be supported by gtk+. The first Google
result[1] for multiple item dragging gtk contains a patch to
implement support for multi-item DnD in gtk+ was never accepted,
judging from the documentation.

[1] http://mail.gnome.org/archives/gtk-devel-list/2003-December/msg00160.html

I don't know whether the capability can be implemented in API
client code, though.

Gruss,
-- 
Aristoteles
Wer nicht über sich selbst lachen kann, nimmt das Leben nicht ernst genug.

Regards,
-- 
Aristotle
If you can't laugh at yourself, you don't take life seriously enough.

Regards,
-- 
Aristotle
Like punning, programming is a play on words.
  -- Alan J. Perlis, Epigrams in Programming

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: non-resizable window wants to resize to be a square

2005-03-17 Thread A. Pagaltzis
* Jeff 'japhy' Pinyan [EMAIL PROTECTED] [2005-03-17 07:35]:
 Hrm.  Someone else on Windows has verified the bug.  So then,
 to whom do I address a bug report?  Torsten (the Gtk2-Perl
 primary author), or the gtk+ authors?

I would say try to reproduce it in a short C gtk+ program; if
that exhibits the same behaviour, then it's something for the
gtk+ guys to figure out. If doesn't, then it's more likely got
something to do with the build process for Gtk2 on Win32.

Regards,
-- 
Aristotle
Like punning, programming is a play on words.
  -- Alan J. Perlis, Epigrams in Programming
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: UI for scheduling events (appointments)

2005-03-17 Thread A. Pagaltzis
* ofey aikon [EMAIL PROTECTED] [2005-03-17 07:40]:
 But I am wondering what is a clean approach to package the xml
 file in the module.

You could stick the XML in the DATA section of your module,
that's the simplest solution that can possibly work.

 For example, if I want to generate a cpan dist, is it normal to
 package a glade xml file along?

I see no problem there. Extra files should probably be packaged in
a directory according to the module they belong to, ie with
Gtk2::Ex::Foo having a widget.glade you'd install

Gtk2/Ex/Foo.pm
Gtk2/Ex/Foo/widget.glade

from Makefile.PL/Build.PL.

Regards,
-- 
Aristotle
Like punning, programming is a play on words.
  -- Alan J. Perlis, Epigrams in Programming
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Big trouble on little Powerbook

2005-03-12 Thread A. Pagaltzis
* Daniel Kasak [EMAIL PROTECTED] [2005-03-12 13:25]:
 Please don't say you use emacs...
 Please don't say you use emacs...
 Please don't say you use emacs...

Vim? :-)

Regards,
-- 
Aristotle
Like punning, programming is a play on words.
  -- Alan J. Perlis, Epigrams in Programming
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: cad files

2005-02-28 Thread A. Pagaltzis
* Flatman [EMAIL PROTECTED] [2005-02-28 00:00]:
 is there a widget for showing cad-files ? like dxf , dwg or
 other ? thanks

No, but there is gtkglext, which Ross has bound as Gtk2::GLExt.
That will let you render 3D scenes using OpenGL; you'll then have
to write a loader for DXF or DWG. The gtkglext homepage[1] has a
demo program written in C which displays Lightwave models; that
may or may not be useful as a first reference.

[1] http://gtkglext.sourceforge.net/

Regards,
-- 
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(,$\/, )[defined wantarray]/e;$1};
Just-another-Perl-hacker;
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list


Re: Gtk2::Ex::MarkupTextBuffer

2005-02-05 Thread A. Pagaltzis
* Kevin C. Krinke [EMAIL PROTECTED] [2005-02-04 22:40]:
 Does anyone have any suggestions as to other CPAN XML modules
 that preserve prefixing and suffixing whitespace of tagged
 contents?

I'd suggest trying XML::LibXML before you finalize your decision
to stick with XML::Parser -- not the least reason being that
::LibXML depends on libxml2, which a gtk+ system is likely to
have. Of course libxml2 is also a damn great XML library besides.
::Parser wraps expat, which is a separate dependency and not
nearly as nice to work with, being that it was written at a time
before all the relevant XML standard specs were set in stone (ie
as far as I'm concerned, expat and thus the whole ::Parser family
is kind of obsolete (maybe I should write XML::Simple::LibXML)).

Regards,
-- 
Aristotle
Like punning, programming is a play on words.
  -- Alan J. Perlis, Epigrams in Programming
___
gtk-perl-list mailing list
gtk-perl-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-perl-list