[chronojump] changuing gui (chronopic on main gui done)



commit 1dda9d2735d12c5a7f075cde7bc0e5a9cfdd4219
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Mar 22 15:06:46 2011 +0100

    changuing gui (chronopic on main gui done)

 glade/chronojump.glade |  131 ++++++++++++++++++++++++++++++++++--------------
 src/constants.cs       |    5 ++-
 src/gui/chronojump.cs  |   64 +++++++++++++++++-------
 src/gui/chronopic.cs   |    1 +
 4 files changed, 145 insertions(+), 56 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 3ece505..d2e52f8 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -17434,26 +17434,6 @@ by you</property>
                 <child>
                   <widget class="GtkMenu" id="menu_view_menu">
                     <child>
-                      <widget class="GtkImageMenuItem" id="menuitem_chronopic">
-                        <property name="label">_Chronopic</property>
-                        <property name="visible">True</property>
-                        <property name="use_underline">True</property>
-                        <property name="use_stock">False</property>
-                        <signal name="activate" handler="on_menuitem_chronopic_activate"/>
-                        <child internal-child="image">
-                          <widget class="GtkImage" id="image18">
-                            <property name="visible">True</property>
-                            <property name="stock">gtk-missing-image</property>
-                          </widget>
-                        </child>
-                      </widget>
-                    </child>
-                    <child>
-                      <widget class="GtkSeparatorMenuItem" id="separatormenuitem2">
-                        <property name="visible">True</property>
-                      </widget>
-                    </child>
-                    <child>
                       <widget class="GtkImageMenuItem" id="menuitem_view_stats">
                         <property name="label" translatable="yes">S_tats</property>
                         <property name="visible">True</property>
@@ -17735,7 +17715,7 @@ by you</property>
                                         <property name="can_default">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="has_tooltip">True</property>
-                                        <property name="tooltip" translatable="yes">New person</property>
+                                        <property name="tooltip" translatable="yes">New persons (multiple)</property>
                                         <signal name="clicked" handler="on_person_add_multiple_clicked"/>
                                         <child>
                                           <widget class="GtkImage" id="image_persons_new_plus">
@@ -17779,7 +17759,7 @@ by you</property>
                                         <property name="can_default">True</property>
                                         <property name="receives_default">True</property>
                                         <property name="has_tooltip">True</property>
-                                        <property name="tooltip" translatable="yes">Load person</property>
+                                        <property name="tooltip" translatable="yes">Load persons from other session</property>
                                         <signal name="clicked" handler="on_recuperate_persons_from_session_clicked"/>
                                         <child>
                                           <widget class="GtkImage" id="image_persons_open_plus">
@@ -18290,6 +18270,7 @@ Chronopic</property>
                               <widget class="GtkNotebook" id="notebook_execute">
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
+                                <property name="show_tabs">False</property>
                                 <property name="show_border">False</property>
                                 <child>
                                   <widget class="GtkFrame" id="frame2">
@@ -19818,12 +19799,12 @@ Chronopic</property>
                               </packing>
                             </child>
                             <child>
-                              <widget class="GtkTable" id="table3">
+                              <widget class="GtkTable" id="table_execute_test">
                                 <property name="visible">True</property>
                                 <property name="n_rows">2</property>
                                 <property name="n_columns">3</property>
-                                <property name="column_spacing">6</property>
-                                <property name="row_spacing">6</property>
+                                <property name="column_spacing">8</property>
+                                <property name="row_spacing">8</property>
                                 <child>
                                   <widget class="GtkFrame" id="frame1">
                                     <property name="visible">True</property>
@@ -20379,31 +20360,105 @@ weight</property>
                                 <child>
                                   <widget class="GtkVBox" id="vbox11">
                                     <property name="visible">True</property>
+                                    <property name="spacing">12</property>
                                     <child>
-                                      <widget class="GtkHBox" id="hbox14">
+                                      <widget class="GtkFrame" id="frame5">
+                                        <property name="width_request">200</property>
                                         <property name="visible">True</property>
