[chronojump] Encoder triggers visible on analyze tab
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder triggers visible on analyze tab
- Date: Tue, 25 Apr 2017 07:54:23 +0000 (UTC)
commit c2cc84bb22335cfca2a822e1956bc911fd9e0e02
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Apr 25 09:53:52 2017 +0200
Encoder triggers visible on analyze tab
chronojump.csproj | 1 +
glade/app1.glade | 55 ++++++++++++++++++++++++++++++++++++++++++++++++
src/Makefile.am | 1 +
src/encoderCapture.cs | 7 +++++-
src/gui/encoder.cs | 25 +++++++++++++++++++++
src/gui/trigger.cs | 56 +++++++++++++++++++++++++++++++++++++++++++++++++
src/sqlite/trigger.cs | 3 +-
src/trigger.cs | 32 ++++++++++++++++++++++++++++
8 files changed, 178 insertions(+), 2 deletions(-)
---
diff --git a/chronojump.csproj b/chronojump.csproj
index e70adb0..2a4fd6b 100644
--- a/chronojump.csproj
+++ b/chronojump.csproj
@@ -1120,6 +1120,7 @@
<Compile Include="src\forceSensor.cs" />
<Compile Include="src\sqlite\force.cs" />
<Compile Include="src\sqlite\forceSensor.cs" />
+ <Compile Include="src\gui\trigger.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="src\" />
diff --git a/glade/app1.glade b/glade/app1.glade
index 49b1529..e441868 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1230,6 +1230,9 @@
<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>
@@ -20296,6 +20299,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -20608,6 +20614,55 @@ then click this button.</property>
<property name="type">tab</property>
</packing>
</child>
+ <child>
+ <widget class="GtkVBox" id="vbox52">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="border_width">8</property>
+ <property name="spacing">8</property>
+ <child>
+ <widget class="GtkLabel" id="label60">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label"
translatable="yes">Triggers found on this set</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkTextView"
id="textview_encoder_analyze_triggers">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="cursor_visible">False</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label59">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Show
triggers</property>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ <property name="type">tab</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index 410684f..3620d07 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -55,6 +55,7 @@ SOURCES = \
gui/networks.cs\
gui/queryServer.cs\
gui/usefulObjects.cs\
+ gui/trigger.cs\
gui/old/chronojumpServerOld.cs\
statType.cs\
stats/main.cs\
diff --git a/src/encoderCapture.cs b/src/encoderCapture.cs
index 2014c60..e559eaf 100644
--- a/src/encoderCapture.cs
+++ b/src/encoderCapture.cs
@@ -743,7 +743,12 @@ public abstract class EncoderCapture
{
triggerList.SQLInsert(signalID);
}
-
+
+ public TriggerList GetTriggers()
+ {
+ return triggerList;
+ }
+
//this methods only applies to inertial subclass
protected virtual void inertialCheckIfInverted() {
}
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index e6f73cb..3e9efac 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -136,6 +136,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Button button_encoder_capture_curves_none;
[Widget] Gtk.Button button_encoder_capture_curves_4top;
+ [Widget] Gtk.Notebook notebook_analyze_results;
[Widget] Gtk.Box hbox_combo_encoder_exercise_analyze;
[Widget] Gtk.ComboBox combo_encoder_exercise_analyze;
@@ -447,6 +448,10 @@ public partial class ChronoJumpWindow
//configInit();
array1RM = new ArrayList();
+
+ //triggers
+ triggerList = new TriggerList();
+ showTriggerTab(false);
}
@@ -1432,6 +1437,14 @@ public partial class ChronoJumpWindow
encoderConfigurationGUIUpdate();
label_encoder_selected.Text = econfSO.name;
+
+ //triggers
+ triggerList = new TriggerList(
+ SqliteTrigger.Select(
+ false, Trigger.Modes.ENCODER,
+ Convert.ToInt32(encoderSignalUniqueID))
+ );
+ showTriggersAndTab();
}
}
@@ -2689,6 +2702,8 @@ public partial class ChronoJumpWindow
button_encoder_analyze_sensitiveness();
hbox_encoder_analyze_current_signal.Visible = true;
+
+ showTriggersAndTab();
}
private void on_radio_encoder_analyze_individual_current_session_toggled (object obj, EventArgs args)
@@ -2729,6 +2744,8 @@ public partial class ChronoJumpWindow
button_encoder_analyze_sensitiveness();
hbox_encoder_analyze_current_signal.Visible = false;
+
+ showTriggerTab(false);
}
private void on_radio_encoder_analyze_individual_all_sessions_toggled (object obj, EventArgs args)
@@ -2757,6 +2774,8 @@ public partial class ChronoJumpWindow
radiobutton_encoder_analyze_single.Visible = false;
radiobutton_encoder_analyze_side.Visible = false;
radiobutton_encoder_analyze_neuromuscular_profile.Visible = false;
+
+ showTriggerTab(false);
}
private void on_radio_encoder_analyze_groupal_current_session_toggled (object obj, EventArgs args)
@@ -2784,6 +2803,8 @@ public partial class ChronoJumpWindow
radiobutton_encoder_analyze_single.Visible = false;
radiobutton_encoder_analyze_side.Visible = false;
radiobutton_encoder_analyze_neuromuscular_profile.Visible = false;
+
+ showTriggerTab(false);
}
@@ -5772,7 +5793,11 @@ public partial class ChronoJumpWindow
//save the triggers now that we have an encoderSignalUniqueID
if(action == encoderActions.CURVES_AC)
+ {
eCapture.SaveTriggers(Convert.ToInt32(encoderSignalUniqueID)); //dbcon is closed
+ triggerList = eCapture.GetTriggers();
+ showTriggersAndTab();
+ }
} else
encoder_pulsebar_capture.Text = "";
diff --git a/src/gui/trigger.cs b/src/gui/trigger.cs
new file mode 100644
index 0000000..aea62c9
--- /dev/null
+++ b/src/gui/trigger.cs
@@ -0,0 +1,56 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * ChronoJump is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * 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) 2017 Xavier de Blas <xaviblas gmail com>
+ */
+
+using System;
+using Gtk;
+using Glade;
+using System.Collections.Generic; //List<T>
+
+
+public partial class ChronoJumpWindow
+{
+ [Widget] Gtk.TextView textview_encoder_analyze_triggers;
+ TriggerList triggerList;
+
+ private void showTriggersAndTab()
+ {
+ triggerList.Print();
+ if(triggerList.Count() > 0)
+ {
+ //fill textview
+ TextBuffer tb1 = new TextBuffer (new TextTagTable());
+ tb1.Text = triggerList.ToString();
+ textview_encoder_analyze_triggers.Buffer = tb1;
+ }
+
+ if(radio_encoder_analyze_individual_current_set.Active && triggerList.Count() > 0)
+ showTriggerTab(true);
+ else
+ showTriggerTab(false);
+ }
+
+ private void showTriggerTab(bool show)
+ {
+ if(show)
+ notebook_analyze_results.GetNthPage(2).Show();
+ else
+ notebook_analyze_results.GetNthPage(2).Hide();
+ }
+}
diff --git a/src/sqlite/trigger.cs b/src/sqlite/trigger.cs
index 40b881f..9cf1bf8 100644
--- a/src/sqlite/trigger.cs
+++ b/src/sqlite/trigger.cs
@@ -56,7 +56,8 @@ class SqliteTrigger : Sqlite
{
openIfNeeded(dbconOpened);
- dbcmd.CommandText = "SELECT * FROM " + table + " WHERE mode = " + mode + " AND modeID = " +
modeID;
+ dbcmd.CommandText = "SELECT * FROM " + table +
+ " WHERE mode = \"" + mode + "\" AND modeID = " + modeID;
LogB.SQL(dbcmd.CommandText.ToString());
dbcmd.ExecuteNonQuery();
diff --git a/src/trigger.cs b/src/trigger.cs
index 2ec60cc..0d9f4f4 100644
--- a/src/trigger.cs
+++ b/src/trigger.cs
@@ -81,6 +81,12 @@ public class Trigger
;
}
+ //used on TextView
+ public override string ToString()
+ {
+ return ms.ToString() + ", " + Util.BoolToInOut(inOut).ToString();
+ }
+
public int UniqueID {
get { return uniqueID; }
}
@@ -93,10 +99,18 @@ public class Trigger
public class TriggerList
{
private List<Trigger> l;
+
+ //constructors
public TriggerList()
{
l = new List<Trigger>();
}
+ //from SqliteTrigger.Select()
+ public TriggerList(List<Trigger> l)
+ {
+ this.l = l;
+ }
+
public void Add(Trigger trigger)
{
@@ -117,6 +131,24 @@ public class TriggerList
LogB.Information(trigger.ToString());
}
+ //used on TextView
+ public override string ToString()
+ {
+ string s = "";
+ string sep = "";
+ foreach(Trigger trigger in l)
+ {
+ s += sep + trigger.ToString();
+ sep = "\n";
+ }
+ return s;
+ }
+
+ public int Count()
+ {
+ return l.Count;
+ }
+
public void SQLInsert(int signalID)
{
//save triggers to file (if any)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]