[chronojump/FS-TFT-Menu] Discover devices on preferences win / advanced



commit 18e2cad5d5b4f7940b485d3022ab79cd4fae748d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Apr 28 17:44:44 2022 +0200

    Discover devices on preferences win / advanced

 glade/preferences_win.glade | 15 ++++++++++++++-
 src/gui/preferences.cs      | 13 +++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)
---
diff --git a/glade/preferences_win.glade b/glade/preferences_win.glade
index 5f40a4b95..d68618726 100644
--- a/glade/preferences_win.glade
+++ b/glade/preferences_win.glade
@@ -6952,7 +6952,6 @@ version:</property>
                                                 <property name="visible">True</property>
                                                 <property name="can_focus">False</property>
                                                 <property name="spacing">8</property>
-                                                <property name="layout_style">spread</property>
                                                 <child>
                                                   <widget class="GtkButton" id="button1">
                                                     <property name="label" translatable="yes">SQL short 
test</property>
@@ -6981,6 +6980,20 @@ version:</property>
                                                     <property name="position">1</property>
                                                   </packing>
                                                 </child>
+                                                <child>
+                                                  <widget class="GtkButton" id="button_discover_devices">
+                                                    <property name="label">Discover devices</property>
+                                                    <property name="visible">True</property>
+                                                    <property name="can_focus">True</property>
+                                                    <property name="receives_default">True</property>
+                                                    <signal name="clicked" 
handler="on_button_discover_devices_clicked" swapped="no"/>
+                                                  </widget>
+                                                  <packing>
+                                                    <property name="expand">False</property>
+                                                    <property name="fill">False</property>
+                                                    <property name="position">2</property>
+                                                  </packing>
+                                                </child>
                                               </widget>
                                               <packing>
                                                 <property name="expand">True</property>
diff --git a/src/gui/preferences.cs b/src/gui/preferences.cs
index 3ac6141db..a1866309b 100644
--- a/src/gui/preferences.cs
+++ b/src/gui/preferences.cs
@@ -1770,6 +1770,19 @@ public class PreferencesWindow
 
        // <---- end SQL stress tests ----
 
+       private void on_button_discover_devices_clicked (object o, EventArgs args)
+       {
+               List<string> list_discover_ports = Util.StringArrayToListString (ChronopicPorts.GetPorts ());
+               ArduinoDiscover ad = new ArduinoDiscover (list_discover_ports); //all ports
+               List<string> discovered_l = ad.Discover ();
+
+               string discoveredStr = "Discovered: ";
+               foreach (string str in discovered_l)
+                       discoveredStr += "\n- " + str;
+
+               new DialogMessage(Constants.MessageTypes.INFO, discoveredStr);
+       }
+
        private void on_debug_mode_clicked (object o, EventArgs args) {
                //will be managed from gui/chronojump.cs
                FakeButtonDebugModeStart.Click();


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