+                                        <property name="label_xalign">0</property>
+                                        <property name="label_yalign">0.69999998807907104</property>
+                                        <property name="shadow_type">out</property>
                                         <child>
-                                          <widget class="GtkLabel" id="label9">
+                                          <widget class="GtkAlignment" id="alignment1">
                                             <property name="visible">True</property>
-                                            <property name="label">chronopic info</property>
+                                            <property name="left_padding">6</property>
+                                            <child>
+                                              <widget class="GtkVBox" id="vbox15">
+                                                <property name="visible">True</property>
+                                                <property name="border_width">4</property>
+                                                <property name="spacing">10</property>
+                                                <child>
+                                                  <widget class="GtkVBox" id="vbox16">
+                                                    <property name="visible">True</property>
+                                                    <property name="spacing">6</property>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox21">
+                                                        <property name="visible">True</property>
+                                                        <property name="spacing">6</property>
+                                                        <child>
+                                                          <widget class="GtkLabel" id="label36">
+                                                            <property name="visible">True</property>
+                                                            <property name="label" translatable="yes">Connected Chronopics</property>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkLabel" id="label_connected_chronopics">
+                                                            <property name="visible">True</property>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="position">1</property>
+                                                          </packing>
+                                                        </child>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="expand">False</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkTextView" id="textview_message_connected_chronopics">
+                                                        <property name="visible">True</property>
+                                                        <property name="can_focus">True</property>
+                                                        <property name="editable">False</property>
+                                                        <property name="wrap_mode">word</property>
+                                                        <property name="cursor_visible">False</property>
+                                                        <property name="accepts_tab">False</property>
+                                                      </widget>
+                                                      <packing>
+                                                        <property name="position">1</property>
+                                                      </packing>
+                                                    </child>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="position">0</property>
+                                                  </packing>
+                                                </child>
+                                                <child>
+                                                  <widget class="GtkButton" id="button_activate_chronopics">
+                                                    <property name="label" translatable="yes">Configure Chronopic/s</property>
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="receives_default">True</property>
+                                                    <signal name="clicked" handler="on_chronopic_clicked"/>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="position">1</property>
+                                                  </packing>
+                                                </child>
+                                              </widget>
+                                            </child>
                                           </widget>
-                                          <packing>
-                                            <property name="position">0</property>
-                                          </packing>
                                         </child>
                                         <child>
-                                          <widget class="GtkLabel" id="label12">
+                                          <widget class="GtkLabel" id="label35">
                                             <property name="visible">True</property>
-                                            <property name="label">button
-chronopic
-window</property>
+                                            <property name="label" translatable="yes">&lt;b&gt;Chronopic connection&lt;/b&gt;</property>
+                                            <property name="use_markup">True</property>
                                           </widget>
                                           <packing>
-                                            <property name="position">1</property>
+                                            <property name="type">label_item</property>
                                           </packing>
                                         </child>
                                       </widget>
                                       <packing>
+                                        <property name="expand">False</property>
+                                        <property name="fill">False</property>
                                         <property name="position">0</property>
                                       </packing>
                                     </child>
@@ -20413,10 +20468,10 @@ window</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
+                                        <property name="border_width">8</property>
                                         <signal name="clicked" handler="on_button_execute_test_clicked"/>
                                       </widget>
                                       <packing>
-                                        <property name="expand">False</property>
                                         <property name="position">1</property>
                                       </packing>
                                     </child>
@@ -20424,6 +20479,7 @@ window</property>
                                   <packing>
                                     <property name="left_attach">1</property>
                                     <property name="right_attach">2</property>
+                                    <property name="x_options">GTK_FILL</property>
                                   </packing>
                                 </child>
                                 <child>
@@ -20458,6 +20514,7 @@ of execution</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>
                                   </packing>
                                 </child>
