From: Michael Wiebusch Date: Thu, 22 Aug 2013 09:47:23 +0000 (+0200) Subject: added nice icons to testgui, testgui visual feedback now distinguishes between busy... X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=694ee5a3a554be322f0fa9b31eaae7b4761cf942;p=mvdsensorcontrol.git added nice icons to testgui, testgui visual feedback now distinguishes between busy and error, old sensor occupancy pictures are deleted each new run --- diff --git a/Environment.pm b/Environment.pm index cc93cd7..3fb35ee 100644 --- a/Environment.pm +++ b/Environment.pm @@ -19,6 +19,7 @@ use constant SPECDIR => JTAGROOTPATH."specs/"; use constant PICTUREPATH => TEMPDIR."prevImgs/"; #path for images on webserver (absolute path) use constant PICTUREPATHREL => "../temp/prevImgs/"; #path for images on webserver relative to tools/ use constant DUMPPATH => "/tmp/MAPS_PREV/"; #path for small hld dumps +use constant SHAREPATH => JTAGROOTPATH."share/"; #path for icons and misc stuff use constant SETUPFILE => SETUPDIR."testsetup.xml"; diff --git a/share/error.png b/share/error.png new file mode 100644 index 0000000..6361129 Binary files /dev/null and b/share/error.png differ diff --git a/share/hourglass.png b/share/hourglass.png new file mode 100644 index 0000000..a023581 Binary files /dev/null and b/share/hourglass.png differ diff --git a/tools/run.pl b/tools/run.pl index c4887a8..145b511 100755 --- a/tools/run.pl +++ b/tools/run.pl @@ -61,6 +61,7 @@ my $dummy; $dummy=qx"./preview/exec_evtbuild_t.pl -t $runtime -p $dumpPath 2>&1"; #14 $dummy.=qx"rm $dumpPath/temp.hld 2>&1"; $dummy.=qx"mv $dumpPath/te1* $dumpPath/temp.hld 2>&1"; +$dummy.=qx"rm $picPath/*.png 2>&1"; # delete old pictures $dummy.=qx"./preview/unpack_hld.pl -f $dumpPath/temp.hld -p $picPath 2>&1"; my $escapedDummy = escapeHTML($dummy); $escapedDummy =~ s/\n/
/g; diff --git a/tools/testgui.js b/tools/testgui.js index ea2da80..01b6ca9 100644 --- a/tools/testgui.js +++ b/tools/testgui.js @@ -1,6 +1,4 @@ -// var sensorIdHash = new Object(); - @@ -16,36 +14,20 @@ function reloadQuickEditArea(configFile,destId) { function run(time) { -// sensorIdHash["hugo"]="hugo"; -// sensorIdHash["hugo2"]="hugonaut"; for( var sensorId in previewAreaIdHash){ -// alert(laufid+" => "+previewAreaIdHash[laufid]); var sensorId_ = encodeURIComponent(sensorId); - getdata("testgui.pl?action=showPlot&sensorId=",previewAreaIdHash[sensorId],true); + getdata("testgui.pl?action=showPlot&sensorId="+sensorId_+"&busy=true",previewAreaIdHash[sensorId],true); } var time_= encodeURIComponent(time); getdata("run.pl?runtime="+time_,"theConsole",false); for( var sensorId in previewAreaIdHash){ -// alert(laufid+" => "+previewAreaIdHash[laufid]); var sensorId_ = encodeURIComponent(sensorId); getdata("testgui.pl?action=showPlot&sensorId="+sensorId_,previewAreaIdHash[sensorId],true); } } - -// function toggleVis(elementId) { -// if(document.getElementById(elementId)){ -// if( document.getElementById(elementId).style.visibility == "visible") { -// document.getElementById(elementId).style.visibility = "collapse"; -// } else { -// document.getElementById(elementId).style.visibility = "visible" ; -// } -// } -// } - - diff --git a/tools/testgui.pl b/tools/testgui.pl index 38d0004..025b585 100755 --- a/tools/testgui.pl +++ b/tools/testgui.pl @@ -61,19 +61,26 @@ unless($q->param()) { print header; #process the arguments + # CGI says I have to print the quick Edit Area if ($q->param('action') eq "print_quickEditArea") { my $configFileName = $q->param('configFile'); my $destId = $q->param('destId'); $quickEditAreaId = $destId; print_quickEditArea($configFileName); + # CGI says I have to show plots } elsif ($q->param('action') eq "showPlot") { my $sensorId = $q->param('sensorId'); - my $imgSrc = $picPath.'/image_recalibrated_'.$sensorId.'.png'; - if (-e $imgSrc) { - print img{src=>$imgSrc."?".rand(),title=>$sensorId}; + + if ($q->param('busy') ne "false" ) { + print img{src=>"../share/hourglass.png",title=>$sensorId}; } else { - print img{src=>"./preview/error.jpg",title=>$sensorId}; + my $imgSrc = $picPath.'/image_recalibrated_'.$sensorId.'.png'; + if (-e $imgSrc) { + print img{src=>$imgSrc."?".rand(),title=>$sensorId}; + } else { + print img{src=>"../share/error.png",title=>$sensorId}; + } } } else { @@ -249,12 +256,7 @@ sub print_sensorArea { $sensorAreaId = $sensorId; print "
"; print ""; -# print ""; -# print ""; -# print "";V + print ""; my $previewAreaId = "preview_".$sensorId; print ""; print ""; -# print ""; -# print ""; -# print ""; + print "
"; -# # print ""; -# # print "
$sensorName (id=$sensorId)
description: $sensorDescription
"; -# print "
"; @@ -267,12 +269,7 @@ sub print_sensorArea { print_quickEditArea($sensorConfig); print "
"; -# my $command = "./prevImg.pl"; -# print q%%; -# print "
"; print "
"; @@ -288,17 +285,6 @@ sub print_quickEditArea { -# print ""; -# my @fields = $quickEditMaskTree->findnodes("/MAPS/register/field"); -# for my $field (@fields) { -# print ""; -# -# -# } -# print "
"; -# print $field->findvalue("./\@name"); -# print "
"; -# print "print_registers();",br; parseConfigAndSpec($argumentConfigFile); integrateAncestry(); print "
quick editor
"; @@ -311,203 +297,6 @@ sub print_quickEditArea { -# -# sub print_registers { -# -# my $configFile = getConfigFile(); -# my $specFile = getSpecFile(); -# my $configFileName = getConfigFileName(); -# my $specFileName = getSpecFileName(); -# my $configTree = getConfigTree(); -# my $specTree = getSpecTree(); -# -# my $xmlfile = $_[0]; -# my $xmltree; -# # if ( $xmlfile eq $configFile ) { -# # $xmltree = $configTree; -# # } -# # elsif ( $xmlfile eq $specFile ) { -# # $xmltree = $specTree; -# # } -# # else { -# # die "xmlfile given to sub print_registers is unknown"; -# # } -# my @registers = sort by_name $quickEditMaskTree->findnodes("/MAPS/register"); -# print ""; -# for my $register (@registers) { -# -# my $registerName = $register->findvalue("./\@name"); -# my $registerId = $register->findvalue("./\@id"); -# my $registerSize = $register->findvalue("./\@size"); -# my $registerDescr = prepare_text( -# $specTree->findvalue( -# "/MAPS/register[\@name='" . $registerName . "']/description" -# ) -# || "n/a" -# ); -# -# my $flistid = $configFile . "//" . $registerName; -# -# print ""; -# -# print < +  -# EOF -# print ""; -# -# #print ""; -# -# # if ( $xmlfile eq $configFile ) { # we are printing the Specifications Tree -# # print < X  -# # EOF -# # } -# -# -# print ""; -# -# #print ""; -# -# print ''; -# print ''; -# print '"; -# } -# print "
$registerName$registerId
'; -# print_fields( $configFile, $register ); -# print ""; -# print "
"; -# } -# -# sub print_fields { -# -# my $configFile = getConfigFile(); -# my $specFile = getSpecFile(); -# my $configFileName = getConfigFileName(); -# my $specFileName = getSpecFileName(); -# my $configTree = getConfigTree(); -# my $specTree = getSpecTree(); -# -# my $register = $_[1]; -# my $xmlfile = $_[0]; -# my $registerName = $register->findvalue("./\@name"); -# -# my @maskFields = sort by_name $register->findnodes("./field"); -# print ""; -# for my $maskField (@maskFields) { -# -# my $fieldName = $maskField->findvalue("./\@name"); -# -# my $field = $configTree->findnodes("/MAPS/register[\@name='". -# $registerName."']/field[\@name='".$fieldName."']")->shift(); -# -# -# unless(defined($field)){ -# -# my $specField = $specTree->findnodes("/MAPS/register[\@name='". -# $registerName."']/field[\@name='".$fieldName."']")->shift(); -# $field=$register->addNewChild("","field"); -# $field->setAttribute("name",$fieldName); -# $field->setAttribute("value",$specField->findvalue("./\@defaultValue")); -# $field->setAttribute( "isHeritageFrom", $specFileName ); -# } -# -# -# -# -# -# my $isHeritageFrom = $field->findvalue("./\@isHeritageFrom") || ""; -# # my $isHeritageFrom = ""; -# my $readOnlyFlag = 0; -# my $fieldValue = $field->findvalue("./\@value"); -# my $fieldSize = -# $specTree->findvalue( "/MAPS/register[\@name='" -# . $registerName -# . "']/field[\@name='" -# . $fieldName -# . "']/\@size" ) -# || "n/a"; -# my $fieldDescr = prepare_text( -# $specTree->findvalue( -# "/MAPS/register[\@name='" -# . $registerName -# . "']/field[\@name='" -# . $fieldName -# . "']/description" -# ) -# || "n/a" -# ); -# -# my $maxFieldVal = 2**$fieldSize; -# my $sizeInfo = -# sprintf( -# "Field contains %d bits, possible values: 0-%d (0x0-0x%x)\n\n", -# $fieldSize, $maxFieldVal, $maxFieldVal ); -# -# $fieldDescr = $sizeInfo . $fieldDescr; -# -# unless ( $isHeritageFrom eq "" ) { -# $fieldDescr = -# "Field was inherited from $isHeritageFrom\n\n" . $fieldDescr; -# } -# -# my $fieldId = $xmlfile . "//" . $registerName . "/" . $fieldName; -# if ( $fieldValue eq "" ) { -# $fieldValue = $field->findvalue("./\@defaultValue"); -# $readOnlyFlag = 1; -# } -# -# print ""; -# print ""; -# print ""; -# if ($readOnlyFlag) { -# print <$fieldValue -# EOF -# } -# else { -# print < -# -# -# EOF -# -# } -# -# print ''; -# # if ( $xmlfile eq $specFile ) { # we are printing the Specifications tree -# # print < →  -# # EOF -# # } -# if ( $xmlfile eq $configFile ) { # we are printing the Settings Tree -# -# if ( $isHeritageFrom eq "" ) -# { # these are actual settings, not inherited! -# print < X  -# EOF -# } -# else { -# print ""; -# } -# } -# print ""; -# if ( ( any2dec($fieldValue) < 0 ) -# or ( any2dec($fieldValue) > $maxFieldVal ) ) -# { -# print -# "" -# ; # just debug -# } -# } -# print "
$fieldName  =  X 
!!!Above value not in allowed range!!!
"; -# -# } sub report_param { print br,br;