[chronojump] Jumps simple capture tab graph can be saved



commit 45a07926a211736ecb148803a6829cb500d2d26d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed May 12 12:26:16 2021 +0200

    Jumps simple capture tab graph can be saved

 glade/app1.glade           | 77 ++++++++++++++++++++++++++++++++++++++--------
 src/constants.cs           |  1 +
 src/gui/app1/chronojump.cs |  2 ++
 src/gui/app1/encoder.cs    | 22 +++++++++++--
 src/gui/app1/icons.cs      |  6 ++++
 src/gui/app1/jump.cs       | 31 +++++++++++++++++++
 6 files changed, 124 insertions(+), 15 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index c428afd4..c023c98c 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -8180,6 +8180,7 @@ EncoderInertialCapture</property>
                                                             </child>
                                                             <child>
                                                             <widget class="GtkVBox" id="vbox17">
+                                                            <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">3</property>
                                                             <child>
@@ -8247,7 +8248,6 @@ EncoderInertialCapture</property>
                                                             </child>
                                                             <child>
                                                             <widget class="GtkButton" 
id="event_execute_button_properties">
-                                                            <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="has_tooltip">True</property>
@@ -8290,6 +8290,51 @@ EncoderInertialCapture</property>
                                                             <property name="position">2</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_jumps_simple_capture_save_image">
+                                                            <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_jumps_simple_capture_save_image_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox255">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">4</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_button_jumps_simple_capture_save_image_chart">
+                                                            <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_button_jumps_simple_capture_save_image_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">3</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -25398,6 +25443,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -31595,6 +31643,18 @@ Concentric</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">6</property>
                                                             <child>
+                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
+                                                            </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>
+                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_capturing">
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
@@ -31631,18 +31691,6 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkLabel" 
id="label_video_encoder_tests_will_be_filmed">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label" translatable="yes">Tests 
will be filmed</property>
-                                                            </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>
-                                                            <child>
                                                             <widget class="GtkHBox" 
id="hbox_video_encoder_no_capturing">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -40704,6 +40752,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 61a3d5b6..0ff94c34 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -1109,6 +1109,7 @@ public class Constants
 
        public enum EncoderGI {ALL, GRAVITATORY, INERTIAL}
        public enum CheckFileOp {
+               JUMPS_SIMPLE_CAPTURE_SAVE_IMAGE,
                JUMPS_PROFILE_SAVE_IMAGE, JUMPS_DJ_OPTIMAL_FALL_SAVE_IMAGE, 
JUMPS_WEIGHT_FV_PROFILE_SAVE_IMAGE, JUMPS_EVOLUTION_SAVE_IMAGE,
                JUMPS_RJ_FATIGUE_SAVE_IMAGE,
                RUNS_EVOLUTION_SAVE_IMAGE,
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index d06d526b..5bb23da6 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -3152,6 +3152,7 @@ public partial class ChronoJumpWindow
                radio_mode_contacts_capture.Active = true; //it is safe to change to capture, because analyze 
has different graphs depending on mode
                radio_mode_encoder_capture_small.Active = true; //it is safe to change to capture, to ensure 
all widgets are ok on analyze (everything seems ok, but just to have same behaviour than in contacts)
 
+               button_jumps_simple_capture_save_image.Visible = false;
                radio_mode_contacts_jumps_profile.Active = true;
                hbox_radio_mode_contacts_analyze_buttons.Visible = false;
                radio_mode_contacts_jumps_rj_fatigue.Visible = false;
@@ -3211,6 +3212,7 @@ public partial class ChronoJumpWindow
                                event_graph_label_graph_test.Visible = false;
                                hbox_contacts_simple_graph_controls.Visible = true;
                                check_run_simple_show_time.Visible = false;
+                               button_jumps_simple_capture_save_image.Visible = true;
 
                                check_vbox_contacts_graph_legend.Visible = true;
                                //vbox_contacts_graph_legend.Visible = false;
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 830bc8a1..caf96db2 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -2098,6 +2098,7 @@ public partial class ChronoJumpWindow
                if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
                        exportString = Catalog.GetString ("Export set in CSV format");
                else if(
+                               checkFileOp == Constants.CheckFileOp.JUMPS_SIMPLE_CAPTURE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.JUMPS_DJ_OPTIMAL_FALL_SAVE_IMAGE ||
                                checkFileOp == Constants.CheckFileOp.JUMPS_WEIGHT_FV_PROFILE_SAVE_IMAGE ||
@@ -2171,6 +2172,18 @@ public partial class ChronoJumpWindow
                        nameString += "_encoder_set_export.csv";
                else if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_SAVE_IMAGE)
                        nameString += "_encoder_set.png";
+               else if(checkFileOp == Constants.CheckFileOp.JUMPS_SIMPLE_CAPTURE_SAVE_IMAGE)
+               {
+                       //if showing all persons, do not person name on filename
+                       if(radio_contacts_graph_allPersons.Active)
+                               nameString = currentSession.DateShortAsSQL;
+
+                       //if showing a jump or all, show on filename
+                       if(radio_contacts_graph_allTests.Active)
+                               nameString += "_jumps_" + Catalog.GetString("all") + ".png";
+                       else
+                               nameString += "_jumps_" + radio_contacts_graph_currentTest.Label + ".png";
+               }
                else if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
                        nameString += "_jumps_profile.png";
                else if(checkFileOp == Constants.CheckFileOp.JUMPS_DJ_OPTIMAL_FALL_SAVE_IMAGE)
@@ -2265,7 +2278,10 @@ public partial class ChronoJumpWindow
                                                                "Are you sure you want to overwrite: "), "",
                                                        exportFileName);
 
