[chronojump] Sprint export moves the csv to user selected location and images if needed
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Sprint export moves the csv to user selected location and images if needed
- Date: Thu, 25 Mar 2021 15:01:12 +0000 (UTC)
commit 5c33ce5381741219b43120f591c50a37a7e789fd
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Mar 25 16:00:49 2021 +0100
Sprint export moves the csv to user selected location and images if needed
r-scripts/sprintPhotocells.R | 14 +++++++++-----
src/constants.cs | 2 ++
src/gui/app1/encoder.cs | 46 ++++++++++++++++++++++++++++++++++++++++++++
src/gui/sprint.cs | 16 +++++++++++----
4 files changed, 69 insertions(+), 9 deletions(-)
---
diff --git a/r-scripts/sprintPhotocells.R b/r-scripts/sprintPhotocells.R
index 23230442..50ab9a86 100644
--- a/r-scripts/sprintPhotocells.R
+++ b/r-scripts/sprintPhotocells.R
@@ -302,13 +302,17 @@ start <- function(op)
#3) call testPhotocelssCJ
progressFolder = paste(tempPath, "/chronojump_export_progress", sep ="")
- #tempGraphsFolder = paste(tempPath, "/chronojump_race_analyzer_export_graphs/", sep ="")
+ tempGraphsFolder = paste(tempPath, "/chronojump_sprint_export_graphs/", sep ="")
exportDF = NULL
for(i in 1:length(dataFiles[,1]))
{
print("splitTimes at for: ")
print(as.numeric(unlist(strsplit(as.character(dataFiles$splitTimes[i]), "\\_"))))
+
+ pngFile <- paste(tempGraphsFolder, i, ".png", sep="") #but remember to graph also when model
fails
+
+ prepareGraph(op$os, pngFile, op$graphWidth, op$graphHeight)
exportRow = testPhotocellsCJ(
as.numeric(unlist(strsplit(as.character(dataFiles$positions[i]),
"\\_"))),
as.numeric(unlist(strsplit(as.character(dataFiles$splitTimes[i]), "\\_"))),
@@ -325,13 +329,13 @@ start <- function(op)
#(to control if we print them as , or .)
for(j in 1:length(exportRow))
exportRowDF = cbind (exportRowDF, exportRow[j])
-# if(op$includeImagesOnExport)
-# exportRowDF = cbind(exportRowDF, paste(i, ".png", sep=""))
+ if(op$includeImagesOnExport)
+ exportRowDF = cbind(exportRowDF, paste(i, ".png", sep=""))
#write the correct names of the row dataframe
namesDF = c("Person",names)
-# if(op$includeImagesOnExport)
-# namesDF = c(namesDF, "Image")
+ if(op$includeImagesOnExport)
+ namesDF = c(namesDF, "Image")
colnames(exportRowDF) = namesDF
exportDF <- rbind (exportDF, exportRowDF) #rbind with exportDF
diff --git a/src/constants.cs b/src/constants.cs
index 93cc26bf..e6de5e73 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -1109,6 +1109,8 @@ public class Constants
JUMPS_PROFILE_SAVE_IMAGE, JUMPS_DJ_OPTIMAL_FALL_SAVE_IMAGE,
JUMPS_WEIGHT_FV_PROFILE_SAVE_IMAGE, JUMPS_EVOLUTION_SAVE_IMAGE,
JUMPS_RJ_FATIGUE_SAVE_IMAGE,
RUNS_SPRINT_SAVE_IMAGE,
+ RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES,
RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES,
+ RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES,
RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES,
ENCODER_CAPTURE_EXPORT_ALL, ENCODER_CAPTURE_SAVE_IMAGE, ENCODER_ANALYZE_SAVE_IMAGE,
ENCODER_ANALYZE_SEND_IMAGE, //like save image but just defines the name exportFileName to be
sended
ENCODER_ANALYZE_SAVE_AB, ENCODER_ANALYZE_SAVE_TABLE,
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index f60b1575..35fec92e 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -2087,6 +2087,8 @@ public partial class ChronoJumpWindow
exportString = Catalog.GetString ("Save image");
else if(
checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.RUNENCODER_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
@@ -2101,6 +2103,7 @@ public partial class ChronoJumpWindow
string nameString = currentPerson.Name + "_" + currentSession.DateShortAsSQL;
if(
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.RUNENCODER_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES )
nameString = currentSession.DateShortAsSQL;
@@ -2168,6 +2171,10 @@ public partial class ChronoJumpWindow
nameString += "_encoder_repetition_export.csv";
else if(checkFileOp == Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB)
nameString += "_forcesensor_analyze_AB_export.csv";
+ else if(
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES)
+ nameString += "_races_sprint_export.csv";
else if(
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES)
@@ -2200,6 +2207,8 @@ public partial class ChronoJumpWindow
if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL ||
checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB ||
checkFileOp == Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.RUNENCODER_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
@@ -2273,6 +2282,11 @@ public partial class ChronoJumpWindow
else if(checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB)
confirmWin.Button_accept.Clicked +=
new
EventHandler(on_overwrite_file_forcesensor_save_AB_accepted);
+ else if(
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES )
+ confirmWin.Button_accept.Clicked +=
+ new
EventHandler(on_overwrite_file_sprint_export_accepted);
else if(
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES )
@@ -2321,6 +2335,10 @@ public partial class ChronoJumpWindow
on_button_forcesensor_save_image_rfd_manual_file_selected
(exportFileName);
else if(checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB)
on_button_force_sensor_save_AB_file_selected (exportFileName);
+ else if(
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES )
+ on_button_sprint_export_file_selected (exportFileName);
else if(
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES )
@@ -2336,6 +2354,8 @@ public partial class ChronoJumpWindow
//show message, but not in long processes managed by a thread
if(
+ checkFileOp !=
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES &&
+ checkFileOp !=
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES &&
checkFileOp !=
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES &&
checkFileOp !=
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES &&
checkFileOp !=
Constants.CheckFileOp.RUNENCODER_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES &&
@@ -2381,11 +2401,16 @@ public partial class ChronoJumpWindow
string nameString = currentPerson.Name + "_" + currentSession.DateShortAsSQL;
if(
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.RUNENCODER_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
nameString = currentSession.DateShortAsSQL;
if(
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
+ nameString += "_races_sprint_export";
+ else if(
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES)
nameString += "_forcesensor_export";
@@ -2429,6 +2454,14 @@ public partial class ChronoJumpWindow
exportFileName);
if(
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES )
+ {
+ confirmWin.Button_accept.Clicked +=
+ new
EventHandler(on_overwrite_file_sprint_export_accepted);
+ confirmWin.Button_cancel.Clicked +=
+ new
EventHandler(on_overwrite_file_sprint_export_cancelled);
+ } else if(
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES )
{
@@ -2448,6 +2481,10 @@ public partial class ChronoJumpWindow
}
else {
if(
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
+ checkFileOp ==
Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES )
+ on_button_sprint_export_file_selected (exportFileName);
+ else if(
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES ||
checkFileOp ==
Constants.CheckFileOp.FORCESENSOR_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES )
on_button_force_sensor_export_file_selected (exportFileName);
@@ -2522,6 +2559,15 @@ public partial class ChronoJumpWindow
new DialogMessage(Constants.MessageTypes.INFO, myString);
}
+ private void on_overwrite_file_sprint_export_accepted (object o, EventArgs args)
+ {
+ on_button_sprint_export_file_selected (exportFileName); //file or folder
+ }
+ private void on_overwrite_file_sprint_export_cancelled(object o, EventArgs args)
+ {
+ //TODO: sensitivity
+ }
+
private void on_overwrite_file_forcesensor_export_accepted(object o, EventArgs args)
{
on_button_force_sensor_export_file_selected (exportFileName); //file or folder
diff --git a/src/gui/sprint.cs b/src/gui/sprint.cs
index 3f0a44cb..2628ecd3 100644
--- a/src/gui/sprint.cs
+++ b/src/gui/sprint.cs
@@ -368,15 +368,23 @@ public partial class ChronoJumpWindow
sprintExport.Button_done.Clicked += new EventHandler(sprint_export_done);
bool selectedFile = false;
- //TODO: if(check_sprint_encoder_export_images.Active)
- //} else {
- //}
+ if(check_sprint_export_images.Active)
+ {
+ if(personID == -1)
+ selectedFile = checkFolder
(Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES);
+ else
+ selectedFile = checkFolder
(Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES);
+ } else {
+ if(personID == -1)
+ selectedFile = checkFile
(Constants.CheckFileOp.RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES);
+ else
+ selectedFile = checkFile
(Constants.CheckFileOp.RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES);
+ }
//restore the gui if cancelled
if(! selectedFile) {
//TODO: sensitive stuff (true)
}
-sprintExport.Start("/tmp/prova_sprintExport.csv");
}
private void on_button_sprint_export_file_selected (string selectedFileName)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]