Fixed closing root canvas issue using WaitPrimitive trick.
This commit is contained in:
parent
828b8ddd15
commit
e14dd7303a
@ -1,6 +1,6 @@
|
||||
# Form implementation generated from reading ui file 'TrimSPGUI.ui'
|
||||
#
|
||||
# Created: Mon Nov 30 11:16:53 2009
|
||||
# Created: Tue Mar 2 17:53:21 2010
|
||||
# by: The PerlQt User Interface Compiler (puic)
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
@ -2340,20 +2340,19 @@ sub PlotProfiles
|
||||
my $filenames=join(",",@files);
|
||||
|
||||
if ($filenames ne "" ) {
|
||||
my $Warning = Qt::MessageBox::information( this, "Big Fat Warning",
|
||||
"Warning:\nClose the plot using the menu FILE -> Quit ROOT\nDO NOT CLOSE USING X.");
|
||||
# my $Warning = Qt::MessageBox::information( this, "Big Fat Warning",
|
||||
# "Warning:\nClose the plot using the menu FILE -> Quit ROOT\nDO NOT CLOSE USING X.");
|
||||
|
||||
# Now that we have the file list send it to root macro for plotting.
|
||||
my $cmd='root -n -l "plotRge.C(\"'.$filenames.'\")"';
|
||||
my $cmd='root -n -l "plotRge.C(\"'.$filenames.'\")"&';
|
||||
# my $pid = open(FTO,"$cmd");
|
||||
my $pid = open(FTO,"$cmd 2>&1 |");
|
||||
print "PID=$pid\n";
|
||||
while (<FTO>) {
|
||||
print "$_";
|
||||
}
|
||||
close(FTO);
|
||||
# my $pid=system($cmd);
|
||||
|
||||
# my $pid = open(FTO,"$cmd 2>&1 |");
|
||||
# print "PID=$pid\n";
|
||||
# while (<FTO>) {
|
||||
# print "$_";
|
||||
# }
|
||||
# close(FTO);
|
||||
my $pid=system($cmd);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -622,20 +622,19 @@ void TrimSPGUI::PlotProfiles()
|
||||
my $filenames=join(",",@files);
|
||||
|
||||
if ($filenames ne "" ) {
|
||||
my $Warning = Qt::MessageBox::information( this, "Big Fat Warning",
|
||||
"Warning:\nClose the plot using the menu FILE -> Quit ROOT\nDO NOT CLOSE USING X.");
|
||||
# my $Warning = Qt::MessageBox::information( this, "Big Fat Warning",
|
||||
# "Warning:\nClose the plot using the menu FILE -> Quit ROOT\nDO NOT CLOSE USING X.");
|
||||
|
||||
# Now that we have the file list send it to root macro for plotting.
|
||||
my $cmd='root -n -l "plotRge.C(\"'.$filenames.'\")"';
|
||||
my $cmd='root -n -l "plotRge.C(\"'.$filenames.'\")"&';
|
||||
# my $pid = open(FTO,"$cmd");
|
||||
my $pid = open(FTO,"$cmd 2>&1 |");
|
||||
print "PID=$pid\n";
|
||||
while (<FTO>) {
|
||||
print "$_";
|
||||
}
|
||||
close(FTO);
|
||||
# my $pid=system($cmd);
|
||||
|
||||
# my $pid = open(FTO,"$cmd 2>&1 |");
|
||||
# print "PID=$pid\n";
|
||||
# while (<FTO>) {
|
||||
# print "$_";
|
||||
# }
|
||||
# close(FTO);
|
||||
my $pid=system($cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -114,9 +114,9 @@ void plotRge(TString &names)
|
||||
rge[last]->GetXaxis()->SetTitle("depth (nm)");
|
||||
rge[last]->GetYaxis()->SetTitle("normalized stopping distribution (nm^{-1})");
|
||||
|
||||
TCanvas *c1 = new TCanvas("c1", "rge plot");
|
||||
TCanvas *c1 = new TCanvas("c1", "Range");
|
||||
c1->Show();
|
||||
|
||||
|
||||
rge[last]->Draw("apl");
|
||||
rge[last]->GetYaxis()->SetRangeUser(min, 1.05*max);
|
||||
|
||||
@ -144,5 +144,13 @@ void plotRge(TString &names)
|
||||
legend->Draw();
|
||||
|
||||
delete tokens;
|
||||
|
||||
// I am not sure what this does, but it waits until canvas is closed
|
||||
c1->WaitPrimitive(" ");
|
||||
cout << endl << "Canvas Closed" << endl ;
|
||||
|
||||
// Then quit root cleanly
|
||||
gApplication->Terminate();
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user