[chronojump] contacts detect calls for forceSensor, raceAnalyzer, wichro and caller button



commit d230589fdf9aaa4b9f4080feab3ea5bfb74b34f2
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed May 4 12:23:35 2022 +0200

    contacts detect calls for forceSensor, raceAnalyzer, wichro and caller button

 glade/app1.glade           | 94 ++++++++++++++++++++++++++++++++++++++--------
 src/gui/app1/chronojump.cs | 53 ++++++++++++++++++++++++++
 src/gui/app1/icons.cs      |  4 ++
 3 files changed, 135 insertions(+), 16 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 77431c6a1..fcc50580e 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -5994,29 +5994,67 @@ EncoderInertialCapture</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">8</property>
                                                             <child>
-                                                            <widget class="GtkButton" 
id="button_execute_test">
+                                                            <widget class="GtkHBox" id="hbox118">
                                                             <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_contacts_detect">
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
                                                             <property name="has_tooltip">True</property>
-                                                            <signal name="clicked" 
handler="on_button_execute_test_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_button_contacts_detect_clicked" swapped="no"/>
                                                             <accelerator key="space" signal="clicked" 
modifiers="GDK_CONTROL_MASK"/>
                                                             <child>
-                                                            <widget class="GtkVBox" id="vbox70">
+                                                            <widget class="GtkVBox" id="vbox59">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <child>
-                                                            <widget class="GtkImage" 
id="image_button_execute">
+                                                            <widget class="GtkLabel" 
id="label_button_contacts_detect">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="label">Detect
+device</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_button_contacts_detect">
+                                                            <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="stock">gtk-apply</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">True</property>
+                                                            <property name="fill">True</property>
                                                             <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
+                                                            <widget class="GtkButton" 
id="button_execute_test">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <property name="has_tooltip">True</property>
+                                                            <signal name="clicked" 
handler="on_button_execute_test_clicked" swapped="no"/>
+                                                            <accelerator key="space" signal="clicked" 
modifiers="GDK_CONTROL_MASK"/>
+                                                            <child>
+                                                            <widget class="GtkVBox" id="vbox70">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_button_execute_connect">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -6025,6 +6063,17 @@ EncoderInertialCapture</property>
                                                             <packing>
                                                             <property name="expand">True</property>
                                                             <property name="fill">True</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkImage" 
id="image_button_execute">
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-apply</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
                                                             <property name="position">1</property>
                                                             </packing>
                                                             </child>
@@ -6032,6 +6081,13 @@ EncoderInertialCapture</property>
                                                             </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="position">0</property>
@@ -26300,6 +26356,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -32708,6 +32767,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>
@@ -32744,18 +32815,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>
@@ -42054,6 +42113,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/app1/chronojump.cs b/src/gui/app1/chronojump.cs
index cea4b753a..1ce2461fa 100644
--- a/src/gui/app1/chronojump.cs
+++ b/src/gui/app1/chronojump.cs
@@ -293,6 +293,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Button button_repair_selected_pulse;
 
        [Widget] Gtk.Box vbox_execute_test;
+       [Widget] Gtk.Button button_contacts_detect;
        [Widget] Gtk.Button button_execute_test;
        [Widget] Gtk.Viewport viewport_chronopics;
        [Widget] Gtk.Viewport viewport_chronopic_encoder;
@@ -3561,6 +3562,9 @@ public partial class ChronoJumpWindow
                hbox_drawingarea_realtime_capture_cairo.Visible = false;
                vbox_event_execute_drawingarea_run_interval_realtime_capture_cairo.Visible = false;
 
+               button_contacts_detect.Visible = false;
+               button_execute_test.Visible = true;
+
                //blank exercise options: useful for changing from jumps or runs to forceSensor, runEncoder, 
reaction time, other
                label_contacts_exercise_selected_name.Visible = true; //will not be visible when all the 
contacts_top combo is implemented
                label_contacts_exercise_selected_options.Text = "";
@@ -3664,6 +3668,9 @@ public partial class ChronoJumpWindow
                        else
                                button_execute_test_show_connect_or_execute(! 
cp2016.SuccededConnectContactsRealThread);
 
