[chronojump] Implemented force sensor exercise creation
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Implemented force sensor exercise creation
- Date: Mon, 3 Dec 2018 17:12:19 +0000 (UTC)
commit c5b1e122d677d84c70312ef4144e61703b2bf523
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Dec 3 18:11:48 2018 +0100
Implemented force sensor exercise creation
glade/app1.glade | 409 ++++++++++++++++++++++--------------------
src/forceSensor.cs | 34 ++++
src/gui/chronojump.cs | 13 ++
src/gui/chronojumpIcons.cs | 2 +
src/gui/forceSensor.cs | 163 ++++++++++++++++-
src/gui/forceSensorAnalyze.cs | 9 +-
src/sqlite/forceSensor.cs | 62 ++++++-
src/sqlite/main.cs | 12 +-
8 files changed, 490 insertions(+), 214 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index a6822f1a..4b916d2e 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1790,6 +1790,15 @@
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <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>
@@ -5237,51 +5246,92 @@ EncoderInertialCapture</property>
</packing>
</child>
<child>
- <widget class="GtkAlignment" id="alignment9">
+ <widget class="GtkAlignment"
id="alignment_force_sensor">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="top_padding">8</property>
<child>
- <widget class="GtkHBox" id="hbox_force_buttons">
+ <widget class="GtkHBox"
id="hbox_force_capture_buttons">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">30</property>
+ <property name="spacing">100</property>
<child>
- <widget class="GtkButton"
id="button_force_sensor_capture_load">
+ <widget class="GtkHBox" id="hbox_force_sensor">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked"
handler="on_button_force_sensor_load_clicked" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="spacing">20</property>
<child>
- <widget class="GtkHBox" id="hbox236">
+ <widget class="GtkHBox" id="hbox152">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="spacing">8</property>
<child>
- <widget class="GtkImage"
id="image_force_sensor_capture_load">
+ <widget class="GtkLabel" id="label18">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property
name="stock">gtk-missing-image</property>
+ <property name="label"
translatable="yes">Test</property>
</widget>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label157">
+ <widget class="GtkHBox"
id="hbox_combo_force_sensor_exercise">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Load
file</property>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox" id="hbox298">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkButton"
id="button_force_sensor_exercise_add">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Add
exercise type</property>
+ <signal name="clicked"
handler="on_button_force_sensor_exercise_add_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkImage" id="image_add_test5">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-new</property>
+ <property name="icon-size">2</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
<packing>
@@ -5291,18 +5341,18 @@ EncoderInertialCapture</property>
</packing>
</child>
<child>
- <widget class="GtkButton"
id="button_force_sensor_adjust">
+ <widget class="GtkButton"
id="button_force_sensor_capture_load">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked"
handler="on_button_force_sensor_adjust_clicked" swapped="no"/>
+ <signal name="clicked"
handler="on_button_force_sensor_load_clicked" swapped="no"/>
<child>
- <widget class="GtkHBox" id="hbox152">
+ <widget class="GtkHBox" id="hbox236">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkImage"
id="image_force_sensor_capture_adjust">
+ <widget class="GtkImage"
id="image_force_sensor_capture_load">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property
name="stock">gtk-missing-image</property>
@@ -5314,10 +5364,10 @@ EncoderInertialCapture</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label51">
+ <widget class="GtkLabel" id="label157">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label"
translatable="yes">Adjust</property>
+ <property name="label" translatable="yes">Load
file</property>
</widget>
<packing>
<property name="expand">True</property>
@@ -5801,6 +5851,49 @@ EncoderInertialCapture</property>
<property name="position">1</property>
</packing>
</child>
+ <child>
+ <widget class="GtkButton"
id="button_force_sensor_adjust">
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_force_sensor_adjust_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox207">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkImage"
id="image_force_sensor_capture_adjust">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label51">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Adjust</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
@@ -7194,72 +7287,22 @@ EncoderInertialCapture</property>
</packing>
</child>
<child>
- <widget class="GtkAlignment"
id="alignment_force_sensor_adjust">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="xscale">0</property>
- <child>
- <widget class="GtkHBox" id="hbox207">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">30</property>
- <child>
- <widget class="GtkButton"
id="button_force_sensor_adjust_close">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked"
handler="on_button_force_sensor_adjust_close_clicked" swapped="no"/>
- <accelerator key="Escape" signal="clicked"/>
- <child>
- <widget class="GtkHBox" id="hbox269">
+ <widget class="GtkHBox" id="hbox301">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
<child>
- <widget class="GtkImage"
id="image_force_sensor_capture_adjust_close">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property
name="stock">gtk-missing-image</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
+ <placeholder/>
</child>
<child>
- <widget class="GtkLabel" id="label299">
- <property name="visible">True</property>
+ <widget class="GtkAlignment"
id="alignment_force_sensor_adjust">
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Close
options</property>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
+ <property name="xalign">0</property>
+ <property name="xscale">0</property>
<child>
- <widget class="GtkVSeparator" id="vseparator6">
+ <widget class="GtkHBox" id="hbox230">
<property name="visible">True</property>
<property name="can_focus">False</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="spacing">30</property>
<child>
<widget class="GtkButton"
id="button_force_sensor_tare">
<property name="visible">True</property>
@@ -7301,11 +7344,11 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox230">
+ <widget class="GtkHBox" id="hbox237">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
@@ -7362,7 +7405,7 @@ EncoderInertialCapture</property>
<property name="receives_default">True</property>
<signal name="clicked"
handler="on_buttons_force_sensor_clicked" swapped="no"/>
<child>
- <widget class="GtkHBox" id="hbox237">
+ <widget class="GtkHBox" id="hbox254">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
@@ -7403,7 +7446,7 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">True</property>
<property name="fill">False</property>
- <property name="position">3</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
@@ -7423,6 +7466,62 @@ EncoderInertialCapture</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkVSeparator" id="vseparator6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_force_sensor_adjust_close">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked"
handler="on_button_force_sensor_adjust_close_clicked" swapped="no"/>
+ <accelerator key="Escape" signal="clicked"/>
+ <child>
+ <widget class="GtkHBox" id="hbox269">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkImage"
id="image_force_sensor_capture_adjust_close">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label299">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Close
options</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
@@ -7430,6 +7529,13 @@ EncoderInertialCapture</property>
</child>
</widget>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
<property name="position">4</property>
</packing>
</child>
@@ -19184,114 +19290,6 @@ Concentric</property>
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel"
id="label_force_sensor_ai_rfd_a">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -19579,6 +19577,15 @@ Concentric</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkCheckButton"
id="checkbutton_force_sensor_ai_b">
<property name="width_request">30</property>
<property name="visible">True</property>
@@ -19664,6 +19671,15 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -27919,6 +27935,15 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index 7782e0d6..4d475a61 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -23,6 +23,40 @@ using System.IO; //for detect OS
using System.Collections.Generic; //List<T>
using Mono.Unix;
+public class ForceSensorExercise
+{
+ private int uniqueID;
+ private string name;
+ private int percentBodyWeight;
+ private string resistance;
+ private int angleDefault;
+ private string description;
+
+ public ForceSensorExercise()
+ {
+ }
+
+ public ForceSensorExercise(string name)
+ {
+ this.name = name;
+ }
+
+ public ForceSensorExercise(int uniqueID, string name, int percentBodyWeight, string resistance, int
angleDefault, string description)
+ {
+ this.uniqueID = uniqueID;
+ this.name = name;
+ this.percentBodyWeight = percentBodyWeight;
+ this.resistance = resistance;
+ this.angleDefault = angleDefault;
+ this.description = description;
+ }
+
+ public string Name
+ {
+ get { return name; }
+ }
+}
+
/*
* TODO: this class only contains points plot stuff
* currently all the code relevant to force sensor actions is on gui/forcesensor.cs
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 4d3d95d5..aadad8a1 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -344,6 +344,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.HBox hbox_chronopics_and_more;
[Widget] Gtk.Button button_activate_chronopics;
[Widget] Gtk.Button button_threshold;
+ [Widget] Gtk.Button button_force_sensor_adjust;
//non standard icons
[Widget] Gtk.Image image_jump_reactive_bell;
@@ -3193,6 +3194,7 @@ public partial class ChronoJumpWindow
//notebook_capture_analyze.ShowTabs = true;
hbox_contacts_sup_capture_analyze_two_buttons.Visible = true;
button_threshold.Visible = true;
+ button_force_sensor_adjust.Visible = false;
if(m == Constants.Menuitem_modes.JUMPSSIMPLE)
{
notebooks_change(m);
@@ -3222,6 +3224,7 @@ public partial class ChronoJumpWindow
//notebook_capture_analyze.ShowTabs = true;
hbox_contacts_sup_capture_analyze_two_buttons.Visible = true;
button_threshold.Visible = true;
+ button_force_sensor_adjust.Visible = false;
button_inspect_last_test.Visible = true;
if(m == Constants.Menuitem_modes.RUNSSIMPLE)
@@ -3361,6 +3364,7 @@ public partial class ChronoJumpWindow
//notebook_capture_analyze.ShowTabs = false; //only capture tab is shown (only valid
for "OTHER" tests)
hbox_contacts_sup_capture_analyze_two_buttons.Visible = true;
button_threshold.Visible = false;
+ button_force_sensor_adjust.Visible = true;
//notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
hbox_results_legend.Visible = false;
@@ -3378,6 +3382,7 @@ public partial class ChronoJumpWindow
//notebook_capture_analyze.ShowTabs = false; //only capture tab is shown (only valid
for "OTHER" tests)
hbox_contacts_sup_capture_analyze_two_buttons.Visible = false;
button_threshold.Visible = false;
+ button_force_sensor_adjust.Visible = false;
//notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
hbox_results_legend.Visible = false;
@@ -3398,6 +3403,7 @@ public partial class ChronoJumpWindow
//notebook_capture_analyze.ShowTabs = false; //only capture tab is shown (only valid
for "OTHER" tests)
hbox_contacts_sup_capture_analyze_two_buttons.Visible = false;
button_threshold.Visible = true;
+ button_force_sensor_adjust.Visible = false;
//notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
}
else { //m == Constants.Menuitem_modes.OTHER (contacts / other)
@@ -3410,6 +3416,7 @@ public partial class ChronoJumpWindow
//notebook_capture_analyze.ShowTabs = false; //only capture tab is shown (only valid
for "OTHER" tests)
hbox_contacts_sup_capture_analyze_two_buttons.Visible = false;
button_threshold.Visible = true;
+ button_force_sensor_adjust.Visible = false;
//notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
}
@@ -7536,6 +7543,7 @@ LogB.Debug("mc finished 5");
sensitiveLastTestButtons(false);
vbox_execute_test.Sensitive = false;
button_execute_test.Sensitive = false;
+ button_force_sensor_adjust.Sensitive = false;
encoderButtonsSensitive(encoderSensEnum.NOSESSION);
@@ -7555,6 +7563,7 @@ LogB.Debug("mc finished 5");
button_contacts_person_change.Sensitive = true;
button_encoder_person_change.Sensitive = true;
+ button_force_sensor_adjust.Sensitive = false;
menuSessionSensitive(true);
vbox_stats.Sensitive = true;
@@ -7581,6 +7590,7 @@ LogB.Debug("mc finished 5");
menuPersonSelectedSensitive(false);
vbox_execute_test.Sensitive = false;
+ button_force_sensor_adjust.Sensitive = false;
label_top_person_name.Text = "";
label_top_encoder_person_name.Text = "";
@@ -7615,6 +7625,7 @@ LogB.Debug("mc finished 5");
combo_select_runs_interval.Sensitive = true;
combo_result_runs_interval.Sensitive = true;
combo_pulses.Sensitive = true;
+ button_force_sensor_adjust.Sensitive = true;
vbox_execute_test.Sensitive = true;
}
@@ -7676,6 +7687,7 @@ LogB.Debug("mc finished 5");
button_activate_chronopics.Sensitive = false;
button_threshold.Sensitive = false;
+ button_force_sensor_adjust.Sensitive = false;
button_auto_start.Sensitive = false;
notebook_options_top.Sensitive = false;
event_execute_button_update.Sensitive = false;
@@ -7740,6 +7752,7 @@ LogB.Debug("mc finished 5");
button_activate_chronopics.Sensitive = true;
button_threshold.Sensitive = true;
+ button_force_sensor_adjust.Sensitive = true;
button_auto_start.Sensitive = true;
notebook_options_top.Sensitive = true;
event_execute_button_update.Sensitive = true;
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 875c5cf9..310f734b 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -75,6 +75,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_add_test2;
[Widget] Gtk.Image image_add_test3;
[Widget] Gtk.Image image_add_test4;
+ [Widget] Gtk.Image image_add_test5;
[Widget] Gtk.Image image_test_inspect;
[Widget] Gtk.Image image_message_at_start;
@@ -268,6 +269,7 @@ public partial class ChronoJumpWindow
image_add_test2.Pixbuf = pixbuf;
image_add_test3.Pixbuf = pixbuf;
image_add_test4.Pixbuf = pixbuf;
+ image_add_test5.Pixbuf = pixbuf;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_test_inspect.png");
image_test_inspect.Pixbuf = pixbuf;
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 486721bd..6d5803aa 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -26,6 +26,7 @@ using Gtk;
using Gdk;
using Glade;
using System.Text; //StringBuilder
+using System.Collections;
using System.Collections.Generic; //List<T>
using Mono.Unix;
@@ -65,7 +66,10 @@ public partial class ChronoJumpWindow
[Widget] Gtk.MenuItem menuitem_force_sensor_check_version;
//capture tab tab
- [Widget] Gtk.HBox hbox_force_buttons;
+ [Widget] Gtk.HBox hbox_force_capture_buttons;
+ [Widget] Gtk.Box hbox_combo_force_sensor_exercise;
+ [Widget] Gtk.ComboBox combo_force_sensor_exercise;
+ [Widget] Gtk.Alignment alignment_force_sensor_adjust;
[Widget] Gtk.Button button_force_sensor_tare;
[Widget] Gtk.Button button_force_sensor_calibrate;
[Widget] Gtk.Label label_force_sensor_value_max;
@@ -126,6 +130,16 @@ public partial class ChronoJumpWindow
Catalog.GetString("Force sensor is not detected!") + " " +
Catalog.GetString("Plug cable and click on 'device' button.");
+
+ private void initForceSensor ()
+ {
+ createForceExerciseCombo();
+ createForceAnalyzeCombos();
+ setRFDValues();
+ setImpulseValue();
+ }
+
+
private void force_graphs_init()
{
colormapForce = Gdk.Colormap.System;
@@ -332,7 +346,7 @@ public partial class ChronoJumpWindow
void forceSensorButtonsSensitive(bool sensitive)
{
//force related buttons
- hbox_force_buttons.Sensitive = sensitive;
+ hbox_force_capture_buttons.Sensitive = sensitive;
button_execute_test.Sensitive = sensitive;
button_force_sensor_analyze_load.Sensitive = sensitive;
@@ -1422,9 +1436,6 @@ LogB.Information(" re R ");
{
hbox_capture_phases_time_record.Visible = ! modeForceSensor;
button_image_test_zoom.Visible = ! modeForceSensor;
- notebook_options_top.Visible = ! modeForceSensor;
-
- //button_threshold.Visible = ! modeForceSensor;
menuitem_force_sensor_open_folder.Visible = modeForceSensor;
menuitem_force_sensor_check_version.Visible = modeForceSensor;
@@ -1432,21 +1443,27 @@ LogB.Information(" re R ");
private void on_button_force_sensor_adjust_clicked (object o, EventArgs args)
{
- notebook_options_top.Visible = true;
+ hbox_force_capture_buttons.Sensitive = false;
+ button_force_sensor_adjust.Sensitive = false;
+ alignment_force_sensor_adjust.Visible = true;
notebook_options_at_execute_button.CurrentPage = 2;
+
forceSensorCaptureAdjustSensitivity(false);
event_execute_label_message.Text = Catalog.GetString("If you want to calibrate, please tare
first.");
}
private void on_button_force_sensor_adjust_close_clicked (object o, EventArgs args)
{
- notebook_options_top.Visible = false;
+ hbox_force_capture_buttons.Sensitive = true;
+ button_force_sensor_adjust.Sensitive = true;
+ alignment_force_sensor_adjust.Visible = false;
notebook_options_at_execute_button.CurrentPage = 0;
+
forceSensorCaptureAdjustSensitivity(true);
}
private void forceSensorCaptureAdjustSensitivity(bool s) //s for sensitive. When adjusting s = false
{
- hbox_force_buttons.Sensitive = s;
+ hbox_force_capture_buttons.Sensitive = s;
button_activate_chronopics.Sensitive = s;
image_test.Sensitive = s;
@@ -1465,6 +1482,134 @@ LogB.Information(" re R ");
preferences.GetForceSensorAdjustString());
}
+ // -------------------------------- exercise stuff --------------------
+
+
+ private void createForceExerciseCombo ()
+ {
+ //force_sensor_exercise
+
+ combo_force_sensor_exercise = ComboBox.NewText ();
+ fillForceSensorExerciseCombo();
+
+// combo_force_sensor_exercise.Changed += new EventHandler
(on_combo_force_sensor_exercise_changed);
+ hbox_combo_force_sensor_exercise.PackStart(combo_force_sensor_exercise, true, true, 0);
+ hbox_combo_force_sensor_exercise.ShowAll();
+ }
+
+ //TODO: implement this with id:name like exerciseNameTranslated but without translation
+ private void fillForceSensorExerciseCombo()
+ {
+ ArrayList forceSensorExercises = SqliteForceSensorExercise.Select (false, -1, true);
+ if(forceSensorExercises.Count == 0)
+ return;
+
+ string [] exerciseNamesToCombo = new String [forceSensorExercises.Count];
+ int i =0;
+ foreach(ForceSensorExercise ex in forceSensorExercises)
+ exerciseNamesToCombo[i++] = ex.Name;
+
+ UtilGtk.ComboUpdate(combo_force_sensor_exercise, exerciseNamesToCombo, "");
+ combo_force_sensor_exercise.Active = 0;
+ }
+
+ //info is now info and edit (all values can be changed), and detete (there's delete button)
+ void on_button_force_sensor_exercise_edit_clicked (object o, EventArgs args)
+ {
+ if(UtilGtk.ComboGetActive(combo_force_sensor_exercise) == "")
+ {
+ new DialogMessage(Constants.MessageTypes.WARNING, "Need to create/select an
exercise.");
+ return;
+ }
+
+ //TODO
+ }
+
+ private void on_button_force_sensor_exercise_add_clicked (object o, EventArgs args)
+ {
+ ArrayList bigArray = new ArrayList();
+
+ ArrayList a1 = new ArrayList();
+ ArrayList a2 = new ArrayList();
+ ArrayList a3 = new ArrayList();
+ ArrayList a4 = new ArrayList();
+ //ArrayList a5 = new ArrayList();
+
+ //0 is the widgget to show; 1 is the editable; 2 id default value
+ a1.Add(Constants.GenericWindowShow.ENTRY); a1.Add(true); a1.Add("");
+ bigArray.Add(a1);
+
+ a2.Add(Constants.GenericWindowShow.SPININT); a2.Add(true); a2.Add("");
+ bigArray.Add(a2);
+
+ a3.Add(Constants.GenericWindowShow.ENTRY2); a3.Add(true); a3.Add("");
+ bigArray.Add(a3);
+
+ a4.Add(Constants.GenericWindowShow.ENTRY3); a4.Add(true); a4.Add("");
+ bigArray.Add(a4);
+
+ //a5.Add(Constants.GenericWindowShow.SPININT2); a5.Add(true); a5.Add("");
+ //bigArray.Add(a5);
+
+
+ genericWin = GenericWindow.Show(Catalog.GetString("Exercise"), false, //don't show now
+ Catalog.GetString("Write the name of the force sensor exercise:"), bigArray);
+ genericWin.LabelSpinInt = Catalog.GetString("Displaced body weight") + " (%)";
+ genericWin.SetSpinRange(0, 100);
+ genericWin.LabelEntry2 = Catalog.GetString("Resistance");
+ genericWin.LabelEntry3 = Catalog.GetString("Description");
+ //genericWin.LabelSpinInt2 = Catalog.GetString("Default angle");
+ //genericWin.SetSpin2Range(0,180);
+
+ genericWin.SetButtonAcceptLabel(Catalog.GetString("Add"));
+
+ genericWin.HideOnAccept = false;
+
+ genericWin.Button_accept.Clicked += new
EventHandler(on_button_force_sensor_exercise_add_accepted);
+ genericWin.ShowNow();
+ }
+
+ void on_button_force_sensor_exercise_add_accepted (object o, EventArgs args)
+ {
+ if(force_sensor_exercise_add())
+ {
+ genericWin.Button_accept.Clicked -= new
EventHandler(on_button_force_sensor_exercise_add_accepted);
+ genericWin.HideAndNull();
+ }
+ }
+
+ bool force_sensor_exercise_add ()
+ {
+ string name = Util.RemoveTildeAndColonAndDot(genericWin.EntrySelected);
+ name = Util.RemoveChar(name, '"');
+
+ LogB.Information("force_sensor_exercise_add - Trying to insert: " + name);
+
+ if(name == "")
+ genericWin.SetLabelError(Catalog.GetString("Error: Missing name of exercise."));
+ else if (Sqlite.Exists(false, Constants.ForceSensorExerciseTable, name))
+ genericWin.SetLabelError(string.Format(Catalog.GetString(
+ "Error: An exercise named '{0}' already exists."),
name));
+ else {
+ SqliteForceSensorExercise.Insert(false, -1, name, genericWin.SpinIntSelected,
+ genericWin.Entry2Selected,
+ genericWin.SpinInt2Selected,
+ genericWin.Entry3Selected
+ );
+
+ fillForceSensorExerciseCombo();
+
+ LogB.Information("done");
+ return true;
+ }
+
+ return false;
+ }
+
+ // -------------------------------- end of exercise stuff --------------------
+
+ // ------------------------------------------------ slides stuff for presentations
+
double lastChangedTime; //changeSlideCode
private void changeSlideIfNeeded(int time, double force)
{
@@ -1504,4 +1649,6 @@ LogB.Information(" re R ");
return execute_result.success;
}
+ // ------------------------------------------------ end of slides stuff for presentations
+
}
diff --git a/src/gui/forceSensorAnalyze.cs b/src/gui/forceSensorAnalyze.cs
index 2513551f..b9b6e993 100644
--- a/src/gui/forceSensorAnalyze.cs
+++ b/src/gui/forceSensorAnalyze.cs
@@ -164,13 +164,6 @@ public partial class ChronoJumpWindow
forceSensorAnalyzeOptionsSensitivity(true);
}
- private void initForceSensor ()
- {
- createForceCombos();
- setRFDValues();
- setImpulseValue();
- }
-
private void check_force_visibilities()
{
hbox_force_1.Visible = (check_force_1.Active);
@@ -185,7 +178,7 @@ public partial class ChronoJumpWindow
check_force_visibilities();
}
- private void createForceCombos ()
+ private void createForceAnalyzeCombos ()
{
UtilGtk.ComboUpdate(combo_force_1_function, ForceSensorRFD.FunctionsArray(true), "");
UtilGtk.ComboUpdate(combo_force_2_function, ForceSensorRFD.FunctionsArray(true), "");
diff --git a/src/sqlite/forceSensor.cs b/src/sqlite/forceSensor.cs
index ffd32770..17403ebe 100644
--- a/src/sqlite/forceSensor.cs
+++ b/src/sqlite/forceSensor.cs
@@ -20,6 +20,7 @@
using System;
//using System.Data;
+using System.Collections;
using System.Collections.Generic; //List<T>
using Mono.Data.Sqlite;
@@ -43,8 +44,8 @@ class SqliteForceSensorExercise : Sqlite
"uniqueID INTEGER PRIMARY KEY, " +
"name TEXT, " +
"percentBodyWeight INT, " +
- "ressistance TEXT, " +
- "angle INT, " +
+ "resistance TEXT, " +
+ "angleDefault INT, " +
"description TEXT )";
dbcmd.ExecuteNonQuery();
}
@@ -52,7 +53,7 @@ class SqliteForceSensorExercise : Sqlite
//undefined defaultAngle will be 1000
//note execution can have a different angle than the default angle
public static void Insert (bool dbconOpened, int uniqueID, string name, int percentBodyWeight,
- string ressistance, int angleDefault, string description)
+ string resistance, int angleDefault, string description)
{
if(! dbconOpened)
Sqlite.Open();
@@ -62,9 +63,9 @@ class SqliteForceSensorExercise : Sqlite
uniqueIDStr = uniqueID.ToString();
dbcmd.CommandText = "INSERT INTO " + table +
- " (uniqueID, name, percentBodyWeight, ressistance, angleDefault,
description)" +
+ " (uniqueID, name, percentBodyWeight, resistance, angleDefault, description)"
+
" VALUES (" + uniqueIDStr + ", \"" + name + "\", " + percentBodyWeight + ",
\"" +
- ressistance + "\", " + angleDefault + ", \"" + description + "\")";
+ resistance + "\", " + angleDefault + ", \"" + description + "\")";
LogB.SQL(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
@@ -72,6 +73,57 @@ class SqliteForceSensorExercise : Sqlite
Sqlite.Close();
}
+ public static ArrayList Select (bool dbconOpened, int uniqueID, bool onlyNames)
+ {
+ if(! dbconOpened)
+ Sqlite.Open();
+
+ string uniqueIDStr = "";
+ if(uniqueID != -1)
+ uniqueIDStr = " WHERE " + table + ".uniqueID = " + uniqueID;
+
+ if(onlyNames)
+ dbcmd.CommandText = "SELECT name FROM " + table + uniqueIDStr;
+ else
+ dbcmd.CommandText = "SELECT * FROM " + table + uniqueIDStr;
+
+ LogB.SQL(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+
+ SqliteDataReader reader;
+ reader = dbcmd.ExecuteReader();
+
+ ArrayList array = new ArrayList(1);
+ ForceSensorExercise ex = new ForceSensorExercise();
+
+ if(onlyNames) {
+ while(reader.Read()) {
+ ex = new ForceSensorExercise (reader[0].ToString());
+ array.Add(ex);
+ }
+ } else {
+ while(reader.Read()) {
+ int angleDefault = 0;
+
+ ex = new ForceSensorExercise (
+ Convert.ToInt32(reader[0].ToString()), //uniqueID
+ reader[1].ToString(), //name
+ Convert.ToInt32(reader[2].ToString()), //percentBodyWeight
+ reader[3].ToString(), //resistance
+ angleDefault,
+ reader[4].ToString() //description
+ );
+ array.Add(ex);
+ }
+ }
+
+ reader.Close();
+ if(! dbconOpened)
+ Sqlite.Close();
+
+ return array;
+ }
+
}
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 8b120646..0d3ba8f5 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -125,7 +125,7 @@ class Sqlite
/*
* Important, change this if there's any update to database
*/
- static string lastChronojumpDatabaseVersion = "1.58";
+ static string lastChronojumpDatabaseVersion = "1.59";
public Sqlite() {
}
@@ -2354,6 +2354,14 @@ class Sqlite
currentVersion = updateVersion("1.58");
}
+ if(currentVersion == "1.58")
+ {
+ LogB.SQL("Created ForceSensorExercise");
+
+ SqliteForceSensorExercise.createTable();
+
+ currentVersion = updateVersion("1.59");
+ }
@@ -2529,6 +2537,7 @@ class Sqlite
SqliteChronopicRegister.createTableChronopicRegister();
SqliteTrigger.createTableTrigger();
+ SqliteForceSensorExercise.createTable();
SqliteForceSensorRFD.createTable();
SqliteForceSensorRFD.InsertDefaultValues(true);
@@ -2541,6 +2550,7 @@ class Sqlite
SqliteJson.createTableUploadSprintDataTemp ();
//changes [from - to - desc]
+ //1.58 - 1.59 Converted DB to 1.59 Created ForceSensorExercise
//1.57 - 1.58 Converted DB to 1.58 Added to preferences: encoderCaptureShowNRepetitions
//1.56 - 1.57 Converted DB to 1.57 Created table UploadEncoderDataTemp, UploadSprintDateTemp
//1.55 - 1.56 Converted DB to 1.56 Added encoder rhythm restAfterEcc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]