[chronojump] sprint image can be exported to png



commit ce2f133312539952fb9cf6f690abb99d08ba8ac6
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jun 6 16:30:08 2018 +0200

    sprint image can be exported to png

 glade/app1.glade   | 98 ++++++++++++++++++++++++++++++++++++++++++------------
 src/constants.cs   |  1 +
 src/gui/encoder.cs |  7 ++++
 src/gui/sprint.cs  | 25 ++++++++++++++
 4 files changed, 109 insertions(+), 22 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 985c46d3..3d7e04fa 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1746,6 +1746,9 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -16181,7 +16184,12 @@ Concentric</property>
                                                           </packing>
                                                         </child>
                                                         <child>
-                                                          <widget class="GtkScrolledWindow" 
id="scrolledwindow4">
+                                                          <widget class="GtkHBox" id="hbox291">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkScrolledWindow" 
id="scrolledwindow4">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property 
name="hscrollbar_policy">automatic</property>
@@ -16200,6 +16208,70 @@ Concentric</property>
                                                             </child>
                                                             </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="vbox133">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_sprint_save_image">
+                                                            <property name="visible">True</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_sprint_save_image_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox134">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_sprint_analyze_save">
+                                                            <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_sprint_analyze_image_save">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-save</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>
                                                           <packing>
                                                             <property name="resize">True</property>
@@ -19554,27 +19626,6 @@ Concentric</property>
                                                             <placeholder/>
                                                             </child>
                                                             <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_force_sensor_ai_rfd_a">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -27963,6 +28014,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/constants.cs b/src/constants.cs
index 67ec8488..737ceb86 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -805,6 +805,7 @@ public class Constants
        public enum EncoderGI {ALL, GRAVITATORY, INERTIAL}
        public enum CheckFileOp {
                JUMPS_PROFILE_SAVE_IMAGE,
+               RUNS_SPRINT_SAVE_IMAGE,
                ENCODER_CAPTURE_EXPORT_ALL, ENCODER_ANALYZE_SAVE_IMAGE,
                ENCODER_ANALYZE_SAVE_AB, ENCODER_ANALYZE_SAVE_TABLE,
                FORCESENSOR_SAVE_IMAGE_SIGNAL, FORCESENSOR_SAVE_IMAGE_RFD_AUTO,
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 0b6a4b16..c1b552a6 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1968,6 +1968,7 @@ public partial class ChronoJumpWindow
                        exportString = Catalog.GetString ("Export set in CSV format");
                else if(
                                checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE ||
+                               checkFileOp == Constants.CheckFileOp.RUNS_SPRINT_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO ||
@@ -2004,6 +2005,7 @@ public partial class ChronoJumpWindow
                        nameString += "_encoder_set_export.csv";
                else if(
                                checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE ||
+                               checkFileOp == Constants.CheckFileOp.RUNS_SPRINT_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_SIGNAL ||
                                checkFileOp == Constants.CheckFileOp.FORCESENSOR_SAVE_IMAGE_RFD_AUTO ||
@@ -2052,6 +2054,9 @@ public partial class ChronoJumpWindow
                                        if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
                                                confirmWin.Button_accept.Clicked +=
                                                        new 
EventHandler(on_overwrite_file_jumps_profile_save_image_accepted);
+                                       if(checkFileOp == Constants.CheckFileOp.RUNS_SPRINT_SAVE_IMAGE)
+                                               confirmWin.Button_accept.Clicked +=
+                                                       new 
EventHandler(on_overwrite_file_runs_sprint_save_image_accepted);
                                        else if(checkFileOp == 
Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
                                                confirmWin.Button_accept.Clicked += 
                                                        new 
EventHandler(on_overwrite_file_export_all_curves_accepted);
@@ -2080,6 +2085,8 @@ public partial class ChronoJumpWindow
                                } else {
                                        if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
                                                on_button_jumps_profile_save_image_selected (exportFileName);
+                                       else if(checkFileOp == Constants.CheckFileOp.RUNS_SPRINT_SAVE_IMAGE)
+                                               on_button_runs_sprint_save_image_selected (exportFileName);
                                        else if(checkFileOp == 
Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
                                                on_button_encoder_export_all_curves_file_selected 
(exportFileName);
                                        else if(checkFileOp == 
Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE)
diff --git a/src/gui/sprint.cs b/src/gui/sprint.cs
index 1d20a15e..6b9bc347 100644
--- a/src/gui/sprint.cs
+++ b/src/gui/sprint.cs
@@ -19,6 +19,7 @@
  */
 
 using System;
+using System.IO;
 using Gtk;
 using Glade;
 using System.Text; //StringBuilder
@@ -274,4 +275,28 @@ public partial class ChronoJumpWindow
                return true;
        }
 
+       private void on_button_sprint_save_image_clicked (object o, EventArgs args)
+       {
+               checkFile(Constants.CheckFileOp.RUNS_SPRINT_SAVE_IMAGE);
+       }
+
+       private void on_button_runs_sprint_save_image_selected (string destination)
+       {
+               try {
+                       File.Copy(UtilEncoder.GetSprintImage(), 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_runs_sprint_save_image_accepted (object o, EventArgs args)
+       {
+               on_button_runs_sprint_save_image_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]