]> jspc29.x-matter.uni-frankfurt.de Git - coral.git/commitdiff
update on GUI
authorMichael Wiebusch <m.wiebusch@gsi.de>
Fri, 16 Jan 2015 15:54:43 +0000 (16:54 +0100)
committerMichael Wiebusch <m.wiebusch@gsi.de>
Fri, 16 Jan 2015 15:54:43 +0000 (16:54 +0100)
user_interface/coral_scanner.css
user_interface/coral_scanner.js
user_interface/coral_scanner.pm
user_interface/has_settings.pm [moved from user_interface/settings_subs.pm with 79% similarity]
user_interface/pmt_ro.pm
user_interface/table_control.pm

index e4df286506e9f038bdf096079e83c1ae680f2272..612bc16790b0fa232377e1faf04aa4dcd0e5065d 100644 (file)
    }
    
 
+   
+div.padded {
+     padding:10px;
+  
+}
+
+div.settings_form{
+  padding:10px;
+  padding-right:250px;
+}
 
 div.header {
     font-size:13pt;
index 7afa58017faf65d7c2e7a0fa81e94f9cb9618940..8602eb4422f1b343723c580cfb8c92c266e2bf2d 100644 (file)
@@ -23,7 +23,9 @@ $(document).ready(function(){
   timer = $.timer(function() {
   });
   
+  unfolds($("#show_main_controls"),$("#main_controls_container"));
   unfolds($("#show_pmt_ro_settings"),$("#pmt_ro_settings_container"));
+  unfolds($("#show_table_control_settings"),$("#table_control_settings_container"));
   
 });
 
index 5cf8c720d4396eb52d8f1213498485586c626ccd..6effc5f5ec750c01cfdb20085f2cae1efc2c8674 100644 (file)
@@ -12,8 +12,9 @@ use SVG;
 
 use CGI ':standard';
 
-use settings_subs;
-# our @ISA = qw/has_settings/; # assimilate the methods of the has_settings class
+# use settings_subs;
+use has_settings;
+our @ISA = qw/has_settings/; # assimilate the methods of the has_settings class
 
 
 use pmt_ro;
@@ -54,7 +55,7 @@ sub new {
   bless($self, $class);
   
   $self->{pmt_ro} = pmt_ro->new();
-  $self->{pmt_control} = table_control->new();
+  $self->{table_control} = table_control->new();
   
   return $self;
 }
@@ -82,16 +83,30 @@ sub main_html {
     ]
   );
   
-  
+
   print h2 "Coral Scanner";
   
   print "<div id='main_body'>";
   
+  print "<p id='show_main_controls' class='quasibutton' >main controls</p>";
+  print "<div id='main_controls_container' class='stylishBox padded'>";
+  print "<svg width=480 height=260>";
+  $self->{table_control}->scan_pattern_to_svg();
+  print "</svg>";
+  print br;
+  print "some content!";
+  print "</div>";
+  
+  
   print "<p id='show_pmt_ro_settings' class='quasibutton' >pmt_ro settings</p>";
-  print "<div id='pmt_ro_settings_container' class='stylishBox hidden_by_default'>";
+  print "<div align=right id='pmt_ro_settings_container' class='stylishBox settings_form hidden_by_default'>";
   $self->{pmt_ro}->settings_form();
   print "</div>";
   
+  print "<p id='show_table_control_settings' class='quasibutton' >table_control settings</p>";
+  print "<div align=right id='table_control_settings_container' class='stylishBox settings_form hidden_by_default'>";
+  $self->{table_control}->settings_form();
+  print "</div>";
   
   print "</div>";
   
similarity index 79%
rename from user_interface/settings_subs.pm
rename to user_interface/has_settings.pm
index 8763611785fa0a97d66cd37e0eb3915d571cd702..f415a7c6f9a2f94316612de317e4638ed8adbe2e 100644 (file)
@@ -1,20 +1,9 @@
-package settings_subs;
+package has_settings;
 use Storable qw(lock_store lock_retrieve);
 use misc_subs;
 
 
 
