[chronojump] Runs simple capture tab graph can be saved
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Runs simple capture tab graph can be saved
- Date: Wed, 12 May 2021 10:44:22 +0000 (UTC)
commit 7fb8cca6e516833a90406bf06220df4ff91f1c7f
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed May 12 12:43:52 2021 +0200
Runs simple capture tab graph can be saved
glade/app1.glade | 57 +++++++++++++++++++++++++++++++++++++++++++++-
src/constants.cs | 1 +
src/gui/app1/chronojump.cs | 2 ++
src/gui/app1/encoder.cs | 18 ++++++++++++---
src/gui/app1/icons.cs | 4 ++++
src/gui/app1/run.cs | 32 ++++++++++++++++++++++++++
6 files changed, 110 insertions(+), 4 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index c023c98c..3bd24c57 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -8291,13 +8291,17 @@ EncoderInertialCapture</property>
</packing>
</child>
<child>
+ <widget class="GtkVBox" id="vbox255">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <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">
+ <widget class="GtkVBox" id="vbox259">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">4</property>
@@ -8329,6 +8333,57 @@ EncoderInertialCapture</property>
</child>
</widget>
<packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_runs_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_runs_simple_capture_save_image_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkVBox" id="vbox260">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage"
id="image_button_runs_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_runs_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">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack_type">end</property>
diff --git a/src/constants.cs b/src/constants.cs
index 0ff94c34..433b029e 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -1112,6 +1112,7 @@ public class Constants
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_SIMPLE_CAPTURE_SAVE_IMAGE,
RUNS_EVOLUTION_SAVE_IMAGE,
RUNS_SPRINT_SAVE_IMAGE,
RUNS_SPRINT_EXPORT_INDIVIDUAL_CURRENT_SESSION_NO_IMAGES,
RUNS_SPRINT_EXPORT_GROUPAL_CURRENT_SESSION_NO_IMAGES,
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index 5bb23da6..5f04e74f 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -3153,6 +3153,7 @@ public partial class ChronoJumpWindow
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;
+ button_runs_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;
@@ -3269,6 +3270,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 = true;
+ button_runs_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 caf96db2..a33399bd 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -2104,6 +2104,7 @@ public partial class ChronoJumpWindow
checkFileOp == Constants.CheckFileOp.JUMPS_WEIGHT_FV_PROFILE_SAVE_IMAGE ||
checkFileOp == Constants.CheckFileOp.JUMPS_EVOLUTION_SAVE_IMAGE ||
checkFileOp == Constants.CheckFileOp.JUMPS_RJ_FATIGUE_SAVE_IMAGE ||
+ checkFileOp == Constants.CheckFileOp.RUNS_SIMPLE_CAPTURE_SAVE_IMAGE ||
checkFileOp == Constants.CheckFileOp.RUNS_EVOLUTION_SAVE_IMAGE ||
checkFileOp == Constants.CheckFileOp.RUNS_SPRINT_SAVE_IMAGE ||
checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE ||
@@ -2172,17 +2173,23 @@ 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)
+ else if(
+ checkFileOp == Constants.CheckFileOp.JUMPS_SIMPLE_CAPTURE_SAVE_IMAGE ||
+ checkFileOp == Constants.CheckFileOp.RUNS_SIMPLE_CAPTURE_SAVE_IMAGE)
{
//if showing all persons, do not person name on filename
if(radio_contacts_graph_allPersons.Active)
nameString = currentSession.DateShortAsSQL;
+ string testType = "_" + Catalog.GetString("jumps") + "_";
+ if(checkFileOp == Constants.CheckFileOp.RUNS_SIMPLE_CAPTURE_SAVE_IMAGE)
+ testType = "_" + Catalog.GetString("races") + "_";
+
//if showing a jump or all, show on filename
if(radio_contacts_graph_allTests.Active)
- nameString += "_jumps_" + Catalog.GetString("all") + ".png";
+ nameString += testType + Catalog.GetString("all") + ".png";
else
- nameString += "_jumps_" + radio_contacts_graph_currentTest.Label + ".png";
+ nameString += testType + radio_contacts_graph_currentTest.Label + ".png";
}
else if(checkFileOp == Constants.CheckFileOp.JUMPS_PROFILE_SAVE_IMAGE)
nameString += "_jumps_profile.png";
@@ -2296,6 +2303,9 @@ public partial class ChronoJumpWindow
else if(checkFileOp ==
Constants.CheckFileOp.JUMPS_RJ_FATIGUE_SAVE_IMAGE)
confirmWin.Button_accept.Clicked +=
new
EventHandler(on_overwrite_file_jumps_rj_fatigue_save_image_accepted);
+ if(checkFileOp ==
Constants.CheckFileOp.RUNS_SIMPLE_CAPTURE_SAVE_IMAGE)
+ confirmWin.Button_accept.Clicked +=
+ new
EventHandler(on_overwrite_file_runs_simple_capture_save_image_accepted);
else if(checkFileOp ==
Constants.CheckFileOp.RUNS_EVOLUTION_SAVE_IMAGE)
confirmWin.Button_accept.Clicked +=
new
EventHandler(on_overwrite_file_runs_evolution_save_image_accepted);
@@ -2364,6 +2374,8 @@ public partial class ChronoJumpWindow
on_button_jumps_evolution_save_image_selected
(exportFileName);
else if(checkFileOp ==
Constants.CheckFileOp.JUMPS_RJ_FATIGUE_SAVE_IMAGE)
on_button_jumps_rj_fatigue_save_image_selected
(exportFileName);
+ else if(checkFileOp ==
Constants.CheckFileOp.RUNS_SIMPLE_CAPTURE_SAVE_IMAGE)
+ on_button_runs_simple_capture_save_image_selected
(exportFileName);
else if(checkFileOp ==
Constants.CheckFileOp.RUNS_EVOLUTION_SAVE_IMAGE)
on_button_runs_evolution_save_image_selected (exportFileName);
else if(checkFileOp == Constants.CheckFileOp.RUNS_SPRINT_SAVE_IMAGE)
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index 2cd48943..f5e80b21 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -118,6 +118,8 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Image image_button_jumps_simple_capture_save_image_disk;
//run
+ [Widget] Gtk.Image image_button_runs_simple_capture_save_image_chart;
+ [Widget] Gtk.Image image_button_runs_simple_capture_save_image_disk;
[Widget] Gtk.Image image_run_execute_running;
[Widget] Gtk.Image image_run_execute_photocell;
[Widget] Gtk.Image image_sprint_analyze_save;
@@ -805,6 +807,7 @@ public partial class ChronoJumpWindow
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_analyze.png");
image_button_jumps_simple_capture_save_image_chart.Pixbuf = pixbuf;
+ image_button_runs_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;
@@ -827,6 +830,7 @@ public partial class ChronoJumpWindow
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "save.png");
image_button_jumps_simple_capture_save_image_disk.Pixbuf = pixbuf;
+ image_button_runs_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/run.cs b/src/gui/app1/run.cs
index 7af98dbf..9d3b8c59 100644
--- a/src/gui/app1/run.cs
+++ b/src/gui/app1/run.cs
@@ -40,6 +40,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Button button_runs_simple_track_distance;
[Widget] Gtk.Label label_runs_simple_track_distance_value;
[Widget] Gtk.Label label_runs_simple_track_distance_units;
+ [Widget] Gtk.Button button_runs_simple_capture_save_image;
//options runs interval
[Widget] Gtk.Button button_combo_runs_interval_exercise_capture_left;
@@ -452,6 +453,37 @@ public partial class ChronoJumpWindow
);
}
+
+ // ---- save runs simple image start ---->
+
+ private void on_button_runs_simple_capture_save_image_clicked (object o, EventArgs args)
+ {
+ checkFile(Constants.CheckFileOp.RUNS_SIMPLE_CAPTURE_SAVE_IMAGE);
+ }
+
+ private void on_button_runs_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_runs_simple_capture_save_image_accepted (object o, EventArgs args)
+ {
+ on_button_runs_simple_capture_save_image_selected (exportFileName);
+
+ string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+ new DialogMessage(Constants.MessageTypes.INFO, myString);
+ }
+
+ // <---- save runs simple image end ----
+
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]