[chronojump] encoder auto save curve buttons as a combo an a button
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] encoder auto save curve buttons as a combo an a button
- Date: Tue, 29 Oct 2019 11:26:00 +0000 (UTC)
commit 02c8f9b71ebfa15f8b9974b19385f241e27d9cdf
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Oct 29 12:25:28 2019 +0100
encoder auto save curve buttons as a combo an a button
glade/app1.glade | 125 +++++++++++++++++----------------------------
src/constants.cs | 30 ++++++++++-
src/gui/chronojumpIcons.cs | 2 +
src/gui/encoder.cs | 64 ++++++++++++++++-------
src/gui/guiTests.cs | 9 ++++
5 files changed, 134 insertions(+), 96 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index b4b598a2..62cc4f14 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -22150,6 +22150,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -24098,18 +24101,6 @@ Concentric</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Tests
will be filmed</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<widget class="GtkHBox"
id="hbox_video_encoder_capturing">
<property name="can_focus">False</property>
<property name="spacing">4</property>
@@ -24146,6 +24137,18 @@ Concentric</property>
</packing>
</child>
<child>
+ <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tests
will be filmed</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox"
id="hbox_video_encoder_no_capturing">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -24353,48 +24356,18 @@ Concentric</property>
<widget class="GtkHBox"
id="hbox_encoder_capture_curves_save_all_none">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">16</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label108">
+ <widget class="GtkHBox"
id="hbox_encoder_capture_curves_save">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label"
translatable="yes">Save</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
<child>
- <widget class="GtkButton"
id="button_encoder_capture_curves_best">
- <property name="label"
translatable="yes">Best</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked"
handler="on_button_encoder_capture_curves_best_clicked" swapped="no"/>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <widget class="GtkHBox" id="hbox288">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <widget class="GtkButton"
id="button_encoder_capture_curves_best_n">
- <property name="label" translatable="yes">Best
n</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked"
handler="on_button_encoder_capture_curves_best_n_clicked" swapped="no"/>
- </widget>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
@@ -24420,53 +24393,48 @@ Concentric</property>
<property name="position">1</property>
</packing>
</child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
- </packing>
- </child>
<child>
- <widget class="GtkButton"
id="button_encoder_capture_curves_all">
- <property name="label"
translatable="yes">All</property>
+ <widget class="GtkButton"
id="button_encoder_capture_curves_save">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <signal name="clicked"
handler="on_button_encoder_capture_curves_all_clicked" swapped="no"/>
+ <signal name="clicked"
handler="on_button_encoder_capture_curves_save_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox302">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage"
id="image_encoder_capture_curves_save">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkButton"
id="button_encoder_capture_curves_4top">
- <property name="label" translatable="yes">All
but last</property>
+ <widget class="GtkLabel" id="label254">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked"
handler="on_button_encoder_capture_curves_4top_clicked" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Save
repetitions</property>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">4</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
</packing>
</child>
- <child>
- <widget class="GtkButton"
id="button_encoder_capture_curves_none">
- <property name="label"
translatable="yes">None</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked"
handler="on_button_encoder_capture_curves_none_clicked" swapped="no"/>
+ </widget>
+ </child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">5</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
@@ -31169,6 +31137,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/constants.cs b/src/constants.cs
index 9fc8b595..5ab19c88 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -1209,7 +1209,35 @@ public class Constants
public const string ForceSensorLateralityLeft = "Left";
public const string ForceSensorLateralityRight = "Right";
- public enum EncoderAutoSaveCurve { ALL, NONE, BEST, BESTN, BESTNCONSECUTIVE, FROM4TOPENULTIMATE }
+ public enum EncoderAutoSaveCurve { BEST, BESTN, ALL, FROM4TOPENULTIMATE, NONE }
+ public static string [] EncoderAutoSaveCurvesStrings = { "Best", "Best n", "All", "All but last",
"None" };
+ public static string GetEncoderAutoSaveCurvesStrings (EncoderAutoSaveCurve easc)
+ {
+ if(easc == EncoderAutoSaveCurve.BEST)
+ return EncoderAutoSaveCurvesStrings[0];
+ else if(easc == EncoderAutoSaveCurve.BESTN)
+ return EncoderAutoSaveCurvesStrings[1];
+ else if(easc == EncoderAutoSaveCurve.ALL)
+ return EncoderAutoSaveCurvesStrings[2];
+ else if(easc == EncoderAutoSaveCurve.FROM4TOPENULTIMATE)
+ return EncoderAutoSaveCurvesStrings[3];
+ else //(easc == EncoderAutoSaveCurve.NONE
+ return EncoderAutoSaveCurvesStrings[4];
+ }
+ public static EncoderAutoSaveCurve GetEncoderAutoSaveCurvesEnum (string str)
+ {
+ if(str == "Best")
+ return EncoderAutoSaveCurve.BEST;
+ else if(str == "Best n")
+ return EncoderAutoSaveCurve.BESTN;
+ else if(str == "All")
+ return EncoderAutoSaveCurve.ALL;
+ else if(str == "All but last")
+ return EncoderAutoSaveCurve.FROM4TOPENULTIMATE;
+ else //(str == "None")
+ return EncoderAutoSaveCurve.NONE;
+ }
+
//BESTN means: "bests" (cannot say this in English)
//note last mode not need to be 4 because DB 1.63 introduces the config of this value
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 79aca878..f9bf9c87 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -203,6 +203,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_video_preview;
[Widget] Gtk.Image image_video_encoder_preview;
+ [Widget] Gtk.Image image_encoder_capture_curves_save;
[Widget] Gtk.Image image_encoder_analyze_table_save_1;
[Widget] Gtk.Image image_encoder_analyze_image_save_1;
[Widget] Gtk.Image image_encoder_analyze_1RM_save_1;
@@ -669,6 +670,7 @@ public partial class ChronoJumpWindow
image_encoder_analyze_image_compujump_send_email_image.Pixbuf = pixbuf;
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "save.png");
+ image_encoder_capture_curves_save.Pixbuf = pixbuf;
image_encoder_analyze_table_save_1.Pixbuf = pixbuf;
image_encoder_analyze_image_save_1.Pixbuf = pixbuf;
image_encoder_analyze_1RM_save_1.Pixbuf = pixbuf;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index b1edb1cf..bbd87aea 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -128,11 +128,15 @@ public partial class ChronoJumpWindow
[Widget] Gtk.RadioButton radio_encoder_laterality_l;
[Widget] Gtk.Box hbox_encoder_capture_curves_save_all_none;
+ /*
//used on guiTests
[Widget] Gtk.Button button_encoder_capture_curves_all;
[Widget] Gtk.Button button_encoder_capture_curves_best;
[Widget] Gtk.Button button_encoder_capture_curves_none;
[Widget] Gtk.Button button_encoder_capture_curves_4top;
+ */
+ [Widget] Gtk.HBox hbox_encoder_capture_curves_save;
+ [Widget] Gtk.ComboBox combo_encoder_capture_curves_save;
[Widget] Gtk.Notebook notebook_analyze_results;
[Widget] Gtk.Box hbox_combo_encoder_exercise_analyze;
@@ -3842,6 +3846,7 @@ public partial class ChronoJumpWindow
string [] encoderExercisesTranslationAndBodyPWeight;
+ string [] encoderCaptureCurvesSaveOptionsTranslation;
// string [] encoderEcconTranslation;
// string [] encoderLateralityTranslation;
string [] encoderAnalyzeCrossTranslation;
@@ -3860,7 +3865,22 @@ public partial class ChronoJumpWindow
combo_encoder_exercise_capture.Changed += new EventHandler
(on_combo_encoder_exercise_capture_changed);
combo_encoder_exercise_analyze.Changed += new EventHandler
(on_combo_encoder_exercise_analyze_changed);
-
+
+ //combo_encoder_capture_curves_save;
+ combo_encoder_capture_curves_save = ComboBox.NewText();
+ //string [] comboEncoderCaptureCurvesSaveOptions = { "Best", "Best n", "All", "All but last",
"None" };
+ string [] comboEncoderCaptureCurvesSaveOptionsTranslated = { Catalog.GetString("Best"),
Catalog.GetString("Best n"),
+ Catalog.GetString("All"), Catalog.GetString("All but last"),
Catalog.GetString("None") };
+ encoderCaptureCurvesSaveOptionsTranslation = new String
[comboEncoderCaptureCurvesSaveOptionsTranslated.Length];
+ for(int j=0; j < 5 ; j++)
+ encoderCaptureCurvesSaveOptionsTranslation[j] =
+ Constants.EncoderAutoSaveCurvesStrings[j] + ":" +
comboEncoderCaptureCurvesSaveOptionsTranslated[j];
+ UtilGtk.ComboUpdate(combo_encoder_capture_curves_save,
comboEncoderCaptureCurvesSaveOptionsTranslated, "");
+ combo_encoder_capture_curves_save.Active =
UtilGtk.ComboMakeActive(combo_encoder_capture_curves_save,
+
Catalog.GetString(Constants.GetEncoderAutoSaveCurvesStrings(preferences.encoderAutoSaveCurve)));
+ manageVisibilityOf_spin_encoder_capture_curves_best_n ();
+ combo_encoder_capture_curves_save.Changed += new EventHandler
(on_combo_encoder_capture_curves_save_changed);
+
/* ConcentricEccentric
* unavailable until find while concentric data on concentric is the same than in ecc-con,
* but is very different than in con-ecc
@@ -3906,6 +3926,9 @@ public partial class ChronoJumpWindow
hbox_combo_encoder_exercise_capture.PackStart(combo_encoder_exercise_capture, true, true, 10);
+ hbox_encoder_capture_curves_save.PackStart(combo_encoder_capture_curves_save, true, true, 0);
+ hbox_encoder_capture_curves_save.ShowAll();
+
button_combo_encoder_exercise_capture_right = UtilGtk.CreateArrowButton(ArrowType.Right,
ShadowType.In, 40, 40, UtilGtk.ArrowEnum.NONE);
button_combo_encoder_exercise_capture_right.Sensitive = true;
button_combo_encoder_exercise_capture_right.Clicked +=
on_button_encoder_exercise_capture_right_clicked;
@@ -4172,27 +4195,32 @@ public partial class ChronoJumpWindow
image_top_laterality.Pixbuf = pixbuf;
}
- void on_button_encoder_capture_curves_all_clicked (object o, EventArgs args) {
- encoderCaptureSaveCurvesAllNoneBest(Constants.EncoderAutoSaveCurve.ALL,
- Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable));
- }
- void on_button_encoder_capture_curves_best_clicked (object o, EventArgs args) {
- encoderCaptureSaveCurvesAllNoneBest(Constants.EncoderAutoSaveCurve.BEST,
- Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable));
- }
- void on_button_encoder_capture_curves_best_n_clicked (object o, EventArgs args) {
- encoderCaptureSaveCurvesAllNoneBest(Constants.EncoderAutoSaveCurve.BESTN,
- Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable));
+
+ // ---- start of combo_encoder_capture_curves_save stuff ----
+
+ void on_combo_encoder_capture_curves_save_changed (object o, EventArgs args)
+ {
+ manageVisibilityOf_spin_encoder_capture_curves_best_n ();
}
- void on_button_encoder_capture_curves_none_clicked (object o, EventArgs args) {
- encoderCaptureSaveCurvesAllNoneBest(Constants.EncoderAutoSaveCurve.NONE,
- Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable));
+
+ void manageVisibilityOf_spin_encoder_capture_curves_best_n ()
+ {
+ spin_encoder_capture_curves_best_n.Visible = Util.FindOnArray(
+ ':',1,0,UtilGtk.ComboGetActive(combo_encoder_capture_curves_save),
+ encoderCaptureCurvesSaveOptionsTranslation) == "Best n";
}
- void on_button_encoder_capture_curves_4top_clicked (object o, EventArgs args) {
- encoderCaptureSaveCurvesAllNoneBest(Constants.EncoderAutoSaveCurve.FROM4TOPENULTIMATE,
- Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable));
+
+ void on_button_encoder_capture_curves_save_clicked (object o, EventArgs args)
+ {
+ string englishOption =
Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_capture_curves_save),
+ encoderCaptureCurvesSaveOptionsTranslation);
+
+ Constants.EncoderAutoSaveCurve easc = Constants.GetEncoderAutoSaveCurvesEnum (englishOption);
+ encoderCaptureSaveCurvesAllNoneBest(easc,
Constants.GetEncoderVariablesCapture(preferences.encoderCaptureMainVariable));
}
+ // ---- end of combo_encoder_capture_curves_save stuff ----
+
void on_combo_encoder_analyze_cross_changed (object o, EventArgs args)
{
diff --git a/src/gui/guiTests.cs b/src/gui/guiTests.cs
index 44f994b5..042adc9b 100644
--- a/src/gui/guiTests.cs
+++ b/src/gui/guiTests.cs
@@ -609,6 +609,9 @@ public partial class ChronoJumpWindow
//saves all best none 4top randomly
private void chronojumpWindowTestsEncoderSetSaveReps()
{
+ /*
+ * TODO: redo this with new combo_encoder_capture_curves_save
+ *
LogB.TestStart("chronojumpWindowTestsEncoderSetSaveReps");
//Constants.EncoderAutoSaveCurve easc;
@@ -629,6 +632,7 @@ public partial class ChronoJumpWindow
//encoderCaptureSaveCurvesAllNoneBest(easc, encoderCaptureOptionsWin.GetMainVariable());
LogB.TestEnd("chronojumpWindowTestsEncoderSetSaveReps: " + d.ToString());
+ */
}
//saves all best none 4top randomly
@@ -650,6 +654,10 @@ public partial class ChronoJumpWindow
int saveRepsLastI;
private bool chronojumpWindowTestsEncoderSetSaveRepsBucleDo()
{
+ return false;
+ /*
+ * TODO: redo this with new combo_encoder_capture_curves_save
+ *
if(! saveRepsBucleDoing)
return false;
@@ -682,6 +690,7 @@ public partial class ChronoJumpWindow
chronojumpWindowTestsNext();
return false;
}
+ */
}
private void chronojumpWindowTestsWait5seconds()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]