diff --git a/src/constants.cs b/src/constants.cs
index dc3af09..d1aa075 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -405,8 +405,11 @@ public class Constants
 	};
 	
 	public static int Simulated = -1; 
-	public static string SimulatedMessage = Catalog.GetString("Tests are SIMULATED until Chronopic is connected at menu 'Tools / Chronopic'.");
+	public static string SimulatedMessage = Catalog.GetString("Tests are SIMULATED until Chronopic is connected.");
 	public static string SimulatedTreeview = " (" + Catalog.GetString("Simulated") + ")"; 
+	
+	public static string ChronopicOne = Catalog.GetString("All tests available except MultiChronopic.");
+	public static string ChronopicMore = Catalog.GetString("All tests available.");
 
 	
 	//levels of sport practice
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index cc9aa80..b9ae8a8 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -165,6 +165,12 @@ public partial class ChronoJumpWindow
 	[Widget] Gtk.Button button_video_play_selected_pulse;
 	[Widget] Gtk.Button button_delete_selected_pulse;
 	[Widget] Gtk.Button button_repair_selected_pulse;
+
+	[Widget] Gtk.Table table_execute_test;
+	[Widget] Gtk.Button button_execute_test;
+	[Widget] Gtk.Label label_connected_chronopics;
+	[Widget] Gtk.TextView textview_message_connected_chronopics;
+
 	//multiChronopic	
 	[Widget] Gtk.MenuItem menuitem_multi_chronopic_start;
 	[Widget] Gtk.MenuItem menuitem_run_analysis;
@@ -184,7 +190,7 @@ public partial class ChronoJumpWindow
 	[Glade.WidgetAttribute]
 		private ImageMenuItem
 			menuitem_view_stats = null, menuitem_server_stats = null,
-					    menuitem_report_window = null, menuitem_chronopic = null;
+					    menuitem_report_window = null;
 	[Widget] Gtk.MenuItem menuitem_server_evaluator_data;
 	[Widget] Gtk.MenuItem menuitem_server_upload_session;
 	[Widget] Gtk.MenuItem menuitem_preferences;
@@ -487,7 +493,6 @@ public partial class ChronoJumpWindow
 	private void chronopicAtStart(object o, EventArgs args) {
 		//make active menuitem chronopic, and this
 		//will raise other things
-		//menuitem_chronopic.Active = true;
 	}
 */
 
@@ -498,6 +503,7 @@ public partial class ChronoJumpWindow
 			cpd.Add(a);
 		}
 		chronopicWin = ChronopicWindow.Create(cpd, recreate, volumeOn);
+		chronopicLabels(0);
 	}
 
 
@@ -618,8 +624,6 @@ public partial class ChronoJumpWindow
 		image_multi_chronopic_zoom.Pixbuf = pixbuf;
 
 		//menuitems (done differently)
-		pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "chronopic_24.png");
-		menuitem_chronopic.Image = new Gtk.Image(pixbuf);
 		pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "gpm-statistics.png");
 		menuitem_view_stats.Image = new Gtk.Image(pixbuf);
 		menuitem_server_stats.Image = new Gtk.Image(pixbuf);
@@ -685,7 +689,6 @@ public partial class ChronoJumpWindow
 //			cpRunning = false;
 		} else {
 //			simulated = false;
-			//menuitem_chronopic.Active = true;
 			
 //			cpRunning = true;
 		}
