[chronojump] Fixing reconnect USB cable on OSX (once jumps capture	has been done)
- From: Xavier de Blas <xaviblas src gnome org>
 
- To: commits-list gnome org
 
- Cc: 
 
- Subject: [chronojump] Fixing reconnect USB cable on OSX (once jumps capture	has been done)
 
- Date: Mon, 17 Oct 2016 15:19:51 +0000 (UTC)
 
commit d5e6f1c6f3bb548c425ebb06641d10b5f751d9cb
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Oct 17 17:19:09 2016 +0200
    Fixing reconnect USB cable on OSX (once jumps capture has been done)
 src/gui/chronojump.cs        |   12 ++++++++++--
 src/gui/chronopicRegister.cs |   14 +++++++++++++-
 2 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index f774fd8..119c8d8 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -6769,8 +6769,16 @@ LogB.Debug("X");
                ChronopicRegisterSelectOS cros = new ChronopicRegisterSelectOS();
                chronopicRegister = cros.Do();
 
-               if(openWindow)
-                       new ChronopicRegisterWindow(app1, chronopicRegister.Crpl.L);
+               if(openWindow) {
+                       ChronopicRegisterWindow crWin = new ChronopicRegisterWindow(app1, 
chronopicRegister.Crpl.L);
+                       crWin.FakeButtonCloseSerialPort.Clicked += new EventHandler(closeSerialPort);
+               }
+       }
+
+       //trying to fix when an OSX disconnects and reconnects same chronopic (and it has captured)
+       private void closeSerialPort (object o, EventArgs args)
+       {
+               cp2016.SerialPortsCloseIfNeeded();
        }
 
        //start/end auto mode
diff --git a/src/gui/chronopicRegister.cs b/src/gui/chronopicRegister.cs
index 1c93474..63e8978 100644
--- a/src/gui/chronopicRegister.cs
+++ b/src/gui/chronopicRegister.cs
@@ -62,6 +62,7 @@ public class ChronopicRegisterWindow
 {
        Gtk.Window chronopic_register_win;
        Gtk.VBox vbox_main;
+       public Gtk.Button FakeButtonCloseSerialPort;
 
        public ChronopicRegisterWindow(Gtk.Window app1, List<ChronopicRegisterPort> list)
        {
@@ -278,7 +279,11 @@ public class ChronopicRegisterWindow
 
        private void createButton()
        {
-               Gtk.Button button = new Gtk.Button("Close");
+               FakeButtonCloseSerialPort = new Gtk.Button();
+               Gtk.Button button_close_serial_port = new Gtk.Button("Close serial port (debug)");
+               button_close_serial_port.Clicked += new EventHandler(on_button_close_serial_port_clicked);
+
+               Gtk.Button button = new Gtk.Button("Close Window");
                button.Clicked += new EventHandler(on_button_clicked);
 
                //button can be called clicking Escape key
@@ -291,10 +296,17 @@ public class ChronopicRegisterWindow
                          Gtk.AccelFlags.Visible));
 
                Gtk.HButtonBox hbox = new Gtk.HButtonBox ();
+               hbox.Add(button_close_serial_port);
                hbox.Add(button);
 
                vbox_main.Add(hbox);
        }
+       
+       private void on_button_close_serial_port_clicked(object o, EventArgs args)
+       {
+               //try first to see if a sp is opened on a cp but that /ttyusbserial does not exists
+               FakeButtonCloseSerialPort.Click();
+       }
 
        private void on_button_clicked(object o, EventArgs args)
        {
[
Date Prev][
Date Next]   [
Thread Prev][
Thread Next]   
[
Thread Index]
[
Date Index]
[
Author Index]