[chronojump] added graphs for multiChronopic and runAnalysis



commit db62a01e1b5e12c64a17768d18c3d20e1b1d2d2f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Apr 30 18:21:10 2009 +0200

    added graphs for multiChronopic and runAnalysis
    multiChronopic sync is done or not depending on multiChronopic type
    multiChronopic type is recorded
    improvements on threading on multiChronopic, now finishing will not record event 4 times
    
    improvements on (really few sometimes) crash when splash win is created too late (findversion error)
---
 Makefile                       |    2 +
 TODO.txt                       |    7 ++---
 build/data/chronojump.prg      |  Bin 2928128 -> 2951168 bytes
 build/data/chronojump_mini.prg |  Bin 39936 -> 39936 bytes
 changelog.txt                  |    8 +++++++
 glade/chronojump.glade         |    1 +
 images/mini/multiChronopic.png |  Bin 0 -> 2954 bytes
 images/mini/run_analysis.png   |  Bin 0 -> 3126 bytes
 images/multiChronopic.png      |  Bin 0 -> 5528 bytes
 images/run_analysis.png        |  Bin 0 -> 10378 bytes
 src/chronojump.cs              |    9 ++++++++
 src/execute/multiChronopic.cs  |   15 ++++++++++++-
 src/gui/chronojump.cs          |   45 ++++++++++++++++++++++++++-------------
 src/gui/run.cs                 |    2 -
 src/multiChronopic.cs          |   16 --------------
 src/multiChronopicType.cs      |   29 +++++++++++++++++++++++++
 src/treeViewMultiChronopic.cs  |    2 +-
 17 files changed, 97 insertions(+), 39 deletions(-)

diff --git a/Makefile b/Makefile
index 26151f8..2b1e267 100644
--- a/Makefile
+++ b/Makefile
@@ -71,6 +71,8 @@ RESOURCES_IMAGES = -resource:images/mini/no_image.png,mini/no_image.png \
 		-resource:images/run_interval.png,run_interval.png 		-resource:images/mini/run_interval.png,mini/run_interval.png \
 		-resource:images/margaria.png,margaria.png			-resource:images/mini/margaria.png,mini/margaria.png \
 		-resource:images/gesell_dbt.png,gesell_dbt.png			-resource:images/mini/gesell_dbt.png,mini/gesell_dbt.png \
+		-resource:images/multiChronopic.png,multiChronopic.png		-resource:images/mini/multiChronopic.png,mini/multiChronopic.png \
+		-resource:images/run_analysis.png,run_analysis.png		-resource:images/mini/run_analysis.png,mini/run_analysis.png \
 		-resource:images/pulse_free.png,pulse_free.png 			-resource:images/mini/pulse_free.png,mini/pulse_free.png \
 		-resource:images/pulse_custom.png,pulse_custom.png		-resource:images/mini/pulse_custom.png,mini/pulse_custom.png \
 		-resource:images/mtgug.png,mtgug.png				-resource:images/mini/mtgug.png,mini/mtgug.png \
diff --git a/TODO.txt b/TODO.txt
index b4ebd16..0421104 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,10 +1,12 @@
 TODO: 
 
 fix two bugs (really difficult to reproduce):
-1.- the chronojump.cs findVersion (just do more tests check that the error is fixed easily)
+1.- the chronojump.cs findVersion (just do more tests check that the error is fixed easily) 
+work done (30 apr (2)), just do more tests
 2.- the sqlite problem with the thread at start... need to explore more
 
 multiChronopic:
+(when press two for full finishing, say that then it will be recorded)
 -repair
 -tempTable
 -export
@@ -18,11 +20,8 @@ better with only two chronopics, if evaluator push cp1, light1 gets on and perso
 we can also have three or four to have more discriminative
 
 
-Add Cabedo's tests (not prioritary)
-
 server: study possible locks, see sqlite book
 
-add a link to the server page. Develop web stats and survey on web site. Maybe
 done by R script and calling to database
 http://cran.r-project.org/web/packages/RSQLite/index.html
 http://cran.r-project.org/web/packages/RSQLite/INSTALL
