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

Re: liststore questions



Wow, thanks for all the tips!

In case you're interested in what I'm porting, it's ClamTk, a
point-and-click virus scanner using ClamAV for linux (you can debate
the usefulness :).
freshmeat.net/projects/clamtk/

Anyway, the user picks the file or directory to be scanned, and then
it is kind of locked in a loop as it determines whether to scan,
unrar, or unzip each of the file(s) selected (scans and displays the
results one at a time), which is what, I believe, makes it freeze up
like that, without the $mw->update.
While sometimes lots of files will end up being displayed, they're
certainly not all at once - each file takes a second or so during the
scan, especially since it can end up getting unrar-ed or unzipped.

I'd like to give these tips a shot, and I'll post back with results.

Thanks again for your time!

On Apr 8, 2005 7:22 PM, muppet <scott asofyet org> wrote:
> 
> On Apr 8, 2005, at 7:38 PM, Dave M wrote:
> 
> > 1. I don't understand how the liststore works like this. In Tk, for
> > example, I would create an HList, and use something like this to add
> > to it:
> > $widget->itemCreate( entrypath, column, -text => "foo");
> > Is there a dummy's guide to how this works?
> 
> you can do
> 
>      $model->set ($iter,
>                  0, $col0_data,
>                  1, $col1_data,
>                  2, $col2_data,
>                  3, $col3_data);
> 
> at any time during a tree model's lifetime, and all attached views will
> update automatically.
> 
> you can update existing iters as well as add and remove iters at will.
> 
> there are other functions that you can use to keep the view scrolled to
> the bottom as you append new rows.
> 
> it would help if you describe what you want you app to do, so we can
> give you more specific advice.
> 
> if you're going to insert a whole lot of rows at once (more than a
> hundred), it can be a good idea to remove the model from the view, do
> the insertions, then put the model back into the view to avoid a deluge
> of ui updates.
> 
> 
> > 2. (Sorry to keep using Tk examples; it's all I know...) Is there a
> > gtk2 equivalent to $mw->update to refresh the screen? There are
> > various widgets that will need refreshed to create a "real-time" look
> > as data gets displayed in the columns.
> 
> depends on what $mw->update is supposed to do.
> 
>     $toplevel->queue_draw;
> 
> will place a complete-redraw event on the queue to be handled at the
> next idle.  you can call this on any widget if you want finer
> granularity.
> 
> in a lot of cases, if you have those other widgets listening to the
> right events, it will all just work out; most widgets will call
> queue_draw on themselves after a change.  (using queue draw reduces
> flicker resulting from rapid-fire repaints.)
> 
> if your ui isn't updating because you're in a tight loop or blocking on
> a function call, there are other techniques.
> 
> something like this at the bottom of a loop can help:
> 
>     # flush the event queue
>     Gtk2->main_iteration while Gtk2->events_pending;
> 
> if you're blocking on IO, then you want to look at
> Glib::IO->add_watch().
> 
> if you have a function call that blocks or an intensive algorithm, you
> may want to fork a child process to do that work, and monitor its
> progress over a pipe.
> 
> --
> "Ears!  They help us -- Ears!  They help us hear th--
> Ea--E--E--E--Ears!"
>    -- A Sesame Street singing toy, with Yvonne gleefully pressing
>      the button over and over and over and over and...
> 
>



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