[chronojump] Encoder configuration anchorage list (different diameters) DONE
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder configuration anchorage list (different diameters) DONE
- Date: Thu, 30 Jul 2015 15:23:57 +0000 (UTC)
commit 39f872a2bced2a2e466d6ceed1c17e19f43d0165
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Jul 30 17:23:15 2015 +0200
Encoder configuration anchorage list (different diameters) DONE
glade/chronojump.glade | 222 +++++++++++++++++++++++++++++++++++----
src/gui/encoder.cs | 41 +++++++-
src/gui/encoderConfiguration.cs | 35 ++++++-
src/utilGtk.cs | 10 ++
4 files changed, 283 insertions(+), 25 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 50a3c18..2d6f52b 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -7642,6 +7642,12 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
<child>
@@ -9038,6 +9044,12 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -10075,6 +10087,12 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -14958,20 +14976,53 @@ on current Chronojump version.</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox106">
+ <widget class="GtkVBox" id="vbox61">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">8</property>
<child>
- <widget class="GtkHBox" id="hbox160">
+ <widget class="GtkHBox"
id="hbox_encoder_anchorage_diameter">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label183">
+ <widget class="GtkLabel" id="label26">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Anchorage</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkHBox"
id="hbox_combo_encoder_anchorage">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label123">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Extra
weights</property>
+ <property name="label">cm</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -14980,10 +15031,33 @@ on current Chronojump version.</property>
</packing>
</child>
<child>
+ <widget class="GtkHBox" id="hbox66">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <widget class="GtkHBox" id="hbox160">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkLabel" id="label183">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label"
translatable="yes">Weights</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkSpinButton"
id="spin_encoder_im_weights_n">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="invisible_char">●</property>
+ <property name="width_chars">2</property>
<property
name="primary_icon_activatable">False</property>
<property
name="secondary_icon_activatable">False</property>
<property
name="primary_icon_sensitive">True</property>
@@ -15003,8 +15077,8 @@ on current Chronojump version.</property>
</child>
</widget>
<packing>
- <property name="expand">True</property>
- <property name="fill">False</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -15012,17 +15086,17 @@ on current Chronojump version.</property>
<widget class="GtkHBox" id="hbox157">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">6</property>
+ <property name="spacing">8</property>
<child>
<widget class="GtkLabel" id="label182">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip"
translatable="yes">Inertia moment</property>
- <property name="label"
translatable="yes">Inertia M.</property>
+ <property name="label"
translatable="yes">IM</property>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -15040,8 +15114,16 @@ on current Chronojump version.</property>
</child>
</widget>
<packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
<property name="expand">True</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
@@ -15051,7 +15133,7 @@ on current Chronojump version.</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label123">
+ <widget class="GtkLabel" id="label129">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">page
2</property>
@@ -21565,6 +21647,12 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -22501,6 +22589,12 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -23929,6 +24023,12 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -24414,6 +24514,12 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -27090,7 +27196,7 @@ comments</property>
<property
name="secondary_icon_activatable">False</property>
<property name="primary_icon_sensitive">True</property>
<property name="secondary_icon_sensitive">True</property>
- <property name="adjustment">3.9999999999999996 0 80 0.01
10 0</property>
+ <property name="adjustment">3.9999999999999996 0.5 80
0.01 10 0</property>
<property name="climb_rate">1</property>
<property name="digits">2</property>
<property name="snap_to_ticks">True</property>
@@ -35932,6 +36038,42 @@ options</property>
<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>
</widget>
</child>
</widget>
@@ -37639,6 +37781,30 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<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>
</widget>
</child>
</widget>
@@ -39000,12 +39166,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<placeholder/>
</child>
<child>
- <placeholder/>
- </child>
- <child>
- <placeholder/>
- </child>
- <child>
<widget class="GtkLabel" id="label218">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -39941,6 +40101,12 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -43664,6 +43830,12 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -44264,6 +44436,12 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -44879,6 +45057,12 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index b9acc11..77293d9 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -42,6 +42,8 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Label label_encoder_1RM_percent;
[Widget] Gtk.Label label_encoder_im_total;
[Widget] Gtk.SpinButton spin_encoder_im_weights_n;
+ [Widget] Gtk.HBox hbox_combo_encoder_anchorage;
+ [Widget] Gtk.ComboBox combo_encoder_anchorage;
[Widget] Gtk.Label label_encoder_selected;
@@ -312,7 +314,6 @@ public partial class ChronoJumpWindow
//read from SQL
encoderConfigurationCurrent = SqliteEncoder.LoadEncoderConfiguration();
- encoderConfigurationGUIUpdate();
encoderCaptureListStore = new Gtk.ListStore (typeof (EncoderCurve));
@@ -322,6 +323,8 @@ public partial class ChronoJumpWindow
createEncoderCombos();
+ encoderConfigurationGUIUpdate();
+
//on start it's concentric and powerbars. Eccon-together should be unsensitive
check_encoder_analyze_eccon_together.Sensitive = false;
@@ -379,12 +382,22 @@ public partial class ChronoJumpWindow
EncoderConfiguration eConfNew = encoder_configuration_win.GetAcceptedValues();
if(encoderConfigurationCurrent == eConfNew)
return;
+
+ bool combo_encoder_anchorage_should_update = (encoderConfigurationCurrent.list_d !=
eConfNew.list_d);
+
encoderConfigurationCurrent = eConfNew;
-
+ LogB.Information("EncoderConfigurationCurrent = " +
encoderConfigurationCurrent.ToStringOutput(EncoderConfiguration.Outputs.SQL));
+
+
if(encoderConfigurationCurrent.has_inertia) {
notebook_encoder_capture_extra_mass.CurrentPage = 1;
+ if(combo_encoder_anchorage_should_update) {
+ UtilGtk.ComboUpdate(combo_encoder_anchorage,
encoderConfigurationCurrent.list_d);
+ combo_encoder_anchorage.Active = 0;
+ }
+
encoderConfigurationCurrent.extraWeightN = (int) spin_encoder_im_weights_n.Value;
encoderConfigurationCurrent.inertiaTotal =
UtilEncoder.CalculeInertiaTotal(encoderConfigurationCurrent);
label_encoder_im_total.Text = encoderConfigurationCurrent.inertiaTotal.ToString();
@@ -398,6 +411,12 @@ public partial class ChronoJumpWindow
Config.UpdateEncoderConfiguration(encoderConfigurationCurrent);
}
+ void on_combo_encoder_anchorage_changed (object o, EventArgs args) {
+ string selected = UtilGtk.ComboGetActive(combo_encoder_anchorage);
+ if(selected != "" && Util.IsNumber(selected, true))
+ encoderConfigurationCurrent.d = Convert.ToDouble(selected);
+ }
+
void on_spin_encoder_im_weights_n_value_changed (object o, EventArgs args) {
encoderConfigurationCurrent.extraWeightN = (int) spin_encoder_im_weights_n.Value;
encoderConfigurationCurrent.inertiaTotal =
UtilEncoder.CalculeInertiaTotal(encoderConfigurationCurrent);
@@ -1457,6 +1476,15 @@ public partial class ChronoJumpWindow
{
if(encoderConfigurationCurrent.has_inertia) {
notebook_encoder_capture_extra_mass.CurrentPage = 1;
+
+ if(encoderConfigurationCurrent.list_d != null &&
encoderConfigurationCurrent.list_d.Count > 0)
+ {
+ UtilGtk.ComboUpdate(combo_encoder_anchorage,
encoderConfigurationCurrent.list_d);
+ combo_encoder_anchorage.Active = UtilGtk.ComboMakeActive(
+ combo_encoder_anchorage,
+ encoderConfigurationCurrent.d.ToString()
+ );
+ }
spin_encoder_im_weights_n.Value = encoderConfigurationCurrent.extraWeightN;
label_encoder_im_total.Text = encoderConfigurationCurrent.inertiaTotal.ToString();
@@ -3222,6 +3250,11 @@ public partial class ChronoJumpWindow
combo_encoder_laterality.Active = UtilGtk.ComboMakeActive(combo_encoder_laterality,
Catalog.GetString(comboLateralityOptions[0]));
+ //create combo encoder anchorage
+ combo_encoder_anchorage = Gtk.ComboBox.NewText();
+ combo_encoder_anchorage.Changed +=
+ new EventHandler(on_combo_encoder_anchorage_changed );
+
//create combo analyze data compare (variables)
string [] comboDataCompareOptions = {
@@ -3284,6 +3317,10 @@ public partial class ChronoJumpWindow
hbox_combo_encoder_laterality.ShowAll();
combo_encoder_laterality.Sensitive = true;
+ hbox_combo_encoder_anchorage.PackStart(combo_encoder_anchorage, false, true, 0);
+ hbox_combo_encoder_anchorage.ShowAll();
+ combo_encoder_anchorage.Sensitive = true;
+
hbox_encoder_analyze_data_compare.PackStart(combo_encoder_analyze_data_compare, true, true,
0);
hbox_encoder_analyze_data_compare.ShowAll();
combo_encoder_analyze_data_compare.Sensitive = true;
diff --git a/src/gui/encoderConfiguration.cs b/src/gui/encoderConfiguration.cs
index c1bbd45..078f282 100644
--- a/src/gui/encoderConfiguration.cs
+++ b/src/gui/encoderConfiguration.cs
@@ -20,6 +20,7 @@
using System;
using System.Collections;
+using System.Collections.Generic; //List<T>
using Gtk;
using Gdk;
using Glade;
@@ -160,7 +161,7 @@ public class EncoderConfigurationWindow
EncoderConfigurationWindowBox.create_list_d_spinbutton();
EncoderConfigurationWindowBox.putValuesStoredPreviously(
- ec.d, ec.D, ec.anglePush, ec.angleWeight,
+ ec.d, ec.list_d, ec.D, ec.anglePush, ec.angleWeight,
ec.inertiaMachine, ec.extraWeightGrams, ec.extraWeightLength);
@@ -287,11 +288,20 @@ public class EncoderConfigurationWindow
on_button_encoder_capture_inertial_show_clicked (new object(), new EventArgs());
}
- private void putValuesStoredPreviously(double d, double D, int anglePush, int angleWeight,
+ private void putValuesStoredPreviously(double d, List<double> list_d, double D, int anglePush, int
angleWeight,
int inertia, int extraWeightGrams, double extraWeightLength)
{
if(d != -1)
spin_d.Value = d;
+ if(list_d != null && list_d.Count > 0) {
+ //when there's 1 value in list_d, first value (0) in combo should be selected
+ combo_d_num.Active = list_d.Count -1; //this will perform a reset on spinbuttons
+
+ int i = 0;
+ foreach(Gtk.SpinButton sp in hbox_list_d.Children)
+ sp.Value = list_d[i ++];
+ }
+
if(D != -1)
spin_D.Value = D;
if(anglePush != -1)
@@ -379,6 +389,16 @@ public class EncoderConfigurationWindow
hbox_list_d.ShowAll();
}
+ private List<double> get_list_d () {
+ List<double> l = new List<double>();
+ double d = new double();
+ foreach(Gtk.SpinButton sp in hbox_list_d.Children) {
+ d = (double) sp.Value;
+ l.Add(d);
+ }
+ return l;
+ }
+
/*
* Use this to retrieve values after accept
* do not use to know current encoder configuration
@@ -390,13 +410,20 @@ public class EncoderConfigurationWindow
EncoderConfiguration ec = (EncoderConfiguration) list[listCurrent];
ec.d = -1;
+ ec.list_d = new List<double>();
ec.D = -1;
ec.anglePush = -1;
ec.angleWeight = -1;
ec.inertiaMachine = -1;
- if(ec.has_d)
- ec.d = (double) spin_d.Value;
+ if(ec.has_d) {
+ if(ec.has_inertia) {
+ ec.list_d = get_list_d();
+ ec.d = ec.list_d[0]; //selected value is the first
+ }
+ else
+ ec.d = (double) spin_d.Value;
+ }
if(ec.has_D)
ec.D = (double) spin_D.Value;
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 2dcaf6d..95f2cbd 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -21,6 +21,7 @@
using System;
using System.Text; //StringBuilder
using System.Collections; //ArrayList
+using System.Collections.Generic; //List<T>
using System.IO;
using Gtk;
using Gdk;
@@ -151,6 +152,15 @@ public class UtilGtk
myCombo.AppendText (str);
}
+ public static void ComboUpdate(ComboBox myCombo, List<double> list) {
+ //1stdelete combo values
+ comboDelAll(myCombo);
+
+ //2nd put new values
+ foreach (double l in list)
+ myCombo.AppendText (l.ToString());
+ }
+
public static void ComboAdd(ComboBox myCombo, string str) {
myCombo.AppendText (str);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]