diff --git a/build/data/chronojump.prg b/build/data/chronojump.prg
index 18a8860..81b845b 100755
Binary files a/build/data/chronojump.prg and b/build/data/chronojump.prg differ
diff --git a/build/data/chronojump_mini.prg b/build/data/chronojump_mini.prg
index ff08a3a..5a9e74b 100755
Binary files a/build/data/chronojump_mini.prg and b/build/data/chronojump_mini.prg differ
diff --git a/changelog.txt b/changelog.txt
index a852ee1..707a85e 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,13 @@
 CHANGELOG.txt
 
+30 apr 2009 (2)
+	added graphs for multiChronopic and runAnalysis
+	multiChronopic sync is done or not depending on multiChronopic type
+	multiChronopic type is recorded
+	improvements on threading on multiChronopic, now finishing will not record event 4 times
+
+	improvements on (really few sometimes) crash when splash win is created too late (findversion error)
+
 30 apr 2009
 	new test Gesell-DBT test new db: 0.69
 	new runType allows to put decimals at distance (fixes bug)
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index e778b25..f0173a9 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -13522,6 +13522,7 @@ suitable for agility tests)</property>
 					      <property name="relief">GTK_RELIEF_NORMAL</property>
 					      <property name="focus_on_click">True</property>
 					      <signal name="clicked" handler="on_multi_chronopic_start_clicked" last_modification_time="Mon, 27 Apr 2009 16:34:57 GMT"/>
+					      <signal name="enter" handler="on_button_enter" last_modification_time="Thu, 30 Apr 2009 15:25:20 GMT"/>
 					    </widget>
 					    <packing>
 					      <property name="left_attach">0</property>
diff --git a/images/mini/multiChronopic.png b/images/mini/multiChronopic.png
new file mode 100644
index 0000000..8839520
Binary files /dev/null and b/images/mini/multiChronopic.png differ
diff --git a/images/mini/run_analysis.png b/images/mini/run_analysis.png
new file mode 100755
index 0000000..da443f6
Binary files /dev/null and b/images/mini/run_analysis.png differ
diff --git a/images/multiChronopic.png b/images/multiChronopic.png
new file mode 100644
index 0000000..1793b3c
Binary files /dev/null and b/images/multiChronopic.png differ
diff --git a/images/run_analysis.png b/images/run_analysis.png
new file mode 100755
index 0000000..3125d9b
Binary files /dev/null and b/images/run_analysis.png differ
diff --git a/src/chronojump.cs b/src/chronojump.cs
index d777c19..a5fcf21 100644
--- a/src/chronojump.cs
+++ b/src/chronojump.cs
@@ -86,6 +86,8 @@ public class ChronoJump
 		new ChronoJump(args);
 	}
 
+	bool createdSplashWin = false;
+
 	public ChronoJump (string [] args) 
 	{
 		
@@ -93,6 +95,7 @@ public class ChronoJump
 			
 		//start threading to show splash window
 		SplashWindow splashWin = SplashWindow.Show();
+		createdSplashWin = true;
 		
 		fakeSplashButton = new Gtk.Button();
 		fakeSplashButton.Clicked += new EventHandler(on_splash_ended);
@@ -308,6 +311,12 @@ Console.WriteLine("--1--");
 		splashShowButton = true;
 		
 Console.WriteLine("--2--");
+		//maybe other thread doesn't create at time the splash win
+		//then just wait
+		while(! createdSplashWin)
+			;
+Console.WriteLine("--2.1--");
+
 		if(splashWin.FakeButtonCreated)
 			Console.WriteLine("\n\nCREATED\n\n");
 		else
diff --git a/src/execute/multiChronopic.cs b/src/execute/multiChronopic.cs
index bde7e76..d9b9124 100644
--- a/src/execute/multiChronopic.cs
+++ b/src/execute/multiChronopic.cs
@@ -253,6 +253,7 @@ public class MultiChronopicExecute : EventExecute
 		}
 
 		firstValue = true;
+		writingStarted = false;
 			
 
 		//start thread
@@ -434,9 +435,21 @@ public class MultiChronopicExecute : EventExecute
 				*/
 	}
 
