OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [perl_gui/] [lib/] [perl/] [widget3.pl] - Diff between revs 48 and 54

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 48 Rev 54
Line 1... Line 1...
use constant::boolean;
use constant::boolean;
use Gtk3;
use Gtk3;
use strict;
use strict;
use warnings;
use warnings;
 
 
 
use FindBin;
 
use lib $FindBin::Bin;
 
 
use Data::Dumper;
use Data::Dumper;
use Gtk3::SourceView;
use Gtk3::SourceView;
use Consts;
use Consts;
 
 
require "common.pl";
require "common.pl";
 
 
use FindBin;
 
use lib $FindBin::Bin;
 
use IO::CaptureOutput qw(capture qxx qxy);
use IO::CaptureOutput qw(capture qxx qxy);
 
 
#use ColorButton;
#use ColorButton;
use HexSpin3;
use HexSpin3;
 
 
#use Tk::Animation;
#use Tk::Animation;
 
 
our $FONT_SIZE;
our %glob_setting;
our $ICON_SIZE;
 
 
 
##############
##############
# combo box
# combo box
#############
#############
sub gen_combo{
sub gen_combo{
Line 386... Line 387...
 
 
 
 
sub get_icon_pixbuff{
sub get_icon_pixbuff{
    my $icon_file=shift;
    my $icon_file=shift;
    my $size;
    my $size;
    if ($ICON_SIZE eq 'default'){
    if ($glob_setting{'ICON_SIZE'} eq 'default'){
                my $font_size=get_defualt_font_size();
                my $font_size=get_defualt_font_size();
                $size=($font_size *2.5);
                $size=($font_size *2.5);
    }else{
    }else{
        $size = int ($ICON_SIZE);
        $size = int ($glob_setting{'ICON_SIZE'});
    }
    }
        my $pixbuf = Gtk3::Gdk::Pixbuf->new_from_file_at_scale($icon_file,$size,$size,FALSE);
        my $pixbuf = Gtk3::Gdk::Pixbuf->new_from_file_at_scale($icon_file,$size,$size,FALSE);
        return $pixbuf;
        return $pixbuf;
}
}
 
 
Line 866... Line 867...
        return ($box,$window);
        return ($box,$window);
 
 
}
}
 
 
 
 
 
