[chronojump] At networks show red icon and label if encoder or rfid disconnected



commit 34790de156b0d7aa1f52a40acb26e860e84794db
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Nov 5 14:32:09 2019 +0100

    At networks show red icon and label if encoder or rfid disconnected

 glade/app1.glade      | 161 +++++++++++++++++++++++++++++++++++++++++---------
 src/constants.cs      |   2 +-
 src/gui/chronojump.cs |   3 -
 src/gui/encoder.cs    |   6 ++
 src/gui/networks.cs   |  25 +++++++-
 5 files changed, 164 insertions(+), 33 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index a94d8583..87e1107f 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -22156,6 +22156,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -22593,6 +22596,120 @@ Concentric</property>
                                                     <property name="position">2</property>
                                                   </packing>
                                                 </child>
+                                                <child>
+                                                  <widget class="GtkVBox" id="vbox108">
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">False</property>
+                                                    <property name="spacing">4</property>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox_encoder_disconnected">
+                                                        <property name="can_focus">False</property>
+                                                        <child>
+                                                          <widget class="GtkImage" 
id="image_encoder_disconnected">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-no</property>
+                                                            <property name="icon-size">2</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_chronopic_disconnected">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xpad">5</property>
+                                                            <property name="label" 
translatable="yes">Encoder disconnected.</property>
+                                                            <property name="use_markup">True</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">False</property>
+                                                        <property name="fill">False</property>
+                                                        <property name="position">0</property>
+                                                      </packing>
+                                                    </child>
+                                                    <child>
+                                                      <widget class="GtkHBox" id="hbox_RFID_disconnected">
+                                                        <property name="can_focus">False</property>
+                                                        <child>
+                                                          <widget class="GtkImage" 
id="image_RFID_disconnected">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-no</property>
+                                                            <property name="icon-size">2</property>
+                                                          </widget>
+                                                          <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                          </packing>
+                                                        </child>
+                                                        <child>
+                                                          <widget class="GtkVBox" id="vbox110">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="spacing">2</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" 
id="label_RFID_disconnected">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="xpad">5</property>
+                                                            <property name="label" translatable="yes">RFID 
has been disconnected!</property>
+                                                            <property name="use_markup">True</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_RFID_disconnected1">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="xalign">0</property>
+                                                            <property name="xpad">5</property>
+                                                            <property name="label" 
translatable="yes">Please, connect it and restart Chronojump.</property>
+                                                            <property name="use_markup">True</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">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">1</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="expand">False</property>
+                                                    <property name="fill">True</property>
+                                                    <property name="position">3</property>
+                                                  </packing>
+                                                </child>
                                                 <child>
                                                   <widget class="GtkLabel" id="label_rfid_encoder_wait">
                                                     <property name="can_focus">False</property>
@@ -22601,7 +22718,7 @@ Concentric</property>
                                                   <packing>
                                                     <property name="expand">True</property>
                                                     <property name="fill">True</property>
-                                                    <property name="position">3</property>
+                                                    <property name="position">4</property>
                                                   </packing>
                                                 </child>
                                                 <child>
@@ -22741,7 +22858,7 @@ Concentric</property>
                                                   <packing>
                                                     <property name="expand">True</property>
                                                     <property name="fill">True</property>
-                                                    <property name="position">4</property>
+                                                    <property name="position">5</property>
                                                   </packing>
                                                 </child>
                                               </widget>
@@ -23990,19 +24107,6 @@ Concentric</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
-                                                            <child>
-                                                            <widget class="GtkLabel" 
id="label_chronopic_encoder">
-                                                            <property name="can_focus">False</property>
-                                                            <property name="xpad">5</property>
-                                                            <property name="label" 
translatable="yes">Encoder disconnected</property>
-                                                            <property name="use_markup">True</property>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">1</property>
-                                                            </packing>
-                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -24104,18 +24208,6 @@ 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>
@@ -24152,6 +24244,18 @@ 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>
@@ -31147,6 +31251,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 0c9ed4b7..f34eebd5 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -228,7 +228,7 @@ public class Constants
        //Compujump strings
        public static string RFIDDisconnectedMessage()
        {
-               return Catalog.GetString("RFID cable has been disconnected!") + "\n\n" +
+               return Catalog.GetString("RFID has been disconnected!") + "\n\n" +
                        Catalog.GetString("Please, connect it and restart Chronojump.");
        }
        public static string RFIDNotInServerMessage()
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 65a070d9..65312e7b 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -283,9 +283,6 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_execute_test;
        [Widget] Gtk.Viewport viewport_chronopics;
        [Widget] Gtk.Viewport viewport_chronopic_encoder;
