注册会员会员登录

当前位置:首页 > 脚本学习资料 > Perl/Tk

Perl常用语句的整理(一)

发布时间:2016-12-27 19:12:00 点击:

#!e:/perl/bin/perl -w
##################################################################
#scripts:test by chris
#author: chris
#date:2015.08.18
#purpose:
##################################################################
use lib '$ENV{GENESIS_EDIR}/all/perl';
use Tk;
use encoding 'euc_cn';
use Genesis;
$f = new Genesis();

our $job = $ENV{JOB};
our $step = $ENV{STEP};

##################################################################
#defined the path.
our $GENESIS_JOBS_PATH = $ENV{GENESIS_DIR} . "/fw/jobs";
our $GENESIS_LIB_PATH  = $ENV{GENESIS_DIR} . "/lib";
##################################################################
#get all job.
sub get_job_list {
    $f->INFO(entity_type => 'root',
    data_type   => 'JOBS_LIST');
    my @job_list = @{$f->{doinfo}{gJOBS_LIST}};
    return @job_list;
}
##################################################################
#get step list.
sub get_step_list {
    shift;
    my ($job) = @_;
    $f->INFO(entity_type => 'job',
    entity_path => "$job",
    data_type => 'STEPS_LIST');
    my @step_list = @{$f->{doinfo}{gSTEPS_LIST}};
    return @step_list;
}
##################################################################
#get layer list.
sub get_layer_list {
    shift;
    my ($job,$step) = @_;
    $f->INFO(entity_type => 'step',
    entity_path => "$job/$step",
    data_type => 'LAYERS_LIST');
    my @layer_list = @{$f->{doinfo}{gLAYERS_LIST}};
    return @layer_list;
}
##################################################################
#judge job exist.
sub job_exist {
    shift;
    my ($job) = @_;
    $f->DO_INFO("-t job -e $job -d EXISTS");
    return (1) if ( $f->{doinfo}{gEXISTS} eq "yes" );
    return 0;
}
##################################################################
#judge step exist.
sub step_exist {
    shift;
    my ($job,$step) = @_;
    $f->DO_INFO("-t step -e $job/$step -d EXISTS");
    return (1) if ( $f->{doinfo}{gEXISTS} eq "yes" );
    return 0;
}
##################################################################
#judge layer exist.
sub layer_exist {
    shift;
    my ($job,$step,$layer) = @_;
    $f->DO_INFO("-t layer -e $job/$step/$layer -d EXISTS");
    return (1) if ( $f->{doinfo}{gEXISTS} eq "yes" );
    return 0;
}
##################################################################
#open step.
sub open_step {
    shift;
    my ($job,$step) = @_;
    $f->COM("open_entity,job=$job,type=step,name=$step,iconic=no"); 
    $f->AUX("set_group,group=$f->{COMANS}");
}
##################################################################
#affected layer.
sub affected_layer {
    shift;
    my ($layer) = @_;
    $f->COM("clear_layers");
    $f->COM("affected_layer,mode=all,affected=no");
    $f->COM("display_layer,display=yes,number=1,name=$layer");
    $f->COM("work_layer,name=$layer");
}

##################################################################
#job if changed.
sub job_has_changed {
    shift;
    my ($job) = @_;
    $f->DO_INFO("-t job -e $job -d IS_CHANGED");
    return (1) if ( $f->{doinfo}{gIS_CHANGED} eq "yes" );
    return 0;
}
##################################################################
#get profile limits.
sub get_prof_limits{
    shift;
    my ($job_name, $step_name) = @_;

    my @prof_list;
    $f->DO_INFO("-t step -e $job_name/$step_name -d PROF_LIMITS");
    my $xmin = $f->{doinfo}{gPROF_LIMITSxmin};
    my $xmax = $f->{doinfo}{gPROF_LIMITSxmax};
    my $ymin = $f->{doinfo}{gPROF_LIMITSymin};
    my $ymax = $f->{doinfo}{gPROF_LIMITSymax};
    my $xsize = $xmax - $xmin;
    my $ysize = $ymax - $ymin;
    push(@prof_list,$xmin,$xmax,$ymin,$ymax,$xsize,$ysize);
    return(@prof_list);
}

    文章评论
    内容:
     
    惠州韦达软件技术服务有限公司:
    电话:15728891693 /18688300180 邮箱:2933839366@qq.com QQ: 2933839366 网址:www.qhscript.com