[chronojump/FS-TFT-Menu] Encoder analyze can filter repetitions by laterality
- From: Xavier Padullés <xpadulles src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/FS-TFT-Menu] Encoder analyze can filter repetitions by laterality
- Date: Wed, 20 Apr 2022 11:59:24 +0000 (UTC)
commit ee660e97c7710e1b092d9c0973bcfd8b01561785
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Apr 11 12:14:25 2022 +0200
Encoder analyze can filter repetitions by laterality
glade/app1.glade | 48 ++++++++++++++++++--------
src/gui/app1/encoder.cs | 68 +++++++++++++++++++++++++++++++++----
src/gui/encoderSelectRepetitions.cs | 21 ++++++++----
src/sqlite/encoder.cs | 12 +++++--
4 files changed, 119 insertions(+), 30 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index f28d4e23e..7ac6e78cb 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -26251,6 +26251,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -32659,18 +32662,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>
@@ -32707,6 +32698,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>
@@ -36306,7 +36309,7 @@ then click this button.</property>
<widget class="GtkHBox" id="hbox173">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">12</property>
+ <property name="spacing">10</property>
<child>
<widget class="GtkHBox"
id="hbox_encoder_analyze_current_signal">
<property name="visible">True</property>
@@ -36478,6 +36481,20 @@ then click this button.</property>
</packing>
</child>
<child>
+ <widget class="GtkHBox"
id="hbox_combo_encoder_laterality_analyze">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <placeholder/>
+ </child>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkButton"
id="button_encoder_analyze_data_select_curves">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -36594,7 +36611,7 @@ then click this button.</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
@@ -41976,6 +41993,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 56fdcac14..ab5a8c387 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -178,6 +178,8 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Notebook notebook_analyze_results;
[Widget] Gtk.Box hbox_combo_encoder_exercise_analyze;
[Widget] Gtk.ComboBox combo_encoder_exercise_analyze;
+ [Widget] Gtk.HBox hbox_combo_encoder_laterality_analyze;
+ [Widget] Gtk.ComboBox combo_encoder_laterality_analyze;
[Widget] Gtk.Box hbox_combo_encoder_analyze_cross_sup; //includes "Profile" label and the hbox
[Widget] Gtk.Box hbox_combo_encoder_analyze_cross;
@@ -1567,6 +1569,12 @@ public partial class ChronoJumpWindow
}
+ private void on_combo_encoder_laterality_analyze_changed (object o, EventArgs args)
+ {
+ if(currentPerson != null)
+ prepareAnalyzeRepetitions();
+ }
+
private EncoderSelectRepetitions encSelReps;
void on_button_encoder_analyze_data_select_curves_clicked (object o, EventArgs args) {
@@ -1613,15 +1621,40 @@ public partial class ChronoJumpWindow
else
return; //error
+ //laterality
encSelReps.PassVariables(currentPerson, currentSession, currentEncoderGI,
button_encoder_analyze, getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE),
- preferences.askDeletion);
+ getLateralityOnAnalyze(), preferences.askDeletion);
encSelReps.Do();
updateUserCurvesLabelsAndCombo(false);
}
-
+
+ private EncoderSelectRepetitions.Lateralities getLateralityOnAnalyze ()
+ {
+ string lateralityActive = UtilGtk.ComboGetActive (combo_encoder_laterality_analyze);
+ if(lateralityActive == Catalog.GetString("Any laterality"))
+ return EncoderSelectRepetitions.Lateralities.ANY;
+ if(lateralityActive == Catalog.GetString("Both"))
+ return EncoderSelectRepetitions.Lateralities.RL;
+ if(lateralityActive == Catalog.GetString("Left"))
+ return EncoderSelectRepetitions.Lateralities.L;
+ if(lateralityActive == Catalog.GetString("Right"))
+ return EncoderSelectRepetitions.Lateralities.R;
+
+ return EncoderSelectRepetitions.Lateralities.ANY;
+ }
+ //if Any then return "" to not select by laterality on SqliteEncoder.Select
+ private string getLateralityOnAnalyzeToSQL ()
+ {
+ EncoderSelectRepetitions.Lateralities laterality = getLateralityOnAnalyze ();
+ if(laterality == EncoderSelectRepetitions.Lateralities.ANY)
+ return "";
+ else
+ return laterality.ToString();
+ }
+
void on_delete_encoder_curve (object o, EventArgs args)
{
LogB.Information("at on_delete_encoder_curve");
@@ -3536,7 +3569,7 @@ public partial class ChronoJumpWindow
data = SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID,
getEncoderGI(),
getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE),
- "curve", ecconSelect, "",
+ "curve", ecconSelect, getLateralityOnAnalyzeToSQL(),
false, true, true);
}
else if(radio_encoder_analyze_groupal_current_session.Active)
@@ -3548,7 +3581,7 @@ public partial class ChronoJumpWindow
currentSession.UniqueID,
getEncoderGI(),
getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE),
- "curve", EncoderSQL.Eccons.ALL, "",
+ "curve", EncoderSQL.Eccons.ALL,
getLateralityOnAnalyzeToSQL(),
false, //onlyActive=false. Means: all saved
repetitions
true, true);
foreach(EncoderSQL eSQL in dataPre) {
@@ -3568,7 +3601,7 @@ public partial class ChronoJumpWindow
Util.FetchID(encSelReps.EncoderCompareInter[i].ToString()),
getEncoderGI(),
getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE),
- "curve", EncoderSQL.Eccons.ALL, "",
+ "curve", EncoderSQL.Eccons.ALL,
getLateralityOnAnalyzeToSQL(),
false, //onlyActive=false. Means: all saved
repetitions
true, true);
foreach(EncoderSQL eSQL in dataPre) {
@@ -3855,10 +3888,11 @@ public partial class ChronoJumpWindow
private void on_radio_encoder_analyze_individual_current_set (object o, EventArgs args)
{
+ hbox_combo_encoder_laterality_analyze.Visible = false;
+
//not called here
//prepareAnalyzeRepetitions();
-
createComboAnalyzeCross(false, false); //first creation: false, dateOnX: false
createComboEncoderAnalyzeWeights(false); //first creation: false
@@ -3896,6 +3930,7 @@ public partial class ChronoJumpWindow
private void on_radio_encoder_analyze_individual_current_session (object o, EventArgs args)
{
updateEncoderAnalyzeExercisesPre();
+ hbox_combo_encoder_laterality_analyze.Visible = true;
prepareAnalyzeRepetitions();
/*
@@ -3948,6 +3983,7 @@ public partial class ChronoJumpWindow
private void on_radio_encoder_analyze_individual_all_sessions (object o, EventArgs args)
{
updateEncoderAnalyzeExercisesPre();
+ hbox_combo_encoder_laterality_analyze.Visible = true;
prepareAnalyzeRepetitions();
hbox_encoder_analyze_current_signal.Visible = false;
@@ -3982,6 +4018,7 @@ public partial class ChronoJumpWindow
private void on_radio_encoder_analyze_groupal_current_session (object o, EventArgs args)
{
updateEncoderAnalyzeExercisesPre();
+ hbox_combo_encoder_laterality_analyze.Visible = true;
prepareAnalyzeRepetitions();
hbox_encoder_analyze_current_signal.Visible = false;
@@ -4608,6 +4645,25 @@ public partial class ChronoJumpWindow
label_encoder_top_weights.Text = Catalog.GetString("Weights") + ": " +
entry_encoder_im_weights_n.Text;
label_encoder_top_im.Text = Catalog.GetString("Inertia M.") + ": " +
label_encoder_im_total.Text;
+
+
+ //combo_encoder_laterality_analyze
+ string [] comboEncoderLateralityAnalyzeOptions = { "Any laterality", "Both", "Left", "Right"
};
+ string [] comboEncoderLateralityAnalyzeTranslated = {
+ Catalog.GetString("Any laterality"), Catalog.GetString("Both"),
+ Catalog.GetString("Left"), Catalog.GetString("Right")
+ };
+
+ combo_encoder_laterality_analyze = ComboBox.NewText ();
+ UtilGtk.ComboUpdate(combo_encoder_laterality_analyze,
comboEncoderLateralityAnalyzeTranslated, "");
+ combo_encoder_laterality_analyze.Active = 0;
+ combo_encoder_laterality_analyze.Visible = false; //because we start on current set radio
+ combo_encoder_laterality_analyze.Changed += new EventHandler
(on_combo_encoder_laterality_analyze_changed);
+
+ hbox_combo_encoder_laterality_analyze.PackStart(combo_encoder_laterality_analyze, true, true,
0);
+ hbox_combo_encoder_laterality_analyze.ShowAll();
+ combo_encoder_laterality_analyze.Sensitive = true;
+ hbox_combo_encoder_laterality_analyze.Visible = false; //do not show hbox at start
}
private void on_button_encoder_exercise_capture_left_clicked(object o, EventArgs args)
diff --git a/src/gui/encoderSelectRepetitions.cs b/src/gui/encoderSelectRepetitions.cs
index d875134ed..0b750d64d 100644
--- a/src/gui/encoderSelectRepetitions.cs
+++ b/src/gui/encoderSelectRepetitions.cs
@@ -15,7 +15,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * Copyright (C) 2004-2020 Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2022 Xavier de Blas <xaviblas gmail com>
*/
using System;
@@ -62,7 +62,10 @@ public class EncoderSelectRepetitions
public int DeleteCurveID;
public enum Types { UNDEFINED, INDIVIDUAL_CURRENT_SESSION, INDIVIDUAL_ALL_SESSIONS,
GROUPAL_CURRENT_SESSION }
public Types Type;
-
+
+ public enum Lateralities { ANY, RL, L, R }; //RL, L, R are the same codes used on SqliteEncoder.Select
+ protected string lateralityCode; //if ANY it is "" (to not use it on SqliteEncoder.Select
+
//could be Interperson or Intersession
//personID:personName
//sessionID:sessionDate
@@ -77,7 +80,7 @@ public class EncoderSelectRepetitions
}
public void PassVariables(Person currentP, Session currentS, Constants.EncoderGI eGI,
- Gtk.Button button_e_a, int exID, bool askDel)
+ Gtk.Button button_e_a, int exID, Lateralities laterality, bool askDel)
{
RepsActive = 0;
RepsAll = 0;
@@ -90,6 +93,10 @@ public class EncoderSelectRepetitions
button_encoder_analyze = button_e_a;
exerciseID = exID; //can be -1 (all)
askDeletion = askDel;
+
+ lateralityCode = "";
+ if(laterality != Lateralities.ANY)
+ lateralityCode = laterality.ToString();
}
public void Do() {
@@ -189,7 +196,7 @@ public class EncoderSelectRepetitionsIndividualCurrentSession : EncoderSelectRep
{
data = SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID, encoderGI,
- exerciseID, "curve", EncoderSQL.Eccons.ALL, "",
+ exerciseID, "curve", EncoderSQL.Eccons.ALL, lateralityCode,
false, true, true);
}
@@ -320,7 +327,7 @@ public class EncoderSelectRepetitionsIndividualCurrentSession : EncoderSelectRep
ArrayList data = SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID, encoderGI,
- exerciseID, "curve", EncoderSQL.Eccons.ALL, "",
+ exerciseID, "curve", EncoderSQL.Eccons.ALL, lateralityCode,
false, true, true);
//update on database the curves that have been selected/deselected
@@ -392,7 +399,7 @@ public class EncoderSelectRepetitionsIndividualAllSessions : EncoderSelectRepeti
protected override void getData()
{
- data = SqliteEncoder.SelectCompareIntersession(false, encoderGI, exerciseID,
currentPerson.UniqueID);
+ data = SqliteEncoder.SelectCompareIntersession(false, encoderGI, exerciseID, lateralityCode,
currentPerson.UniqueID);
}
protected override void createBigArray()
@@ -548,7 +555,7 @@ public class EncoderSelectRepetitionsGroupalCurrentSession : EncoderSelectRepeti
foreach(Person p in dataPre) {
ArrayList eSQLarray = SqliteEncoder.Select(
false, -1, p.UniqueID, currentSession.UniqueID, encoderGI,
- exerciseID, "curve", EncoderSQL.Eccons.ALL, "",
+ exerciseID, "curve", EncoderSQL.Eccons.ALL, lateralityCode,
false, true, true);
int allCurves = eSQLarray.Count;
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 8c7936ef1..a8ccc5878 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -372,16 +372,22 @@ class SqliteEncoder : Sqlite
}
+ //used on EncoderSelectRepetitionsIndividualAllSessions
//exerciseID can be -1 to get all exercises
- public static ArrayList SelectCompareIntersession (bool dbconOpened, Constants.EncoderGI encoderGI,
int exerciseID, int personID)
+ public static ArrayList SelectCompareIntersession (bool dbconOpened, Constants.EncoderGI encoderGI,
+ int exerciseID, string lateralityCode, int personID)
{
if(! dbconOpened)
Sqlite.Open();
-
+
string exerciseIDStr = "";
if(exerciseID != -1)
exerciseIDStr = "encoder.exerciseID = " + exerciseID + " AND ";
+ string lateralityCodeStr = "";
+ if(lateralityCode != "")
+ lateralityCodeStr = "laterality = \"" + lateralityCode + "\" AND ";
+
//returns a row for each session where there are active or inactive
dbcmd.CommandText =
"SELECT encoder.sessionID, session.name, session.date, encoder.extraWeight, " +
@@ -390,7 +396,7 @@ class SqliteEncoder : Sqlite
" encoder.encoderConfiguration " +
" FROM encoder, session, person77 " +
" WHERE " +
- exerciseIDStr +
+ exerciseIDStr + lateralityCodeStr +
" encoder.personID = " + personID + " AND signalOrCurve = \"curve\" AND " +
" encoder.personID = person77.uniqueID AND encoder.sessionID = session.uniqueID " +
" GROUP BY encoder.sessionID, encoder.extraWeight ORDER BY encoder.sessionID,
encoder.extraWeight, encoder.status";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]