+                       button_contacts_detect.Visible = true;
+                       button_execute_test.Visible = false;
+
                        notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.CONTACTS);
                        //notebook_capture_analyze.ShowTabs = true;
                        hbox_contacts_sup_capture_analyze_two_buttons.Visible = true;
@@ -3849,6 +3856,8 @@ public partial class ChronoJumpWindow
                else if(m == Constants.Modes.FORCESENSOR)
                {
                        button_execute_test_show_connect_or_execute(false);
+                       button_contacts_detect.Visible = true;
+                       button_execute_test.Visible = false;
 
                        notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.CONTACTS);
                        notebooks_change(m);
@@ -3897,6 +3906,8 @@ public partial class ChronoJumpWindow
                else if(m == Constants.Modes.RUNSENCODER)
                {
                        button_execute_test_show_connect_or_execute(false);
+                       button_contacts_detect.Visible = true;
+                       button_execute_test.Visible = false;
 
                        notebook_sup.CurrentPage = Convert.ToInt32(notebook_sup_pages.CONTACTS);
                        notebooks_change(m);
@@ -4520,6 +4531,48 @@ public partial class ChronoJumpWindow
                dialogThreshold.DestroyDialog();
        }
 
+       //right now implemented only contacts
+       void on_button_contacts_detect_clicked (object o, EventArgs args)
+       {
+               if(
+                               current_mode != Constants.Modes.RUNSSIMPLE &&
+                               current_mode != Constants.Modes.RUNSINTERVALLIC &&
+                               current_mode != Constants.Modes.FORCESENSOR &&
+                               current_mode != Constants.Modes.RUNSENCODER)
+                       return;
+
+               ChronoDebug cDebug = new ChronoDebug("Discover " + current_mode.ToString());
+               cDebug.Start();
+
+               List<string> list_discover_ports = Util.StringArrayToListString (ChronopicPorts.GetPorts ());
+               if(list_discover_ports == null || list_discover_ports.Count == 0)
+               {
+                       new DialogMessage( Constants.MessageTypes.INFO,
+                                       string.Format(Catalog.GetPluralString(
+                                               "Found 1 device.",
+                                               "Found {0} devices.",
+                                               0),
+                                       0) );
+                       return;
+               }
+
+               MicroDiscover md = new MicroDiscover (list_discover_ports); //all ports
+               List<string> discovered_l = md.DiscoverOneMode (current_mode);
+
+               cDebug.StopAndPrint();
+
+               string discoveredStr = "Discovered: ";
+               foreach (string str in discovered_l)
+                       discoveredStr += "\n- " + str;
+
+               new DialogMessage( Constants.MessageTypes.INFO, discoveredStr +
+                               string.Format("\n{0} ms", cDebug.StartToEndInMs()) );
+
+
+               button_contacts_detect.Visible = false;
+               button_execute_test.Visible = true;
+       }
+
        void on_button_execute_test_clicked (object o, EventArgs args) 
        {
                if(current_mode == Constants.Modes.FORCESENSOR)
diff --git a/src/gui/app1/icons.cs b/src/gui/app1/icons.cs
index 3c9707b7a..bbc26b4b2 100644
--- a/src/gui/app1/icons.cs
+++ b/src/gui/app1/icons.cs
@@ -56,6 +56,7 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Image image_chronopic_connect_encoder;
        [Widget] Gtk.Image image_chronopic_connect_encoder1;
        [Widget] Gtk.Image image_chronopic_connect_encoder2;
+       [Widget] Gtk.Image image_button_contacts_detect;
        [Widget] Gtk.Image image_button_execute;
        [Widget] Gtk.Image image_contacts_bell;
        [Widget] Gtk.Image image_contacts_close_and_capture;
@@ -517,6 +518,9 @@ public partial class ChronoJumpWindow
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "zero.png");
                image_force_sensor_tare.Pixbuf = pixbuf;
                //pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "run_2x.png");
+
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_capture.png");
+               image_button_contacts_detect.Pixbuf = pixbuf;
                pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_capture_big.png");
                image_encoder_capture_execute.Pixbuf = pixbuf;
                image_button_execute.Pixbuf = pixbuf;


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