~ubuntu-branches/ubuntu/trusty/horae/trusty

« back to all changes in this revision

Viewing changes to artemis_parts/main_window.pl

  • Committer: Bazaar Package Importer
  • Author(s): Carlo Segre
  • Date: 2008-02-23 23:13:02 UTC
  • mfrom: (2.1.2 hardy)
  • Revision ID: james.westby@ubuntu.com-20080223231302-mnyyxs3icvrus4ke
Tags: 066-3
Apply patch to athena_parts/misc.pl for compatibility with 
perl-tk 804.28.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
                               -foreground=>$config{colors}{activehighlightcolor});
27
27
  my @pluck=(-image=>$pluck_X);
28
28
 
29
 
  my $canvas = $parent -> Canvas(-relief=>'flat',
30
 
                                 -borderwidth=>0,
31
 
                                 @window_size,
32
 
                                 -highlightcolor=>$config{colors}{background});
33
 
 
34
 
  my $c = $canvas -> Frame(-relief=>'flat',
 
29
  my $c = $parent -> Frame(-relief=>'flat',
 
30
                           #@window_size,
35
31
                           -borderwidth=>0,
36
 
                           -highlightcolor=>$config{colors}{background});
37
 
  $canvas -> createWindow(0,0, -anchor=>'nw', -window => $c, @window_size,);
 
32
                           -highlightcolor=>$config{colors}{background})
 
33
    -> pack(-fill=>'both', -expand=>1);
38
34
 
39
35
  ## titles
40
 
  my $lfr = $c -> LabFrame(-label=>'Titles',
41
 
                           -foreground=>$config{colors}{activehighlightcolor},
42
 
                           -labelside=>'acrosstop',
43
 
                           -width=>14)
 
36
  my $lfr = $c -> LabFrame(-label      => 'Titles',
 
37
                           -font       => $config{fonts}{med},
 
38
                           -foreground => $config{colors}{activehighlightcolor},
 
39
                           -labelside  => 'acrosstop',
 
40
                           -width      => 14)
44
41
    -> pack(-side=>'top', -padx=>4, -fill=>'x');
45
42
  &labframe_help($lfr);
46
43
  push @op_text, $lfr;
106
103
    -> pack(-side=>'top', -padx=>6, -pady=>0,);
107
104
  $fr = $widgets{chi_frame} -> Frame()
108
105
    -> pack(-side=>'top');
109
 
  my $left = $fr -> LabFrame(-label=>'Data controls',
110
 
                                             -foreground=>$config{colors}{activehighlightcolor},
111
 
                                             -labelside=>'acrosstop',
112
 
                                             -width=>14)
 
106
  my $left = $fr -> LabFrame(-label      => 'Data controls',
 
107
                             -font       => $config{fonts}{med},
 
108
                             -foreground => $config{colors}{activehighlightcolor},
 
109
                             -labelside  => 'acrosstop',
 
110
                             -width      => 14)
113
111
    -> pack(-side=>'left', -padx=>4, -fill=>'x', -anchor=>'n');
114
112
  &labframe_help($left);
115
113
  push @op_text, $left;
179
177
 
180
178
 
181
179
  ## k parameters
182
 
  $fr = $fr -> LabFrame(-label=>'Fourier and fit parameters',
183
 
                        -foreground=>$config{colors}{activehighlightcolor},
184
 
                        -labelside=>'acrosstop',
185
 
                        -width=>14)
 
180
  $fr = $fr -> LabFrame(-label      => 'Fourier and fit parameters',
 
181
                        -font       => $config{fonts}{med},
 
182
                        -foreground => $config{colors}{activehighlightcolor},
 
183
                        -labelside  => 'acrosstop',
 
184
                        -width      => 14)
186
185
    -> pack(-side=>'right', -padx=>4, -fill=>'x', -anchor=>'n');
187
186
  &labframe_help($fr);
188
187
  push @op_text, $fr;
301
300
    -> pack(-side=>'bottom', -padx=>12, -pady=>4);
302
301
 
303
302
  ## fitting space and other fit params
304
 
  $left = $fr -> LabFrame(-label=>'Other parameters',
305
 
                          -foreground=>$config{colors}{activehighlightcolor},
306
 
                          -labelside=>'acrosstop',
307
 
                          -width=>14)
 
303
  $left = $fr -> LabFrame(-label      => 'Other parameters',
 
304
                          -font       => $config{fonts}{med},
 
305
                          -foreground => $config{colors}{activehighlightcolor},
 
306
                          -labelside  => 'acrosstop',
 
307
                          -width      => 14)
308
308
    -> pack(-side=>'left', -padx=>4, -fill=>'x', -anchor=>'n');
309
309
  &labframe_help($left);
310
310
  push @op_text, $left;
