[chronojump] Better encoder call



commit 63dcd88d743578d6ac41afabf1cffc556799ba69
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jan 29 14:58:58 2013 +0100

    Better encoder call

 src/constants.cs   |    4 +++-
 src/gui/encoder.cs |    2 +-
 src/util.cs        |   31 ++++++++++---------------------
 3 files changed, 14 insertions(+), 23 deletions(-)
---
diff --git a/src/constants.cs b/src/constants.cs
index 1ac8790..6febf11 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -576,8 +576,10 @@ public class Constants
 	 * chronojump / encoder / sessionID / graphs
 	 */
 	
-	public static string EncoderScriptCapture = 
+	public static string EncoderScriptCaptureLinux = 
 		"/home/xavier/informatica/progs_meus/chronojump/chronojump/encoder/pyserial_pyper.py";
+	public static string EncoderScriptCaptureWindows = 
+		"TODO_PATH_pyserial_pyper_windows.exe";
 	public static string EncoderScriptGraph = 
 		"/home/xavier/informatica/progs_meus/chronojump/chronojump/encoder/graph.R";
 	//no longer used:
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index bc1d4ca..1c8de4f 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -237,7 +237,7 @@ public partial class ChronoJumpWindow
 				Util.GetEncoderDataTempFileName(), "", ep);				
 
 		//title to sen to python software has to be without spaces
-		Util.RunEncoderCapture(Constants.EncoderScriptCapture, 
+		Util.RunEncoderCapture( 
 				Util.ChangeSpaceForUnderscore(currentPerson.Name) + "----" + 
 				Util.ChangeSpaceForUnderscore(exerciseNameShown) + "----(" + findMass(true) + "Kg)",
 				es, chronopicWin.GetEncoderPort());
diff --git a/src/util.cs b/src/util.cs
index f3842e5..1b9768e 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1046,7 +1046,7 @@ public class Util
 		}
 	}
 
-	public static void RunEncoderCapture(string script, string title, EncoderStruct es, string port) {
+	public static void RunEncoderCapture(string title, EncoderStruct es, string port) {
 		CancelRScript = false;
 
 		ProcessStartInfo pinfo;
@@ -1059,27 +1059,16 @@ public class Util
 		pinfo = new ProcessStartInfo();
 
 		string outputFileCheck = "";
-			
-		pBin="python";
-
-		//currently we are not using useTerminal. It was originally to encoder capture with text and graph
-		/*
-		   bool useTerminal = false;
-		   if(useTerminal)
-		   pBin="xterm";
-		   */
-
-		if (IsWindows())
-			pBin=System.IO.Path.Combine(GetPrefixDir(), "bin/python.exe");
+		
 
-		/*
-		   if(useTerminal) {
-		//currentl we are not using this
-		pinfo.Arguments = "-bg white -fg black -hold -geometry 72x34+100+40 -fn *-fixed-*-*-*-20-* -e \"python " + 
-		script + " " + es.OutputData1 + " " + es.Ep.ToString1() + "\"";
-		} else 
-		*/
-		pinfo.Arguments = script + " " + title + " " + es.OutputData1 + " " + es.Ep.ToString1() + " " + port;
+		if (IsWindows()) {
+			pBin=Constants.EncoderScriptCaptureWindows;
+			pinfo.Arguments = title + " " + es.OutputData1 + " " + es.Ep.ToString1() + " " + port;
+		}
+		else {
+			pBin="python";
+			pinfo.Arguments = Constants.EncoderScriptCaptureLinux + " " + title + " " + es.OutputData1 + " " + es.Ep.ToString1() + " " + port;
+		}
 
 		outputFileCheck = es.OutputData1;
 



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