[chronojump] ForceSensor uses board window



commit 41f6ef1f0efd7b3c244a636a31c860711ff5c42a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon May 22 17:34:50 2017 +0200

    ForceSensor uses board window

 glade/app1.glade       |   60 +++++++----------------------------------------
 src/gui/chronojump.cs  |   14 +++++++----
 src/gui/forceSensor.cs |   30 +-----------------------
 3 files changed, 19 insertions(+), 85 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index cb36d17..cc30dc1 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1254,6 +1254,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>
@@ -4200,56 +4203,8 @@ EncoderInertialCapture</property>
                                                             <property name="can_focus">False</property>
                                                             <property name="spacing">4</property>
                                                             <child>
-                                                            <widget class="GtkLabel" id="label256">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="label">Serial port</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_combo_force_sensor_ports">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <child>
-                                                            <placeholder/>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">False</property>
-                                                            <property name="position">1</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
-                                                            <widget class="GtkButton" 
id="button_force_sensor_ports_reload">
-                                                            <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_force_sensor_ports_reload_clicked" swapped="no"/>
-                                                            <child>
-                                                            <widget class="GtkImage" id="image4">
-                                                            <property name="visible">True</property>
-                                                            <property name="can_focus">False</property>
-                                                            <property name="stock">gtk-refresh</property>
-                                                            <property name="icon-size">1</property>
-                                                            </widget>
-                                                            </child>
-                                                            </widget>
-                                                            <packing>
-                                                            <property name="expand">False</property>
-                                                            <property name="fill">True</property>
-                                                            <property name="position">2</property>
-                                                            </packing>
-                                                            </child>
-                                                            <child>
                                                             <widget class="GtkButton" 
id="button_force_sensor_graph">
-                                                            <property name="label" 
translatable="yes">Graph</property>
+                                                            <property name="label" translatable="yes">Load 
file</property>
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">True</property>
                                                             <property name="receives_default">True</property>
@@ -4259,7 +4214,7 @@ EncoderInertialCapture</property>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="padding">20</property>
-                                                            <property name="position">3</property>
+                                                            <property name="position">0</property>
                                                             </packing>
                                                             </child>
                                                             <child>
@@ -4274,7 +4229,7 @@ EncoderInertialCapture</property>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
                                                             <property name="padding">20</property>
-                                                            <property name="position">4</property>
+                                                            <property name="position">1</property>
                                                             </packing>
                                                             </child>
                                                             </widget>
@@ -20315,6 +20270,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 521226b..a041ff4 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -268,7 +268,6 @@ public partial class ChronoJumpWindow
 
        [Widget] Gtk.Box vbox_execute_test;
        [Widget] Gtk.Button button_execute_test;
-       [Widget] Gtk.HBox hbox_chronopics_and_threshold;
        [Widget] Gtk.Viewport viewport_chronopics;
        //[Widget] Gtk.Label label_chronopic_encoder;
        //[Widget] Gtk.Image image_chronopic_encoder_no;
@@ -576,7 +575,6 @@ public partial class ChronoJumpWindow
                //reaction_times has no combo
                createComboPulses();
                //createComboMultiChronopic();
-               createComboForceSensorPorts(true);
                createdStatsWin = false;
                
                repetitiveConditionsWin = RepetitiveConditionsWindow.Create();
@@ -2817,7 +2815,6 @@ public partial class ChronoJumpWindow
 
                hbox_other.Visible = false;
                vbox_last_test_buttons.Sensitive = false;
-               hbox_chronopics_and_threshold.Visible = true;
 
                //all modes except force sensor show the tabs at bottom
                notebook_capture_graph_table.CurrentPage = 0; //"Show graph"
@@ -3003,7 +3000,6 @@ public partial class ChronoJumpWindow
                        //notebook_capture_analyze.ShowTabs = false; //only capture tab is shown (only valid 
for "OTHER" tests)
                        hbox_contacts_sup_capture_analyze_two_buttons.Visible = false;
                        //notebook_capture_analyze.GetNthPage(2).Hide(); //hide jumpsProfile on other tests
-                       hbox_chronopics_and_threshold.Visible = false;
                        hbox_results_legend.Visible = false;
 
                        //on force sensor only show table
@@ -3577,7 +3573,15 @@ public partial class ChronoJumpWindow
                         * force sensor is not FTDI
                         on_force_sensor_activate(canCaptureC);
                         */
-                       forceSensorCapture();
+
+                       int numForceSensor = chronopicRegister.NumConnectedOfType(
+                                       ChronopicRegisterPort.Types.ARDUINO_FORCE);
+
+                       if(numForceSensor == 0)
+                               new DialogMessage(Constants.MessageTypes.WARNING, "Sensor not found.");
+                       else
+                               forceSensorCapture();
+
                        return;
                }
 
diff --git a/src/gui/forceSensor.cs b/src/gui/forceSensor.cs
index 8773bab..4eedaad 100644
--- a/src/gui/forceSensor.cs
+++ b/src/gui/forceSensor.cs
@@ -29,8 +29,6 @@ using System.Collections.Generic; //List<T>
 
 public partial class ChronoJumpWindow 
 {
-       [Widget] Gtk.HBox hbox_combo_force_sensor_ports;
-       [Widget] Gtk.ComboBox combo_force_sensor_ports;
        [Widget] Gtk.Label label_force_sensor_value_max;
        [Widget] Gtk.Label label_force_sensor_value;
        [Widget] Gtk.Label label_force_sensor_value_min;
@@ -38,8 +36,6 @@ public partial class ChronoJumpWindow
        [Widget] Gtk.Viewport viewport_force_sensor_graph;
        [Widget] Gtk.Image image_force_sensor_graph;
        
-       CjComboForceSensorPorts comboForceSensorPorts;
-
        Thread forceThread;
        static bool forceProcessFinish;
        static bool forceProcessCancel;
@@ -57,34 +53,10 @@ public partial class ChronoJumpWindow
        static bool forceCaptureStartMark;      //Just needed to display "Capturing message"
        static double forceSensorLast;          //Needed to display value and move vscale
 
-       private void on_button_force_sensor_ports_reload_clicked(object o, EventArgs args)
-       {
-               createComboForceSensorPorts(false);
-       }
-
-       private void createComboForceSensorPorts(bool create) 
-       {
-               if(comboForceSensorPorts == null)
-                       create = true;
-
-               if(create)
-               {
-                       //LogB.Information("CREATE");
-                       comboForceSensorPorts = new CjComboForceSensorPorts(combo_force_sensor_ports, 
hbox_combo_force_sensor_ports);
-                       combo_force_sensor_ports = comboForceSensorPorts.Combo;
-                       //combo_force_sensor_ports.Changed += new EventHandler 
(on_combo_force_sensor_ports_changed);
-               } else {
-                       //LogB.Information("NO CREATE");
-                       comboForceSensorPorts.FillNoTranslate();
-                       combo_force_sensor_ports = comboForceSensorPorts.Combo;
-               }
-               combo_force_sensor_ports.Sensitive = true;
-       }
-
        string forceSensorPortName;
        private void forceSensorCapture()
        {
-               forceSensorPortName = UtilGtk.ComboGetActive(combo_force_sensor_ports);
+               forceSensorPortName = 
chronopicRegister.ConnectedOfType(ChronopicRegisterPort.Types.ARDUINO_FORCE).Port;
                if(forceSensorPortName == null || forceSensorPortName == "")
                {
                        new DialogMessage(Constants.MessageTypes.WARNING, "Please, select port");


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