[chronojump] ForceSensor export shows progress text: count/total



commit e881390b962d95336869365e1cf174ff01fb2bcf
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Feb 18 18:50:50 2021 +0100

    ForceSensor export shows progress text: count/total

 glade/app1.glade   | 32 +++++++++++++++++++-------------
 src/forceSensor.cs | 14 ++++++++++----
 2 files changed, 29 insertions(+), 17 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index f288e897..9f33f2bd 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -24059,6 +24059,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -24610,7 +24613,7 @@ Concentric</property>
                                                             <property name="spacing">6</property>
                                                             <child>
                                                             <widget class="GtkProgressBar" 
id="progressbar_force_sensor_export">
-                                                            <property name="width_request">100</property>
+                                                            <property name="width_request">200</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             </widget>
@@ -29210,6 +29213,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>
@@ -29246,18 +29261,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>
@@ -37570,6 +37573,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/forceSensor.cs b/src/forceSensor.cs
index 981d5b64..67d5dddd 100644
--- a/src/forceSensor.cs
+++ b/src/forceSensor.cs
@@ -2555,6 +2555,7 @@ public class ForceSensorExport
        private static Thread thread;
        private static bool cancel;
        private static bool noData;
+       private static string messageToProgressbar;
        //private static double pulseFraction; unused because its managed on pulse, better because on thread 
is working 100% on R call
 
        List<ForceSensor> fs_l;
@@ -2606,6 +2607,7 @@ public class ForceSensorExport
                cancel = false;
                noData = false;
                progressbar.Fraction = 0;
+               messageToProgressbar = "";
                notebook.CurrentPage = 1;
 
                //create progressbar and graph files dirs or delete their contents
@@ -2663,10 +2665,13 @@ public class ForceSensorExport
                //LogB.Information(string.Format("pulse files: {0}", dirInfo.GetFiles().Length));
 
                int files = dirInfo.GetFiles().Length;
-               if(files == 0)
+               if(files == 0) {
+                       progressbar.Text = messageToProgressbar;
                        progressbar.Pulse();
-               else
+               } else {
+                       progressbar.Text = string.Format("Exporting {0}/{1}", files, fs_l.Count);
                        progressbar.Fraction = UtilAll.DivideSafeFraction(files, fs_l.Count);
+               }
 
                Thread.Sleep (100);
                //Log.Write(" (pulseForceSensorExportGTK:" + thread.ThreadState.ToString() + ") ");
@@ -2704,13 +2709,14 @@ public class ForceSensorExport
 
                List<ForceSensorGraphABExport> fsgABe_l = new List<ForceSensorGraphABExport>();
 
-               int count = 0;
-
                //to manage sets we need previousPerson and previousExercise
                ForceSensorExportSetManage fsesm = new ForceSensorExportSetManage();
 
+               int count = 1;
                foreach(ForceSensor fs in fs_l)
                {
+                       messageToProgressbar = string.Format("Preparing {0}/{1}", count++, fs_l.Count);
+
                        if(cancel)
                                return false;
 


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