sub get_default_screen {
 
  return Gtk3::Gdk::Screen::get_default;
my ($scr, $curr_scr, %screens);
 
 
 
sub max_win_size{
 
#       my $screen =Gtk3::Gdk::Screen::get_default;
 
 
 
        if(!defined $curr_scr){
 
 
 
                open my $fh, "xdpyinfo|" or die;
 
 
 
                while (<$fh>) {
 
                  $scr = $1 if m/^\s*screen\s+#(\d+):/;
 
                  $curr_scr = $1 if m/^\s*default screen number:\s+(\d+)/;
 
                  @{$screens{$scr}}{'x','y'} = ($1, $2)
 
                        if m/^\s*dimensions:\s+(\d+)x(\d+)/;
 
                }
 
                close $fh;
 
        }
 
 
 
 
 
        my $width  = $screens{$curr_scr}{'y'};
 
        my $height  = $screens{$curr_scr}{'x'};
 
        return ($height,$width);
 
}
}
 
 
 
 
sub get_defualt_font_size{
sub get_defualt_font_size{
        return int($FONT_SIZE) if ($FONT_SIZE ne 'default');
        return int($glob_setting{'FONT_SIZE'}) if ($glob_setting{'FONT_SIZE'} ne 'default');
 
 
        my($width,$hight)=max_win_size();
        my($width,$hight)=max_win_size();
        #print "($width,$hight)\n";
        #print "($width,$hight)\n";
        my $font_size=($width>=1600)? 10:
        my $font_size=($width>=1600)? 10:
                              ($width>=1400)? 9:
                              ($width>=1400)? 9:
Line 1006... Line 984...
 
 
 
 
sub save_adj {
sub save_adj {
        my ($self,$adjustment,$at1,$at2)=@_;
        my ($self,$adjustment,$at1,$at2)=@_;
        my $value = $adjustment->get_value;
        my $value = $adjustment->get_value;
        $self->object_add_attribute($at1,$at2,$value);
        $self->object_add_attribute($at1,$at2,$value) if (defined $self);
}
}
 
 
 
 
sub load_adj {
sub load_adj {
        my ($self,$adjustment,$at1,$at2)=@_;
        my ($self,$adjustment,$at1,$at2)=@_;
Line 1536... Line 1514...
                my $new_param_value=$widget->get_active_text();
                my $new_param_value=$widget->get_active_text();
                $object->object_add_attribute($attribute1,$attribute2,$new_param_value);
                $object->object_add_attribute($attribute1,$attribute2,$new_param_value);
                set_gui_status($object,$status,$timeout) if (defined $status);
                set_gui_status($object,$status,$timeout) if (defined $status);
         });
         });
        return $widget;
        return $widget;
 
 
 
 
}
}
 
 
 
 
sub gen_comboentry_object {
sub gen_comboentry_object {
        my ($object,$attribute1,$attribute2,$content,$default,$status,$timeout)=@_;
        my ($object,$attribute1,$attribute2,$content,$default,$status,$timeout)=@_;
Line 1975... Line 1951...
        my $c=0;
        my $c=0;
        foreach my $l (@clmn_lables){
        foreach my $l (@clmn_lables){
                my $renderer = Gtk3::CellRendererText->new;
                my $renderer = Gtk3::CellRendererText->new;
                my $column = Gtk3::TreeViewColumn->new_with_attributes ("$l",
                my $column = Gtk3::TreeViewColumn->new_with_attributes ("$l",
                                                               $renderer,
                                                               $renderer,
                                                               text => $c );
                                                               text => $c
 
                                                               );
                $column->set_sort_column_id ($c );
                $column->set_sort_column_id ($c );
                $treeview->append_column ($column);
                $treeview->append_column ($column);
                $c++;
                $c++;
        }
        }
 
 
Line 2188... Line 2165...
    $alive = $proc->alive;
    $alive = $proc->alive;
 
 
    # This while loop will cause Gtk3 to continue processing events, if
    # This while loop will cause Gtk3 to continue processing events, if
    # there are events pending... *which there are...
    # there are events pending... *which there are...
    while (Gtk3::events_pending) {
    while (Gtk3::events_pending) {
 
 
      Gtk3::main_iteration;
      Gtk3::main_iteration;
    }
    }
    Gtk3::Gdk::flush;
    Gtk3::Gdk::flush;
 
 
    usleep(1000);
    usleep(1000);
Line 2225... Line 2203...
{
{
        my $cmd=shift;
        my $cmd=shift;
        my $exit;
        my $exit;
        my ($stdout, $stderr);
        my ($stdout, $stderr);
 
 
        open(OLDERR, ">&STDERR");
        #open(OLDERR, ">&STDERR");
        open(STDERR, ">>/tmp/tmp.spderr") or die "Can't dup stdout";
        #open(STDERR, ">>/tmp/tmp.spderr") or die "Can't dup stdout";
        select(STDOUT); $| = 1;     # make unbuffered
        #select(STDOUT); $| = 1;     # make unbuffered
        print OLDERR "";  #this fixed an error about OLDERR not being used 
        #print OLDERR "";  #this fixed an error about OLDERR not being used 
 
 
## do my stuff here.
## do my stuff here.
 
 
 
        STDOUT->flush();
 
        STDERR->flush();
 
 
        capture { $exit=run_cmd_in_back_ground($cmd) } \$stdout, \$stderr;
        capture { $exit=run_cmd_in_back_ground($cmd) } \$stdout, \$stderr;
 
 
        close(STDERR);
        #close(STDERR);
        open(STDERR, ">&OLDERR");
        #open(STDERR, ">&OLDERR");
        return ($stdout,$exit,$stderr);
        return ($stdout,$exit,$stderr);
 
 
}
}
 
 
sub run_cmd_message_dialog_errors{
sub run_cmd_message_dialog_errors{

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.