[chronojump] RunEncoder analyze images can be saved



commit 781de62eff3d2dc1586e5ae2783b1f6df88bbd25
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Apr 27 14:53:25 2020 +0200

    RunEncoder analyze images can be saved

 glade/app1.glade                  | 69 +++++++++++++++++++++++++++++++++++++++
 src/constants.cs                  |  3 +-
 src/gui/app1/encoder.cs           | 11 +++++--
 src/gui/app1/icons.cs             |  4 +++
 src/gui/app1/runEncoder.cs        |  4 +++
 src/gui/app1/runEncoderAnalyze.cs | 30 +++++++++++++++--
 6 files changed, 116 insertions(+), 5 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index c7dd21bf..b8cba2b7 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -25507,6 +25507,10 @@ Concentric</property>
                                                             <property name="tab_pos">bottom</property>
                                                             <property name="show_border">False</property>
                                                             <child>
+                                                            <widget class="GtkHBox" id="hbox415">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
                                                             <widget class="GtkScrolledWindow" 
id="scrolledwindow9">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
@@ -25538,6 +25542,71 @@ Concentric</property>
                                                             </widget>
                                                             </child>
                                                             </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox213">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_run_encoder_image_save">
+                                                            <property name="visible">True</property>
+                                                            <property name="sensitive">False</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="tooltip" translatable="yes">Save 
image</property>
+                                                            <signal name="clicked" 
handler="on_button_run_encoder_image_save_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox214">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_run_encoder_analyze_image_save_graph">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_run_encoder_analyze_image_save_disk">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property 
name="stock">gtk-missing-image</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
+                                                            </child>
+                                                            </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>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
+                                                            </widget>
                                                             </child>
                                                             <child>
                                                             <widget class="GtkLabel" id="label420">
diff --git a/src/constants.cs b/src/constants.cs
index e420c131..f8958dd4 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -1088,7 +1088,8 @@ public class Constants
                ENCODER_ANALYZE_SEND_IMAGE, //like save image but just defines the name exportFileName to be 
sended
                ENCODER_ANALYZE_SAVE_AB, ENCODER_ANALYZE_SAVE_TABLE,
                FORCESENSOR_SAVE_IMAGE_SIGNAL, FORCESENSOR_SAVE_IMAGE_RFD_AUTO,
-               FORCESENSOR_SAVE_IMAGE_RFD_MANUAL, FORCESENSOR_ANALYZE_SAVE_AB
+               FORCESENSOR_SAVE_IMAGE_RFD_MANUAL, FORCESENSOR_ANALYZE_SAVE_AB,
+               RUNENCODER_SAVE_IMAGE
        }
 
        public static double EncoderErrorCode = -1;
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 0627a862..9e448183 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -2056,7 +2056,8 @@ public partial class ChronoJumpWindow
                                checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO ||
-                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL )
+                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL ||
+                               checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_IMAGE)
                        exportString = Catalog.GetString ("Save image");
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
                        exportString = Catalog.GetString ("Export repetition in CSV format");
@@ -2111,7 +2112,8 @@ public partial class ChronoJumpWindow
                                checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO ||
-                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL )
+                               checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_MANUAL ||
+                               checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_IMAGE)
                        nameString += ".png";
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
                        nameString += "_encoder_repetition_export.csv";
@@ -2192,6 +2194,9 @@ public partial class ChronoJumpWindow
                                        else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB)
                                                confirmWin.Button_accept.Clicked +=
                                                        new 
EventHandler(on_overwrite_file_forcesensor_save_AB_accepted);
+                                       else if(checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_IMAGE)
+                                               confirmWin.Button_accept.Clicked +=
+                                                       new 
EventHandler(on_overwrite_file_runencoder_image_save_accepted);
 
                                } else {
                                        if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
@@ -2220,6 +2225,8 @@ public partial class ChronoJumpWindow
                                                on_button_forcesensor_save_image_rfd_manual_file_selected 
(exportFileName);
                                        else if(checkFileOp == 
Constants.CheckFileOp.FORCESENSOR_ANALYZE_SAVE_AB)
                                                on_button_force_sensor_save_AB_file_selected (exportFileName);
+                                       else if(checkFileOp == Constants.CheckFileOp.RUNENCODER_SAVE_IMAGE)
+                                               on_button_run_encoder_image_save_selected (exportFileName);
 
                                        string myString = string.Format(Catalog.GetString("Saved to {0}"), 
                                                        exportFileName);
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index ee1a9332..c18cd9fd 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -202,6 +202,8 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_run_encoder_exercise_add;
        [Widget] Gtk.Image image_run_encoder_exercise_delete;
        [Widget] Gtk.Image image_run_encoder_analyze_load;
+       [Widget] Gtk.Image image_run_encoder_analyze_image_save_graph;
+       [Widget] Gtk.Image image_run_encoder_analyze_image_save_disk;
 
        //video play icons
        [Widget] Gtk.Image image_video_play_this_test_contacts;
@@ -750,6 +752,7 @@ public partial class ChronoJumpWindow
                image_jumps_weight_fv_profile_save.Pixbuf = pixbuf;
                image_jumps_evolution_save.Pixbuf = pixbuf;
                image_encoder_analyze_image_compujump_send_email_image.Pixbuf = pixbuf;
+               image_run_encoder_analyze_image_save_graph.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "save.png");
                image_encoder_capture_curves_save.Pixbuf = pixbuf;