367
367
 
368
368
 
369
369
 
370
 
  my $right = $fr -> LabFrame(-label=>'Fit k-weights',
371
 
                              -foreground=>$config{colors}{activehighlightcolor},
372
 
                              -labelside=>'acrosstop',
373
 
                              -width=>14)
 
370
  my $right = $fr -> LabFrame(-label      => 'Fit k-weights',
 
371
                              -font       => $config{fonts}{med},
 
372
                              -foreground => $config{colors}{activehighlightcolor},
 
373
                              -labelside  => 'acrosstop',
 
374
                              -width      => 14)
374
375
    -> pack(-side=>'right', -padx=>4, -fill=>'x', -anchor=>'n');
375
376
  &labframe_help($right);
376
377
  push @op_text, $right;
443
444
 
444
445
 
445
446
  ## fill in the mu(E) tab
446
 
  $fr = $widgets{mu_frame} -> LabFrame(-label=>'Background Removal Parameters',
447
 
                                       -foreground=>$config{colors}{activehighlightcolor},
448
 
                                       -labelside=>'acrosstop',)
 
447
  $fr = $widgets{mu_frame} -> LabFrame(-label      => 'Background Removal Parameters',
 
448
                                       -font       => $config{fonts}{med},
 
449
                                       -foreground => $config{colors}{activehighlightcolor},
 
450
                                       -labelside  => 'acrosstop',)
449
451
    -> pack(-fill=>'x', -anchor=>'n', -pady=>2);
450
452
  $fr -> Label(@start, -text=>'E0')
451
453
    -> grid(-row=>0, -column=>0, -sticky=>'e');
583
585
 
584
586
 
585
587
#  $fr = $widgets{mu_frame} -> LabFrame(-label=>'mu(E) plot controls',
 
588
#                                      -font=>$config{fonts}{med},
586
589
#                                      -foreground=>$config{colors}{activehighlightcolor},
587
590
#                                      -labelside=>'acrosstop',)
588
591
  $fr = $widgets{mu_frame} -> Frame(-borderwidth => 2,
606
609
  $fr -> Button(-text=>'Save chi(k)', -width=>20, @button_list)
607
610
    -> grid(-column=>2, -row=>2, -sticky=>'ew');
608
611
 
609
 
  return $canvas;
 
612
  return $c;
610
613
};
611
614
 