+	/*
+	maybe we come here four times, one for any chronopic,
+	best is to put one bool in order to only let on get inside
+	*/
+	bool writingStarted;
+
 	public override void MultiChronopicWrite(bool tempTable)
 	{
-		Log.WriteLine("----------WRITING----------");
+		Log.WriteLine("----------WRITING A----------");
+		if(writingStarted)
+			return;
+		else
+			writingStarted = true; //only one execution can "get in"
+		Log.WriteLine("----------WRITING B----------");
+
 		Console.WriteLine("cp1 In:" + cp1InStr);
 		Console.WriteLine("cp1 Out:" + cp1OutStr + "\n");
 		Console.WriteLine("cp2 In:" + cp2InStr);
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 9590a87..5d00fa0 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -315,6 +315,7 @@ public class ChronoJumpWindow
 	private static JumpType currentJumpType;
 	private static RunType currentRunType;
 	private static PulseType currentPulseType;
+	private static MultiChronopicType currentMultiChronopicType;
 	private static Report report;
 
 	//windows needed
@@ -2711,8 +2712,9 @@ public class ChronoJumpWindow
 		//unhide event buttons for next event
 		sensitiveGuiEventDone();
 
-		if(!simulated)
+		if(!simulated) {
 			checkFinishMultiTotally(o, args);
+		}
 		
 		//let update stats
 		if(createdStatsWin)
@@ -2733,7 +2735,7 @@ public class ChronoJumpWindow
 			errorWin.Button_accept.Clicked += new EventHandler(checkFinishTotally);
 		}
 	}
-		
+	
 	private void checkFinishMultiTotally (object o, EventArgs args) 
 	{
 		bool needFinish1 = false;
@@ -2875,7 +2877,6 @@ Console.WriteLine("X");
 			currentEventType = new RunType("byTime");
 		} else 	if(o == (object) button_run_interval_unlimited) {
 			currentEventType = new RunType("unlimited");
-//TODO: RunAnalysis
 		} else 	if(o == (object) button_run_interval_mtgug) {
 			currentEventType = new RunType("MTGUG");
 		//reactionTime
@@ -2886,9 +2887,9 @@ Console.WriteLine("X");
 			currentEventType = new PulseType("Custom");
 		//multiChronopic
 		} else 	if(o == (object) button_multi_chronopic_start) {
-			return;
+			currentEventType = new MultiChronopicType("multiChronopic");
 		} else 	if(o == (object) button_run_analysis) {
-			return;
+			currentEventType = new MultiChronopicType("runAnalysis");
 		}
 
 		changeTestImage(currentEventType.Type.ToString(), currentEventType.Name, currentEventType.ImageFileName);
@@ -2938,6 +2939,8 @@ Console.WriteLine("X");
 				myType = new JumpType(eventName);
 			else if (eventTypeString == EventType.Types.RUN.ToString()) 
 				myType = new RunType(eventName);
+			else if (eventTypeString == EventType.Types.MULTICHRONOPIC.ToString()) 
+				myType = new MultiChronopicType(eventName);
 			else Log.WriteLine("Error on eventTypeHasLongDescription");
 
 			if(myType.HasLongDescription)
@@ -4040,6 +4043,11 @@ Console.WriteLine("X");
 
 	private void on_multi_chronopic_start_clicked (object o, EventArgs args) {
 		Log.WriteLine("multi chronopic accepted");
+		
+		if(o == (object) button_multi_chronopic_start) 
+			currentMultiChronopicType = new MultiChronopicType("multiChronopic");
+		else if(o == (object) button_run_analysis)
+			currentMultiChronopicType = new MultiChronopicType("runAnalysis");
 
 		//used by cancel and finish
 		currentEventType = new MultiChronopicType();
@@ -4061,8 +4069,7 @@ Console.WriteLine("X");
 			currentPerson.UniqueID, currentPerson.Name, 
 			currentSession.UniqueID, 
 			Constants.MultiChronopicTable, //tableName
-			//currentPulseType.Name, 
-			"", 
+			currentMultiChronopicType.Name, //"" 
 			prefsDigitsNumber, -1, simulated
 			); //-1: unlimited pulses (or changes)
 
@@ -4081,22 +4088,30 @@ Console.WriteLine("X");
 				cp, appbar2, app1, prefsDigitsNumber, volumeOn);
 				*/
 
