[chronojump] Encoder recalibrate done!
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder recalibrate done!
- Date: Tue, 4 Jul 2017 09:27:23 +0000 (UTC)
commit 89ba37b559077f064c1937c522c62a503c6470a6
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jul 4 11:27:02 2017 +0200
Encoder recalibrate done!
glade/app1.glade | 55 +++++++++++++++++++++++++++++++++++++++++++++++-
src/gui/chronojump.cs | 8 +++++++
src/gui/encoder.cs | 43 ++++++++++++++++++++++++++++---------
3 files changed, 93 insertions(+), 13 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 9a008ee..7121bbc 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1334,6 +1334,9 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel"
id="label_start_selector_jumps">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -17220,9 +17223,11 @@ then click this button.</property>
</packing>
</child>
<child>
- <widget class="GtkHButtonBox" id="hbuttonbox12">
+ <widget class="GtkVButtonBox" id="vbuttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">30</property>
+ <property name="layout_style">start</property>
<child>
<widget class="GtkButton"
id="button_encoder_inertial_calibrate">
<property name="visible">True</property>
@@ -17275,6 +17280,50 @@ then click this button.</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkLabel"
id="label_calibrate_output_message">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVButtonBox" id="vbuttonbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <widget class="GtkButton"
id="button_encoder_inertial_calibrate_close">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="relief">half</property>
+ <signal name="clicked"
handler="on_button_encoder_inertial_calibrate_close_clicked" swapped="no"/>
+ <accelerator key="Escape" signal="clicked"/>
+ <child>
+ <widget class="GtkLabel" id="label89">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Close</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -17500,7 +17549,6 @@ then click this button.</property>
<property name="bottom_padding">3</property>
<child>
<widget class="GtkButton"
id="button_encoder_inertial_recalibrate">
- <property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="tooltip"
translatable="yes">Calbrate again</property>
@@ -20788,6 +20836,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 5ae5c13..d604c76 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -6780,6 +6780,7 @@ LogB.Debug("X");
button_contacts_person_change.Sensitive = false;
button_encoder_person_change.Sensitive = false;
+ button_encoder_inertial_recalibrate.Sensitive = false;
encoderButtonsSensitive(encoderSensEnum.PROCESSINGR);
@@ -6840,6 +6841,13 @@ LogB.Debug("X");
button_contacts_person_change.Sensitive = true;
button_encoder_person_change.Sensitive = true;
+ //allow show the recalibrate button
+ if(encoderInertialCalibratedFirstTime)
+ {
+ button_encoder_inertial_recalibrate.Visible = true;
+ button_encoder_inertial_recalibrate.Sensitive = true;
+ }
+
if(encoderCaptureCurves != null && encoderCaptureCurves.Count > 0)
encoderButtonsSensitive(encoderSensEnum.DONEYESSIGNAL);
else
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 91d2c9c..875746e 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -81,7 +81,12 @@ public partial class ChronoJumpWindow
[Widget] Gtk.RadioButton radio_encoder_capture_1set;
[Widget] Gtk.RadioButton radio_encoder_capture_cont;
[Widget] Gtk.Button button_encoder_capture;
+
+ //encoder calibrate/recalibrate widgets
[Widget] Gtk.Button button_encoder_inertial_calibrate;
+ [Widget] Gtk.Button button_encoder_inertial_recalibrate;
+ [Widget] Gtk.Label label_calibrate_output_message;
+ [Widget] Gtk.Button button_encoder_inertial_calibrate_close;
[Widget] Gtk.Label label_wait;
@@ -321,6 +326,7 @@ public partial class ChronoJumpWindow
EncoderConfiguration encoderConfigurationCurrent;
Constants.EncoderGI currentEncoderGI; //store here to not have to check the GUI and have thread
problems
bool firstSetOfCont; //used to don't erase the screen on cont after first set
+ bool encoderInertialCalibratedFirstTime; //allow showing the recalibrate button
/*
* this contains last EncoderSQL captured, recalculated or loaded
@@ -447,6 +453,9 @@ public partial class ChronoJumpWindow
capturingCsharp = encoderCaptureProcess.STOPPED;
+ button_encoder_inertial_recalibrate.Visible = false;
+ encoderInertialCalibratedFirstTime = false; //allow show the recalibrate button
+
//done here because in Glade we cannot use the TextBuffer.Changed
textview_encoder_signal_comment.Buffer.Changed += new
EventHandler(on_textview_encoder_signal_comment_key_press_event);
@@ -660,6 +669,10 @@ public partial class ChronoJumpWindow
if(! canCaptureEncoder())
return;
+ //allow show the recalibrate button
+ encoderInertialCalibratedFirstTime = true;
+ label_calibrate_output_message.Text = Catalog.GetString("Calibrated");
+
/*
* if user calibrates again: put 0 value
* if calibration was not running: start it
@@ -667,15 +680,29 @@ public partial class ChronoJumpWindow
if(encoderThreadBG != null && encoderThreadBG.IsAlive)
eCaptureInertialBG.AngleNow = 0;
else
- {
encoderThreadStart(encoderActions.CAPTURE_BG);
- }
}
void on_button_encoder_inertial_recalibrate_clicked (object o, EventArgs args)
{
+ prepareForEncoderInertiaCalibrate();
+ }
+ void prepareForEncoderInertiaCalibrate()
+ {
+ sensitiveGuiEventDoing(radio_encoder_capture_cont.Active);
+ button_encoder_inertial_calibrate.Sensitive = true;
+ button_encoder_inertial_calibrate_close.Sensitive = true;
+ label_wait.Text = " ";
+ label_calibrate_output_message.Text = "";
+ button_encoder_inertial_recalibrate.Visible = true;
notebook_encoder_capture_or_exercise_or_instructions.Page = 2;
}
+ private void on_button_encoder_inertial_calibrate_close_clicked (object o, EventArgs args)
+ {
+ notebook_encoder_capture_or_exercise_or_instructions.Page = 0;
+ sensitiveGuiEventDone();
+ }
+
private void setEncoderExerciseOptionsFromPreferences()
{
Sqlite.Open();
@@ -821,18 +848,11 @@ public partial class ChronoJumpWindow
if(encoderConfigurationCurrent.has_inertia)
{
- //show inertia calibrate instructions. User will click on calibrate and this
method will be called again
-
- sensitiveGuiEventDoing(radio_encoder_capture_cont.Active);
- button_encoder_inertial_calibrate.Sensitive = true;
- label_wait.Text = " ";
- notebook_encoder_capture_or_exercise_or_instructions.Page = 2;
-
+ prepareForEncoderInertiaCalibrate();
return;
}
}
-
//This notebook has capture (signal plotting), and curves (shows R graph)
if(notebook_encoder_capture.CurrentPage == 1)
notebook_encoder_capture.PrevPage();
@@ -854,7 +874,7 @@ public partial class ChronoJumpWindow
LogB.Debug("end of Calling encoderThreadStart for capture");
}
-
+
void on_button_encoder_capture_calcule_im ()
{
//check if chronopics have changed
@@ -5450,6 +5470,7 @@ public partial class ChronoJumpWindow
if(! shownWaitAtInertialCapture)
{
button_encoder_inertial_calibrate.Sensitive = false;
+ button_encoder_inertial_calibrate_close.Sensitive = false;
label_wait.Text = string.Format("Exercise will start in {0} seconds.", 3);
shownWaitAtInertialCapture = true;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]