-BEGIN {
-  require Exporter;
-  # set the version for version checking
-  our $VERSION = 1.00;
-  # Inherit from Exporter to export functions and variables
-  our @ISA = qw(Exporter);
-  # Functions and variables which are exported by default
-  our @EXPORT = qw(load_settings save_settings reset_settings settings_form);
-  # Functions and variables which can be optionally exported
-  #our @EXPORT_OK = qw($Var1 %Hashit func3);
-}
 
 
 sub load_settings {
@@ -52,15 +41,18 @@ sub reset_settings {
 
 sub settings_form {
   my $self=shift;
+  my %options=@_;
   my $settings = $self->load_settings();
   my $settings_desc = $self->{settings_desc};
+  
+  my $header=$options{header};
 
-  printHeader('text/html');
+  printHeader('text/html') if $header;
   
   print '
 <style>
 .hidden {
-  visibility:collapse
+  display:none;
 }
 
 span.dropt {border-bottom: thin dotted; background: #ffeedd;}
@@ -77,7 +69,7 @@ span.dropt:hover span {margin: 20px 0 0 170px; background: #ffffff; z-index:6;}
 </style>
 
   
-<form action="'.ref($self).'.pl" method="get" target="_self">
+<form action="'.ref($self).'.pl" method="get" target="_blank">
   <input type="text" name="sub" value="save_settings" class="hidden"><br>
   <table>
   ';
index 653d4ef16cea0eeac2df44302357c9427f8093cb..17d7a2d0fecec848a5df0b0157b3af8a4d6a88e1 100644 (file)
@@ -9,8 +9,9 @@ use POSIX;
 use FileHandle;
 use regio;
 
-use settings_subs;
 use misc_subs;
+use has_settings;
+our @ISA = qw/has_settings/; # assimilate the methods of the has_settings class
 
 ## methods
 
index 6bbae0d7006138642515ecc82e7947352ed3bd3d..e26c22e8ffbdb660c5ba91724bcb928098cfbf15 100644 (file)
@@ -14,9 +14,9 @@ use CGI;
 
 # use has_settings;
 # our @ISA = qw/has_settings/; # assimilate the methods of the has_settings class
-use settings_subs;
 use misc_subs;
-
+use has_settings;
+our @ISA = qw/has_settings/; # assimilate the methods of the has_settings class
 
 ## methods
 
@@ -51,7 +51,6 @@ sub new {
     sample_step_size => 1,
     sample_aperture_dia => 1,
     
-    scan_pattern_svg_file => "./scan_pattern.svg",
     scan_pattern_style => "meander"
     
     
@@ -72,7 +71,6 @@ sub new {
     sample_step_size => "The step size/width for the scan pattern in mm",
     sample_aperture_dia => "Estimate of the radiation aperture in mm",
     
-    scan_pattern_svg_file => "Filename for the visualization (svg image) of the scan pattern",
     scan_pattern_style => "Defines the scan modus, available options are 'linebyline' and 'meander'"
   };
 
@@ -378,6 +376,8 @@ sub scan_pattern_to_svg {
   
   $self->require_run("load_settings");
   
+  my $svg_file = $options{svg_file};
+  
   my $scan_pattern = $self->scan_pattern(style => $style);
   
   
@@ -391,6 +391,10 @@ sub scan_pattern_to_svg {
   my $mm2pix = 1; # pixels per mm
   
   # create an SVG object with a size of 40x40 pixels
+  
+  my $pic_width = 480;
+  my $pic_height = 260;
+  
   my $svg = SVG->new(
         -printerror => 1,
         -raiseerror => 0,
@@ -401,11 +405,11 @@ sub scan_pattern_to_svg {
         #-namespace => 'mysvg',
         -inline   => 1,
         id          => 'document_element',
-  width => 800,
-  height => 600,
+    width => $pic_width,
+    height => $pic_height,
   );
   
-  my $scale = 24;
+  my $scale = 12;
   
   my $scaler = $svg->group(
       transform => "scale($scale)"
@@ -422,7 +426,7 @@ sub scan_pattern_to_svg {
     height => ($sample_rect_y2 - $sample_rect_y1)+$aperture_dia,
     style=>{
           'stroke'=>'black',
-          'fill'=>'none',
+          'fill'=>'white',
           'stroke-width'=>5/$scale,
     }
   );
@@ -430,7 +434,8 @@ sub scan_pattern_to_svg {
   my $lastpoint;
   my $counter=0;
   for my $point (@$scan_pattern) {
-    last if ($counter++ > 600);
+    
+    last if (($point->{x} - $sample_rect_x1)*$scale > $pic_width);
     
     
     if(1){ 
@@ -469,13 +474,16 @@ sub scan_pattern_to_svg {
   
   }
   
-
-  my $svgfile = $self->{settings}->{scan_pattern_svg_file};
+  if (defined($svg_file)){
+    open(SVGFILE, ">".$svg_file) or die "could not open $svg_file for writing!\n";
+    # now render the SVG object, implicitly use svg namespace
+    print SVGFILE $svg->xmlify;
+    close(SVGFILE);
+  } else {
+    print $svg->xmlify;
+  }
   
-  open(SVGFILE, ">".$svgfile);
-  # now render the SVG object, implicitly use svg namespace
-  print SVGFILE $svg->xmlify;
-  close(SVGFILE);
+  return " ";
 }