[chronojump] Encoder capture graphs bar can be saved
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder capture graphs bar can be saved
- Date: Fri, 4 Dec 2020 16:34:29 +0000 (UTC)
commit 158fd973bf8d0af8aef72b55ee1bf1a1ec36d749
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Dec 4 17:34:08 2020 +0100
Encoder capture graphs bar can be saved
glade/app1.glade | 62 ++++++++++++++++++++++++++++++++++++++++++++++---
src/constants.cs | 2 +-
src/gui/app1/encoder.cs | 50 +++++++++++++++++++++++++++++++++++----
src/gui/app1/icons.cs | 4 ++++
4 files changed, 109 insertions(+), 9 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index dc0d585f..8acf2bc0 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -23217,6 +23217,12 @@ Concentric</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
@@ -28297,6 +28303,17 @@ Concentric</property>
<property name="can_focus">False</property>
<property name="spacing">12</property>
<child>
+ <widget class="GtkLabel"
id="label_encoder_curve_action">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
<widget class="GtkHBox"
id="hbox_encoder_capture_curves_save_all_none">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -28386,19 +28403,52 @@ Concentric</property>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton"
id="button_encoder_capture_image_save">
+ <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_encoder_capture_image_save_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkHBox" id="hbox340">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage"
id="image_encoder_capture_image_save">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
- <widget class="GtkLabel"
id="label_encoder_curve_action">
+ <widget class="GtkImage"
id="image_encoder_capture_image_save_1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property
name="stock">gtk-missing-image</property>
+ </widget>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
@@ -36237,6 +36287,12 @@ then click this button.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">False</property>
diff --git a/src/constants.cs b/src/constants.cs
index b9a42af8..01b4aa0a 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -1106,7 +1106,7 @@ public class Constants
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_SPRINT_SAVE_IMAGE,
- ENCODER_CAPTURE_EXPORT_ALL, ENCODER_ANALYZE_SAVE_IMAGE,
+ ENCODER_CAPTURE_EXPORT_ALL, ENCODER_CAPTURE_SAVE_IMAGE, ENCODER_ANALYZE_SAVE_IMAGE,
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,
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index a928ed6d..2b1e2b57 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -140,6 +140,7 @@ public partial class ChronoJumpWindow
[Widget] Gtk.Label label_encoder_capture_curves_save;
[Widget] Gtk.ComboBox combo_encoder_capture_curves_save;
[Widget] Gtk.Button button_encoder_capture_curves_save;
+ [Widget] Gtk.Button button_encoder_capture_image_save;
[Widget] Gtk.Notebook notebook_analyze_results;
[Widget] Gtk.Box hbox_combo_encoder_exercise_analyze;
@@ -2128,6 +2129,8 @@ public partial class ChronoJumpWindow
if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_EXPORT_ALL)
nameString += "_encoder_set_export.csv";
+ else if(checkFileOp == Constants.CheckFileOp.ENCODER_CAPTURE_SAVE_IMAGE)
+ nameString += "_encoder_set.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)
@@ -2211,12 +2214,15 @@ public partial class ChronoJumpWindow
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_SAVE_IMAGE)
+ confirmWin.Button_accept.Clicked +=
+ new
EventHandler(on_overwrite_file_encoder_capture_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);
else if(checkFileOp ==
Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE)
confirmWin.Button_accept.Clicked +=
- new
EventHandler(on_overwrite_file_encoder_save_image_accepted);
+ new
EventHandler(on_overwrite_file_encoder_analyze_save_image_accepted);
else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
confirmWin.Button_accept.Clicked +=
new
EventHandler(on_overwrite_file_encoder_save_AB_accepted);
@@ -2255,10 +2261,12 @@ public partial class ChronoJumpWindow
on_button_jumps_rj_fatigue_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_SAVE_IMAGE)
+ on_button_encoder_capture_save_image_file_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)
- on_button_encoder_save_image_file_selected (exportFileName);
+ on_button_encoder_analyze_save_image_file_selected
(exportFileName);
else if(checkFileOp == Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_AB)
on_button_encoder_save_AB_file_selected (exportFileName);
else if(checkFileOp ==
Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_TABLE)
@@ -2311,9 +2319,16 @@ public partial class ChronoJumpWindow
exportFileName) +
Constants.GetSpreadsheetString(preferences.CSVExportDecimalSeparator);
new DialogMessage(Constants.MessageTypes.INFO, myString);
}
- private void on_overwrite_file_encoder_save_image_accepted(object o, EventArgs args)
+ private void on_overwrite_file_encoder_capture_save_image_accepted(object o, EventArgs args)
+ {
+ on_button_encoder_capture_save_image_file_selected (exportFileName);
+
+ string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
+ new DialogMessage(Constants.MessageTypes.INFO, myString);
+ }
+ private void on_overwrite_file_encoder_analyze_save_image_accepted(object o, EventArgs args)
{
- on_button_encoder_save_image_file_selected (exportFileName);
+ on_button_encoder_analyze_save_image_file_selected (exportFileName);
string myString = string.Format(Catalog.GetString("Saved to {0}"), exportFileName);
new DialogMessage(Constants.MessageTypes.INFO, myString);
@@ -4469,6 +4484,29 @@ public partial class ChronoJumpWindow
button_encoder_analyze_sensitiveness();
}
+ void on_button_encoder_capture_image_save_clicked (object o, EventArgs args)
+ {
+ checkFile(Constants.CheckFileOp.ENCODER_CAPTURE_SAVE_IMAGE);
+ }
+ void on_button_encoder_capture_save_image_file_selected (string destination)
+ {
+ try {
+ if(encoder_capture_curves_bars_drawingarea == null)
+ return;
+
+ Gdk.Pixbuf pixbuf =
Gdk.Pixbuf.FromDrawable(encoder_capture_curves_bars_drawingarea.GdkWindow, Gdk.Colormap.System,
+ 0, 0, 0, 0,
+ UtilGtk.WidgetWidth(encoder_capture_curves_bars_drawingarea),
+ UtilGtk.WidgetHeight(encoder_capture_curves_bars_drawingarea) );
+
+ LogB.Information("Saving");
+ pixbuf.Save(destination,"png");
+ } catch {
+ string myString = string.Format(
+ Catalog.GetString("Cannot save file {0} "), destination);
+ new DialogMessage(Constants.MessageTypes.WARNING, myString);
+ }
+ }
void on_button_encoder_analyze_image_save_clicked (object o, EventArgs args)
{
/* file is in:
@@ -4480,7 +4518,7 @@ public partial class ChronoJumpWindow
checkFile(Constants.CheckFileOp.ENCODER_ANALYZE_SAVE_IMAGE);
}
- void on_button_encoder_save_image_file_selected (string destination)
+ void on_button_encoder_analyze_save_image_file_selected (string destination)
{
try {
File.Copy(UtilEncoder.GetEncoderGraphTempFileName(), destination, true);
@@ -5117,6 +5155,7 @@ public partial class ChronoJumpWindow
//c3 hbox_encoder_capture_curves_save_all_none, button_export_encoder_signal,
// button_encoder_delete_signal, vbox_encoder_signal_comment,
// and images: image_encoder_capture , image_encoder_analyze.Sensitive. Update: both NOT
managed here
+ // button_encoder_capture_image_save
//UNUSED c4 button_encoder_save_curve, entry_encoder_curve_comment
//c5 button_encoder_analyze
//c6 button_encoder_analyze_data_select_curves
@@ -5179,6 +5218,7 @@ public partial class ChronoJumpWindow
button_export_encoder_signal.Sensitive = Util.IntToBool(table[3]);
button_encoder_delete_signal.Sensitive = Util.IntToBool(table[3]);
vbox_encoder_signal_comment.Sensitive = Util.IntToBool(table[3]);
+ button_encoder_capture_image_save.Sensitive = Util.IntToBool(table[3]);
//image_encoder_capture.Sensitive = Util.IntToBool(table[3]);
//image_encoder_analyze.Sensitive = Util.IntToBool(table[3]);
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index b40d87db..212ba061 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_video_contacts_preview;
[Widget] Gtk.Image image_video_encoder_preview;
+ [Widget] Gtk.Image image_encoder_capture_image_save;
+ [Widget] Gtk.Image image_encoder_capture_image_save_1;
[Widget] Gtk.Image image_encoder_capture_curves_save;
[Widget] Gtk.Image image_encoder_analyze_table_save_1;
[Widget] Gtk.Image image_encoder_analyze_image_save_1;
@@ -725,6 +727,7 @@ public partial class ChronoJumpWindow
pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_analyze.png");
image_encoder_analyze_stats.Pixbuf = pixbuf;
+ image_encoder_capture_image_save.Pixbuf = pixbuf;
image_encoder_analyze_image_save.Pixbuf = pixbuf;
image_forcesensor_analyze_save_signal.Pixbuf = pixbuf;
image_forcesensor_analyze_save_rfd_auto.Pixbuf = pixbuf;
@@ -746,6 +749,7 @@ public partial class ChronoJumpWindow
image_jumps_rj_fatigue_image_save.Pixbuf = pixbuf;
image_encoder_capture_curves_save.Pixbuf = pixbuf;
image_encoder_analyze_table_save_1.Pixbuf = pixbuf;
+ image_encoder_capture_image_save_1.Pixbuf = pixbuf;
image_encoder_analyze_image_save_1.Pixbuf = pixbuf;
image_encoder_analyze_1RM_save_1.Pixbuf = pixbuf;
image_encoder_analyze_image_save_2.Pixbuf = pixbuf;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]