[chronojump] ForceSensor export saves all pngs on a temps folder
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] ForceSensor export saves all pngs on a temps folder
- Date: Wed, 10 Feb 2021 12:56:10 +0000 (UTC)
commit 7938ba4329778b23639b35e851179d1152c0b7d1
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Feb 10 13:55:50 2021 +0100
ForceSensor export saves all pngs on a temps folder
r-scripts/maximumIsometricForce.R | 15 ++++++++++-----
src/forceSensor.cs | 21 +++++++++++++--------
src/util.cs | 3 +++
3 files changed, 26 insertions(+), 13 deletions(-)
---
diff --git a/r-scripts/maximumIsometricForce.R b/r-scripts/maximumIsometricForce.R
index 5c0faaab..65fcfbb2 100644
--- a/r-scripts/maximumIsometricForce.R
+++ b/r-scripts/maximumIsometricForce.R
@@ -66,7 +66,6 @@ args <- commandArgs(TRUE)
tempPath <- args[1]
optionsFile <- paste(tempPath, "/Roptions.txt", sep="")
-pngFile <- paste(tempPath, "/cj_mif_Graph.png", sep="")
#-------------- scan options file -------------
options <- scan(optionsFile, comment.char="#", what=character(), sep="\n")
@@ -1075,7 +1074,7 @@ readImpulseOptions <- function(optionsStr)
}
}
-doProcess <- function(dataFile, decimalChar, title, exercise, datetime, captureOptions, startSample,
endSample)
+doProcess <- function(pngFile, dataFile, decimalChar, title, exercise, datetime, captureOptions,
startSample, endSample)
{
title = fixTitleAndOtherStrings(title)
exercise = fixTitleAndOtherStrings(exercise)
@@ -1098,7 +1097,8 @@ doProcess <- function(dataFile, decimalChar, title, exercise, datetime, captureO
if(op$singleOrMultiple == "TRUE")
{
dataFile <- paste(tempPath, "/cj_mif_Data.csv", sep="")
- doProcess(dataFile, op$decimalChar, op$title, op$exercise, op$datetime, op$captureOptions,
op$startSample, op$endSample)
+ pngFile <- paste(tempPath, "/cj_mif_Graph.png", sep="")
+ doProcess(pngFile, dataFile, op$decimalChar, op$title, op$exercise, op$datetime, op$captureOptions,
op$startSample, op$endSample)
} else
{
#1) read the csv
@@ -1106,14 +1106,19 @@ if(op$singleOrMultiple == "TRUE")
#2) call doProcess
progressFolder = paste(tempPath, "/chronojump_mif_progress", sep ="")
+ tempGraphsFolder = paste(tempPath, "/chronojump_mif_graphs/", sep ="")
- for(i in 1:length(dataFiles[,1])) {
+ countGraph = 1
+ for(i in 1:length(dataFiles[,1]))
+ {
print("fullURL")
print(as.vector(dataFiles$fullURL[i]))
+ pngFile <- paste(tempGraphsFolder, countGraph, ".png", sep="")
executing <- tryCatch({
- doProcess(as.vector(dataFiles$fullURL[i]), dataFiles$decimalChar[i],
dataFiles$title[i], dataFiles$exercise[i], dataFiles$datetime[i],
+ doProcess(pngFile, as.vector(dataFiles$fullURL[i]), dataFiles$decimalChar[i],
dataFiles$title[i], dataFiles$exercise[i], dataFiles$datetime[i],
dataFiles$captureOptions[i], dataFiles$startSample[i],
dataFiles$endSample[i])
+ countGraph = countGraph +1 #only adds if not error, so the numbering of
graphs matches rows in CSV
}, error = function(e) {
print("error on doProcess:")
print(message(e))
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index f70d56a0..60dd2158 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -2285,8 +2285,8 @@ public class ForceSensorExport
ArrayList personSession_l;
ArrayList fsEx_l;
List<string> exportedRFDs;
- private int imageWidth = 300; //nothing is displayed, remove when R script has been adapted
- private int imageHeight = 300; //nothing is displayed, remove when R script has been adapted
+ private int imageWidth = 900; //nothing is displayed, remove when R script has been adapted
+ private int imageHeight = 600; //nothing is displayed, remove when R script has been adapted
//constructor
public ForceSensorExport (
@@ -2329,8 +2329,17 @@ public class ForceSensorExport
progressbar.Fraction = 0;
notebook.CurrentPage = 1;
- //create progressbar files dir or delete its contents
- string dir = Util.GetForceSensorTempProgressDir();
+ //create progressbar and graph files dirs or delete their contents
+ createOrEmptyDir(Util.GetForceSensorTempProgressDir());
+ createOrEmptyDir(Util.GetForceSensorTempGraphsDir());
+
+ thread = new Thread (new ThreadStart (forceSensorExportDo));
+ GLib.Idle.Add (new GLib.IdleHandler (pulseForceSensorExportGTK));
+ thread.Start();
+ }
+
+ private void createOrEmptyDir(string dir)
+ {
if( ! Directory.Exists(dir))
Directory.CreateDirectory (dir);
else {
@@ -2338,10 +2347,6 @@ public class ForceSensorExport
foreach (FileInfo file in dirInfo.GetFiles())
file.Delete();
}
-
- thread = new Thread (new ThreadStart (forceSensorExportDo));
- GLib.Idle.Add (new GLib.IdleHandler (pulseForceSensorExportGTK));
- thread.Start();
}
public void Cancel()
diff --git a/src/util.cs b/src/util.cs
index ea03095d..4cc16c57 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1070,6 +1070,9 @@ public class Util
public static string GetForceSensorTempProgressDir() {
return Path.Combine(Path.GetTempPath(), "chronojump_mif_progress");
}
+ public static string GetForceSensorTempGraphsDir() {
+ return Path.Combine(Path.GetTempPath(), "chronojump_mif_graphs");
+ }
/*
* <--------------- end of force sensor suff
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]