[chronojump] Gui improvements on rfid and uploadPerson



commit c8e4300de9fe0f1777b9df722550544905419d05
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu May 25 17:15:22 2017 +0200

    Gui improvements on rfid and uploadPerson

 src/gui/chronojump.cs |    8 ++++++--
 src/gui/encoder.cs    |    5 ++++-
 src/gui/networks.cs   |   39 +++++++++++++++++++++++++++++++++++++--
 3 files changed, 47 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 0e1520d..f495008 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2317,8 +2317,12 @@ public partial class ChronoJumpWindow
                
                resetAllTreeViews(true); //boolean means: "also persons"
 
-               bool foundPersons = selectRowTreeView_persons(treeview_persons, 0);
-               
+               bool foundPersons = false;
+
+               //on Compujump don't start with first person, wait to it's rfid
+               if( ! configChronojump.Compujump)
+                       selectRowTreeView_persons(treeview_persons, 0);
+
                //show hidden widgets
                sensitiveGuiNoSession();
                sensitiveGuiYesSession();
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index d34bbab..08a8c62 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -5987,13 +5987,16 @@ public partial class ChronoJumpWindow
                                                         * right now fixed in json.cs UploadEncoderData()
                                                         */
 
+                                                       LogB.Information("calling Upload");
                                                        Json js = new Json();
                                                        bool success = js.UploadEncoderData(
-                                                                       1, //TODO: currentPerson.UniqueID,
+                                                                       currentPerson.UniqueID,
                                                                        1,
                                                                        
UtilGtk.ComboGetActive(combo_encoder_exercise_capture),
                                                                        
Util.ConvertToPoint(findMass(Constants.MassType.DISPLACED)), //this is only for gravitatory
                                                                        uo);
+                                                       LogB.Information(js.ResultMessage);
+                                                       LogB.Information("called Upload");
 
                                                        if(! success) {
                                                                LogB.Error(js.ResultMessage);
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 587668b..90198b9 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -124,7 +124,10 @@ public partial class ChronoJumpWindow
        }
        private void rfidChanged(object sender, EventArgs e)
        {
-               if(rfid.Captured != capturedRFID)
+               /*
+                * TODO: only if we are not in the middle of capture, or in cont mode without repetitions
+                */
+               if(rfid.Captured != capturedRFID && currentSession != null)
                {
                        LogB.Information("RFID changed to: " + rfid.Captured);
 
@@ -360,6 +363,9 @@ public partial class ChronoJumpWindow
                label_rfid_encoder.Text = capturedRFID; //GTK
 
                Person p = SqlitePerson.SelectByRFID(capturedRFID);
+
+               bool currentPersonWasNull = (currentPerson == null);
+               bool pChanged = false;
                if(p.UniqueID == -1)
                {
                        LogB.Information("RFID person does not exist!!");
@@ -382,11 +388,40 @@ public partial class ChronoJumpWindow
                                                Constants.SpeciallityUndefinedID, 
                                                Constants.LevelUndefinedID,
                                                "", false); //comments, dbconOpened
+
+                               if(js.LastPersonByRFIDImageURL != "")
+                               {
+                                       bool downloaded = js.DownloadImage(js.LastPersonByRFIDImageURL, 
currentPerson.UniqueID);
+                                       if(downloaded)
+                                               File.Copy(
+                                                               Path.Combine(Path.GetTempPath(), 
currentPerson.UniqueID.ToString()),
+                                                               Util.GetPhotoFileName(false, 
currentPerson.UniqueID),
+                                                               true); //overwrite
+                               }
+
                                person_added(); //GTK
+                               pChanged = true;
                        }
                }
-               else
+               else {
                        LogB.Information("RFID person exists!!");
+                       currentPerson = p;
+                       personChanged(); //GTK
+                       label_person_change();
+                       pChanged = true;
+               }
+
+               if(currentPersonWasNull)
+                       sensitiveGuiYesPerson();
+
+               /*TODO:
+               if(pChanged)
+               {
+                       int rowToSelect = myTreeViewPersons.FindRow(currentPerson.UniqueID);
+                       if(rowToSelect != -1)
+                               selectRowTreeView_persons(treeview_persons, rowToSelect);
+               }
+                       */
 
                updatingRFIDGuiStuff = false;
 


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