+		bool syncNeeded = false;
+		if(currentMultiChronopicType.SyncNeeded && check_multi_sync.Active)
+			syncNeeded = true;
+
 		if(image_cp2_no.Visible)
 			currentEventExecute = new MultiChronopicExecute(
-					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, currentSession.UniqueID, "", 
-					cp, check_multi_sync.Active, appbar2, app1);
+					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, 
+					currentSession.UniqueID, currentMultiChronopicType.Name, 
+					cp, syncNeeded, appbar2, app1);
 		else if(image_cp2_yes.Visible && image_cp3_no.Visible)
 			currentEventExecute = new MultiChronopicExecute(
-					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, currentSession.UniqueID, "",  
-					cp, cp2, check_multi_sync.Active, appbar2, app1);
+					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, 
+					currentSession.UniqueID, currentMultiChronopicType.Name,  
+					cp, cp2, syncNeeded, appbar2, app1);
 		else if(image_cp3_yes.Visible && image_cp4_no.Visible)
 			currentEventExecute = new MultiChronopicExecute(
-					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, currentSession.UniqueID, "",
-					cp, cp2, cp3, check_multi_sync.Active, appbar2, app1);
+					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, 
+					currentSession.UniqueID, currentMultiChronopicType.Name,
+					cp, cp2, cp3, syncNeeded, appbar2, app1);
 		else if(image_cp4_yes.Visible)
 			currentEventExecute = new MultiChronopicExecute(
-					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, currentSession.UniqueID, "",
-					cp, cp2, cp3, cp4, check_multi_sync.Active, appbar2, app1);
+					eventExecuteWin, currentPerson.UniqueID, currentPerson.Name, 
+					currentSession.UniqueID, currentMultiChronopicType.Name,
+					cp, cp2, cp3, cp4, syncNeeded, appbar2, app1);
 
 		//if(simulated)	
 		//	currentEventExecute.SimulateInitValues(rand);
