[chronojump] Fixed: 649552 - execute test sensitive without person selected



commit 9821fa1fb752a52d8001bd6d73a6bc34e862a3c4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 6 15:06:54 2011 +0200

    Fixed: 649552 - execute test sensitive without person selected

 src/Makefile.am           |    1 -
 src/gui/chronojump.cs     |   26 ++++++++++++++++++--------
 src/gui/eventExecute.cs   |    2 --
 src/gui/multiChronopic.cs |    4 ++++
 src/treeViewPerson.cs     |    5 +++++
 5 files changed, 27 insertions(+), 11 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 1dc98d2..43872a4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -195,7 +195,6 @@ FILES = \
 	utilGtk.cs\
 	constants.cs\
  	report.cs\
- 	updateProgressBar.cs\
  	sport.cs\
  	log.cs\
  	serverPing.cs\
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 531fb59..23062cc 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -104,6 +104,8 @@ public partial class ChronoJumpWindow
 	[Widget] Gtk.MenuItem menuitem_export_xml;
 		
 	//menu person
+	[Widget] Gtk.Button button_persons_up;
+	[Widget] Gtk.Button button_persons_down;
 	[Widget] Gtk.Button button_edit_current_person;
 	[Widget] Gtk.Button button_show_all_person_events;
 	[Widget] Gtk.Button button_delete_current_person;
@@ -4952,11 +4954,17 @@ Console.WriteLine("X");
 		}
 	
 		//button_execute_test have to be non sensitive in multichronopic without two cps
-		//else has to be sensitive	
-		if(notebook_execute.CurrentPage == 6 && chronopicWin.NumConnected() < 2)
-			extra_window_multichronopic_can_do(false);
-		else 
-			extra_window_multichronopic_can_do(true);
+		//else has to be sensitive
+
+		//if there are persons
+		if (notebook_execute.CurrentPage == 6) {
+			if (chronopicWin.NumConnected() >= 2)
+				extra_window_multichronopic_can_do(true);
+			else 
+				extra_window_multichronopic_can_do(false);
+		} else {
+			button_execute_test.Sensitive = myTreeViewPersons.IsThereAnyRecord();
+		}
 
 		stats_win_change_test_type(notebook_execute.CurrentPage);
 	}
@@ -5036,6 +5044,8 @@ Console.WriteLine("X");
 	
 	private void menuPersonSelectedSensitive(bool option)
 	{
+		button_persons_up.Sensitive = option;
+		button_persons_down.Sensitive = option;
 		button_edit_current_person.Sensitive = option;
 		button_show_all_person_events.Sensitive = option;
 		button_delete_current_person.Sensitive = option;
@@ -5066,7 +5076,6 @@ Console.WriteLine("X");
 		frame_share_data.Sensitive = false;
 		
 		hbox_this_test_buttons.Sensitive = false;
-		
 		hbox_execute_test.Sensitive = false;
 		button_execute_test.Sensitive = false;
 		eventExecuteHideAllTables();
@@ -5084,8 +5093,6 @@ Console.WriteLine("X");
 		vbox_stats.Sensitive = true;
 		frame_share_data.Sensitive = true;
 		
-		hbox_execute_test.Sensitive = true;
-		
 		//changeTestImage("", "", "LOGO");
 	}
 
@@ -5101,6 +5108,7 @@ Console.WriteLine("X");
 		treeview_persons.Sensitive = false;
 		
 		menuPersonSelectedSensitive(false);
+		hbox_execute_test.Sensitive = false;
 	}
 	
 	private void sensitiveGuiYesPerson () {
@@ -5123,6 +5131,8 @@ Console.WriteLine("X");
 		combo_runs.Sensitive = true;
 		combo_runs_interval.Sensitive = true;
 		combo_pulses.Sensitive = true;
+		
+		hbox_execute_test.Sensitive = true;
 	}
 	
 	private void sensitiveGuiYesEvent () {
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 0e17aaf..38e4cfa 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -241,7 +241,6 @@ public partial class ChronoJumpWindow
 		}
 
 		event_execute_button_cancel.Sensitive = true;
-//		event_execute_button_close.Sensitive = false;
 
 		event_execute_clearDrawingArea();
 		clearProgressBars();
@@ -1764,7 +1763,6 @@ Log.WriteLine("Preparing reactive A");
 		
 	private void hideButtons() {
 		event_execute_button_cancel.Sensitive = false;
-//		button_close.Sensitive = true;
 		event_execute_button_finish.Sensitive = false;
 	}
 
diff --git a/src/gui/multiChronopic.cs b/src/gui/multiChronopic.cs
index aab1ef1..898fb32 100644
--- a/src/gui/multiChronopic.cs
+++ b/src/gui/multiChronopic.cs
@@ -89,6 +89,10 @@ public partial class ChronoJumpWindow
 
 
 	private void extra_window_multichronopic_can_do(bool can_do) {
+		//if there are no persons, cannot show this stuff
+		if( ! myTreeViewPersons.IsThereAnyRecord() )
+			can_do = false;
+
 		button_execute_test.Sensitive = can_do;
 		extra_window_textview_multichronopic_need_two.Visible = ! can_do;
 		
diff --git a/src/treeViewPerson.cs b/src/treeViewPerson.cs
index 85ef140..ffd6a92 100644
--- a/src/treeViewPerson.cs
+++ b/src/treeViewPerson.cs
@@ -110,6 +110,11 @@ public class TreeViewPersons
 		}
 	}
 	
+	public bool IsThereAnyRecord() {
+		TreeIter iter;
+		return store.GetIterFirst(out iter);
+	}
+	
 	public int FindRow(int uniqueID)
 	{
 		TreeIter iter;



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