[chronojump] Auto mode with treeviews
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Auto mode with treeviews
- Date: Fri, 10 Oct 2014 16:22:43 +0000 (UTC)
commit 26ae813bb4c97c1f6655e26a9badc61ba8b42310
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Oct 10 12:44:48 2014 +0200
Auto mode with treeviews
glade/chronojump.glade | 297 ++++++++++++++++++++++++++++++++++-------------
src/gui/executeAuto.cs | 96 +++++++++-------
src/utilGtk.cs | 12 ++
3 files changed, 283 insertions(+), 122 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 19ff58a..76c8534 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -6263,6 +6263,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -6936,6 +6939,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
<child>
@@ -7743,6 +7749,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -8309,6 +8318,9 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -18001,6 +18013,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -18475,6 +18490,9 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -18545,6 +18563,21 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkLabel" id="label_tv_title">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -19426,6 +19459,9 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -19449,6 +19485,9 @@ by you</property>
<property name="y_options"/>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -25125,150 +25164,211 @@ One serie can contain several tests.</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">3</property>
- <property name="n_columns">3</property>
+ <property name="n_columns">2</property>
<property name="column_spacing">10</property>
- <property name="row_spacing">10</property>
- <child>
- <widget class="GtkLabel" id="label_serie1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Serie 1</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <widget class="GtkLabel" id="label_serie2">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Serie 2</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
+ <property name="row_spacing">20</property>
<child>
- <widget class="GtkLabel" id="label_serie3">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Serie 3</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
- </packing>
- </child>
- <child>
- <widget class="GtkButton" id="button_add1">
- <property name="label">gtk-add</property>
+ <widget class="GtkScrolledWindow" id="scrolled_win_serie1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_button_add_exercise_clicked"
swapped="no"/>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <widget class="GtkTreeView" id="treeview_serie1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="rules_hint">True</property>
+ <property name="enable_search">False</property>
+ </widget>
+ </child>
</widget>
<packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkButton" id="button_add2">
- <property name="label">gtk-add</property>
+ <widget class="GtkScrolledWindow" id="scrolled_win_serie2">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_button_add_exercise_clicked"
swapped="no"/>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <widget class="GtkTreeView" id="treeview_serie2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="rules_hint">True</property>
+ <property name="enable_search">False</property>
+ </widget>
+ </child>
</widget>
<packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkButton" id="button_add3">
- <property name="label">gtk-add</property>
+ <widget class="GtkScrolledWindow" id="scrolled_win_serie3">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="use_stock">True</property>
- <signal name="clicked" handler="on_button_add_exercise_clicked"
swapped="no"/>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <child>
+ <widget class="GtkTreeView" id="treeview_serie3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="rules_hint">True</property>
+ <property name="enable_search">False</property>
+ </widget>
+ </child>
</widget>
<packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_combo_serie1">
+ <widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">8</property>
<child>
- <placeholder/>
+ <widget class="GtkLabel" id="label_serie1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Serie 1</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_add1">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <property name="yalign">0</property>
+ <signal name="clicked" handler="on_button_add_exercise_clicked"
swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="x_options"/>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_combo_serie2">
+ <widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">8</property>
<child>
- <placeholder/>
+ <widget class="GtkLabel" id="label_serie2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Serie 2</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_add2">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <signal name="clicked" handler="on_button_add_exercise_clicked"
swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="x_options"/>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_combo_serie3">
+ <widget class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">8</property>
<child>
- <placeholder/>
+ <widget class="GtkLabel" id="label_serie3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Serie 3</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_add3">
+ <property name="label">gtk-add</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <property name="yalign">0</property>
+ <signal name="clicked" handler="on_button_add_exercise_clicked"
swapped="no"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"/>
+ <property name="x_options"/>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
<packing>
- <property name="expand">True</property>
+ <property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
@@ -27694,6 +27794,24 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -29558,6 +29676,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -30091,6 +30212,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -32597,6 +32721,9 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -32735,6 +32862,9 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -32888,6 +33018,9 @@ show elevation as:</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/gui/executeAuto.cs b/src/gui/executeAuto.cs
index 911c365..a01f6fa 100644
--- a/src/gui/executeAuto.cs
+++ b/src/gui/executeAuto.cs
@@ -47,22 +47,25 @@ public class ExecuteAutoWindow
//2nd tab
[Widget] Gtk.Box hbox_combo_select;
[Widget] Gtk.ComboBox combo_select;
- [Widget] Gtk.Box hbox_combo_serie1;
- [Widget] Gtk.ComboBox combo_serie1;
- [Widget] Gtk.Box hbox_combo_serie2;
- [Widget] Gtk.ComboBox combo_serie2;
- [Widget] Gtk.Box hbox_combo_serie3;
- [Widget] Gtk.ComboBox combo_serie3;
[Widget] Gtk.Button button_add1;
[Widget] Gtk.Button button_add2;
[Widget] Gtk.Button button_add3;
[Widget] Gtk.Label label_serie1;
[Widget] Gtk.Label label_serie2;
[Widget] Gtk.Label label_serie3;
+ [Widget] Gtk.ScrolledWindow scrolled_win_serie1;
+ [Widget] Gtk.ScrolledWindow scrolled_win_serie2;
+ [Widget] Gtk.ScrolledWindow scrolled_win_serie3;
+ [Widget] Gtk.TreeView treeview_serie1;
+ [Widget] Gtk.TreeView treeview_serie2;
+ [Widget] Gtk.TreeView treeview_serie3;
//3rd tab
[Widget] Gtk.TreeView treeview;
+ TreeStore store_serie1;
+ TreeStore store_serie2;
+ TreeStore store_serie3;
static ExecuteAutoWindow ExecuteAutoWindowBox;
Gtk.Window parent;
@@ -137,7 +140,7 @@ public class ExecuteAutoWindow
label_series_info.Visible = false;
createComboSelect();
- createComboSeries();
+ createTreeviewSeries();
}
private void initializeShowJustOrder(int rowNumber) {
@@ -211,27 +214,34 @@ public class ExecuteAutoWindow
}
- ArrayList comboSerie1Array;
- ArrayList comboSerie2Array;
- ArrayList comboSerie3Array;
-
- private void createComboSeries() {
- combo_serie1 = ComboBox.NewText ();
- hbox_combo_serie1.PackStart(combo_serie1, true, true, 0);
- hbox_combo_serie1.ShowAll();
- comboSerie1Array = new ArrayList(0);
-
- combo_serie2 = ComboBox.NewText ();
- hbox_combo_serie2.PackStart(combo_serie2, true, true, 0);
- hbox_combo_serie2.ShowAll();
- comboSerie2Array = new ArrayList(0);
-
- combo_serie3 = ComboBox.NewText ();
- hbox_combo_serie3.PackStart(combo_serie3, true, true, 0);
- hbox_combo_serie3.ShowAll();
- comboSerie3Array = new ArrayList(0);
- }
+ ArrayList treeviewSerie1Array;
+ ArrayList treeviewSerie2Array;
+ ArrayList treeviewSerie3Array;
+ private void createTreeviewSeries()
+ {
+ treeviewSerie1Array = new ArrayList(0);
+ store_serie1 = new TreeStore(typeof (string));
+ treeview_serie1.Model = store_serie1;
+ treeview_serie1.HeadersVisible=false;
+ UtilGtk.CreateCols(treeview_serie1, store_serie1, "", 0, true);
+ treeview_serie1.Selection.Mode = SelectionMode.None;
+
+ treeviewSerie2Array = new ArrayList(0);
+ store_serie2 = new TreeStore(typeof (string));
+ treeview_serie2.Model = store_serie2;
+ treeview_serie2.HeadersVisible=false;
+ UtilGtk.CreateCols(treeview_serie2, store_serie2, "", 0, true);
+ treeview_serie2.Selection.Mode = SelectionMode.None;
+
+ treeviewSerie3Array = new ArrayList(0);
+ store_serie3 = new TreeStore(typeof (string));
+ treeview_serie3.Model = store_serie3;
+ treeview_serie3.HeadersVisible=false;
+ UtilGtk.CreateCols(treeview_serie3, store_serie3, "", 0, true);
+ treeview_serie3.Selection.Mode = SelectionMode.None;
+ }
+
private void on_button_add_exercise_clicked(object o, EventArgs args)
{
int selectedPos = UtilGtk.ComboGetActivePos(combo_select);
@@ -240,36 +250,42 @@ public class ExecuteAutoWindow
if(o == (object) button_add1)
{
- comboSerie1Array.Add(tc);
- UtilGtk.ComboAdd(combo_serie1, tc.trName);
- combo_serie1.Active = comboSerie1Array.Count -1;
+ treeviewSerie1Array.Add(tc);
+ UtilGtk.TreeviewAddRow(treeview_serie1, store_serie1, tc.trName);
} else if(o == (object) button_add2)
{
- comboSerie2Array.Add(tc);
- UtilGtk.ComboAdd(combo_serie2, tc.trName);
- combo_serie2.Active = comboSerie2Array.Count -1;
+ treeviewSerie2Array.Add(tc);
+ UtilGtk.TreeviewAddRow(treeview_serie2, store_serie2, tc.trName);
} else
{ //button_add3
- comboSerie3Array.Add(tc);
- UtilGtk.ComboAdd(combo_serie3, tc.trName);
- combo_serie3.Active = comboSerie3Array.Count -1;
+ treeviewSerie3Array.Add(tc);
+ UtilGtk.TreeviewAddRow(treeview_serie3, store_serie3, tc.trName);
}
//a test is added, sensitivize "next" button
button_next.Sensitive = true;
}
+ //true means "by series" (shows more stuff)
private void showSeriesStuff(bool show)
{
button_add2.Visible = show;
button_add3.Visible = show;
- hbox_combo_serie2.Visible = show;
- hbox_combo_serie3.Visible = show;
-
label_serie1.Visible = show;
label_serie2.Visible = show;
label_serie3.Visible = show;
+
+ if(! show)
+ treeview_serie1.SetSizeRequest(150,120);
+ else {
+ treeview_serie1.SetSizeRequest(150,80);
+ treeview_serie2.SetSizeRequest(150,80);
+ treeview_serie3.SetSizeRequest(150,80);
+ }
+
+ scrolled_win_serie2.Visible = show;
+ scrolled_win_serie3.Visible = show;
}
TreeStore store;
@@ -315,7 +331,7 @@ public class ExecuteAutoWindow
ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(sessionID);
orderedData = ExecuteAuto.CreateOrder(mode, persons,
- comboSerie1Array, comboSerie2Array, comboSerie3Array);
+ treeviewSerie1Array, treeviewSerie2Array, treeviewSerie3Array);
createTreeview(radio_by_series.Active);
fillTreeview();
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index 4b91f26..7f4605c 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -234,6 +234,18 @@ public class UtilGtk
return tv;
}
+ //this is used only in a row with only one column
+ public static void TreeviewAddRow(Gtk.TreeView tv, TreeStore store, string row) {
+ TreeIter iter = new TreeIter();
+ bool iterOk = store.GetIterFirst(out iter);
+
+ iter = store.AppendValues(row);
+
+ //scroll treeview if needed
+ TreePath path = store.GetPath (iter);
+ tv.ScrollToCell (path, null, true, 0, 0);
+
+ }
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]