diff --git a/src/gui/run.cs b/src/gui/run.cs
index 9b8dfe1..5c1e4ad 100644
--- a/src/gui/run.cs
+++ b/src/gui/run.cs
@@ -149,8 +149,6 @@ public class EditRunWindow : EditEventWindow
 	
 	protected override void on_spin_mistakes_changed (object o, EventArgs args) {
 		if(Util.IsNumber(spin_mistakes.Value.ToString(), true) && entry_time_value.Text.ToString().Length > 0) {
-			Console.WriteLine("A");
-			Console.WriteLine(entry_time_value.Text.ToString());
 			double timeWithoutMistakes = Convert.ToDouble(entry_time_value.Text.ToString()) - 2 * mistakes;
 			entry_time_value.Text = (timeWithoutMistakes + 2 * spin_mistakes.Value).ToString();
 			entryTime = entry_time_value.Text.ToString();
diff --git a/src/multiChronopic.cs b/src/multiChronopic.cs
index 57220d7..5a75f79 100644
--- a/src/multiChronopic.cs
+++ b/src/multiChronopic.cs
@@ -112,34 +112,26 @@ public class MultiChronopic : Event
 
 	public ArrayList AsArrayList(int pDN) 
 	{
-//Console.WriteLine("A");
 		if(arrayDone)
 			return array;
 		
-//Console.WriteLine("B");
 		ArrayList returnArray = new ArrayList(1);
 		string [] returnLine = new String[20];
 
-//Console.WriteLine("B1");
 		string [] cp1InFull = this.Cp1InStr.Split(new char[] {'='});
-//Console.WriteLine("B2");
 		string [] cp1OutFull = this.Cp1OutStr.Split(new char[] {'='});
 		string [] cp2InFull = this.Cp2InStr.Split(new char[] {'='});
 		string [] cp2OutFull = this.Cp2OutStr.Split(new char[] {'='});
-//Console.WriteLine("B3");
 		string [] cp3InFull = this.Cp3InStr.Split(new char[] {'='});
-//Console.WriteLine("B4");
 		string [] cp3OutFull = this.Cp3OutStr.Split(new char[] {'='});
 		string [] cp4InFull = this.Cp4InStr.Split(new char[] {'='});
 		string [] cp4OutFull = this.Cp4OutStr.Split(new char[] {'='});
 
-//Console.WriteLine("B5");
 		bool ended = false;
 		bool cp1NextIn = Util.IntToBool(this.Cp1StartedIn);
 		bool cp2NextIn = Util.IntToBool(this.Cp2StartedIn);
 		bool cp3NextIn = Util.IntToBool(this.Cp3StartedIn);
 		bool cp4NextIn = Util.IntToBool(this.Cp4StartedIn);
-//Console.WriteLine("B6");
 		double cp1NextTime;
 		double cp2NextTime;
 		double cp3NextTime;
@@ -158,7 +150,6 @@ public class MultiChronopic : Event
 		double cp2Sum = 0;
 		double cp3Sum = 0;
 		double cp4Sum = 0;
-//Console.WriteLine("B7");
 						
 		double rt1InRecorded = 0;
 		double rt1OutRecorded = 0;
@@ -173,7 +164,6 @@ public class MultiChronopic : Event
 		double oobefore = -1;
 
 		int lineCount = 0;
-//Console.WriteLine("C");
 		
 		while(! ended) {
 			int nextCp = -1;
@@ -212,7 +202,6 @@ public class MultiChronopic : Event
 				cp4NextTime = 99999;
 
 
-//Console.WriteLine("D");
 			if(cp1NextTime == 99999 && cp2NextTime == 99999 && cp3NextTime == 99999 && cp4NextTime == 99999)
 				ended = true;
 			else {
@@ -241,7 +230,6 @@ public class MultiChronopic : Event
 							nextCp = 4;
 					}
 				}
-//Console.WriteLine("E");
 
 				int pos=0;
 				double thisTime = 0;
@@ -348,14 +336,10 @@ public class MultiChronopic : Event
 				returnLine[count++] = ""; //description column (unused because this array if for eg. treeview subLines)
 				returnLine[count++] = "-1"; //mark to non select here, select first line 
 				returnArray.Add(Util.StringArrayToString(returnLine, ":"));
-//Console.WriteLine("F");
 			}
-//Console.WriteLine("G");
 		}
-//Console.WriteLine("H");
 		array = returnArray;
 		arrayDone = true;
-//Console.WriteLine("I");
 		return array;
 	}
 	
diff --git a/src/multiChronopicType.cs b/src/multiChronopicType.cs
index bdaacd5..96040ee 100644
--- a/src/multiChronopicType.cs
+++ b/src/multiChronopicType.cs
@@ -23,9 +23,38 @@ using System.Data;
 
 public class MultiChronopicType : EventType 
 {
+	/*
+	   if false, a type doesn't need sync
+	   if true, it can be synced or not depending on checkbox active by user
+	   */
+	bool syncNeeded;
+
 	public MultiChronopicType() {
 		type = Types.MULTICHRONOPIC;
 	}
 	
+	//predefined values
+	public MultiChronopicType(string name) {
+		type = Types.MULTICHRONOPIC;
+		this.name = name;
+		
+		//if this changes, sqlite/pulseType.cs initialize table should change
+		if(name == "multiChronopic") {
+			syncNeeded = true;
+			imageFileName = "multiChronopic.png";
+			description = "";
+			longDescription = ""; 
+
+		} else if(name == "runAnalysis") {
+			syncNeeded = false;
+			imageFileName = "run_analysis.png";
+			description = "";
+			longDescription = ""; 
+		}
+	}
+
+	public bool SyncNeeded {
+		get { return syncNeeded; }
+	}
 }
 
diff --git a/src/treeViewMultiChronopic.cs b/src/treeViewMultiChronopic.cs
index 8ae9683..0966b18 100644
--- a/src/treeViewMultiChronopic.cs
+++ b/src/treeViewMultiChronopic.cs
@@ -112,7 +112,7 @@ public class TreeViewMultiChronopic : TreeViewEvent
 		string title;
 		//title = mc.Type; //currently ""
 
-		title = "CPs: " + getCpsString(mc);
+		title = mc.Type + " CPs: " + getCpsString(mc);
 		title += "; n: " + array.Count.ToString();
 		if(mc.Simulated == Constants.Simulated)
 			title += " (s) ";



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