[chronojump] encoderRhythm wait pulsebar to image and label



commit fc67a00435d1ad487e2df725300167a2772219f1
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jan 24 15:51:06 2018 +0100

    encoderRhythm wait pulsebar to image and label

 glade/app1.glade                  |   34 +++++++++++++++++++++++++++++++---
 glade/repetitive_conditions.glade |    2 +-
 src/encoderRhythm.cs              |   16 ++++++++++++++++
 src/gui/chronojumpIcons.cs        |    2 ++
 src/gui/encoder.cs                |   11 ++++++-----
 src/gui/repetitiveConditions.cs   |    1 +
 6 files changed, 57 insertions(+), 9 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index c1ebfb0..50b158c 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1521,6 +1521,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>
@@ -16854,11 +16857,33 @@ Concentric</property>
                                                             </packing>
                                                             </child>
                                                             <child>
-                                                            <widget class="GtkProgressBar" 
id="encoder_pulsebar_rhythm_wait">
-                                                            <property name="width_request">120</property>
+                                                            <widget class="GtkHBox" id="hbox243">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">6</property>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_encoder_rhythm_rest">
+                                                            <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="GtkLabel" 
id="label_encoder_rhythm_rest">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
-                                                            <property 
name="pulse_step">0.050000000000000003</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">True</property>
@@ -22590,6 +22615,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/glade/repetitive_conditions.glade b/glade/repetitive_conditions.glade
index 0c7aa29..daabd00 100644
--- a/glade/repetitive_conditions.glade
+++ b/glade/repetitive_conditions.glade
@@ -3886,7 +3886,7 @@
                                             <property name="secondary_icon_activatable">False</property>
                                             <property name="primary_icon_sensitive">True</property>
                                             <property name="secondary_icon_sensitive">True</property>
-                                            <property name="adjustment">6 0.10000000000000001 99 0 0 
0</property>
+                                            <property name="adjustment">6 0.10000000000000001 99 
0.10000000000000001 1 0</property>
                                             <property name="climb_rate">1</property>
                                             <property name="digits">2</property>
                                           </widget>
diff --git a/src/encoderRhythm.cs b/src/encoderRhythm.cs
index 54a58da..a18a85d 100644
--- a/src/encoderRhythm.cs
+++ b/src/encoderRhythm.cs
@@ -57,10 +57,26 @@ public class EncoderRhythm
                RestClustersSeconds = restClustersSeconds;
        }
 
+       //this also affects to encoder automatic end time. Is deactivated if UseClusters()
        public bool UseClusters()
        {
                return (RepsCluster > 1);
        }
+
+       //to show or not image_encoder_rhythm_rest
+       public bool UseRest()
+       {
+               if(! Active)
+                       return false;
+
+               if(RestRepsSeconds > 0)
+                       return true;
+
+               if(UseClusters() && RestClustersSeconds > 0)
+                       return true;
+
+               return false;
+       }
 }
 
 public class EncoderRhythmExecute
diff --git a/src/gui/chronojumpIcons.cs b/src/gui/chronojumpIcons.cs
index 6d57dfe..22299b7 100644
--- a/src/gui/chronojumpIcons.cs
+++ b/src/gui/chronojumpIcons.cs
@@ -104,6 +104,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_encoder_calibrate;
        [Widget] Gtk.Image image_encoder_recalibrate;
        [Widget] Gtk.Image image_encoder_triggers;
+       [Widget] Gtk.Image image_encoder_rhythm_rest;
 
        //force sensor
        [Widget] Gtk.Image image_selector_start_force_sensor;
@@ -288,6 +289,7 @@ public partial class ChronoJumpWindow
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_rest.png");
                image_rest.Pixbuf = pixbuf;
+               image_encoder_rhythm_rest.Pixbuf = pixbuf;
 
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_visibility.png");
                image_all_persons_events.Pixbuf = pixbuf;
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 63eb88f..ba183e2 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -100,7 +100,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_encoder_capture;
        [Widget] Gtk.ProgressBar encoder_pulsebar_capture;
        [Widget] Gtk.ProgressBar encoder_pulsebar_rhythm_eccon;
-       [Widget] Gtk.ProgressBar encoder_pulsebar_rhythm_wait;
+       [Widget] Gtk.Label label_encoder_rhythm_rest;
        [Widget] Gtk.Image image_encoder_rhythm_alert;
        [Widget] Gtk.VBox vbox_encoder_signal_comment;
        [Widget] Gtk.Notebook notebook_encoder_signal_comment_rhythm_and_triggers;
@@ -5311,7 +5311,10 @@ public partial class ChronoJumpWindow
                                        reallyCutByTriggers = preferences.encoderCaptureCutByTriggers;
                                        notebook_encoder_signal_comment_rhythm_and_triggers.Page = 2;
                                } else if(encoderRhythm.Active)
+                               {
                                        notebook_encoder_signal_comment_rhythm_and_triggers.Page = 1;
+                                       image_encoder_rhythm_rest.Visible = encoderRhythm.UseRest();
+                               }
 
                                encoderRProcCapture.CutByTriggers = reallyCutByTriggers;
 
@@ -6024,7 +6027,7 @@ public partial class ChronoJumpWindow
                if(! encoderRhythmExecute.FirstRepetitionDone())
                {
                        encoder_pulsebar_rhythm_eccon.Fraction = 0;
-                       encoder_pulsebar_rhythm_wait.Fraction = 0;
+                       label_encoder_rhythm_rest.Text = "";
                        encoder_pulsebar_rhythm_eccon.Text = "Waiting 1st rep.";
                        return;
                }
@@ -6032,9 +6035,7 @@ public partial class ChronoJumpWindow
                encoderRhythmExecute.CalculateFractionsAndText();
                encoder_pulsebar_rhythm_eccon.Fraction = encoderRhythmExecute.FractionRepetition;
                encoder_pulsebar_rhythm_eccon.Text = encoderRhythmExecute.TextRepetition;
-               //TODO: this pulsebar should be a sofa and a label with seconds in one decimal
-               encoder_pulsebar_rhythm_wait.Fraction = encoderRhythmExecute.FractionRest;
-               encoder_pulsebar_rhythm_wait.Text = encoderRhythmExecute.TextRest;
+               label_encoder_rhythm_rest.Text = encoderRhythmExecute.TextRest;
 
                if(encoderRhythmExecute.FractionRepetition >= 1)
                        image_encoder_rhythm_alert.Visible = true;
diff --git a/src/gui/repetitiveConditions.cs b/src/gui/repetitiveConditions.cs
index b2a0b70..60cb1ba 100644
--- a/src/gui/repetitiveConditions.cs
+++ b/src/gui/repetitiveConditions.cs
@@ -594,6 +594,7 @@ public class RepetitiveConditionsWindow
 
        private void encoder_rhythm_set_values(EncoderRhythm encoderRhythm)
        {
+               check_rhythm_active.Active = encoderRhythm.Active;
                spin_rhythm_ecc.Value = encoderRhythm.EccSeconds;
                spin_rhythm_con.Value = encoderRhythm.ConSeconds;
                spin_rhythm_rest_reps.Value = encoderRhythm.RestRepsSeconds;


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