[chronojump] encoder updatePulseBar try catch status file
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] encoder updatePulseBar try catch status file
- Date: Thu, 7 Mar 2013 18:50:21 +0000 (UTC)
commit 65422032782d2b667e6855b0e6e6277d333c8e53
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Mar 7 19:22:38 2013 +0100
encoder updatePulseBar try catch status file
src/gui/encoder.cs | 61 ++++++++++++++++++++++++++++-----------------------
1 files changed, 33 insertions(+), 28 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 4406580..b8cfc3d 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -2914,37 +2914,42 @@ Log.Write("l");
return;
}
- string contents = Catalog.GetString("Please, wait.");
- double fraction = -1;
- if(Util.FileExists(Util.GetEncoderStatusTempFileName())) {
- contents = Util.ReadFile(Util.GetEncoderStatusTempFileName(), true);
- //contents is:
- //(1/5) Starting R
- //(5/5) R tasks done
-
- //-48: ascii 0 char
- if(System.Char.IsDigit(contents[1]) && System.Char.IsDigit(contents[3]))
- fraction = Util.DivideSafeFraction(
- Convert.ToInt32(contents[1]-48), Convert.ToInt32(contents[3]-48) );
- }
-
- if(mode == encoderModes.CALCULECURVES || mode == encoderModes.RECALCULATE_OR_LOAD) {
- if(fraction == -1) {
- encoder_pulsebar_capture.Pulse();
- encoder_pulsebar_capture.Text = contents;
- } else {
- encoder_pulsebar_capture.Fraction = fraction;
- encoder_pulsebar_capture.Text = contents.Substring(6);
+ try {
+ string contents = Catalog.GetString("Please, wait.");
+ double fraction = -1;
+ if(Util.FileExists(Util.GetEncoderStatusTempFileName())) {
+ contents = Util.ReadFile(Util.GetEncoderStatusTempFileName(), true);
+ //contents is:
+ //(1/5) Starting R
+ //(5/5) R tasks done
+
+ //-48: ascii 0 char
+ if(System.Char.IsDigit(contents[1]) && System.Char.IsDigit(contents[3]))
+ fraction = Util.DivideSafeFraction(
+ Convert.ToInt32(contents[1]-48),
Convert.ToInt32(contents[3]-48) );
}
- } else {
- if(fraction == -1) {
- encoder_pulsebar_analyze.Pulse();
- encoder_pulsebar_analyze.Text = contents;
+
+ if(mode == encoderModes.CALCULECURVES || mode == encoderModes.RECALCULATE_OR_LOAD) {
+ if(fraction == -1) {
+ encoder_pulsebar_capture.Pulse();
+ encoder_pulsebar_capture.Text = contents;
+ } else {
+ encoder_pulsebar_capture.Fraction = fraction;
+ encoder_pulsebar_capture.Text = contents.Substring(6);
+ }
} else {
- encoder_pulsebar_analyze.Fraction = fraction;
- encoder_pulsebar_analyze.Text = contents.Substring(6);
+ if(fraction == -1) {
+ encoder_pulsebar_analyze.Pulse();
+ encoder_pulsebar_analyze.Text = contents;
+ } else {
+ encoder_pulsebar_analyze.Fraction = fraction;
+ encoder_pulsebar_analyze.Text = contents.Substring(6);
+ }
+
}
-
+ } catch {
+ //Util.GetEncoderStatusTempFileName() is deleted at the end of the process
+ //this can make crash updatePulsebar sometimes
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]