@@ -2946,7 +2949,6 @@ Console.WriteLine("X");
 	//suitable for all jumps not repetitive
 	private void on_normal_jump_activate (object o, EventArgs args) 
 	{
-Log.WriteLine("1 " + currentJumpType.Name);
 		double jumpWeight = 0;
 		if(currentJumpType.HasWeight) {
 			if(extra_window_jumps_option == "%") 
@@ -2962,7 +2964,6 @@ Log.WriteLine("1 " + currentJumpType.Name);
 		}
 		
 			
-Log.WriteLine("2 " + currentJumpType.Name);
 		//used by cancel and finish
 		//currentEventType = new JumpType();
 		currentEventType = currentJumpType;
@@ -2974,7 +2975,6 @@ Log.WriteLine("2 " + currentJumpType.Name);
 		//update, don't do this now, because it's buggy with currentJump on More
 		//notebooks_change(0);
 		
-Log.WriteLine("3 " + currentJumpType.Name);
 		//show the event doing window
 		double myLimit = 3; //3 phases for show the Dj
 		if( currentJumpType.StartIn || 
@@ -2986,7 +2986,6 @@ Log.WriteLine("3 " + currentJumpType.Name);
 		if(createdStatsWin)
 			statsWin.HideUpdateStatsButton();
 
-Log.WriteLine("4 " + currentJumpType.Name);
 		eventExecuteWin = EventExecuteWindow.Show(
 			Catalog.GetString("Execute Jump"), //windowTitle
 			Catalog.GetString("Phases"),  	  //name of the different moments
@@ -2996,22 +2995,18 @@ Log.WriteLine("4 " + currentJumpType.Name);
 			currentJumpType.Name, 
 			prefsDigitsNumber, myLimit, chronopicWin.Connected);
 
-Log.WriteLine("5 " + currentJumpType.Name);
 		eventExecuteWin.ButtonCancel.Clicked += new EventHandler(on_cancel_clicked);
 		eventExecuteWin.ButtonFinish.Clicked += new EventHandler(on_finish_clicked);
 
-Log.WriteLine("6 " + currentJumpType.Name);
 		//when user clicks on update the eventExecute window 
 		//(for showing with his new confgured values: max, min and guides
 		eventExecuteWin.ButtonUpdate.Clicked -= new EventHandler(on_update_clicked); //if we don't do this, on_update_clicked it's called 'n' times when 'n' events are don
 		eventExecuteWin.ButtonUpdate.Clicked += new EventHandler(on_update_clicked);
 
-Log.WriteLine("7 " + currentJumpType.Name);
 		currentEventExecute = new JumpExecute(eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, 
 				currentSession.UniqueID, currentJumpType.Name, myFall, jumpWeight,
 				chronopicWin.CP, appbar2, app1, prefsDigitsNumber, volumeOn);
 
-Log.WriteLine("8 " + currentJumpType.Name);
 		if (!chronopicWin.Connected) 
 			currentEventExecute.SimulateInitValues(rand);
 		
@@ -3020,7 +3015,6 @@ Log.WriteLine("8 " + currentJumpType.Name);
 		 else 
 			currentEventExecute.ManageFall();
 
-Log.WriteLine("9 " + currentJumpType.Name);
 		currentEventExecute.FakeButtonFinished.Clicked += new EventHandler(on_jump_finished);
 	}	
 
@@ -3030,7 +3024,6 @@ Log.WriteLine("9 " + currentJumpType.Name);
 		currentEventExecute.FakeButtonFinished.Clicked -= new EventHandler(on_jump_finished);
 		
 		if ( ! currentEventExecute.Cancel ) {
-Log.WriteLine("10 " + currentJumpType.Name);
 			currentJump = (Jump) currentEventExecute.EventDone;
 
 			//move video file if exists
@@ -3910,15 +3903,15 @@ Log.WriteLine("10 " + currentJumpType.Name);
 	 *  --------------------------------------------------------
 	 */
 
-	private void on_menuitem_chronopic_activate (object o, EventArgs args) {
+	private void on_chronopic_clicked (object o, EventArgs args) {
 		chronopicWin = ChronopicWindow.View(volumeOn);
 		chronopicWin.FakeWindowDone.Clicked += new EventHandler(on_chronopic_window_done);
 	}
 	
 	private void on_chronopic_window_done (object o, EventArgs args) {
 		chronopicWin.FakeWindowDone.Clicked -= new EventHandler(on_chronopic_window_done);
-
-		if(chronopicWin.NumConnected()>=2) {
+		int cps = chronopicWin.NumConnected();
+		if(cps >= 2) {	
 			menuitem_multi_chronopic_start.Sensitive = true;
 			menuitem_run_analysis.Sensitive = true;
 			button_multi_chronopic_start.Sensitive = true;
@@ -3931,8 +3924,28 @@ Log.WriteLine("10 " + currentJumpType.Name);
 			entry_run_analysis_distance.Sensitive = false;
 			button_run_analysis.Sensitive = false;
 		}
+		
+		chronopicLabels(cps);
+	}
+	
+	private void chronopicLabels(int cps) {
+		label_connected_chronopics.Text = "<b>" + cps.ToString() + "</b>";
+		label_connected_chronopics.UseMarkup = true; 
+		
+		string myMessage = "";
+		if(cps == 0) 
+			myMessage = Constants.SimulatedMessage;
+		else if(cps == 1) 
+			myMessage = Constants.ChronopicOne;
+		else 
+			myMessage = Constants.ChronopicMore;
+			
+		TextBuffer tb = new TextBuffer (new TextTagTable());
+		tb.Text = myMessage;
+		textview_message_connected_chronopics.Buffer = tb;
 	}
 
+
 	private void on_entry_run_analysis_distance_changed (object o, EventArgs args) {
 		if(Util.IsNumber(entry_run_analysis_distance.Text, false) && entry_run_analysis_distance.Text != "0" &&
 				chronopicWin.NumConnected()>=2) {
@@ -5076,6 +5089,9 @@ Console.WriteLine("X");
 		notebook_results.Sensitive = false;
 		notebook_options.Sensitive = false;
 		
+		table_execute_test.Sensitive = false;
+		button_execute_test.Sensitive = false;
+		
 		//button_last.Sensitive = false;
 		button_run_last.Sensitive=false;
 		button_run_interval_last.Sensitive=false;
@@ -5092,11 +5108,17 @@ Console.WriteLine("X");
 		menuSessionSensitive(true);
 		menuToolsSensitive(true);
 		
+		table_execute_test.Sensitive = true;
+		
 		//changeTestImage("", "", "LOGO");
 	}
 
 	//only called by delete person functions (if we run out of persons)
 	private void sensitiveGuiNoPerson () {
+		hbox_jumps.Sensitive = false;
+		hbox_jumps_rj.Sensitive = false;
+		button_execute_test.Sensitive = false;
+
 		notebook_execute.Sensitive = false;
 		notebook_results.Sensitive = false;
 		notebook_options.Sensitive = false;
@@ -5109,6 +5131,10 @@ Console.WriteLine("X");
 	}
 	
 	private void sensitiveGuiYesPerson () {
+		hbox_jumps.Sensitive = true;
+		hbox_jumps_rj.Sensitive = true;
+		button_execute_test.Sensitive = true;
+
 		notebook_execute.Sensitive = true;
 		notebook_results.Sensitive = true;
 		notebook_options.Sensitive = true;
@@ -5133,6 +5159,7 @@ Console.WriteLine("X");
 	}
 	
 	private void sensitiveGuiEventDoing () {
+		button_execute_test.Sensitive = false;
 		//hbox
 		hbox_jumps.Sensitive = false;
 		hbox_jumps_rj.Sensitive = false;
@@ -5148,6 +5175,7 @@ Console.WriteLine("X");
 	}
    
 	private void sensitiveGuiEventDone () {
+		button_execute_test.Sensitive = true;
 		//hbox
 		hbox_jumps.Sensitive = true;
 		hbox_jumps_rj.Sensitive = true;
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
index 251d019..651a040 100644
--- a/src/gui/chronopic.cs
+++ b/src/gui/chronopic.cs
@@ -670,6 +670,7 @@ public class ChronopicWindow
 		foreach(ChronopicPortData a in cpd)
 			Log.WriteLine(a.Num + ", " + a.Port + ", " + a.Connected);
 
+		fakeWindowDone.Click();
 		needUpdateChronopicWin = true;
 	}
 



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