[chronojump] ForceSensor session overview: done!
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] ForceSensor session overview: done!
- Date: Tue, 8 Oct 2019 11:17:37 +0000 (UTC)
commit 7fa5df860ca080400ac992c0b962741a07432061
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Oct 8 13:17:22 2019 +0200
ForceSensor session overview: done!
glade/app1.glade | 39 +++++++++++++++++--------
src/gui/chronojump.cs | 4 ++-
src/gui/forceSensor.cs | 5 ++++
src/gui/overview.cs | 73 +++++++++++++++++++++++++++++++++++++++++++++++
src/sqlite/forceSensor.cs | 36 +++++++++++++++++++++++
5 files changed, 144 insertions(+), 13 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 850060bc..4b6232d0 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -518,6 +518,15 @@
</child>
</widget>
</child>
+ <child>
+ <widget class="GtkMenuItem" id="menuitem_forceSensor_session_overview">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Overview of this session</property>
+ <property name="use_underline">True</property>
+ <signal name="activate" handler="on_menuitem_forceSensor_session_overview_activate"
swapped="no"/>
+ </widget>
+ </child>
<child>
<widget class="GtkImageMenuItem" id="menuitem_force_sensor_check_version">
<property name="label" translatable="yes">Force sensor - Check version</property>
@@ -21941,6 +21950,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -23889,18 +23901,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>
@@ -23937,6 +23937,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>
@@ -30889,6 +30901,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 3cefd681..71bb48be 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -199,8 +199,9 @@ public partial class ChronoJumpWindow
[Widget] Gtk.MenuItem menuitem_delete_session;
[Widget] Gtk.MenuItem menuitem_export_csv;
[Widget] Gtk.MenuItem menuitem_encoder_session_overview;
+ [Widget] Gtk.MenuItem menuitem_forceSensor_session_overview;
[Widget] Gtk.Image image_session_open;
-
+
//menu person
[Widget] Gtk.Button button_persons_up;
[Widget] Gtk.Button button_persons_down;
@@ -7224,6 +7225,7 @@ LogB.Debug("mc finished 5");
menuitem_export_csv.Sensitive = option;
//menuitem_export_xml.Sensitive = option; not implemented yet
menuitem_encoder_session_overview.Sensitive = option;
+ menuitem_forceSensor_session_overview.Sensitive = option;
}
private void menuPersonSelectedSensitive(bool option)
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index e7f8f875..ee7d698f 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -2121,6 +2121,11 @@ LogB.Information(" fs R ");
new DialogMessage(Constants.MessageTypes.WARNING, Constants.DirectoryCannotOpenStr());
}
+ void on_menuitem_forceSensor_session_overview_activate (object o, EventArgs args)
+ {
+ ForceSensorOverviewWindow.Show (app1, currentSession.UniqueID);
+ }
+
private void on_button_force_sensor_adjust_clicked (object o, EventArgs args)
{
hbox_force_capture_buttons.Sensitive = false;
diff --git a/src/gui/overview.cs b/src/gui/overview.cs
index 454c5c90..452a38b5 100644
--- a/src/gui/overview.cs
+++ b/src/gui/overview.cs
@@ -31,6 +31,7 @@ public abstract class OverviewWindow
[Widget] protected Gtk.Window overview_win;
[Widget] protected Gtk.TreeView treeview_sets;
[Widget] protected Gtk.TreeView treeview_reps;
+ [Widget] protected Gtk.Notebook notebook;
protected enum treeviewType { SETS, REPS }
protected int sessionID;
@@ -182,3 +183,75 @@ public class EncoderOverviewWindow : OverviewWindow
}
}
+
+public class ForceSensorOverviewWindow : OverviewWindow
+{
+ static ForceSensorOverviewWindow ForceSensorOverviewWindowBox;
+
+ public ForceSensorOverviewWindow(Gtk.Window parent)
+ {
+ Glade.XML gladeXML;
+ gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "overview.glade", "overview_win",
null);
+
+ gladeXML.Autoconnect(this);
+ overview_win.Parent = parent;
+
+ //put an icon to window
+ UtilGtk.IconWindow(overview_win);
+ }
+
+ static public ForceSensorOverviewWindow Show (Gtk.Window parent, int sessionID)
+ {
+ if (ForceSensorOverviewWindowBox == null)
+ ForceSensorOverviewWindowBox = new ForceSensorOverviewWindow (parent);
+
+ ForceSensorOverviewWindowBox.sessionID = sessionID;
+
+ ForceSensorOverviewWindowBox.initialize();
+
+ ForceSensorOverviewWindowBox.notebook.GetNthPage(1).Hide();
+
+ ForceSensorOverviewWindowBox.overview_win.Show ();
+
+ return ForceSensorOverviewWindowBox;
+ }
+
+ protected override string getTitle()
+ {
+ return Catalog.GetString("Force sensor overview");
+ }
+
+ protected override ArrayList selectData(treeviewType type)
+ {
+ return SqliteForceSensor.SelectSessionOverviewSets(false, sessionID);
+ }
+
+ protected override void createTreeView(Gtk.TreeView tv, treeviewType type)
+ {
+ tv.HeadersVisible=true;
+ int count = 0;
+
+ tv.AppendColumn (Catalog.GetString ("Person"), new CellRendererText(), "text", count++);
+ tv.AppendColumn (Catalog.GetString ("Sex"), new CellRendererText(), "text", count++);
+ tv.AppendColumn (Catalog.GetString ("Exercise"), new CellRendererText(), "text", count++);
+ tv.AppendColumn (Catalog.GetString ("Sets"), new CellRendererText(), "text", count++);
+ }
+
+ protected override TreeStore getStore(treeviewType type)
+ {
+ return new TreeStore(typeof (string), typeof (string), typeof (string), typeof (string));
//person, sex, exercise, sets
+ }
+
+ void on_button_close_clicked (object o, EventArgs args)
+ {
+ ForceSensorOverviewWindowBox.overview_win.Hide();
+ ForceSensorOverviewWindowBox = null;
+ }
+
+ void on_delete_event (object o, DeleteEventArgs args)
+ {
+ ForceSensorOverviewWindowBox.overview_win.Hide();
+ ForceSensorOverviewWindowBox = null;
+ }
+
+}
diff --git a/src/sqlite/forceSensor.cs b/src/sqlite/forceSensor.cs
index 5c00d76e..5ac7a03b 100644
--- a/src/sqlite/forceSensor.cs
+++ b/src/sqlite/forceSensor.cs
@@ -224,6 +224,42 @@ class SqliteForceSensor : Sqlite
return array;
}
+ public static ArrayList SelectSessionOverviewSets (bool dbconOpened, int sessionID)
+ {
+ if(! dbconOpened)
+ Sqlite.Open();
+
+ dbcmd.CommandText =
+ "SELECT person77.name, person77.sex, forceSensorExercise.name, COUNT(*)" +
+ " FROM person77, personSession77, forceSensorExercise, forceSensor" +
+ " WHERE person77.uniqueID == forceSensor.personID AND personSession77.personID ==
forceSensor.personID AND personSession77.sessionID == forceSensor.sessionID AND
forceSensorExercise.uniqueID==forceSensor.exerciseID AND forceSensor.sessionID == " + sessionID +
+ " GROUP BY forceSensor.personID, exerciseID" +
+ " ORDER BY person77.name";
+
+ LogB.SQL(dbcmd.CommandText.ToString());
+
+ SqliteDataReader reader;
+ reader = dbcmd.ExecuteReader();
+
+ ArrayList array = new ArrayList();
+ while(reader.Read())
+ {
+ string [] s = {
+ reader[0].ToString(), //person name
+ reader[1].ToString(), //person sex
+ reader[2].ToString(), //exercise name
+ reader[3].ToString() //sets count
+ };
+ array.Add (s);
+ }
+
+ reader.Close();
+ if(! dbconOpened)
+ Sqlite.Close();
+
+ return array;
+ }
+
public static string DirToImport;
protected internal static void import_from_1_68_to_1_69() //database is opened
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]