[chronojump] Run encoder comments



commit 2cd1b7407b9cd52422db7ac7307bce613d9e1317
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Sep 17 16:20:51 2019 +0200

    Run encoder comments

 glade/app1.glade       | 31 +++++++++++++++++++++++++++++++
 src/gui/forceSensor.cs | 14 +++++---------
 src/gui/runEncoder.cs  |  6 +++++-
 src/runEncoder.cs      |  5 +++++
 src/utilGtk.cs         |  7 +++++++
 5 files changed, 53 insertions(+), 10 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index cb311c5c..670dfba5 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -10527,6 +10527,37 @@ Inverted values</property>
                                                             <property name="position">3</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkFrame" 
id="frame_race_analyzer_comment">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label_xalign">0</property>
+                                                            <property name="shadow_type">in</property>
+                                                            <child>
+                                                            <widget class="GtkTextView" 
id="textview_race_analyzer_comment">
+                                                            <property name="width_request">200</property>
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            </widget>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label411">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" 
translatable="yes">Comments</property>
+                                                            <property name="use_markup">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="type">label_item</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">4</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="position">8</property>
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index e17a4c11..b86f3fc6 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -791,7 +791,7 @@ public partial class ChronoJumpWindow
                forceSensorTimeStart = DateTime.Now; //to have an active count of capture time
                forceSensorTimeStartCapture = forceSensorTimeStart; //to have same DateTime on filename and 
on sql datetime
                capturingForce = arduinoCaptureStatus.CAPTURING;
-               string captureComment = getCaptureComment(); //includes "_" if it's no empty
+               string captureComment = 
UtilGtk.TextViewGetCommentValidSQL(textview_force_sensor_capture_comment);
 
                Util.CreateForceSensorSessionDirIfNeeded (currentSession.UniqueID);
 
@@ -960,7 +960,9 @@ LogB.Information(" re C ");
                                                        ForceSensor.AngleUndefined, getLaterality(false),
                                                        Util.GetLastPartOfPath(lastForceSensorFile + ".csv"), 
//filename
                                                        
Util.MakeURLrelative(Util.GetForceSensorSessionDir(currentSession.UniqueID)), //url
-                                                       UtilDate.ToFile(forceSensorTimeStartCapture), 
getCaptureComment(), "", //dateTime, comment, videoURL
+                                                       UtilDate.ToFile(forceSensorTimeStartCapture),
+                                                       
UtilGtk.TextViewGetCommentValidSQL(textview_force_sensor_capture_comment),
+                                                       "", //videoURL
                                                        currentForceSensorExercise.Name);
 
                                        currentForceSensor.UniqueID = currentForceSensor.InsertSQL(false);
@@ -1540,7 +1542,7 @@ LogB.Information(" re R ");
                currentForceSensor.ExerciseName = currentForceSensorExercise.Name; //just in case
                currentForceSensor.CaptureOption = getForceSensorCaptureOptions();
                currentForceSensor.Laterality = getLaterality(false);
-               currentForceSensor.Comments = getCaptureComment();
+               currentForceSensor.Comments = 
UtilGtk.TextViewGetCommentValidSQL(textview_force_sensor_capture_comment);
 
                currentForceSensor.UpdateSQL(false);
        }
@@ -2335,12 +2337,6 @@ LogB.Information(" re R ");
                        radio_force_sensor_laterality_r.Active = true;
        }
 
-       private string getCaptureComment()
-       {
-               string s = Util.MakeValidSQL(textview_force_sensor_capture_comment.Buffer.Text);
-               return s;
-       }
-
        // -------------------------------- end of options, laterality and comment stuff ------
 
        // ------------------------------------------------ slides stuff for presentations
diff --git a/src/gui/runEncoder.cs b/src/gui/runEncoder.cs
index 24857a64..e1b95490 100644
--- a/src/gui/runEncoder.cs
+++ b/src/gui/runEncoder.cs
@@ -38,6 +38,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.SpinButton race_analyzer_spinbutton_temperature;
        [Widget] Gtk.SpinButton race_analyzer_spinbutton_graph_width;
        [Widget] Gtk.SpinButton race_analyzer_spinbutton_graph_height;
+       [Widget] Gtk.TextView textview_race_analyzer_comment;
        [Widget] Gtk.HBox hbox_race_analyzer_device;
        [Widget] Gtk.RadioButton race_analyzer_radio_device_manual;
        [Widget] Gtk.RadioButton race_analyzer_radio_device_other; //resisted
@@ -543,6 +544,8 @@ public partial class ChronoJumpWindow
 
                raceEncoderSetDevice(re.Device);
                raceEncoderSetDistanceAndTemp(re.Distance, re.Temperature);
+               textview_race_analyzer_comment.Buffer.Text = re.Comments;
+
                raceEncoderReadWidgets(); //needed to be able to do R graph
 
                raceEncoderCopyTempAndDoGraphs();
@@ -634,10 +637,11 @@ public partial class ChronoJumpWindow
                radio_mode_contacts_analyze.Active = true;
                button_run_encoder_recalculate.Sensitive = true;
 
-               //update SQL with device, distance, temperature
+               //update SQL with device, distance, temperature, comments
                currentRunEncoder.Device = raceEncoderGetDevice();
                currentRunEncoder.Distance = Convert.ToInt32(race_analyzer_spinbutton_distance.Value);
                currentRunEncoder.Temperature = Convert.ToInt32(race_analyzer_spinbutton_temperature.Value);
+               currentRunEncoder.Comments = 
UtilGtk.TextViewGetCommentValidSQL(textview_race_analyzer_comment);
 
                currentRunEncoder.UpdateSQL(false);
        }
diff --git a/src/runEncoder.cs b/src/runEncoder.cs
index 348948f4..2ff5c805 100644
--- a/src/runEncoder.cs
+++ b/src/runEncoder.cs
@@ -190,6 +190,11 @@ public class RunEncoder
                get { return temperature; }
                set { temperature = value; }
        }
+       public string Comments
+       {
+               get { return comments; }
+               set { comments = value; }
+       }
 }
 
 public class RunEncoderGraph
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index d2a851ce..3229642b 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -623,6 +623,13 @@ public class UtilGtk
        }
 
 
+       public static string TextViewGetCommentValidSQL (Gtk.TextView tv)
+       {
+               //string s = Util.MakeValidSQL(textview_force_sensor_capture_comment.Buffer.Text);
+               string s = Util.MakeValidSQL(tv.Buffer.Text);
+               return s;
+       }
+
        
        public static TextBuffer TextViewPrint(string message) {
                TextBuffer tb = new TextBuffer (new TextTagTable());


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