[chronojump] SprintEncoder export with check for instantaneous and own column on csv: 1.csv
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] SprintEncoder export with check for instantaneous and own column on csv: 1.csv
- Date: Tue, 29 Jun 2021 11:06:38 +0000 (UTC)
commit a26f941d9dda78cb2b2ff4bd3d36ddf14da50fab
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Jun 29 13:05:30 2021 +0200
SprintEncoder export with check for instantaneous and own column on csv: 1.csv
glade/app1.glade | 51 +++++++++++++++++++++++++++------------
r-scripts/sprintEncoder.R | 7 +++++-
src/exportFiles/re.cs | 17 ++++++++-----
src/gui/app1/runEncoderAnalyze.cs | 6 +++--
src/runEncoder.cs | 9 +++++--
5 files changed, 64 insertions(+), 26 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 3775b0199..04e018aff 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -25725,6 +25725,9 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -29533,6 +29536,21 @@ Concentric</property>
</packing>
</child>
<child>
+ <widget class="GtkCheckButton"
id="check_run_encoder_export_instantaneous">
+ <property name="label"
translatable="yes">Include instantaneous data</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property
name="receives_default">False</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkAlignment" id="alignment71">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -29701,7 +29719,7 @@ Concentric</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child>
@@ -29714,7 +29732,7 @@ Concentric</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
<child>
@@ -29745,7 +29763,7 @@ Concentric</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
</widget>
@@ -31986,18 +32004,6 @@ Concentric</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Tests
will be filmed</property>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="pack_type">end</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
<widget class="GtkHBox"
id="hbox_video_encoder_capturing">
<property name="can_focus">False</property>
<property name="spacing">4</property>
@@ -32034,6 +32040,18 @@ Concentric</property>
</packing>
</child>
<child>
+ <widget class="GtkLabel"
id="label_video_encoder_tests_will_be_filmed">
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Tests
will be filmed</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox"
id="hbox_video_encoder_no_capturing">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -41122,6 +41140,9 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/r-scripts/sprintEncoder.R b/r-scripts/sprintEncoder.R
index 00dcc9ce2..a2ad889e4 100644
--- a/r-scripts/sprintEncoder.R
+++ b/r-scripts/sprintEncoder.R
@@ -60,7 +60,8 @@ assignOptions <- function(options) {
triggersOffList = as.numeric(unlist(strsplit(options[22], "\\;"))),
singleOrMultiple = options[23],
decimalCharAtExport = options[24],
- includeImagesOnExport = options[25]
+ includeImagesOnExport = options[25],
+ includeInstantaneousOnExport = options[26]
))
}
@@ -908,11 +909,15 @@ start <- function(op)
exportRowDF = cbind (exportRowDF, dataFiles$comments[i])
if(op$includeImagesOnExport)
exportRowDF = cbind(exportRowDF, paste(i, ".png", sep=""))
+ if(op$includeInstantaneousOnExport)
+ exportRowDF = cbind(exportRowDF, paste(i, ".csv", sep=""))
#write the correct names of the row dataframe
namesDF = c("Title","Datetime",names,"comments")
if(op$includeImagesOnExport)
namesDF = c(namesDF, "Image")
+ if(op$includeInstantaneousOnExport)
+ namesDF = c(namesDF, "Instantaneous")
colnames(exportRowDF) = namesDF
exportDF <- rbind (exportDF, exportRowDF) #rbind with exportDF
diff --git a/src/exportFiles/re.cs b/src/exportFiles/re.cs
index 961c39950..cb56c032d 100644
--- a/src/exportFiles/re.cs
+++ b/src/exportFiles/re.cs
@@ -26,6 +26,7 @@ using System.Threading;
public class RunEncoderExport : ExportFiles
{
+ private bool includeInstantaneous;
private double startAccel;
private bool plotRawAccel;
private bool plotFittedAccel;
@@ -45,6 +46,7 @@ public class RunEncoderExport : ExportFiles
Gtk.Label labelResult,
bool includeImages,
int imageWidth, int imageHeight,
+ bool includeInstantaneous,
bool isWindows,
int personID,
int sessionID,
@@ -60,6 +62,7 @@ public class RunEncoderExport : ExportFiles
assignParams(notebook, progressbar, labelResult, includeImages,
imageWidth, imageHeight, isWindows, personID, sessionID,
exportDecimalSeparator);
+ this.includeInstantaneous = includeInstantaneous;
this.startAccel = startAccel;
this.plotRawAccel = plotRawAccel;
this.plotFittedAccel = plotFittedAccel;
@@ -194,7 +197,7 @@ public class RunEncoderExport : ExportFiles
plotRawPower, plotFittedPower,
rege_l,
exportDecimalSeparator,
- includeImages
+ includeImages, includeInstantaneous
);
if(! reg.CallR(imageWidth, imageHeight, false))
@@ -212,11 +215,13 @@ public class RunEncoderExport : ExportFiles
return false;
//copy the images if needed
- if(includeImages && (
- ! copyImages(getTempGraphsDir(), exportURL,
- "chronojump_race_analyzer_export_graphs") ||
- ! copyImages(getTempExportInstantDir(), exportURL,
- "chronojump_race_analyzer_export_instantaneous")) )
+ if(includeImages && ! copyImages(getTempGraphsDir(), exportURL,
+ "chronojump_race_analyzer_export_graphs"))
+ return false;
+
+ //copy instantanous data if needed
+ if(includeInstantaneous && ! copyImages(getTempExportInstantDir(), exportURL,
+ "chronojump_race_analyzer_export_instantaneous"))
return false;
// copy the CSV
diff --git a/src/gui/app1/runEncoderAnalyze.cs b/src/gui/app1/runEncoderAnalyze.cs
index 778b6ca0f..a49b9aaf2 100644
--- a/src/gui/app1/runEncoderAnalyze.cs
+++ b/src/gui/app1/runEncoderAnalyze.cs
@@ -56,6 +56,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.HBox hbox_run_encoder_export_width_height;
[Widget] Gtk.SpinButton spinbutton_run_encoder_export_image_width;
[Widget] Gtk.SpinButton spinbutton_run_encoder_export_image_height;
+ [Widget] Gtk.CheckButton check_run_encoder_export_instantaneous;
[Widget] Gtk.ProgressBar progressbar_run_encoder_export;
[Widget] Gtk.Label label_run_encoder_export_result;
[Widget] Gtk.Button button_run_encoder_export_result_open;
@@ -364,6 +365,7 @@ public partial class ChronoJumpWindow
check_run_encoder_export_images.Active,
Convert.ToInt32(spinbutton_run_encoder_export_image_width.Value),
Convert.ToInt32(spinbutton_run_encoder_export_image_height.Value),
+ check_run_encoder_export_instantaneous.Active,
UtilAll.IsWindows(),
personID,
currentSession.UniqueID,
@@ -381,13 +383,13 @@ public partial class ChronoJumpWindow
runEncoderExport.Button_done.Clicked += new EventHandler(run_encoder_export_done);
bool selectedFile = false;
- if(check_run_encoder_export_images.Active)
+ if(check_run_encoder_export_images.Active || check_run_encoder_export_instantaneous.Active)
//export folder
{
if(personID == -1)
selectedFile = checkFolder
(Constants.CheckFileOp.RUNENCODER_EXPORT_GROUPAL_CURRENT_SESSION_YES_IMAGES);
else
selectedFile = checkFolder
(Constants.CheckFileOp.RUNENCODER_EXPORT_INDIVIDUAL_CURRENT_SESSION_YES_IMAGES);
- } else {
+ } else {
//export file
if(personID == -1)
selectedFile = checkFile
(Constants.CheckFileOp.RUNENCODER_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES);
else
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index 4f5a745f6..5ba0f0d0a 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -594,6 +594,7 @@ public class RunEncoderGraph
private TriggerList triggerList;
private char exportDecimalSeparator;
private bool includeImagesOnExport;
+ private bool includeInstantaneousOnExport;
private void assignGenericParams(
int testLength, double mass, double personHeight, double tempC, RunEncoder.Devices
device,
@@ -643,6 +644,7 @@ public class RunEncoderGraph
this.exportDecimalSeparator = '.';
this.includeImagesOnExport = false;
+ this.includeInstantaneousOnExport = false;
}
//constructor for export (many sets of possible different persons)
@@ -653,7 +655,8 @@ public class RunEncoderGraph
bool plotRawPower, bool plotFittedPower,
List<RunEncoderGraphExport> rege_l,
char exportDecimalSeparator,
- bool includeImagesOnExport
+ bool includeImagesOnExport,
+ bool includeInstantaneousOnExport
)
{
assignGenericParams(
@@ -668,6 +671,7 @@ public class RunEncoderGraph
this.exportDecimalSeparator = exportDecimalSeparator;
this.includeImagesOnExport = includeImagesOnExport;
+ this.includeInstantaneousOnExport = includeInstantaneousOnExport;
writeMultipleFilesCSV(rege_l);
}
@@ -713,7 +717,8 @@ public class RunEncoderGraph
printTriggers(TriggerList.Type3.OFF) + "\n" + //unused on multiple
"#singleOrMultiple\n" + Util.BoolToRBool(singleOrMultiple) + "\n" +
"#decimalCharAtExport\n" + exportDecimalSeparator + "\n" +
- "#includeImagesOnExport\n" + Util.BoolToRBool(includeImagesOnExport) + "\n";
+ "#includeImagesOnExport\n" + Util.BoolToRBool(includeImagesOnExport) + "\n" +
+ "#includeInstantaneousOnExport\n" +
Util.BoolToRBool(includeInstantaneousOnExport) + "\n";
TextWriter writer = File.CreateText(Path.GetTempPath() + "Roptions.txt");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]