-       //[Widget] Gtk.Label label_chronopic_encoder;
-       //[Widget] Gtk.Image image_chronopic_encoder_no;
-       //[Widget] Gtk.Image image_chronopic_encoder_yes;
 
        [Widget] Gtk.Label label_threshold;
 
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 94478f3f..99123164 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -701,6 +701,9 @@ public partial class ChronoJumpWindow
                        //open device window
                        on_chronopic_encoder_clicked(new object(), new EventArgs());
                        UtilGtk.DeviceColors(viewport_chronopic_encoder, false);
+                       if(configChronojump.Compujump)
+                               networksShowDeviceMissingEncoder(true);
+
                        return false;
                }
                if(numEncoders > 1) {
@@ -709,6 +712,9 @@ public partial class ChronoJumpWindow
                        return false;
                }
 
+               if(configChronojump.Compujump)
+                       networksShowDeviceMissingEncoder(false);
+
                UtilGtk.DeviceColors(viewport_chronopic_encoder, true);
                return true;
        }
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index c3aa6235..18812b75 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -77,6 +77,14 @@ public partial class ChronoJumpWindow
        //encoder ...
        [Widget] Gtk.Button button_encoder_monthly_change_current_session;
        [Widget] Gtk.Button button_encoder_analyze_image_compujump_send_email;
+       /*
+       [Widget] Gtk.Label label_RFID_disconnected;
+       [Widget] Gtk.Label label_chronopic_encoder;
+       [Widget] Gtk.Image image_chronopic_encoder_no;
+       [Widget] Gtk.Image image_chronopic_encoder_yes;
+       */
+       [Widget] Gtk.HBox hbox_encoder_disconnected;
+       [Widget] Gtk.HBox hbox_RFID_disconnected;
 
        //runsInterval
        [Widget] Gtk.HBox hbox_runs_interval_compujump;
@@ -197,6 +205,7 @@ public partial class ChronoJumpWindow
                        chronopicRegisterUpdate(false);
                        if(chronopicRegister != null && chronopicRegister.GetRfidPortName() != "")
                        {
+                               networksShowDeviceMissingRFID (false);
                                rfid = new RFID(chronopicRegister.GetRfidPortName());
                                rfid.FakeButtonChange.Clicked += new EventHandler(rfidChanged);
                                rfid.FakeButtonReopenDialog.Clicked += new EventHandler(rfidReopenDialog);
@@ -208,7 +217,8 @@ public partial class ChronoJumpWindow
 
                                LogB.ThreadStart();
                                threadRFID.Start();
-                       }
+                       } else
+                               networksShowDeviceMissingRFID (true);
 
                        if(configChronojump.CompujumpAdminEmail != "")
                                button_encoder_analyze_image_compujump_send_email.Visible = true;
@@ -513,7 +523,8 @@ public partial class ChronoJumpWindow
        {
                if(shouldShowRFIDDisconnected)
                {
-                       new DialogMessage(Constants.MessageTypes.WARNING, 
Constants.RFIDDisconnectedMessage());
+                       //new DialogMessage(Constants.MessageTypes.WARNING, 
Constants.RFIDDisconnectedMessage());
+                       networksShowDeviceMissingRFID (true);
 
                        if(dialogPersonPopup != null)
                                dialogPersonPopup.DestroyDialog();
@@ -1019,6 +1030,16 @@ public partial class ChronoJumpWindow
                //other future send email send objects
        }
 
+       private void networksShowDeviceMissingEncoder (bool missing)
+       {
+               hbox_encoder_disconnected.Visible = missing;
+       }
+
+       private void networksShowDeviceMissingRFID (bool missing)
+       {
+               hbox_RFID_disconnected.Visible = missing;
+       }
+
        /*
         *
         * This code uses a watcher to see changes on a filename


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