[chronojump] chronojumpImport verbose pulsebar depending on tests imported



commit c011cae6ffc303b5e247244a71077ad2f8fd58d7
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 29 14:08:20 2020 +0200

    chronojumpImport verbose pulsebar depending on tests imported

 src/chronojump-importer/chronojump_importer.py | 15 +++++++++++++++
 src/gui/chronojumpImporter.cs                  | 19 ++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)
---
diff --git a/src/chronojump-importer/chronojump_importer.py b/src/chronojump-importer/chronojump_importer.py
index fee7914f..fb29e980 100755
--- a/src/chronojump-importer/chronojump_importer.py
+++ b/src/chronojump-importer/chronojump_importer.py
@@ -430,6 +430,8 @@ class ImportSession:
         self._import_forceSensor()
         self._import_runEncoder()
 
+        self._print_status(self, "allData")
+
     def _import_session(self):
         """
         Imports the Session information saved in self._source_session (only table Session).
@@ -477,6 +479,8 @@ class ImportSession:
 
 
     def _import_persons77(self):
+        self._print_status(self, "persons")
+
         persons77 = self.source_db.read(table_name="Person77",
                                         
where_condition="personSession77.sessionID={}".format(self.source_session),
                                         join_clause="LEFT JOIN personSession77 ON 
personSession77.personID=Person77.uniqueID",
@@ -597,6 +601,7 @@ class ImportSession:
         self.destination_db.write(table=person_session_77, matches_columns=["sessionID", "personID"])
 
     def _import_encoder(self):
+        self._print_status(self, "encoder")
         # Imports EncoderExercise
         encoder_exercise_from_encoder = self.source_db.read(table_name="EncoderExercise",
                                                
where_condition="Encoder.sessionID={}".format(self.source_session),
@@ -677,6 +682,7 @@ class ImportSession:
 
 
     def _import_forceSensor(self):
+        self._print_status(self, "forceSensor")
         # Imports ForceSensorExercise
         # based on encoder exercise code because rest of the code exercises and tests are linked by names
         # but on encoder and forceSensor is linked by ex.uniqueID
@@ -711,6 +717,7 @@ class ImportSession:
             debugFile.write(" end _import_forceSensor\n")
 
     def _import_runEncoder(self):
+        self._print_status(self, "runEncoder")
         # Imports RunEncoderExercise
         # VERY similar to _import_runEncoder
 
@@ -810,6 +817,14 @@ class ImportSession:
         elif os.sep == "\\":
             return path.replace("/", "\\")
 
+    @staticmethod
+    def _print_status(self, name):
+        statusPath = self._normalize_path(self.source_temp_directory + "/status/")
+        if not os.path.exists(statusPath):
+            os.makedirs(statusPath)
+        open(statusPath + name + ".txt", 'a').close()
+
+
     def _import_encoder_files(self, encoder_table):
         if self.source_base_directory is None:
             # We are skipping to copy the Encoding files. This is used in unit tests.
diff --git a/src/gui/chronojumpImporter.cs b/src/gui/chronojumpImporter.cs
index 859a7a3a..cf00ed0f 100644
--- a/src/gui/chronojumpImporter.cs
+++ b/src/gui/chronojumpImporter.cs
@@ -20,6 +20,7 @@
 
 using Gtk;
 using System;
+using System.IO;
 using System.Threading;
 
 public partial class ChronoJumpWindow
@@ -108,7 +109,23 @@ public partial class ChronoJumpWindow
                        return false;
                }
 
-               app1s_Pulse(chronojumpImporter.MessageToPulsebar);
+               string message = chronojumpImporter.MessageToPulsebar;
+               string statusDir = Util.GetDatabaseTempImportDir() + Path.DirectorySeparatorChar +
+                       "status" + Path.DirectorySeparatorChar;
+
+               //files are created on this order
+               if(File.Exists(statusDir + "persons.txt"))
+                       message = "Importing persons";
+               if(File.Exists(statusDir + "encoder.txt"))
+                       message = "Importing encoder files";
+               if(File.Exists(statusDir + "forceSensor.txt"))
+                       message = "Importing forceSensor files";
+               if(File.Exists(statusDir + "runEncoder.txt"))
+                       message = "Importing race analyzer files";
+               if(File.Exists(statusDir + "allData.txt"))
+                       message = "All data imported, finishing";
+
+               app1s_Pulse(message);
 
                Thread.Sleep (100);
                //LogB.Debug(threadImport.ThreadState.ToString());


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