[chronojump] load/import can show/hide persons data: sport, specialty, level
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] load/import can show/hide persons data: sport, specialty, level
- Date: Thu, 16 Apr 2020 11:28:18 +0000 (UTC)
commit 479d9b5a76672cfcfeac9393f778a35311709140
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Apr 16 13:27:43 2020 +0200
load/import can show/hide persons data: sport, specialty, level
glade/app1.glade | 143 +++++++++++++++---------
src/gui/app1/session/loadAndImport.cs | 200 +++++++++++++++-------------------
src/gui/app1/session/main.cs | 1 +
3 files changed, 180 insertions(+), 164 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 0300c47f..572f9bd0 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -24922,6 +24922,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -27214,18 +27217,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>
@@ -27262,6 +27253,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>
@@ -35025,6 +35028,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -36320,62 +36326,61 @@ then click this button.</property>
<widget class="GtkHBox" id="app1s_hbox_load_controls">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">10</property>
+ <property name="spacing">12</property>
<child>
- <widget class="GtkVBox" id="vbox182">
+ <widget class="GtkVBox" id="vbox183">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">4</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkCheckButton"
id="app1s_checkbutton_show_data_jump_run">
- <property name="label" translatable="yes">Show
data of jump and race tests</property>
+ <widget class="GtkLabel" id="label443">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property
name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled"
handler="app1s_on_checkbutton_show_data_jump_run_toggled" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Search
filter</property>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton"
id="app1s_checkbutton_show_data_other_tests">
- <property name="label" translatable="yes">Show
data of other tests</property>
+ <widget class="GtkEntry"
id="app1s_entry_search_filter">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property
name="receives_default">False</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled"
handler="app1s_on_checkbutton_show_data_other_tests_toggled" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="invisible_char">●</property>
+ <property
name="invisible_char_set">True</property>
+ <property
name="primary_icon_activatable">False</property>
+ <property
name="secondary_icon_activatable">False</property>
+ <property
name="primary_icon_sensitive">True</property>
+ <property
name="secondary_icon_sensitive">True</property>
+ <signal name="changed"
handler="app1s_on_entry_search_filter_changed" swapped="no"/>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkVBox" id="vbox183">
+ <widget class="GtkVBox" id="vbox208">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">4</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkLabel" id="label443">
+ <widget class="GtkLabel" id="label494">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Search
filter</property>
+ <property name="label" translatable="yes">Show
more data</property>
</widget>
<packing>
<property name="expand">True</property>
@@ -36384,16 +36389,56 @@ then click this button.</property>
</packing>
</child>
<child>
- <widget class="GtkEntry"
id="app1s_entry_search_filter">
+ <widget class="GtkHBox" id="hbox405">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="invisible_char">●</property>
- <property
name="invisible_char_set">True</property>
- <property
name="primary_icon_activatable">False</property>
- <property
name="secondary_icon_activatable">False</property>
- <property
name="primary_icon_sensitive">True</property>
- <property
name="secondary_icon_sensitive">True</property>
- <signal name="changed"
handler="app1s_on_entry_search_filter_changed" swapped="no"/>
+ <property name="spacing">6</property>
+ <child>
+ <widget class="GtkCheckButton"
id="app1s_checkbutton_show_data_persons">
+ <property name="label"
translatable="yes">Persons</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="app1s_on_checkbutton_show_data_persons_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton"
id="app1s_checkbutton_show_data_jump_run">
+ <property name="label" translatable="yes">Jumps
and races</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="app1s_on_checkbutton_show_data_jump_run_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkCheckButton"
id="app1s_checkbutton_show_data_other_tests">
+ <property name="label" translatable="yes">Other
tests</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled"
handler="app1s_on_checkbutton_show_data_other_tests_toggled" swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -36403,8 +36448,8 @@ then click this button.</property>
</child>
</widget>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
diff --git a/src/gui/app1/session/loadAndImport.cs b/src/gui/app1/session/loadAndImport.cs
index 0a0f3cfa..ac7a5dd3 100644
--- a/src/gui/app1/session/loadAndImport.cs
+++ b/src/gui/app1/session/loadAndImport.cs
@@ -83,10 +83,10 @@ public partial class ChronoJumpWindow
app1s_image_import.Pixbuf = new Pixbuf (null, Util.GetImagePath(false) +
Constants.FileNameImport);
app1s_image_import1.Pixbuf = new Pixbuf (null, Util.GetImagePath(false) +
Constants.FileNameImport);
- app1s_createTreeView(app1s_treeview_session_load, false, false);
- app1s_store = app1s_getStore(false, false);
+ app1s_createTreeView(app1s_treeview_session_load, false, false, false);
+ app1s_store = app1s_getStore(false, false, false);
app1s_treeview_session_load.Model = app1s_store;
- app1s_fillTreeView(app1s_treeview_session_load, app1s_store, false, false);
+ app1s_fillTreeView(app1s_treeview_session_load, app1s_store, false, false, false);
app1s_store.SetSortColumnId(1, Gtk.SortType.Descending); //date
app1s_store.ChangeSortColumn();
@@ -108,38 +108,22 @@ public partial class ChronoJumpWindow
*/
}
- private TreeStore app1s_getStore(bool showContacts, bool showEncoderAndForceSensor) {
- TreeStore s;
- if(showContacts && showEncoderAndForceSensor)
- s = new TreeStore(
- typeof (string), typeof (string), typeof (string), typeof (string),
//number (hidden), date, name, place
- typeof (string), typeof (string), typeof (string), typeof (string),
//persons, sport, spllity, level
- typeof (string), typeof (string), typeof (string), typeof(string),
//jumps s,r, runs s, i,
- typeof (string), typeof (string), typeof (string), //rt,
pulses, mc
- typeof (string), typeof (string), typeof (string), typeof (string),
//encoder s, c, forceSensor, runEncoder
- typeof (string)
//comments
- );
- else if(showContacts && ! showEncoderAndForceSensor)
- s = new TreeStore(
- typeof (string), typeof (string), typeof (string), typeof (string),
//number (hidden), date, name, place
- typeof (string), typeof (string), typeof (string), typeof (string),
//persons, sport, spllity, level
- typeof (string), typeof (string), typeof (string), typeof(string),
//jumps s,r, runs s, i,
- typeof (string), typeof (string), typeof (string), //rt,
pulses, mc
- typeof (string)
//comments
- );
- else if(! showContacts && showEncoderAndForceSensor)
- s = new TreeStore(
- typeof (string), typeof (string), typeof (string), typeof (string),
//number (hidden), date, name, place
- typeof (string), typeof (string), typeof (string), typeof (string),
//persons, sport, spllity, level
- typeof (string), typeof (string), typeof (string), typeof (string),
//encoder s, c, forceSensor, runEncoder
- typeof (string)
//comments
- );
- else // ! showContacts && ! showEncoderAndForceSensor
- s = new TreeStore(
- typeof (string), typeof (string), typeof (string), typeof (string),
//number (hidden), date, name, place
- typeof (string), typeof (string), typeof (string), typeof (string),
//persons, sport, spllity, level
- typeof (string)
//comments
- );
+ private TreeStore app1s_getStore(bool showPersons, bool showContacts, bool showOtherTests)
+ {
+ int columns = 6;
+ if(showPersons)
+ columns += 3;
+ if(showContacts)
+ columns += 7;
+ if(showOtherTests)
+ columns += 4;
+
+ Type [] types = new Type [columns];
+ for (int i=0; i < columns; i++) {
+ types[i] = typeof (string);
+ }
+
+ TreeStore s = new TreeStore(types);
//s.SetSortFunc (0, UtilGtk.IdColumnCompare); //not needed, it's hidden
s.SetSortFunc (1, app1s_dateColumnCompare);
@@ -148,7 +132,6 @@ public partial class ChronoJumpWindow
return s;
}
-
private static int app1s_dateColumnCompare (TreeModel model, TreeIter iter1, TreeIter iter2)
{
var dt1String = (model.GetValue(iter1, 1).ToString());
@@ -173,7 +156,7 @@ public partial class ChronoJumpWindow
app1s_recreateTreeView("loaded the dialog");
}
- private void app1s_createTreeView (Gtk.TreeView tv, bool showContacts, bool showOtherTests)
+ private void app1s_createTreeView (Gtk.TreeView tv, bool showPersons, bool showContacts, bool
showOtherTests)
{
tv.HeadersVisible=true;
int count = 0;
@@ -197,9 +180,11 @@ public partial class ChronoJumpWindow
tv.AppendColumn ( Catalog.GetString ("Place"), new CellRendererText(), "text", count++);
tv.AppendColumn ( Catalog.GetString ("Persons"), new CellRendererText(), "text", count++);
- tv.AppendColumn ( Catalog.GetString ("Sport"), new CellRendererText(), "text", count++);
- tv.AppendColumn ( Catalog.GetString ("Specialty"), new CellRendererText(), "text", count++);
- tv.AppendColumn ( Catalog.GetString ("Level"), new CellRendererText(), "text", count++);
+ if(showPersons) {
+ tv.AppendColumn ( Catalog.GetString ("Sport"), new CellRendererText(), "text",
count++);
+ tv.AppendColumn ( Catalog.GetString ("Specialty"), new CellRendererText(), "text",
count++);
+ tv.AppendColumn ( Catalog.GetString ("Level"), new CellRendererText(), "text",
count++);
+ }
if(showContacts) {
tv.AppendColumn ( Catalog.GetString ("Jumps simple"), new CellRendererText(), "text",
count++);
tv.AppendColumn ( Catalog.GetString ("Jumps reactive"), new CellRendererText(),
"text", count++);
@@ -249,6 +234,10 @@ public partial class ChronoJumpWindow
filechooser.Destroy ();
app1s_recreateTreeView ("file path changed");
}
+
+ void app1s_on_checkbutton_show_data_persons_toggled (object o, EventArgs args) {
+ app1s_recreateTreeView("persons " + app1s_checkbutton_show_data_persons.Active.ToString());
+ }
void app1s_on_checkbutton_show_data_jump_run_toggled (object o, EventArgs args) {
app1s_recreateTreeView("jump run " + app1s_checkbutton_show_data_jump_run.Active.ToString());
}
@@ -262,12 +251,18 @@ public partial class ChronoJumpWindow
UtilGtk.RemoveColumns(app1s_treeview_session_load);
app1s_createTreeView(app1s_treeview_session_load,
- app1s_checkbutton_show_data_jump_run.Active,
app1s_checkbutton_show_data_other_tests.Active);
+ app1s_checkbutton_show_data_persons.Active,
+ app1s_checkbutton_show_data_jump_run.Active,
+ app1s_checkbutton_show_data_other_tests.Active);
app1s_store = app1s_getStore(
- app1s_checkbutton_show_data_jump_run.Active,
app1s_checkbutton_show_data_other_tests.Active);
+ app1s_checkbutton_show_data_persons.Active,
+ app1s_checkbutton_show_data_jump_run.Active,
+ app1s_checkbutton_show_data_other_tests.Active);
app1s_treeview_session_load.Model = app1s_store;
app1s_fillTreeView(app1s_treeview_session_load, app1s_store,
- app1s_checkbutton_show_data_jump_run.Active,
app1s_checkbutton_show_data_other_tests.Active);
+ app1s_checkbutton_show_data_persons.Active,
+ app1s_checkbutton_show_data_jump_run.Active,
+ app1s_checkbutton_show_data_other_tests.Active);
app1s_store.SetSortColumnId(1, Gtk.SortType.Descending); //date
app1s_store.ChangeSortColumn();
@@ -281,7 +276,8 @@ public partial class ChronoJumpWindow
app1s_onSelectionEntry (app1s_treeview_session_load.Selection, new EventArgs ());
}
- private void app1s_fillTreeView (Gtk.TreeView tv, TreeStore store, bool showContacts, bool
showOtherTests)
+ private void app1s_fillTreeView (Gtk.TreeView tv, TreeStore store,
+ bool showPersons, bool showContacts, bool showOtherTests)
{
string filterName = "";
if(app1s_entry_search_filter.Text.ToString().Length > 0)
@@ -296,7 +292,8 @@ public partial class ChronoJumpWindow
SqliteSessionSwitcher sessionSwitcher = new SqliteSessionSwitcher (databaseType,
app1s_import_file_path);
string [] mySessions = sessionSwitcher.SelectAllSessions(filterName); //returns a string of
values separated by ':'
- foreach (string session in mySessions) {
+ foreach (string session in mySessions)
+ {
string [] myStringFull = session.Split(new char[] {':'});
//don't show any text at sport, speciallity and level if it's undefined
@@ -312,76 +309,49 @@ public partial class ChronoJumpWindow
if (myStringFull[6] != Catalog.GetString(Constants.LevelUndefined))
myLevel = Catalog.GetString(myStringFull[6]);
- if(showContacts && showOtherTests)
- app1s_store.AppendValues (
- myStringFull[0], //session num
- myStringFull[3], //session date
- myStringFull[1], //session name
- myStringFull[2], //session place
- myStringFull[8], //number of jumpers x session
- mySport, //personsSport
- mySpeciallity, //personsSpeciallity
- myLevel, //personsLevel
- myStringFull[9], //number of jumps x session
- myStringFull[10], //number of jumpsRj x session
- myStringFull[11], //number of runs x session
- myStringFull[12], //number of runsInterval x session
- myStringFull[13], //number of reaction times x session
- myStringFull[14], //number of pulses x session
- myStringFull[15], //number of multiChronopics x session
- myStringFull[16], //number of encoder signal x session
- myStringFull[17], //number of encoder curve x session
- myStringFull[18], //number of forceSensor
- myStringFull[19], //number of runEncoder
- myStringFull[7] //description of session
- );
- else if(showContacts && ! showOtherTests)
- app1s_store.AppendValues (
- myStringFull[0], //session num
- myStringFull[3], //session date
- myStringFull[1], //session name
- myStringFull[2], //session place
- myStringFull[8], //number of jumpers x session
- mySport, //personsSport
- mySpeciallity, //personsSpeciallity
- myLevel, //personsLevel
- myStringFull[9], //number of jumps x session
- myStringFull[10], //number of jumpsRj x session
- myStringFull[11], //number of runs x session
- myStringFull[12], //number of runsInterval x session
- myStringFull[13], //number of reaction times x session
- myStringFull[14], //number of pulses x session
- myStringFull[15], //number of multiChronopics x session
- myStringFull[7] //description of session
- );
- else if(! showContacts && showOtherTests)
- app1s_store.AppendValues (
- myStringFull[0], //session num
- myStringFull[3], //session date
- myStringFull[1], //session name
- myStringFull[2], //session place
- myStringFull[8], //number of jumpers x session
- mySport, //personsSport
- mySpeciallity, //personsSpeciallity
- myLevel, //personsLevel
- myStringFull[16], //number of encoder signal x session
- myStringFull[17], //number of encoder curve x session
- myStringFull[18], //number of forceSensor
- myStringFull[19], //number of runEncoder
- myStringFull[7] //description of session
- );
- else // ! showContacts && ! showOtherTests
- app1s_store.AppendValues (
- myStringFull[0], //session num
- myStringFull[3], //session date
- myStringFull[1], //session name
- myStringFull[2], //session place
- myStringFull[8], //number of jumpers x session
- mySport, //personsSport
- mySpeciallity, //personsSpeciallity
- myLevel, //personsLevel
- myStringFull[7] //description of session
- );
+ //new 2.0 code
+ int columns = 6;
+ if(showPersons)
+ columns += 3;
+ if(showContacts)
+ columns += 7;
+ if(showOtherTests)
+ columns += 4;
+
+ string [] strings = new string [columns];
+ //for (int i=0; i < columns; i++) {
+ // types[i] = typeof (string);
+ //}
+ int i = 0;
+ strings[i ++] = myStringFull[0]; //session num
+ strings[i ++] = myStringFull[3]; //session date
+ strings[i ++] = myStringFull[1]; //session name
+ strings[i ++] = myStringFull[2]; //session place
+ strings[i ++] = myStringFull[8]; //number of jumpers x session
+
+ if(showPersons) {
+ strings[i ++] = mySport; //personsSport
+ strings[i ++] = mySpeciallity; //personsSpeciallity
+ strings[i ++] = myLevel; //personsLevel
+ }
+ if(showContacts) {
+ strings[i ++] = myStringFull[9]; //number of jumps x session
+ strings[i ++] = myStringFull[10]; //number of jumpsRj x session
+ strings[i ++] = myStringFull[11]; //number of runs x session
+ strings[i ++] = myStringFull[12]; //number of runsInterval x session
+ strings[i ++] = myStringFull[13]; //number of reaction times x session
+ strings[i ++] = myStringFull[14]; //number of pulses x session
+ strings[i ++] = myStringFull[15]; //number of multiChronopics x session
+ }
+ if(showOtherTests) {
+ strings[i ++] = myStringFull[16]; //number of encoder signal x session
+ strings[i ++] = myStringFull[17]; //number of encoder curve x session
+ strings[i ++] = myStringFull[18]; //number of forceSensor
+ strings[i ++] = myStringFull[19]; //number of runEncoder
+ }
+ strings[i ++] = myStringFull[7]; //description of session (comments)
+
+ app1s_store.AppendValues (strings);
}
}
diff --git a/src/gui/app1/session/main.cs b/src/gui/app1/session/main.cs
index cadab855..fa71cc1c 100644
--- a/src/gui/app1/session/main.cs
+++ b/src/gui/app1/session/main.cs
@@ -45,6 +45,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Button app1s_button_import;
[Widget] Gtk.Image app1s_image_import;
[Widget] Gtk.Entry app1s_entry_search_filter;
+ [Widget] Gtk.CheckButton app1s_checkbutton_show_data_persons;
[Widget] Gtk.CheckButton app1s_checkbutton_show_data_jump_run;
[Widget] Gtk.CheckButton app1s_checkbutton_show_data_other_tests;
[Widget] Gtk.Label app1s_file_path_import;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]