[chronojump] Select session shows a combo for tags, signals working.
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Select session shows a combo for tags, signals working.
- Date: Sat, 28 Nov 2020 22:54:36 +0000 (UTC)
commit f8c9a235bce64648c637b65c3a25eef6952d724b
Author: Xavier de Blas <xaviblas gmail com>
Date: Sat Nov 28 23:53:15 2020 +0100
Select session shows a combo for tags, signals working.
src/gui/app1/chronojump.cs | 4 +++-
src/gui/app1/session/loadAndImport.cs | 40 ++++++++++++++++++++++++++++++++++-
src/gui/cjCombo.cs | 15 +++++++++++++
src/tagSession.cs | 15 +++++++++++++
4 files changed, 72 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 84f74b7a..e626ee21 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -624,7 +624,9 @@ public partial class ChronoJumpWindow
createComboPulses();
//createComboMultiChronopic();
createdStatsWin = false;
-
+
+ createComboSessionLoadTags(true);
+
repetitiveConditionsWin = RepetitiveConditionsWindow.Create();
//to have objects ok to be able to be readed before viewing the repetitiveConditionsWin
repetitiveConditionsWin.View(Constants.BellModes.ENCODERGRAVITATORY, preferences,
encoderRhythm, false); //not viewWindow
diff --git a/src/gui/app1/session/loadAndImport.cs b/src/gui/app1/session/loadAndImport.cs
index ef7bab2c..fd13cbce 100644
--- a/src/gui/app1/session/loadAndImport.cs
+++ b/src/gui/app1/session/loadAndImport.cs
@@ -52,6 +52,10 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Label app1s_label_import;
[Widget] Gtk.ScrolledWindow scrolledwin_session_load;
+ [Widget] Gtk.HBox app1s_hbox_combo_tags;
+ [Widget] Gtk.ComboBox app1s_combo_tags;
+ CjComboGeneric app1sComboTags;
+
/*
* when fillTreeView() is called, it executes:
* SqliteSessionSwitcher sessionSwitcher = new SqliteSessionSwitcher (databaseType, import_file_path);
@@ -105,6 +109,8 @@ public partial class ChronoJumpWindow
app1s_button_select_file_import_same_database.Visible = false; //is shown when user
want to import a second session
app1s_notebook.CurrentPage = app1s_PAGE_IMPORT_START;
}
+
+ createComboSessionLoadTags (false); //TODO: care because this is only related to load (not
report)
app1s_entry_search_filter.Text = "";
app1s_createTreeView(app1s_treeview_session_load, true, false, false, false);
@@ -236,7 +242,26 @@ public partial class ChronoJumpWindow
}
tv.AppendColumn ( Catalog.GetString ("Comments"), new CellRendererText(), "text", count++);
}
-
+
+ private void createComboSessionLoadTags (bool create)
+ {
+ if(create)
+ {
+ app1sComboTags = new CjComboGeneric(app1s_combo_tags, app1s_hbox_combo_tags);
+ app1s_combo_tags = app1sComboTags.Combo;
+ app1s_combo_tags.Changed += new EventHandler (app1s_on_combo_tags_changed);
+ } else {
+ app1sComboTags.L_types = TagSession.ListSelectTypesOnSQL();
+ app1sComboTags.Fill();
+ app1s_combo_tags = app1sComboTags.Combo;
+ }
+ app1s_combo_tags.Sensitive = true;
+ }
+
+ private void app1s_on_combo_tags_changed (object o, EventArgs args) {
+ app1s_recreateTreeView("changed tag");
+ }
+
protected void app1s_on_entry_search_filter_changed (object o, EventArgs args) {
app1s_recreateTreeView("changed search filter");
}
@@ -367,12 +392,25 @@ public partial class ChronoJumpWindow
strings[i ++] = myStringFull[3]; //session date
strings[i ++] = myStringFull[1]; //session name
+ //to show tag column
if (app1s_type == app1s_windowType.LOAD_SESSION)
{
List<TagSession> tagSession_list = SessionTagSession.FindTagSessionsOfSession(
Convert.ToInt32(myStringFull[0]),
tagsOfAllSessions);
strings[i ++] = SessionTagSession.PrintTagNamesOfSession(tagSession_list);
+
+ //do not show this session depending on tags
+ if(app1sComboTags.GetSelectedId() > 0)
+ {
+ bool found = false;
+ foreach(TagSession ts in tagSession_list)
+ if(ts.UniqueID == app1sComboTags.GetSelectedId())
+ found = true;
+
+ if(! found)
+ continue;
+ }
}
strings[i ++] = myStringFull[2]; //session place
diff --git a/src/gui/cjCombo.cs b/src/gui/cjCombo.cs
index 37c26be6..ce2b1e45 100644
--- a/src/gui/cjCombo.cs
+++ b/src/gui/cjCombo.cs
@@ -292,6 +292,21 @@ public class CjComboForceSensorPorts : CjCombo
}
}
+/*
+public class CjComboSessionSelectTags : CjCombo
+{
+ public CjComboSessionSelectTags (Gtk.ComboBox combo, Gtk.HBox hbox_combo)
+ {
+ this.combo = combo;
+ this.hbox = hbox_combo;
+
+ create();
+ FillNoTranslate();
+ package();
+ }
+
+}
+*/
//------------ generic -------------
public class CjComboGeneric : CjCombo
diff --git a/src/tagSession.cs b/src/tagSession.cs
index 3b564872..681579bd 100644
--- a/src/tagSession.cs
+++ b/src/tagSession.cs
@@ -75,6 +75,21 @@ public class TagSession
return str;
}
+ public static List<object> ListSelectTypesOnSQL ()
+ {
+ List<object> list = new List<object>();
+
+ foreach(TagSession ts in SqliteTagSession.Select(false, -1))
+ {
+ if(list.Count == 0)
+ list.Add(new SelectTypes(0, "Select tag", Catalog.GetString("Select tag")));
+
+ list.Add(new SelectTypes(ts.UniqueID, ts.Name, ts.Name)); //no translation on tags
+ }
+
+ return list;
+ }
+
public static string GetActiveTagNamesOfThisSession(int sessionID)
{
string str = "";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]