[chronojump] New option on menu: Overview of encoder session
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] New option on menu: Overview of encoder session
- Date: Tue, 10 Nov 2015 15:07:32 +0000 (UTC)
commit 5704d33cd32494d15d15c3510d3cd6f2b464d40a
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Nov 10 15:59:29 2015 +0100
New option on menu: Overview of encoder session
glade/chronojump.glade | 147 ++++++++++++++++++++++++++++++++++++++++++++++--
src/gui/chronojump.cs | 2 +
src/gui/encoder.cs | 38 ++++++++++++
src/sqlite/encoder.cs | 37 ++++++++++++
4 files changed, 218 insertions(+), 6 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index a0a90a5..b5cbd49 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -100,6 +100,21 @@
</widget>
</child>
<child>
+ <widget class="GtkMenuItem" id="menuitem_encoder_session_overview">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Overview of this encoder session</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_menuitem_encoder_session_overview_activate"
swapped="no"/>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkSeparatorMenuItem" id="separador10">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ </child>
+ <child>
<widget class="GtkImageMenuItem" id="menuitem_export_csv">
<property name="label" translatable="yes">Export session to _CSV
(Spreadsheet)</property>
<property name="visible">True</property>
@@ -7899,6 +7914,12 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
<child>
@@ -9346,6 +9367,12 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -10434,6 +10461,12 @@ after time</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -22135,6 +22168,12 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -23122,6 +23161,12 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -24601,6 +24646,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>
@@ -25137,6 +25188,12 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -36961,6 +37018,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>
@@ -38872,6 +38965,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>
@@ -40182,12 +40299,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>
@@ -41174,6 +41285,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>
@@ -44933,6 +45050,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>
@@ -45584,6 +45707,12 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -46250,6 +46379,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/chronojump.cs b/src/gui/chronojump.cs
index bf44020..d413af7 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -156,6 +156,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.MenuItem menuitem_delete_session;
[Widget] Gtk.MenuItem menuitem_export_csv;
[Widget] Gtk.MenuItem menuitem_export_xml;
+ [Widget] Gtk.MenuItem menuitem_encoder_session_overview;
[Widget] Gtk.Image image_session_open;
//menu person
@@ -6298,6 +6299,7 @@ LogB.Debug("X");
menuitem_delete_session.Sensitive = option;
menuitem_export_csv.Sensitive = option;
//menuitem_export_xml.Sensitive = option; not implemented yet
+ menuitem_encoder_session_overview.Sensitive = option;
}
private void menuPersonSelectedSensitive(bool option)
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index d5561d7..eb50f50 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1602,6 +1602,44 @@ public partial class ChronoJumpWindow
{
checkFile(Constants.EncoderCheckFileOp.CAPTURE_EXPORT_ALL);
}
+
+ /*
+ * encoder session overview
+ */
+
+ void on_menuitem_encoder_session_overview_activate (object o, EventArgs args)
+ {
+ ArrayList dataPrint = SqliteEncoder.SelectSessionOverview(false, currentSession.UniqueID);
+
+ string [] columnsString = {
+ "Unused count",
+ Catalog.GetString("Person"),
+ Catalog.GetString("Exercise"),
+ Catalog.GetString("Displaced mass"),
+ Catalog.GetString("Sets")
+ };
+
+ ArrayList bigArray = new ArrayList();
+ ArrayList a1 = new ArrayList();
+
+ //0 is the widgget to show; 1 is the editable; 2 id default value
+ a1.Add(Constants.GenericWindowShow.TREEVIEW); a1.Add(true); a1.Add("");
+ bigArray.Add(a1);
+
+ genericWin = GenericWindow.Show(false, //don't show now
+ "Sets captured on this session",
+ bigArray);
+
+ ArrayList nonSensitiveRows = new ArrayList();
+ for(int i=0; i < dataPrint.Count; i ++)
+ nonSensitiveRows.Add(i);
+
+ genericWin.SetTreeview(columnsString, false, dataPrint, nonSensitiveRows,
Constants.ContextMenu.NONE, false);
+ genericWin.ShowButtonCancel(false);
+ genericWin.SetButtonAcceptSensitive(true);
+ genericWin.ShowNow();
+ genericWin.SetButtonAcceptSensitive(true);
+ }
void on_button_encoder_export_all_curves_file_selected (string selectedFileName)
{
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 04e1fc4..f657f49 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -374,6 +374,43 @@ class SqliteEncoder : Sqlite
return array;
}
+
+ public static ArrayList SelectSessionOverview (bool dbconOpened, int sessionID)
+ {
+ if(! dbconOpened)
+ Sqlite.Open();
+
+ dbcmd.CommandText =
+ "SELECT person77.name, encoderExercise.name, (personSession77.weight *
encoderExercise.percentBodyWeight/100) + encoder.extraWeight, COUNT(*)" +
+ " FROM person77, personSession77, encoderExercise, encoder" +
+ " WHERE person77.uniqueID == encoder.personID AND personSession77.personID ==
encoder.personID AND personSession77.sessionID == encoder.sessionID AND
encoderExercise.uniqueID==encoder.exerciseID AND signalOrCurve == 'signal' AND encoder.sessionID == " +
sessionID +
+ " GROUP BY encoder.personID, exerciseID, extraWeight" +
+ " ORDER BY person77.name";
+
+ LogB.SQL(dbcmd.CommandText.ToString());
+
+ SqliteDataReader reader;
+ reader = dbcmd.ExecuteReader();
+
+ ArrayList array = new ArrayList();
+ int count = 0;
+ while(reader.Read()) {
+ string [] s = {
+ (count++).ToString(), //not displayed but needed on genericWin.SetTreeView
+ reader[0].ToString(), //person name
+ reader[1].ToString(), //encoder exercise name
+ reader[2].ToString(), //displaced mass (includes percentBodyeight)
+ reader[3].ToString() //sets count
+ };
+ array.Add (s);
+ }
+
+ reader.Close();
+ if(! dbconOpened)
+ Sqlite.Close();
+
+ return array;
+ }
/*
* EncoderSignalCurve
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]