[chronojump] RaceAnalyzer: Discardex export of ! sprints



commit 62c7397ec792d94e8e8236693575ea46ec6f133f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Feb 18 11:05:57 2022 +0100

    RaceAnalyzer: Discardex export of ! sprints

 glade/app1.glade                  | 47 +++++++++++++++++++++++++++------------
 src/exportFiles/exportFiles.cs    | 15 ++++++++++++-
 src/exportFiles/fs.cs             |  2 +-
 src/exportFiles/re.cs             | 44 ++++++++++++++++++++++--------------
 src/exportFiles/sprint.cs         |  2 +-
 src/gui/app1/runEncoder.cs        |  1 +
 src/gui/app1/runEncoderAnalyze.cs |  7 ++++++
 7 files changed, 84 insertions(+), 34 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index ae48fa3a6..5c1d0f8e6 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -26224,6 +26224,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -30300,7 +30303,7 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_run_encoder_export_result">
+                                                            <widget class="GtkLabel" 
id="label_run_encoder_export_discarded">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="xalign">0</property>
@@ -30313,6 +30316,19 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_run_encoder_export_result">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="selectable">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">6</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkAlignment" id="alignment81">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -30340,7 +30356,7 @@ Concentric</property>
                                                             <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
-                                                            <property name="position">6</property>
+                                                            <property name="position">7</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -32581,6 +32597,18 @@ 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>
@@ -32617,18 +32645,6 @@ 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>
@@ -42100,6 +42116,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/exportFiles/exportFiles.cs b/src/exportFiles/exportFiles.cs
index 63807c274..ef886dce6 100644
--- a/src/exportFiles/exportFiles.cs
+++ b/src/exportFiles/exportFiles.cs
@@ -31,6 +31,7 @@ public abstract class ExportFiles
        //passed variables
        protected Gtk.Notebook notebook;
        protected Gtk.ProgressBar progressbar;
+       protected Gtk.Label labelDiscarded;
        protected Gtk.Label labelResult;
        protected bool includeImages;
        protected int imageWidth;
@@ -49,11 +50,13 @@ public abstract class ExportFiles
        protected static bool noData;
        protected static bool cannotCopy;
        protected static bool allOk;
+       protected static int discarded;
        protected static string messageToProgressbar;
 
        protected void assignParams (
                        Gtk.Notebook notebook,
                        Gtk.ProgressBar progressbar,
+                       Gtk.Label labelDiscarded,
                        Gtk.Label labelResult,
                        bool includeImages,
                        int imageWidth, int imageHeight,
@@ -63,6 +66,7 @@ public abstract class ExportFiles
        {
                this.notebook = notebook;
                this.progressbar = progressbar;
+               this.labelDiscarded = labelDiscarded;
                this.labelResult = labelResult;
                this.includeImages = includeImages;
                this.imageWidth = imageWidth;
@@ -87,6 +91,7 @@ public abstract class ExportFiles
                progressbar.Fraction = 0;
                messageToProgressbar = "";
                notebook.CurrentPage = 1;
+               discarded = 0;
        }
                
        protected virtual void createOrEmptyDirs()
@@ -155,6 +160,12 @@ public abstract class ExportFiles
                        progressbar.Fraction = 1;
                        notebook.CurrentPage = 0;
 
+                       if(discarded > 0)
+                               labelDiscarded.Text = string.Format(Catalog.GetPluralString(
+                                                       "Discarded 1 set for not being an sprint.",
+                                                       "Discarded {0} sets for not being sprints.",
+                                                       discarded), discarded);
+
                        if(cancel)
                                labelResult.Text = Catalog.GetString("Cancelled.");
                        else if (noData)
@@ -236,5 +247,7 @@ public abstract class ExportFiles
        public string ExportURL {
                get { return exportURL; }
        }
-
+       public int Discarded {
+               get { return discarded; }
+       }
 }