612
615
sub pluck {
658
661
 
659
662
  my @bold   = (-foreground => $config{colors}{mbutton},
660
663
                -background => $config{colors}{activebackground},
 
664
                -cursor     => $mouse_over_cursor,
661
665
                -font       => ($text =~ /Data file/) ? $config{fonts}{bold} : $config{fonts}{med});
662
666
  my @normal = (-foreground => $config{colors}{activehighlightcolor},
663
667
                -background => $config{colors}{background},
709
713
 
710
714
  my $skip = ($text !~ /^(Fit|Fourier|Space)/);
711
715
 
712
 
  my @bold   = (-foreground => $config{colors}{mbutton},);
 
716
  my @bold   = (-foreground => $config{colors}{mbutton},
 
717
                -cursor     => $mouse_over_cursor,
 
718
               );
713
719
  my @normal = (-foreground => $config{colors}{activehighlightcolor},);
714
720
  my @nodata = (-foreground => $config{colors}{activehighlightcolor},);
715
721
 
897
903
 
898
904
  $plot_features{r_pl} ||= 'm';
899
905
  $plot_features{r_pl_label} = $parts{$plot_features{r_pl}};
900
 
  $frm -> Label(-text=>'Plot in R: ', -foreground=>$config{colors}{activehighlightcolor})
 
906
  $frm -> Label(-text       => 'Plot in R: ',
 
907
                -font       => $config{fonts}{med},
 
908
                -foreground => $config{colors}{activehighlightcolor})
901
909
    -> grid(-row=>0, -column=>0, -sticky=>'e');
902
910
  ##   $widgets{plot_r} = $frm -> Optionmenu(-textvariable => \$plot_features{r_pl_label},
903
911
  ##                                    -width=>12,
925
933
 
926
934
  $plot_features{q_pl} ||= 'r';
927
935
  $plot_features{q_pl_label} = $parts{$plot_features{q_pl}};
928
 
  $frm -> Label(-text=>'Plot in q: ', -foreground=>$config{colors}{activehighlightcolor})
 
936
  $frm -> Label(-text       => 'Plot in q: ',
 
937
                -font       => $config{fonts}{med},
 
938
                -foreground => $config{colors}{activehighlightcolor})
929
939
    -> grid(-row=>$r, -column=>0, -sticky=>'e');
930
940
  foreach my $p (@list) {
931
941
    $frm -> Radiobutton(-value    => $p,
941
951
 
942
952
  $plot_features{win} ||= 0;
943
953
  $widgets{plot_win} = $container ->
944
 
    Checkbutton(-text=>'Window',
945
 
                -onvalue=>'w', -offvalue=>"",
946
 
                -selectcolor=>$config{colors}{check},
947
 
                -foreground=>$config{colors}{activehighlightcolor},
948
 
                -activeforeground=>$config{colors}{activehighlightcolor},
949
 
                -variable=>\$plot_features{win},
950
 
                -command => sub{&plot($last_plot, 0)}
 
954
    Checkbutton(-text             => 'Window',
 
955
                -font             => $config{fonts}{med},
 
956
                -onvalue          => 'w',
 
957
                -offvalue         => "",
 
958
                -selectcolor      => $config{colors}{check},
 
959
                -foreground       => $config{colors}{activehighlightcolor},
 
960
                -activeforeground => $config{colors}{activehighlightcolor},
 
961
                -variable         => \$plot_features{win},
 
962
                -command          => sub{&plot($last_plot, 0)}
951
963
               )
952
964
      -> pack();
953
965
  $widgets{plot_bkg} = $container ->
954
 
    Checkbutton(-text=>'Background',
955
 
                -onvalue=>'b', -offvalue=>"",
956
 
                -selectcolor=>$config{colors}{check},
957
 
                -activeforeground=>$config{colors}{activehighlightcolor},
958
 
                -foreground=>$config{colors}{activehighlightcolor},
959
 
                -variable=>\$plot_features{bkg},
960
 
                -command => sub{&plot($last_plot, 0)}
 
966
    Checkbutton(-text             => 'Background',
 
967
                -font             => $config{fonts}{med},
 
968
                -onvalue          => 'b',
 
969
                -offvalue         => "",
 
970
                -selectcolor      => $config{colors}{check},
 
971
                -activeforeground => $config{colors}{activehighlightcolor},
 
972
                -foreground       => $config{colors}{activehighlightcolor},
 
973
                -variable         => \$plot_features{bkg},
 
974
                -command          => sub{&plot($last_plot, 0)}
961
975
               )
962
976
      -> pack();
963
977
 
964
978
  $widgets{plot_res} = $container ->
965
 
    Checkbutton(-text=>'Residual',
966
 
                -onvalue=>'z', -offvalue=>"",
967
 
                -selectcolor=>$config{colors}{check},
968
 
                -foreground=>$config{colors}{activehighlightcolor},
969
 
                -activeforeground=>$config{colors}{activehighlightcolor},
970
 
                -variable=>\$plot_features{res},
971
 
                -command => sub{&plot($last_plot, 0)}
 
979
    Checkbutton(-text             => 'Residual',
 
980
                -font             => $config{fonts}{med},
 
981
                -onvalue          => 'z',
 
982
                -offvalue         => "",
 
983
                -selectcolor      => $config{colors}{check},
 
984
                -foreground       => $config{colors}{activehighlightcolor},
 
985
                -activeforeground => $config{colors}{activehighlightcolor},
 
986
                -variable         => \$plot_features{res},
 
987
                -command          => sub{&plot($last_plot, 0)}
972
988
               )
973
989
      -> pack();
974
990
 
983
999
  $plot_features{qmax} ||= 15;
984
1000
  my $row = 0;
985
1001
  foreach my $s (qw(k R q)) {
986
 
    $frm -> Label(-text=>$s.'min:', -foreground=>$config{colors}{activehighlightcolor})
 
1002
    $frm -> Label(-text       => $s.'min:',
 
1003
                  -font       => $config{fonts}{med},
 
1004
                  -foreground => $config{colors}{activehighlightcolor})
987
1005
      -> grid(-row=>$row, -column=>0);
988
1006
    $widgets{'plot_'.lc($s).'min'} = $frm ->
989
1007
      Entry(-width=>5, -textvariable=>\$plot_features{lc($s).'min'}, -state=>'normal')
990
1008
      -> grid(-row=>$row, -column=>1);
991
 
    $frm -> Label(-text=>$s.'max:', -foreground=>$config{colors}{activehighlightcolor})
 
1009
    $frm -> Label(-text       => $s.'max:',
 
1010
                  -font       => $config{fonts}{med},
 
1011
                  -foreground => $config{colors}{activehighlightcolor})
992
1012
      -> grid(-row=>$row, -column=>2);
993
1013
    $widgets{'plot_'.lc($s).'max'} = $frm ->
994
1014
      Entry(-width=>5, -textvariable=>\$plot_features{lc($s).'max'}, -state=>'normal')
1219
1239
  foreach ($gsd_menu, $feff_menu, $paths_menu, $data_menu, $sum_menu, $fit_menu) { # , $settings_menu) {
1220
1240
    $_ -> configure(-state=>'normal');
1221
1241
  };
1222
 
  $feff_menu  -> menu -> entryconfigure($_, -state=>'disabled') for (5..8, 15, 17);
 
1242
  $feff_menu  -> menu -> entryconfigure($_, -state=>'disabled') for (5..8, 11, 12, 13, 15, 17);
1223
1243
  $paths_menu -> menu -> entryconfigure($_, -state=>'disabled') for (1..3, 5..8, 10..13);
1224
1244
  $fit_menu   -> menu -> entryconfigure(1,  -state=>'disabled', -label=>"Restore this fit model");
1225
1245
  $fit_menu   -> menu -> entryconfigure($_, -state=>'disabled') for (3..8, 10..11, 14..15);
1251
1271
      $feff->packForget(), last SWITCH if ($current_canvas eq 'feff');
1252
1272
      $path->packForget(), last SWITCH if ($current_canvas eq 'path');
1253
1273
    };
1254
 
    $logviewer->pack();
 
1274
    $logviewer->pack(-expand=>1, -fill=>'both');
1255
1275
    my $skip = 1 if ($current_canvas eq 'logview');
1256
1276
    $skip = 0 if $log_params{force};
1257
1277
    $current_canvas = 'logview';
1280
1300
      $path->packForget(), last SWITCH if ($current_canvas eq 'path');
1281
1301
      $logviewer ->packForget(), last SWITCH if ($current_canvas eq 'logview');
1282
1302
    };
1283
 
    $opparams->pack();
 
1303
    $opparams->pack(-expand=>1, -fill=>'both');
1284
1304
    $current_canvas = 'op';
1285
1305
    #my $this = ($current;
1286
1306
    #($anchor =~ /(data\d+)/) and ($this = $1);
1294
1314
      $path    ->packForget(), last SWITCH if ($current_canvas eq 'path');
1295
1315
      $logviewer ->packForget(), last SWITCH if ($current_canvas eq 'logview');
1296
1316
    };
1297
 
    $gsd->pack();
 
1317
    $gsd->pack(-expand=>1, -fill=>'both');
1298
1318
    foreach ($feff_menu, $paths_menu, $fit_menu, $data_menu, $sum_menu) {
1299
1319
      $_ -> configure(-state=>'disabled');
1300
1320
    };
1308
1328
      $path    ->packForget(), last SWITCH if ($current_canvas eq 'path');
1309
1329
      $logviewer ->packForget(), last SWITCH if ($current_canvas eq 'logview');
1310
1330
    };
1311
 
    $feff->pack();
 
1331
    $feff->pack(-expand=>1, -fill=>'both');
1312
1332
    $current_canvas = 'feff';
1313
1333
    populate_feff($current);
1314
 
    map { $feff_menu  -> menu -> entryconfigure($_, -state=>'normal') } (5..8, 15, 17);
 
1334
    map { $feff_menu  -> menu -> entryconfigure($_, -state=>'normal') } (5..8, 11, 12, 13, 11, 12, 13, 15, 17);
1315
1335
    map { $paths_menu -> menu -> entryconfigure($_, -state=>'normal') } (5..8, 13);
 
1336
    ## disabled atoms options in theory menu if the atoms data is not present
 
1337
    my $state = $fefftabs -> pagecget("Atoms", "-state");
 
1338
    map { $feff_menu  -> menu -> entryconfigure($_, -state=>$state) } (10 .. 13);
1316
1339
  } elsif ($anchor =~ /feff\d+\.\d+$/) {
1317
1340
  SWITCH: {
1318
1341
      $opparams->packForget(), last SWITCH if ($current_canvas eq 'op');
1320
1343
      $feff    ->packForget(), last SWITCH if ($current_canvas eq 'feff');
1321
1344
      $logviewer ->packForget(), last SWITCH if ($current_canvas eq 'logview');
1322
1345
    };
1323
 
    $path->pack();
 
1346
    $path->pack(-expand=>1, -fill=>'both');
1324
1347
    $current_canvas = 'path';
1325
1348
    populate_path($current);
1326
 
    map { $feff_menu  -> menu -> entryconfigure($_, -state=>'normal') } (5..8, 15, 17);
 
1349
    map { $feff_menu  -> menu -> entryconfigure($_, -state=>'normal') } (5..8, 11, 12, 13, 15, 17);
1327
1350
    map { $paths_menu -> menu -> entryconfigure($_, -state=>'normal') } (1..3, 5..8, 10..13);
1328
1351
    $paths_menu -> menu -> entryconfigure(3, -state=>'normal') if $n_feff;
1329
1352
    #$show_menu  -> menu -> entryconfigure(3, -state=>'normal') if $n_feff;