[chronojump] Encoder: Show curves treeview on genericWin



commit 9960d4b20eb3d3727e97a93ba4c6b7c804a9ef2e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Jun 1 12:54:37 2012 +0200

    Encoder: Show curves treeview on genericWin

 glade/chronojump.glade   |    7 +++++--
 src/gui/encoder.cs       |   33 ++++++++++++++++++++++++++++++++-
 src/gui/genericWindow.cs |   13 ++++++++-----
 3 files changed, 45 insertions(+), 8 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index c14f6f6..b4c7887 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -24756,10 +24756,13 @@ Evaluator can use real name or nickname.</property>
                                                           </packing>
                                                         </child>
                                                         <child>
-                                                          <widget class="GtkButton" id="button_encoder_analyze_data_select_user_curves">
-                                                            <property name="label" translatable="yes">Select</property>
+                                                          <widget class="GtkButton" id="button_encoder_analyze_data_show_user_curves">
+                                                            <property name="label" translatable="yes">Show</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="sensitive">False</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
+                                                            <signal name="clicked" handler="on_button_encoder_analyze_data_show_user_curves_clicked"/>
                                                           </widget>
                                                           <packing>
                                                             <property name="position">1</property>
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 4498254..8c70559 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -56,6 +56,7 @@ public partial class ChronoJumpWindow
 	[Widget] Gtk.Button button_encoder_analyze;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_data_current_stream;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_data_user_curves;
+	[Widget] Gtk.Button button_encoder_analyze_data_show_user_curves;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_powerbars;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_single;
 	[Widget] Gtk.RadioButton radiobutton_encoder_analyze_side;
@@ -91,7 +92,6 @@ public partial class ChronoJumpWindow
 	//TODO: put chronopic detection in a generic place. Done But:
 	//TODO: solve the problem of connecting two different chronopics
 	//
-	//TODO: analyze-user curves: create file with n lines: titlecurve,otherparams,...,filecurve and pass this file to graph.R. graph.R will know that this file is not a rawdata file because will be called chronojump-encoder-graph-input-multi.txt
 	//TODO: if user has no curves, has to stop, multi file gets generated with title row but no curves. Fixed, but need to (best) don't allow to analyze, or show a clear message, blanking the graphic
 	//TODO:put zoom,unzoom (at side of delete curve)  in capture curves (for every curve)
 	//TODO: treeview on analyze
@@ -260,6 +260,34 @@ public partial class ChronoJumpWindow
 		//if is not stored, it can change when changed eccon radiobutton on cursor is in treeview
 		ecconLast = findEccon(false);
 	}
+	
+	void on_button_encoder_analyze_data_show_user_curves_clicked (object o, EventArgs args) 
+	{
+		ArrayList data = SqliteEncoder.Select(false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve");
+
+		ArrayList dataPrint = new ArrayList();
+		foreach(EncoderSQL es in data) {
+			dataPrint.Add(es.ToStringArray());
+		}
+		
+		string [] columnsString = {
+			Catalog.GetString("ID"),
+			Catalog.GetString("Type"),
+			Catalog.GetString("Contraction"),
+			Catalog.GetString("Extra weight"),
+			Catalog.GetString("Date"),
+			Catalog.GetString("Comment")
+		};
+
+		genericWin = GenericWindow.Show(
+				string.Format(Catalog.GetString("Saved curves of athlete {0} on this session."), 
+					currentPerson.Name), Constants.GenericWindowShow.TREEVIEW);
+
+		genericWin.SetTreeview(columnsString, dataPrint);
+		genericWin.ShowButtonCancel(false);
+		genericWin.SetButtonAcceptSensitive(true);
+		genericWin.SetButtonAcceptLabel(Catalog.GetString("Close"));
+	}
 		
 	void on_button_encoder_load_stream_clicked (object o, EventArgs args) 
 	{
@@ -285,6 +313,7 @@ public partial class ChronoJumpWindow
 
 		genericWin.SetTreeview(columnsString, dataPrint);
 		genericWin.SetButtonAcceptLabel(Catalog.GetString("Load"));
+		genericWin.SetButtonAcceptSensitive(false);
 		genericWin.Button_accept.Clicked += new EventHandler(on_encoder_load_stream_accepted);
 	}
 	
@@ -526,9 +555,11 @@ public partial class ChronoJumpWindow
 	
 	private void on_radiobutton_encoder_analyze_data_current_stream_toggled (object obj, EventArgs args) {
 		button_encoder_analyze.Sensitive = encoderTimeStamp != null;
+		button_encoder_analyze_data_show_user_curves.Sensitive = false;
 	}
 	private void on_radiobutton_encoder_analyze_data_user_curves_toggled (object obj, EventArgs args) {
 		button_encoder_analyze.Sensitive = currentPerson != null;
+		button_encoder_analyze_data_show_user_curves.Sensitive = currentPerson != null;
 	}
 
 	//show curve_num only on simple and superpose
diff --git a/src/gui/genericWindow.cs b/src/gui/genericWindow.cs
index b5b4e29..6c08a92 100644
--- a/src/gui/genericWindow.cs
+++ b/src/gui/genericWindow.cs
@@ -43,6 +43,7 @@ public class GenericWindow
 	[Widget] Gtk.ScrolledWindow scrolled_window_treeview;
 	[Widget] Gtk.TreeView treeview;
 	[Widget] Gtk.Button button_accept;
+	[Widget] Gtk.Button button_cancel;
 
 	static GenericWindow GenericWindowBox;
 	
@@ -118,7 +119,6 @@ public class GenericWindow
 		foreach (string [] line in data) 
 			store.AppendValues (line);
 		
-		setButtonAcceptSensitive(false);
 		treeview.CursorChanged += on_treeview_cursor_changed; 
 	}
 	
@@ -159,9 +159,9 @@ public class GenericWindow
 		TreeIter iter = new TreeIter();
 		TreeModel myModel = treeview.Model;
 		if (treeview.Selection.GetSelected (out myModel, out iter)) 
-			setButtonAcceptSensitive(true);
+			SetButtonAcceptSensitive(true);
 		else
-			setButtonAcceptSensitive(false);
+			SetButtonAcceptSensitive(false);
 	}
 	
 	public int TreeviewSelectedRowID() {
@@ -177,10 +177,13 @@ public class GenericWindow
 		button_accept.Label=str;
 	}
 	
-	private void setButtonAcceptSensitive(bool show) {
+	public void SetButtonAcceptSensitive(bool show) {
 		button_accept.Sensitive=show;
 	}
-
+	
+	public void ShowButtonCancel(bool show) {
+		button_cancel.Visible = show;
+	}
 
 	protected void on_button_cancel_clicked (object o, EventArgs args)
 	{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]