diff --git a/src/exportFiles/fs.cs b/src/exportFiles/fs.cs
index 0c54aafd3..411a857da 100644
--- a/src/exportFiles/fs.cs
+++ b/src/exportFiles/fs.cs
@@ -62,7 +62,7 @@ public class ForceSensorExport : ExportFiles
        {
                Button_done = new Gtk.Button();
 
-               assignParams(notebook, progressbar, labelResult, includeImages,
+               assignParams(notebook, progressbar, new Gtk.Label(), labelResult, includeImages,
                                imageWidth, imageHeight, isWindows, personID, sessionID, 
exportDecimalSeparator);
 
                this.rfdList = rfdList;
diff --git a/src/exportFiles/re.cs b/src/exportFiles/re.cs
index e55c77048..9080b0531 100644
--- a/src/exportFiles/re.cs
+++ b/src/exportFiles/re.cs
@@ -43,6 +43,7 @@ public class RunEncoderExport : ExportFiles
        public RunEncoderExport (
                        Gtk.Notebook notebook,
                        Gtk.ProgressBar progressbar,
+                       Gtk.Label labelDiscarded,
                        Gtk.Label labelResult,
                        bool includeImages,
                        int imageWidth, int imageHeight,
@@ -59,7 +60,7 @@ public class RunEncoderExport : ExportFiles
        {
                Button_done = new Gtk.Button();
 
-               assignParams(notebook, progressbar, labelResult, includeImages,
+               assignParams(notebook, progressbar, labelDiscarded, labelResult, includeImages,
                                imageWidth, imageHeight, isWindows, personID, sessionID, 
exportDecimalSeparator);
 
                this.includeInstantaneous = includeInstantaneous;
@@ -167,6 +168,12 @@ public class RunEncoderExport : ExportFiles
                        if(! found)
                                continue;
 
+                       if(! reEx.IsSprint) //currently can only export (analyze with model) sprints
+                       {
+                               discarded ++;
+                               continue;
+                       }
+
                        // 4) create the export row
                        string title = Util.ChangeSpaceAndMinusForUnderscore(p.Name) + "-" +
                                Util.ChangeSpaceAndMinusForUnderscore(reEx.Name);
@@ -190,25 +197,28 @@ public class RunEncoderExport : ExportFiles
 
                Util.FileDelete(RunEncoder.GetCSVResultsURL());
 
+               if(rege_l.Count == 0)
+               {
+                       noData = true;
+                       return false;
+               }
+
                // call the graph
 
-               if(rege_l.Count > 0)
+               RunEncoderGraph reg = new RunEncoderGraph(
+                               startAccel,
+                               plotRawAccel, plotFittedAccel,
+                               plotRawForce, plotFittedForce,
+                               plotRawPower, plotFittedPower,
+                               rege_l,
+                               exportDecimalSeparator,
+                               includeImages, includeInstantaneous
+                               );
+
+               if(! reg.CallR(imageWidth, imageHeight, false))
                {
-                       RunEncoderGraph reg = new RunEncoderGraph(
-                                       startAccel,
-                                       plotRawAccel, plotFittedAccel,
-                                       plotRawForce, plotFittedForce,
-                                       plotRawPower, plotFittedPower,
-                                       rege_l,
-                                       exportDecimalSeparator,
-                                       includeImages, includeInstantaneous
-                                       );
-
-                       if(! reg.CallR(imageWidth, imageHeight, false))
-                       {
-                               failedRprocess = true;
-                               return false;
-                       }
+                       failedRprocess = true;
+                       return false;
                }
 
                LogB.Information("Waiting creation of file... ");
diff --git a/src/exportFiles/sprint.cs b/src/exportFiles/sprint.cs
index 60403d273..9fabc194c 100644
--- a/src/exportFiles/sprint.cs
+++ b/src/exportFiles/sprint.cs
@@ -47,7 +47,7 @@ public class SprintExport : ExportFiles
        {
                Button_done = new Gtk.Button();
 
-               assignParams(notebook, progressbar, labelResult, includeImages,
+               assignParams(notebook, progressbar, new Gtk.Label(), labelResult, includeImages,
                                imageWidth, imageHeight, isWindows, personID, sessionID, 
exportDecimalSeparator);
 
                this.digitsNumber = digitsNumber;
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index 75c85395a..0c5500c30 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -471,6 +471,7 @@ public partial class ChronoJumpWindow
                                label_run_encoder_export_data.Text = "";
                }
 
+               label_run_encoder_export_discarded.Text = "";
                label_run_encoder_export_result.Text = "";
                button_run_encoder_export_result_open.Visible = false;
        }
diff --git a/src/gui/app1/runEncoderAnalyze.cs b/src/gui/app1/runEncoderAnalyze.cs
index e0319366b..e2a794c25 100644
--- a/src/gui/app1/runEncoderAnalyze.cs
+++ b/src/gui/app1/runEncoderAnalyze.cs
@@ -59,6 +59,7 @@ public partial class ChronoJumpWindow
        [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_discarded;
        [Widget] Gtk.Label label_run_encoder_export_result;
        [Widget] Gtk.Button button_run_encoder_export_result_open;
 
@@ -297,6 +298,7 @@ public partial class ChronoJumpWindow
                hbox_run_encoder_export_width_height.Visible = check_run_encoder_export_images.Active;
 
                //also hide the label and the open button
+               label_run_encoder_export_discarded.Text = "";
                label_run_encoder_export_result.Text = "";
                button_run_encoder_export_result_open.Visible = false;
        }
@@ -307,6 +309,7 @@ public partial class ChronoJumpWindow
                button_run_encoder_analyze_analyze.Visible = true;
 
                notebook_run_encoder_analyze.CurrentPage = 
Convert.ToInt32(notebook_run_encoder_analyze_pages.CURRENTSET);
+               label_run_encoder_export_discarded.Text = "";
                label_run_encoder_export_result.Text = "";
                button_run_encoder_export_result_open.Visible = false;
        }
@@ -321,6 +324,7 @@ public partial class ChronoJumpWindow
                        label_run_encoder_export_data.Text = "";
 
                notebook_run_encoder_analyze.CurrentPage = 
Convert.ToInt32(notebook_run_encoder_analyze_pages.CURRENTSESSION);
+               label_run_encoder_export_discarded.Text = "";
                label_run_encoder_export_result.Text = "";
                button_run_encoder_export_result_open.Visible = false;
        }
@@ -332,6 +336,7 @@ public partial class ChronoJumpWindow
                label_run_encoder_export_data.Text = currentSession.Name;
 
                notebook_run_encoder_analyze.CurrentPage = 
Convert.ToInt32(notebook_run_encoder_analyze_pages.CURRENTSESSION);
+               label_run_encoder_export_discarded.Text = "";
                label_run_encoder_export_result.Text = "";
                button_run_encoder_export_result_open.Visible = false;
        }
@@ -368,6 +373,7 @@ public partial class ChronoJumpWindow
        RunEncoderExport runEncoderExport;
        private void button_run_encoder_export_session (int personID, int sessionID)
        {
+               label_run_encoder_export_discarded.Text = "";
                label_run_encoder_export_result.Text = "";
                button_run_encoder_export_result_open.Visible = false;
                runEncoderButtonsSensitive(false);
@@ -394,6 +400,7 @@ public partial class ChronoJumpWindow
                runEncoderExport = new RunEncoderExport (
                                notebook_run_encoder_export,
                                progressbar_run_encoder_export,
+                               label_run_encoder_export_discarded,
                                label_run_encoder_export_result,
                                check_run_encoder_export_images.Active,
                                Convert.ToInt32(spinbutton_run_encoder_export_image_width.Value),


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