Issues with performance of Simple List
- From: Mike Martin <redtux1 googlemail com>
- To: gtk-perl-list gnome org
- Subject: Issues with performance of Simple List
- Date: Sat, 27 Feb 2010 22:28:39 +0000
I am having issues with the performance of simple list in a wierd way
Basicaly I have a simple list object embedded into a window which gets
data from a sqlite database via user defined criteria
If I dont access the simplelist at all changes to the data are nearly
instantaeous however if access the simple list at all there is a delay
between 20-40 seconds
this is the table creation code
any tips appreciated
my $table=Gtk2::SimpleList->new(
'ID'=>'text',
'Channel'=>'text',
'Start Time'=>'text',
'Start Sort'=>'text',
'Programme'=>'text',
'End Time'=>'text',
'End Sort'=>'text',
'Category'=>'text'
);
$table->set_headers_clickable(1);
$table->set_headers_visible(1);
$table->set_grid_lines('both');
my $id=$table->get_column(0);
$id->set_visible(0);
my $start=$table->get_column(2);
my $startsort=$table->get_column(3);
my $channel=$table->get_column(1);
my $stop=$table->get_column(5);
my $stopsort=$table->get_column(6);
my $cat=$table->get_column(7);
my $description=$table->get_column(8);
my $programme=$table->get_column(4);
$programme->set_max_width(300);
$startsort->set_visible(0);
$stopsort->set_visible(0);
my $name=$table->get_column(4);
$start->set_sort_column_id(3);
$stop->set_sort_column_id(6);
$channel->set_sort_column_id(1);
$name->set_sort_column_id(4);
$cat->set_sort_column_id(7);
$table->signal_connect (cursor_changed => sub{
&show_details;
});
sub show_details {
my ($path,undef)= $table->get_cursor;
my $row_ref = $table->get_row_data_from_path ($path);
$start_record=$$row_ref[3];
$tsid=$dbh->selectcol_arrayref("select distinct tsid from channels
where channel='$$row_ref[1]'")->[0];
$end_record=$$row_ref[6];
$rec_channel=$$row_ref[1];
$prog_name=$$row_ref[4];
$rec_id=$$row_ref[0];
my $time=time;
$rec_ids='REC_'.UnixDate(ParseDateString("epoch $time"),'%Y_%m_%d_%H_%M_%S');
my $id="'%".$$row_ref[0]."%'";
print $archive_button->get_active;
my @details;
if ($archive_button->get_active == 1){
@details=$dbh->selectrow_array("select start,lang,cat0,stext,name from
guide where id like $id union select start,lang,cat0,stext,name from
archive where id like $id");
}
else
{
@details=$dbh->selectrow_array("select start,lang,cat0,stext,name from
guide where id like $id")
}
my $desc1=&wordwrap($details[3],90);
print $desc1;
my $text= join "\n", 'time: '.$details[0],'lang:
'.$details[1],'Category: '.$details[2],'Name:
'.$details[4],'Description: '.$desc1;
my $buffer=Gtk2::TextBuffer->new;
use Gtk2::Pango;
$buffer->create_tag('big',size => 15 * PANGO_SCALE);
my $iter = $buffer->get_iter_at_offset (0);
$buffer->insert_with_tags_by_name($iter,$text,'big');
no strict 'refs';
my $reclist=&other_channels($$row_ref[1]);
my $text_chan=join "\t",@{$reclist};
my $text_show="These Channels can be recorded if you check record
multiplex\n".&wordwrap($text_chan,100);
$channel_rec_list->set_markup("<span background='yellow'
foreground='red'>$text_show</span>");
$desc->set_buffer($buffer);
}
my $pid;
$table->signal_connect ('button-press-event' => sub {
&but_press
});
sub but_press {
my $record_menu=Gtk2::Menu->new;
my $title=Gtk2::MenuItem->new('Recording');
my $timed=Gtk2::MenuItem->new('Scheduled');
my $manual=Gtk2::MenuItem->new('Manual');
my $sep=Gtk2::SeparatorMenuItem->new;
$sep->set_sensitive(0);
$record_menu->append($title);
$record_menu->append($sep);
$record_menu->append($timed);
$record_menu->append($manual);$title->show;$sep->show;
$timed->show;
$manual->show;
my ($widget,$event)= _;
return 0 unless $event->button == 3;
$record_menu->popup(
undef,
undef,
undef,
undef,
$event->button,
$event->time);
#my $path= $widget->get_path_at_pos($event->x, $event->y );
my ($path,undef)= $widget->get_cursor;
$widget->set_cursor($path);
$timed->signal_connect('activate'=>sub{
&record("timed");
}
);
$manual->signal_connect('activate'=>sub{
&record("manual");
}
);
}
sub show_details {
my ($path,undef)= $table->get_cursor;
my $row_ref = $table->get_row_data_from_path ($path);
$start_record=$$row_ref[3];
$tsid=$dbh->selectcol_arrayref("select distinct tsid from channels
where channel='$$row_ref[1]'")->[0];
$end_record=$$row_ref[6];
$rec_channel=$$row_ref[1];
$prog_name=$$row_ref[4];
$rec_id=$$row_ref[0];
my $time=time;
$rec_ids='REC_'.UnixDate(ParseDateString("epoch $time"),'%Y_%m_%d_%H_%M_%S');
my $id="'%".$$row_ref[0]."%'";
print $archive_button->get_active;
my @details;
if ($archive_button->get_active == 1){
@details=$dbh->selectrow_array("select start,lang,cat0,stext,name from
guide where id like $id union select start,lang,cat0,stext,name from
archive where id like $id");
}
else
{
@details=$dbh->selectrow_array("select start,lang,cat0,stext,name from
guide where id like $id")
}
my $desc1=&wordwrap($details[3],90);
print $desc1;
my $text= join "\n", 'time: '.$details[0],'lang:
'.$details[1],'Category: '.$details[2],'Name:
'.$details[4],'Description: '.$desc1;
my $buffer=Gtk2::TextBuffer->new;
use Gtk2::Pango;
$buffer->create_tag('big',size => 15 * PANGO_SCALE);
my $iter = $buffer->get_iter_at_offset (0);
$buffer->insert_with_tags_by_name($iter,$text,'big');
no strict 'refs';
my $reclist=&other_channels($$row_ref[1]);
my $text_chan=join "\t",@{$reclist};
my $text_show="These Channels can be recorded if you check record
multiplex\n".&wordwrap($text_chan,100);
$channel_rec_list->set_markup("<span background='yellow'
foreground='red'>$text_show</span>");
$desc->set_buffer($buffer);
}
my $pid;
$table->signal_connect ('button-press-event' => sub {
&but_press
});
sub but_press {
my $record_menu=Gtk2::Menu->new;
my $title=Gtk2::MenuItem->new('Recording');
my $timed=Gtk2::MenuItem->new('Scheduled');
my $manual=Gtk2::MenuItem->new('Manual');
my $sep=Gtk2::SeparatorMenuItem->new;
$sep->set_sensitive(0);
$record_menu->append($title);
$record_menu->append($sep);
$record_menu->append($timed);
$record_menu->append($manual);$title->show;$sep->show;
$timed->show;
$manual->show;
my ($widget,$event)= _;
return 0 unless $event->button == 3;
$record_menu->popup(
undef,
undef,
undef,
undef,
$event->button,
$event->time);
#my $path= $widget->get_path_at_pos($event->x, $event->y );
my ($path,undef)= $widget->get_cursor;
$widget->set_cursor($path);
$timed->signal_connect('activate'=>sub{
&record("timed");
}
);
$manual->signal_connect('activate'=>sub{
&record("manual");
}
);
}
[
Date Prev][Date Next] [
Thread Prev][Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]