[chronojump] DB: 1.63 encoderCaptureInertialDiscardFirstN on preferences
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] DB: 1.63 encoderCaptureInertialDiscardFirstN on preferences
- Date: Mon, 13 May 2019 11:44:25 +0000 (UTC)
commit bb82d88d291f28e22f6472d6f26b0809f7c8edf0
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon May 13 13:43:44 2019 +0200
DB: 1.63 encoderCaptureInertialDiscardFirstN on preferences
glade/preferences_win.glade | 78 ++++++++++++++++++++++++++++++++++++++-
glade/repetitive_conditions.glade | 15 --------
src/gui/chronojump.cs | 2 +-
src/gui/encoder.cs | 38 ++++++++-----------
src/gui/preferences.cs | 29 ++++++++++++++-
src/gui/repetitiveConditions.cs | 10 -----
src/preferences.cs | 1 +
src/sqlite/main.cs | 13 ++++++-
src/sqlite/preferences.cs | 3 ++
9 files changed, 138 insertions(+), 51 deletions(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index 8f67950d..9822aab2 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -1866,7 +1866,7 @@ It starts before and arrives there with some speed.</property>
<widget class="GtkHBox" id="hbox23">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">20</property>
+ <property name="spacing">16</property>
<child>
<widget class="GtkLabel" id="label64">
<property name="visible">True</property>
@@ -1937,6 +1937,82 @@ It starts before and arrives there with some speed.</property>
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <widget class="GtkHBox" id="hbox32">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">16</property>
+ <child>
+ <widget class="GtkCheckButton"
id="checkbutton_encoder_capture_inertial_discard_first_n">
+ <property name="label" translatable="yes">On inertial discard
first repetitions</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="on_checkbutton_encoder_capture_inertial_discard_first_n_toggled" swapped="no"/>
+ </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_encoder_capture_inertial_discard_first_n">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkSpinButton"
id="spin_encoder_capture_inertial_discard_first_n">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip" translatable="yes">Minimal
height</property>
+ <property name="invisible_char">●</property>
+ <property name="width_chars">1</property>
+ <property name="invisible_char_set">True</property>
+ <property name="primary_icon_activatable">False</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 1 9 1 10 0</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</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="label79">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Recommended:
3</property>
+ </widget>
+ <packing>
+ <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">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</widget>
</child>
</widget>
diff --git a/glade/repetitive_conditions.glade b/glade/repetitive_conditions.glade
index 2333d488..e341f0e6 100644
--- a/glade/repetitive_conditions.glade
+++ b/glade/repetitive_conditions.glade
@@ -3472,21 +3472,6 @@
<property name="position">2</property>
</packing>
</child>
- <child>
- <widget class="GtkCheckButton" id="checkbutton_inertial_discard_first_three">
- <property name="label" translatable="yes">On inertial discard first three
repetitions.</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="active">True</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
- </packing>
- </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 1a698493..4655c8d8 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -6940,7 +6940,7 @@ LogB.Debug("mc finished 5");
double mainVariableHigher =
repetitiveConditionsWin.GetMainVariableHigher(mainVariableStr);
double mainVariableLower =
repetitiveConditionsWin.GetMainVariableLower(mainVariableStr);
plotCurvesGraphDoPlot(mainVariableStr, mainVariableHigher,
mainVariableLower, captureCurvesBarsData,
-
repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
+ preferences.encoderCaptureInertialDiscardFirstN,
false); //not capturing
} else
UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea,
encoder_capture_curves_bars_pixmap);
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index bcabc4f9..9ec1ce70 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -5072,7 +5072,7 @@ public partial class ChronoJumpWindow
//if we are capturing, play sounds
void plotCurvesGraphDoPlot(string mainVariable, double mainVariableHigher, double mainVariableLower,
- ArrayList data6Variables, bool discardFirstThree, bool capturing)
+ ArrayList data6Variables, int discardFirstN, bool capturing)
{
UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea,
encoder_capture_curves_bars_pixmap);
@@ -5114,12 +5114,8 @@ public partial class ChronoJumpWindow
if(d < minThisSet)
minThisSet = d;
- if(
- encoderConfigurationCurrent.has_inertia && count == 0
- ||
- ( encoderConfigurationCurrent.has_inertia && discardFirstThree &&
- ((eccon == "c" && count < 3) || (eccon != "c" && count < 6)) )
- )
+ if( encoderConfigurationCurrent.has_inertia && discardFirstN > 0 &&
+ ((eccon == "c" && count < discardFirstN) || (eccon != "c" && count
< discardFirstN * 2)) )
LogB.Information("Discarded phase");
else {
countValid ++;
@@ -5299,12 +5295,10 @@ public partial class ChronoJumpWindow
bool discarded = false;
if(encoderConfigurationCurrent.has_inertia) {
- if(eccon == "c" && discardFirstThree && count < 3)
+ if(eccon == "c" && discardFirstN > 0 && count < discardFirstN)
discarded = true;
- else if(eccon != "c" && discardFirstThree && count < 6)
+ else if(eccon != "c" && discardFirstN > 0 && count < discardFirstN * 2)
discarded = true;
- else if ((eccon == "ec" || eccon == "ecS") && count == 0)
- discarded = true; //on inertial devices "ec" or "ecS", the
first ecc cannot have feedback
}
if( ! discarded && ( myColor == UtilGtk.ColorGood || (mainVariableHigher != -1 && d
= mainVariableHigher) ) )
@@ -5335,12 +5329,9 @@ public partial class ChronoJumpWindow
if (eccon == "ec" || eccon == "ecS") {
bool isEven = Util.IsEven(count +1);
- //on inertial devices "ec" or "ecS", the first ecc has to be gray
- if(encoderConfigurationCurrent.has_inertia && count == 0)
- my_pen = pen_gray;
- //on inertial if discard first three, they have to be gray
- else if( encoderConfigurationCurrent.has_inertia && discardFirstThree &&
- ((eccon == "c" && count < 3) || (eccon != "c" && count < 6)) )
+ //on inertial if discardFirstN , they have to be gray
+ if( encoderConfigurationCurrent.has_inertia && discardFirstN > 0 &&
+ ((eccon == "c" && count < discardFirstN) || (eccon != "c" &&
count < discardFirstN * 2)) )
my_pen = pen_gray;
else {
if(isEven) //par, concentric
@@ -5349,8 +5340,8 @@ public partial class ChronoJumpWindow
my_pen = my_pen_ecc_con_e;
}
} else {
- if( encoderConfigurationCurrent.has_inertia && discardFirstThree &&
- ((eccon == "c" && count < 3) || (eccon != "c" && count < 6)) )
+ if( encoderConfigurationCurrent.has_inertia && discardFirstN > 0 &&
+ ((eccon == "c" && count < discardFirstN) || (eccon != "c" &&
count < discardFirstN * 2)) )
my_pen = pen_gray;
else
my_pen = my_pen_con;
@@ -5451,6 +5442,9 @@ public partial class ChronoJumpWindow
units = "W";
decimals = 1;
}
+
+//LogB.Information(string.Format("sumValid: {0}, countValid: {1}, div: {2}", sumValid, countValid, sumValid
/ countValid));
+//LogB.Information(string.Format("sumSaved: {0}, countSaved: {1}, div: {2}", sumSaved, countSaved, sumSaved
/ countSaved));
//add avg and avg of saved values
string title = mainVariable + " [X = " +
@@ -5513,7 +5507,7 @@ public partial class ChronoJumpWindow
double mainVariableHigher =
repetitiveConditionsWin.GetMainVariableHigher(mainVariable);
double mainVariableLower = repetitiveConditionsWin.GetMainVariableLower(mainVariable);
plotCurvesGraphDoPlot(mainVariable, mainVariableHigher, mainVariableLower,
captureCurvesBarsData,
- repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
+ preferences.encoderCaptureInertialDiscardFirstN,
false); //not capturing
} else if( ! ( radio_encoder_capture_cont.Active && ! firstSetOfCont) )
UtilGtk.ErasePaint(encoder_capture_curves_bars_drawingarea,
encoder_capture_curves_bars_pixmap);
@@ -6384,7 +6378,7 @@ public partial class ChronoJumpWindow
//captureCurvesBarsData.Add(new EncoderBarsData(20, 39, 10, 40));
plotCurvesGraphDoPlot(mainVariable, mainVariableHigher, mainVariableLower,
captureCurvesBarsData,
- repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
+ preferences.encoderCaptureInertialDiscardFirstN,
true); //capturing
//}
@@ -6894,7 +6888,7 @@ public partial class ChronoJumpWindow
maxPowerIntersession = findMaxPowerIntersession();
plotCurvesGraphDoPlot(mainVariable, mainVariableHigher, mainVariableLower,
captureCurvesBarsData,
- repetitiveConditionsWin.EncoderInertialDiscardFirstThree,
+ preferences.encoderCaptureInertialDiscardFirstN,
false); //not capturing
button_encoder_signal_save_comment.Label = Catalog.GetString("Save comment");
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index fb0a73bd..b88d1772 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -107,6 +107,9 @@ public class PreferencesWindow
[Widget] Gtk.VBox vbox_encoder_inertial; //change Visible param to not have a vertical big first page
with only one row of info
[Widget] Gtk.SpinButton spin_encoder_capture_min_height_gravitatory;
[Widget] Gtk.SpinButton spin_encoder_capture_min_height_inertial;
+ [Widget] Gtk.CheckButton checkbutton_encoder_capture_inertial_discard_first_n;
+ [Widget] Gtk.HBox hbox_encoder_capture_inertial_discard_first_n;
+ [Widget] Gtk.SpinButton spin_encoder_capture_inertial_discard_first_n;
[Widget] Gtk.CheckButton check_appearance_encoder_only_bars;
[Widget] Gtk.HBox hbox_restart;
[Widget] Gtk.SpinButton spin_encoder_capture_show_only_some_bars;
@@ -459,7 +462,17 @@ public class PreferencesWindow
PreferencesWindowBox.spin_encoder_capture_min_height_gravitatory.Value =
preferences.encoderCaptureMinHeightGravitatory;
PreferencesWindowBox.spin_encoder_capture_min_height_inertial.Value =
preferences.encoderCaptureMinHeightInertial;
-
+
+ if(preferences.encoderCaptureInertialDiscardFirstN > 0) {
+ PreferencesWindowBox.checkbutton_encoder_capture_inertial_discard_first_n.Active =
true;
+ PreferencesWindowBox.spin_encoder_capture_inertial_discard_first_n.Value =
preferences.encoderCaptureInertialDiscardFirstN;
+ PreferencesWindowBox.hbox_encoder_capture_inertial_discard_first_n.Visible = true;
+ } else {
+ PreferencesWindowBox.checkbutton_encoder_capture_inertial_discard_first_n.Active =
false;
+ PreferencesWindowBox.spin_encoder_capture_inertial_discard_first_n.Value = 3;
+ PreferencesWindowBox.hbox_encoder_capture_inertial_discard_first_n.Visible = false;
+ }
+
if(preferences.encoderCaptureShowOnlyBars)
PreferencesWindowBox.check_appearance_encoder_only_bars.Active = true;
else
@@ -684,6 +697,11 @@ public class PreferencesWindow
hbox_restart.Visible = ! check_appearance_encoder_only_bars.Active;
}
+ private void on_checkbutton_encoder_capture_inertial_discard_first_n_toggled (object obj, EventArgs
args)
+ {
+ hbox_encoder_capture_inertial_discard_first_n.Visible =
(checkbutton_encoder_capture_inertial_discard_first_n.Active);
+ }
+
// ---- multimedia stuff
@@ -1416,6 +1434,15 @@ public class PreferencesWindow
preferences.encoderCaptureMinHeightInertial,
(int) PreferencesWindowBox.spin_encoder_capture_min_height_inertial.Value);
+ int spinEncoderCaptureDiscardFirstN =
Convert.ToInt32(PreferencesWindowBox.spin_encoder_capture_inertial_discard_first_n.Value);
+ if(! checkbutton_encoder_capture_inertial_discard_first_n.Active)
+ spinEncoderCaptureDiscardFirstN = 0;
+ if(spinEncoderCaptureDiscardFirstN != preferences.encoderCaptureInertialDiscardFirstN)
+ {
+ SqlitePreferences.Update("encoderCaptureInertialDiscardFirstN",
spinEncoderCaptureDiscardFirstN.ToString(), true);
+ preferences.encoderCaptureInertialDiscardFirstN = spinEncoderCaptureDiscardFirstN;
+ }
+
if( preferences.encoderCaptureShowOnlyBars !=
PreferencesWindowBox.check_appearance_encoder_only_bars.Active ) {
SqlitePreferences.Update("encoderCaptureShowOnlyBars",
PreferencesWindowBox.check_appearance_encoder_only_bars.Active.ToString(), true);
preferences.encoderCaptureShowOnlyBars =
PreferencesWindowBox.check_appearance_encoder_only_bars.Active;
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index 53c8085e..349c58d3 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -114,7 +114,6 @@ public class RepetitiveConditionsWindow
[Widget] Gtk.SpinButton spinbutton_encoder_peakpower_higher;
[Widget] Gtk.SpinButton spinbutton_encoder_power_lower;
[Widget] Gtk.SpinButton spinbutton_encoder_peakpower_lower;
- [Widget] Gtk.CheckButton checkbutton_inertial_discard_first_three;
[Widget] Gtk.Button button_test_good;
@@ -257,7 +256,6 @@ public class RepetitiveConditionsWindow
frame_encoder_automatic_conditions.Hide();
vbox_encoder_manual.Hide();
notebook_encoder_conditions.Hide();
- checkbutton_inertial_discard_first_three.Hide();
vbox_encoder_stuff.Hide();
notebook_main.GetNthPage(RHYTHMPAGE).Hide();
@@ -282,9 +280,6 @@ public class RepetitiveConditionsWindow
if(checkbutton_encoder_show_manual_feedback.Active)
notebook_encoder_conditions.Show();
- if(bellMode == Constants.BellModes.ENCODERINERTIAL)
- checkbutton_inertial_discard_first_three.Show();
-
combo_encoder_main_variable.Active =
UtilGtk.ComboMakeActive(combo_encoder_main_variable,
Constants.GetEncoderVariablesCapture(encoderMainVariable));
@@ -1018,10 +1013,5 @@ public class RepetitiveConditionsWindow
public int EncoderPeakPowerLowerValue {
get { return Convert.ToInt32(spinbutton_encoder_peakpower_lower.Value); }
}
-
- public bool EncoderInertialDiscardFirstThree {
- get { return checkbutton_inertial_discard_first_three.Active; }
- }
-
}
diff --git a/src/preferences.cs b/src/preferences.cs
index 69f15160..1a978ec1 100644
--- a/src/preferences.cs
+++ b/src/preferences.cs
@@ -61,6 +61,7 @@ public class Preferences
public Constants.EncoderVariablesCapture encoderCaptureMainVariable;
public int encoderCaptureMinHeightGravitatory;
public int encoderCaptureMinHeightInertial;
+ public int encoderCaptureInertialDiscardFirstN;
public bool encoderCaptureCheckFullyExtended;
public int encoderCaptureCheckFullyExtendedValue;
public Constants.EncoderAutoSaveCurve encoderAutoSaveCurve;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 9e7276e4..bd660a02 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.62";
+ static string lastChronojumpDatabaseVersion = "1.63";
public Sqlite() {
}
@@ -2387,6 +2387,14 @@ class Sqlite
currentVersion = updateVersion("1.62");
}
+ if(currentVersion == "1.62")
+ {
+ LogB.SQL("Added to preferences: encoderCaptureInertialDiscardFirstN");
+
+ SqlitePreferences.Insert ("encoderCaptureInertialDiscardFirstN", "3");
+
+ currentVersion = updateVersion("1.63");
+ }
@@ -2576,6 +2584,9 @@ class Sqlite
SqliteJson.createTableUploadExhibitionTestTemp ();
//changes [from - to - desc]
+ //1.62 - 1.63 Converted DB to 1.63 Added to preferences: encoderCaptureInertialDiscardFirstN
+ //1.61 - 1.62 Converted DB to 1.62 Added to preferences: videoStopAfter
+ //1.60 - 1.61 Converted DB to 1.61 Added to preferences: videoDeviceResolution,
videoDeviceFramerate
//1.59 - 1.60 Converted DB to 1.60 Created table UploadExhibitionTestTemp
//1.58 - 1.59 Converted DB to 1.59 Created ForceSensorExercise
//1.57 - 1.58 Converted DB to 1.58 Added to preferences: encoderCaptureShowNRepetitions
diff --git a/src/sqlite/preferences.cs b/src/sqlite/preferences.cs
index bcdc3fbb..0ad500a4 100644
--- a/src/sqlite/preferences.cs
+++ b/src/sqlite/preferences.cs
@@ -127,6 +127,7 @@ class SqlitePreferences : Sqlite
Insert ("encoderCaptureMainVariable",
Constants.EncoderVariablesCapture.MeanPower.ToString(), dbcmdTr);
Insert ("encoderCaptureMinHeightGravitatory", "20", dbcmdTr);
Insert ("encoderCaptureMinHeightInertial", "5", dbcmdTr);
+ Insert ("encoderCaptureInertialDiscardFirstN", "3", dbcmdTr);
Insert ("encoderCaptureCheckFullyExtended", "True", dbcmdTr);
Insert ("encoderCaptureCheckFullyExtendedValue", "4", dbcmdTr);
Insert ("encoderCaptureBarplotFontSize", "14", dbcmdTr);
@@ -320,6 +321,8 @@ class SqlitePreferences : Sqlite
preferences.encoderCaptureMinHeightGravitatory =
Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "encoderCaptureMinHeightInertial")
preferences.encoderCaptureMinHeightInertial =
Convert.ToInt32(reader[1].ToString());
+ else if(reader[0].ToString() == "encoderCaptureInertialDiscardFirstN")
+ preferences.encoderCaptureInertialDiscardFirstN =
Convert.ToInt32(reader[1].ToString());
else if(reader[0].ToString() == "encoderCaptureCheckFullyExtended")
preferences.encoderCaptureCheckFullyExtended = reader[1].ToString() == "True";
else if(reader[0].ToString() == "encoderCaptureCheckFullyExtendedValue")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]