-                                       if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
+                                       if(checkFileOp == 
Constants.CheckFileOp.JUMPS_SIMPLE_CAPTURE_SAVE_IMAGE)
+                                               confirmWin.Button_accept.Clicked +=
+                                                       new 
EventHandler(on_overwrite_file_jumps_simple_capture_save_image_accepted);
+                                       else if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
                                                confirmWin.Button_accept.Clicked +=
                                                        new 
EventHandler(on_overwrite_file_jumps_profile_save_image_accepted);
                                        else if(checkFileOp == 
Constants.CheckFileOp.JUMPS_DJ_OPTIMAL_FALL_SAVE_IMAGE)
@@ -2336,7 +2352,9 @@ public partial class ChronoJumpWindow
                                                        new 
EventHandler(on_overwrite_file_raceAnalyzer_save_table_accepted);
 
                                } else {
-                                       if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
+                                       if(checkFileOp == 
Constants.CheckFileOp.JUMPS_SIMPLE_CAPTURE_SAVE_IMAGE)
+                                               on_button_jumps_simple_capture_save_image_selected 
(exportFileName);
+                                       else if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
                                                on_button_jumps_profile_save_image_selected (exportFileName);
                                        else if(checkFileOp == 
Constants.CheckFileOp.JUMPS_DJ_OPTIMAL_FALL_SAVE_IMAGE)
                                                on_button_jumps_dj_optimal_fall_save_image_selected 
(exportFileName);
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index a9548946..2cd48943 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -113,6 +113,10 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Label label_start_selector_races;
        [Widget] Gtk.Label label_start_selector_encoder;
 
+       //jumps
+       [Widget] Gtk.Image image_button_jumps_simple_capture_save_image_chart;
+       [Widget] Gtk.Image image_button_jumps_simple_capture_save_image_disk;
+
        //run
        [Widget] Gtk.Image image_run_execute_running;
        [Widget] Gtk.Image image_run_execute_photocell;
@@ -800,6 +804,7 @@ public partial class ChronoJumpWindow
                UtilGtk.ColorsCheckbox(viewport_chronopics, check_encoder_analyze_show_time_to_peak_power);
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_analyze.png");
+               image_button_jumps_simple_capture_save_image_chart.Pixbuf = pixbuf;
                image_encoder_analyze_stats.Pixbuf = pixbuf;
                image_encoder_capture_image_save.Pixbuf = pixbuf;
                image_encoder_analyze_image_save.Pixbuf = pixbuf;
@@ -821,6 +826,7 @@ public partial class ChronoJumpWindow
                image_run_encoder_analyze_image_save_graph.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "save.png");
+               image_button_jumps_simple_capture_save_image_disk.Pixbuf = pixbuf;
                image_jumps_rj_fatigue_image_save.Pixbuf = pixbuf;
                image_sprint_analyze_table_save_1.Pixbuf = pixbuf;
                image_button_encoder_exercise_actions_edit_do.Pixbuf = pixbuf;
diff --git a/src/gui/app1/jump.cs b/src/gui/app1/jump.cs
index b39e0113..73a12706 100644
--- a/src/gui/app1/jump.cs
+++ b/src/gui/app1/jump.cs
@@ -48,6 +48,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.RadioButton extra_window_jumps_radiobutton_weight;
        [Widget] Gtk.Label extra_window_jumps_label_weight;
        [Widget] Gtk.CheckButton extra_window_jumps_check_dj_arms;
+       [Widget] Gtk.Button button_jumps_simple_capture_save_image;
 
        //show weight on kg when percent is selected (SJl, CMJl, ABKl)
        [Widget] Gtk.Label label_extra_window_jumps_radiobutton_weight_percent_as_kg;
@@ -669,6 +670,36 @@ public partial class ChronoJumpWindow
                notebook_contacts_capture_doing_wait.CurrentPage = 0;
        }
 
+       // ---- save jumps simple image start ---->
+
+       private void on_button_jumps_simple_capture_save_image_clicked (object o, EventArgs args)
+       {
+               checkFile(Constants.CheckFileOp.JUMPS_SIMPLE_CAPTURE_SAVE_IMAGE);
+       }
+
+       private void on_button_jumps_simple_capture_save_image_selected (string destination)
+       {
+               if(event_execute_drawingarea == null)
+                       return;
+
+               Gdk.Pixbuf pixbuf = Gdk.Pixbuf.FromDrawable(event_execute_drawingarea.GdkWindow, 
Gdk.Colormap.System,
+                               0, 0, 0, 0,
+                               UtilGtk.WidgetWidth(event_execute_drawingarea),
+                               UtilGtk.WidgetHeight(event_execute_drawingarea) );
+
+               LogB.Information("Saving");
+               pixbuf.Save(destination,"png");
+       }
+       private void on_overwrite_file_jumps_simple_capture_save_image_accepted (object o, EventArgs args)
+       {
+               on_button_jumps_simple_capture_save_image_selected (exportFileName);
+
+               string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+               new DialogMessage(Constants.MessageTypes.INFO, myString);
+       }
+
+       // <---- save jumps simple image end ----
+
 }
 
 


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