@@ -766,6 +769,7 @@ public partial class ChronoJumpWindow
                image_forcesensor_analyze_image_save6.Pixbuf = pixbuf;
                image_forcesensor_analyze_image_save7.Pixbuf = pixbuf;
                image_sprint_analyze_image_save.Pixbuf = pixbuf;
+               image_run_encoder_analyze_image_save_disk.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "grid.png");
                image_encoder_analyze_table_save.Pixbuf = pixbuf;
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index 5a51a117..1d27d3d0 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -275,6 +275,7 @@ public partial class ChronoJumpWindow
                button_run_encoder_analyze_options.Sensitive = false;
                button_run_encoder_analyze_analyze.Sensitive = false;
                button_delete_last_test.Sensitive = false;
+               button_run_encoder_image_save.Sensitive = false;
        }
 
        private void raceEncoderReadWidgets()
@@ -763,6 +764,7 @@ public partial class ChronoJumpWindow
 
                event_execute_label_message.Text = "Loaded: " + Util.GetLastPartOfPath(re.Filename);
                button_run_encoder_analyze_options.Sensitive = true;
+               button_run_encoder_image_save.Sensitive = true;
        }
 
        protected void on_run_encoder_load_signal_row_play (object o, EventArgs args)
@@ -1120,6 +1122,7 @@ public partial class ChronoJumpWindow
                                        button_contacts_exercise_close_and_recalculate.Sensitive = true;
                                        button_run_encoder_analyze_options.Sensitive = true;
                                        button_run_encoder_analyze_analyze.Sensitive = true;
+                                       button_run_encoder_image_save.Sensitive = true;
                                        button_delete_last_test.Sensitive = true;
 
                                        /*
@@ -1142,6 +1145,7 @@ public partial class ChronoJumpWindow
                                contactsShowCaptureDoingButtons(false);
                                button_run_encoder_analyze_options.Sensitive = false;
                                button_run_encoder_analyze_analyze.Sensitive = false;
+                               button_run_encoder_image_save.Sensitive = false;
                                button_delete_last_test.Sensitive = false;
 
                                if(runEncoderProcessCancel)
diff --git a/src/gui/app1/runEncoderAnalyze.cs b/src/gui/app1/runEncoderAnalyze.cs
index ec978aa1..986f1106 100644
--- a/src/gui/app1/runEncoderAnalyze.cs
+++ b/src/gui/app1/runEncoderAnalyze.cs
@@ -19,6 +19,7 @@
  */
 
 using System;
+using System.IO;
 using Gtk;
 using Glade;
 using Mono.Unix;
@@ -35,6 +36,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.ComboBox combo_run_encoder_analyze_power;
        [Widget] Gtk.Button button_run_encoder_analyze_options;
        [Widget] Gtk.Button button_run_encoder_analyze_analyze;
+       [Widget] Gtk.Button button_run_encoder_image_save;
 
 
        private string runEncoderAnalyzeRawName = "RAW";
@@ -92,12 +94,12 @@ public partial class ChronoJumpWindow
        private void on_button_run_encoder_analyze_options_clicked (object o, EventArgs args)
        {
                notebook_run_encoder_analyze_or_options.CurrentPage = 1;
-               runEncoderButtonsSensitive(false); //TODO: add this new buttons if needed
+               runEncoderButtonsSensitive(false);
        }
        private void on_button_run_encoder_analyze_options_close_clicked (object o, EventArgs args)
        {
                notebook_run_encoder_analyze_or_options.CurrentPage = 0;
-               runEncoderButtonsSensitive(true); //TODO: add this new buttons if needed
+               runEncoderButtonsSensitive(true);
        }
 
        private void on_button_run_encoder_analyze_options_close_and_analyze_clicked (object o, EventArgs 
args)
@@ -118,4 +120,28 @@ public partial class ChronoJumpWindow
                        raceEncoderCopyTempAndDoGraphs();
        }
 
+       private void on_button_run_encoder_image_save_clicked (object o, EventArgs args)
+       {
+               checkFile(Constants.CheckFileOp.RUNENCODER_SAVE_IMAGE);
+       }
+
+       private void on_button_run_encoder_image_save_selected (string destination)
+       {
+               try {
+                       File.Copy(UtilEncoder.GetSprintEncoderImage(), destination, true);
+               } catch {
+                       string myString = string.Format(
+                                       Catalog.GetString("Cannot save file {0} "), destination);
+                       new DialogMessage(Constants.MessageTypes.WARNING, myString);
+               }
+       }
+
+       private void on_overwrite_file_runencoder_image_save_accepted(object o, EventArgs args)
+       {
+               on_button_run_encoder_image_save_selected (exportFileName);
+
+               string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+               new DialogMessage(Constants.MessageTypes.INFO, myString);
+       }
+
 }


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