[chronojump] chronopicWizard detects ports and GUI is nice.



commit 1e52d7ccd861d8da6745acc439f34e79171ce5f7
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Sep 7 14:26:49 2016 +0200

    chronopicWizard detects ports and GUI is nice.

 glade/chronojump.glade     |  630 ++++++++++++++++++++++++++------------------
 src/gui/chronopicWizard.cs |  217 +++++++++++++---
 2 files changed, 560 insertions(+), 287 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index be30c8a..1e0cf11 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -18341,6 +18341,9 @@ Concentric</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -20534,7 +20537,7 @@ Just select port and then close this window.</property>
         <property name="can_focus">False</property>
         <property name="spacing">20</property>
         <child>
-          <widget class="GtkNotebook" id="notebook">
+          <widget class="GtkNotebook" id="notebook_main">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
             <property name="show_tabs">False</property>
@@ -20542,14 +20545,14 @@ Just select port and then close this window.</property>
               <widget class="GtkVBox" id="vbox2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">12</property>
+                <property name="spacing">20</property>
                 <child>
                   <widget class="GtkLabel" id="label4">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="label">Welcome to Chronopic connection wizard.
 
-Which devices are you going to use in this session?</property>
+Which devices are you going to use?</property>
                   </widget>
                   <packing>
                     <property name="expand">False</property>
@@ -20621,7 +20624,7 @@ Which devices are you going to use in this session?</property>
               <widget class="GtkLabel" id="label1">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">page 1</property>
+                <property name="label">start</property>
               </widget>
               <packing>
                 <property name="tab_fill">False</property>
@@ -20632,29 +20635,142 @@ Which devices are you going to use in this session?</property>
               <widget class="GtkVBox" id="vbox3">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">12</property>
+                <property name="spacing">20</property>
                 <child>
-                  <widget class="GtkLabel" id="label_unplug">
+                  <widget class="GtkHBox" id="hbox12">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label">unplug</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox13">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">10</property>
+                        <child>
+                          <widget class="GtkImage" id="image4">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="stock">gtk-disconnect</property>
+                            <property name="icon-size">6</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_unplug">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label">unplug</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="expand">True</property>
+                        <property name="fill">False</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
-                    <property name="expand">True</property>
+                    <property name="expand">False</property>
                     <property name="fill">False</property>
                     <property name="position">0</property>
                   </packing>
                 </child>
                 <child>
-                  <widget class="GtkImage" id="image2">
+                  <widget class="GtkNotebook" id="notebook_unplugged">
                     <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="stock">gtk-disconnect</property>
-                    <property name="icon-size">6</property>
+                    <property name="can_focus">True</property>
+                    <property name="show_tabs">False</property>
+                    <property name="show_border">False</property>
+                    <child>
+                      <widget class="GtkHBox" id="hbox11">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <child>
+                          <widget class="GtkButton" id="button_done_unplugged">
+                            <property name="label">Done!</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <signal name="clicked" handler="on_button_done_unplugged_clicked" swapped="no"/>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label12">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label">done</property>
+                      </widget>
+                      <packing>
+                        <property name="tab_fill">False</property>
+                        <property name="type">tab</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkVBox" id="vbox5">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <widget class="GtkLabel" id="label23">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label">Detected ports:</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkTextView" id="textview_detected_unplugged">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="editable">False</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                      <packing>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <widget class="GtkLabel" id="label24">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label">detected</property>
+                      </widget>
+                      <packing>
+                        <property name="position">1</property>
+                        <property name="tab_fill">False</property>
+                        <property name="type">tab</property>
+                      </packing>
+                    </child>
                   </widget>
                   <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">False</property>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
                     <property name="position">1</property>
                   </packing>
                 </child>
@@ -20667,7 +20783,7 @@ Which devices are you going to use in this session?</property>
               <widget class="GtkLabel" id="label2">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">page 2</property>
+                <property name="label">unplug</property>
               </widget>
               <packing>
                 <property name="position">1</property>
@@ -20681,42 +20797,8 @@ Which devices are you going to use in this session?</property>
                 <property name="can_focus">False</property>
                 <property name="spacing">12</property>
                 <child>
-                  <widget class="GtkVBox" id="vbox5">
-                    <property name="visible">True</property>
-                    <property name="can_focus">False</property>
-                    <property name="spacing">6</property>
-                    <child>
-                      <widget class="GtkLabel" id="label6">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label">Detected ports:</property>
-                      </widget>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">0</property>
-                      </packing>
-                    </child>
-                    <child>
-                      <widget class="GtkTextView" id="textview_detected_unplugged">
-                        <property name="visible">True</property>
-                        <property name="can_focus">True</property>
-                      </widget>
-                      <packing>
-                        <property name="expand">True</property>
-                        <property name="fill">True</property>
-                        <property name="position">1</property>
-                      </packing>
-                    </child>
-                  </widget>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                    <property name="position">0</property>
-                  </packing>
-                </child>
-                <child>
                   <widget class="GtkFrame" id="frame_detection_contacts">
+                    <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="label_xalign">0</property>
                     <property name="label_yalign">0.69999998807907104</property>
@@ -20730,16 +20812,52 @@ Which devices are you going to use in this session?</property>
                           <widget class="GtkVBox" id="vbox6">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="spacing">6</property>
+                            <property name="spacing">20</property>
                             <child>
-                              <widget class="GtkLabel" id="label3">
+                              <widget class="GtkHBox" id="hbox7">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="label">Connect Chronopic for jumps/runs</property>
+                                <child>
+                                  <widget class="GtkHBox" id="hbox8">
+                                    <property name="visible">True</property>
+                                    <property name="can_focus">False</property>
+                                    <property name="spacing">10</property>
+                                    <child>
+                                      <widget class="GtkImage" id="image1">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="stock">gtk-connect</property>
+                                        <property name="icon-size">6</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="label3">
+                                        <property name="visible">True</property>
+                                        <property name="can_focus">False</property>
+                                        <property name="label">Connect Chronopic for jumps/runs</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">True</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
+                                  </packing>
+                                </child>
                               </widget>
                               <packing>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
+                                <property name="expand">False</property>
+                                <property name="fill">False</property>
                                 <property name="position">0</property>
                               </packing>
                             </child>
@@ -20754,11 +20872,12 @@ Which devices are you going to use in this session?</property>
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
                                     <child>
-                                      <widget class="GtkButton" id="button4">
+                                      <widget class="GtkButton" id="button_done_contacts">
                                         <property name="label">Done!</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
                                         <property name="receives_default">True</property>
+                                        <signal name="clicked" handler="on_button_done_contacts_clicked" 
swapped="no"/>
                                       </widget>
                                       <packing>
                                         <property name="expand">True</property>
@@ -20766,71 +20885,26 @@ Which devices are you going to use in this session?</property>
                                         <property name="position">0</property>
                                       </packing>
                                     </child>
-                                  </widget>
-                                </child>
-                                <child>
-                                  <widget class="GtkLabel" id="label8">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">page 1</property>
-                                  </widget>
-                                  <packing>
-                                    <property name="tab_fill">False</property>
-                                    <property name="type">tab</property>
-                                  </packing>
-                                </child>
-                                <child>
-                                  <widget class="GtkHBox" id="hbox5">
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
                                     <child>
-                                      <widget class="GtkHBox" id="hbox4">
+                                      <widget class="GtkProgressBar" id="progressbar_contacts">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
-                                        <property name="spacing">20</property>
-                                        <child>
-                                          <widget class="GtkLabel" id="label11">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="label">Detecting ...</property>
-                                          </widget>
-                                          <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">False</property>
-                                            <property name="position">0</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <widget class="GtkSpinner" id="spinner_contacts">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</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">True</property>
+                                        <property name="expand">False</property>
                                         <property name="fill">False</property>
-                                        <property name="position">0</property>
+                                        <property name="position">1</property>
                                       </packing>
                                     </child>
                                   </widget>
-                                  <packing>
-                                    <property name="position">1</property>
-                                  </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkLabel" id="label9">
+                                  <widget class="GtkLabel" id="label8">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">page 2</property>
+                                    <property name="label">page 1</property>
                                   </widget>
                                   <packing>
-                                    <property name="position">1</property>
                                     <property name="tab_fill">False</property>
                                     <property name="type">tab</property>
                                   </packing>
@@ -20853,9 +20927,10 @@ Which devices are you going to use in this session?</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <widget class="GtkTextView" id="textview1">
+                                      <widget class="GtkTextView" id="textview_detected_contacts">
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
+                                        <property name="editable">False</property>
                                       </widget>
                                       <packing>
                                         <property name="expand">True</property>
@@ -20865,17 +20940,17 @@ Which devices are you going to use in this session?</property>
                                     </child>
                                   </widget>
                                   <packing>
-                                    <property name="position">2</property>
+                                    <property name="position">1</property>
                                   </packing>
                                 </child>
                                 <child>
                                   <widget class="GtkLabel" id="label10">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">page 3</property>
+                                    <property name="label">page 2</property>
                                   </widget>
                                   <packing>
-                                    <property name="position">2</property>
+                                    <property name="position">1</property>
                                     <property name="tab_fill">False</property>
                                     <property name="type">tab</property>
                                   </packing>
@@ -20903,217 +20978,221 @@ Which devices are you going to use in this session?</property>
                     </child>
                   </widget>
                   <packing>
-                    <property name="expand">True</property>
+                    <property name="expand">False</property>
                     <property name="fill">False</property>
-                    <property name="position">1</property>
+                    <property name="position">0</property>
                   </packing>
                 </child>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkLabel" id="label19">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label">detect contacts</property>
+              </widget>
+              <packing>
+                <property name="position">2</property>
+                <property name="tab_fill">False</property>
+                <property name="type">tab</property>
+              </packing>
+            </child>
+            <child>
+              <widget class="GtkFrame" id="frame_detection_encoder">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="label_xalign">0</property>
+                <property name="label_yalign">0.69999998807907104</property>
+                <property name="shadow_type">none</property>
                 <child>
-                  <widget class="GtkFrame" id="frame_detection_encoder">
+                  <widget class="GtkAlignment" id="alignment2">
+                    <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label_xalign">0</property>
-                    <property name="label_yalign">0.69999998807907104</property>
-                    <property name="shadow_type">none</property>
+                    <property name="left_padding">12</property>
                     <child>
-                      <widget class="GtkAlignment" id="alignment2">
+                      <widget class="GtkVBox" id="vbox8">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="left_padding">12</property>
+                        <property name="spacing">20</property>
                         <child>
-                          <widget class="GtkVBox" id="vbox8">
+                          <widget class="GtkHBox" id="hbox9">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="spacing">6</property>
                             <child>
-                              <widget class="GtkLabel" id="label12">
+                              <widget class="GtkHBox" id="hbox10">
                                 <property name="visible">True</property>
                                 <property name="can_focus">False</property>
-                                <property name="label">Connect Chronopic for encoder</property>
-                              </widget>
-                              <packing>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
-                                <property name="position">0</property>
-                              </packing>
-                            </child>
-                            <child>
-                              <widget class="GtkNotebook" id="notebook_encoder">
-                                <property name="visible">True</property>
-                                <property name="can_focus">True</property>
-                                <property name="show_tabs">False</property>
-                                <property name="show_border">False</property>
+                                <property name="spacing">10</property>
                                 <child>
-                                  <widget class="GtkHBox" id="hbox1">
+                                  <widget class="GtkImage" id="image3">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <child>
-                                      <widget class="GtkButton" id="button1">
-                                        <property name="label">Done!</property>
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                        <property name="receives_default">True</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">True</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
+                                    <property name="stock">gtk-connect</property>
+                                    <property name="icon-size">6</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="label13">
+                                  <widget class="GtkLabel" id="label6">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">page 1</property>
+                                    <property name="label">Connect Chronopic for encoder</property>
                                   </widget>
                                   <packing>
-                                    <property name="tab_fill">False</property>
-                                    <property name="type">tab</property>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">1</property>
                                   </packing>
                                 </child>
+                              </widget>
+                              <packing>
+                                <property name="expand">True</property>
+                                <property name="fill">False</property>
+                                <property name="position">0</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="GtkNotebook" id="notebook_encoder">
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="show_tabs">False</property>
+                            <property name="show_border">False</property>
+                            <child>
+                              <widget class="GtkHBox" id="hbox1">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
                                 <child>
-                                  <widget class="GtkHBox" id="hbox2">
+                                  <widget class="GtkButton" id="button_done_encoder">
+                                    <property name="label">Done!</property>
                                     <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <child>
-                                      <widget class="GtkHBox" id="hbox6">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="spacing">20</property>
-                                        <child>
-                                          <widget class="GtkLabel" id="label14">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</property>
-                                            <property name="label">Detecting ...</property>
-                                          </widget>
-                                          <packing>
-                                            <property name="expand">False</property>
-                                            <property name="fill">False</property>
-                                            <property name="position">0</property>
-                                          </packing>
-                                        </child>
-                                        <child>
-                                          <widget class="GtkSpinner" id="spinner_encoder">
-                                            <property name="visible">True</property>
-                                            <property name="can_focus">False</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">True</property>
-                                        <property name="fill">False</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
+                                    <property name="can_focus">True</property>
+                                    <property name="receives_default">True</property>
+                                    <signal name="clicked" handler="on_button_done_encoder_clicked" 
swapped="no"/>
                                   </widget>
                                   <packing>
-                                    <property name="position">1</property>
+                                    <property name="expand">True</property>
+                                    <property name="fill">False</property>
+                                    <property name="position">0</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkLabel" id="label15">
+                                  <widget class="GtkProgressBar" id="progressbar_encoder">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">page 2</property>
                                   </widget>
                                   <packing>
+                                    <property name="expand">False</property>
+                                    <property name="fill">False</property>
                                     <property name="position">1</property>
-                                    <property name="tab_fill">False</property>
-                                    <property name="type">tab</property>
                                   </packing>
                                 </child>
+                              </widget>
+                            </child>
+                            <child>
+                              <widget class="GtkLabel" id="label13">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label">page 1</property>
+                              </widget>
+                              <packing>
+                                <property name="tab_fill">False</property>
+                                <property name="type">tab</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <widget class="GtkVBox" id="vbox9">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="spacing">6</property>
                                 <child>
-                                  <widget class="GtkVBox" id="vbox9">
+                                  <widget class="GtkLabel" id="label16">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="spacing">6</property>
-                                    <child>
-                                      <widget class="GtkLabel" id="label16">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="label">Detected ports:</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">True</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">0</property>
-                                      </packing>
-                                    </child>
-                                    <child>
-                                      <widget class="GtkTextView" id="textview2">
-                                        <property name="visible">True</property>
-                                        <property name="can_focus">True</property>
-                                      </widget>
-                                      <packing>
-                                        <property name="expand">True</property>
-                                        <property name="fill">True</property>
-                                        <property name="position">1</property>
-                                      </packing>
-                                    </child>
+                                    <property name="label">Detected ports:</property>
                                   </widget>
                                   <packing>
-                                    <property name="position">2</property>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">0</property>
                                   </packing>
                                 </child>
                                 <child>
-                                  <widget class="GtkLabel" id="label17">
+                                  <widget class="GtkTextView" id="textview_detected_encoder">
                                     <property name="visible">True</property>
-                                    <property name="can_focus">False</property>
-                                    <property name="label" translatable="yes">page 3</property>
+                                    <property name="can_focus">True</property>
+                                    <property name="editable">False</property>
                                   </widget>
                                   <packing>
-                                    <property name="position">2</property>
-                                    <property name="tab_fill">False</property>
-                                    <property name="type">tab</property>
+                                    <property name="expand">True</property>
+                                    <property name="fill">True</property>
+                                    <property name="position">1</property>
                                   </packing>
                                 </child>
                               </widget>
                               <packing>
-                                <property name="expand">True</property>
-                                <property name="fill">True</property>
                                 <property name="position">1</property>
                               </packing>
                             </child>
+                            <child>
+                              <widget class="GtkLabel" id="label17">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label">page 2</property>
+                              </widget>
+                              <packing>
+                                <property name="position">1</property>
+                                <property name="tab_fill">False</property>
+                                <property name="type">tab</property>
+                              </packing>
+                            </child>
                           </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">1</property>
+                          </packing>
                         </child>
                       </widget>
                     </child>
-                    <child>
-                      <widget class="GtkLabel" id="label18">
-                        <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="use_markup">True</property>
-                      </widget>
-                      <packing>
-                        <property name="type">label_item</property>
-                      </packing>
-                    </child>
+                  </widget>
+                </child>
+                <child>
+                  <widget class="GtkLabel" id="label18">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="use_markup">True</property>
                   </widget>
                   <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">False</property>
-                    <property name="position">2</property>
+                    <property name="type">label_item</property>
                   </packing>
                 </child>
               </widget>
               <packing>
-                <property name="position">2</property>
+                <property name="position">3</property>
               </packing>
             </child>
             <child>
-              <widget class="GtkLabel" id="label19">
+              <widget class="GtkLabel" id="label20">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">page 3</property>
+                <property name="label">detect encoder</property>
               </widget>
               <packing>
-                <property name="position">2</property>
+                <property name="position">3</property>
                 <property name="tab_fill">False</property>
                 <property name="type">tab</property>
               </packing>
@@ -21148,7 +21227,7 @@ Which devices are you going to use in this session?</property>
             </child>
             <child>
               <widget class="GtkButton" id="button_next">
-                <property name="label">Next</property>
+                <property name="label" translatable="yes">Next</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -23853,6 +23932,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -25197,6 +25279,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -27033,6 +27118,9 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -27926,6 +28014,9 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -41518,6 +41609,24 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -44857,6 +44966,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -45938,9 +46059,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -47284,6 +47402,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
@@ -52211,6 +52332,9 @@ Other</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -53219,6 +53343,9 @@ Other</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -54242,6 +54369,9 @@ Other</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/gui/chronopicWizard.cs b/src/gui/chronopicWizard.cs
index e75dda0..988495e 100644
--- a/src/gui/chronopicWizard.cs
+++ b/src/gui/chronopicWizard.cs
@@ -28,22 +28,34 @@ using Mono.Unix;
 public class ChronopicWizardWindow
 {
        [Widget] Gtk.Window chronopic_wizard_win;
-       [Widget] Gtk.Notebook notebook;
+       [Widget] Gtk.Notebook notebook_main;
        [Widget] Gtk.Button button_cancel;
        [Widget] Gtk.Button button_next;
 
-       //tab 0
+       //tab 0 start
        [Widget] Gtk.RadioButton radio_contacts;
        [Widget] Gtk.RadioButton radio_encoder;
        [Widget] Gtk.RadioButton radio_both;
        
-       //tab 1
+       //tab 1 unplug
        [Widget] Gtk.Label label_unplug;
-       
-       //tab 2
+       [Widget] Gtk.Notebook notebook_unplugged;
+       [Widget] Gtk.Button button_done_unplugged;
        [Widget] Gtk.TextView textview_detected_unplugged;
+       
+       //tab 2 contacts
        [Widget] Gtk.Frame frame_detection_contacts;
+       [Widget] Gtk.Notebook notebook_contacts;
+       [Widget] Gtk.Button button_done_contacts;
+       [Widget] Gtk.ProgressBar progressbar_contacts;
+       [Widget] Gtk.TextView textview_detected_contacts;
+
+       //tab 3 encoder
        [Widget] Gtk.Frame frame_detection_encoder;
+       [Widget] Gtk.Notebook notebook_encoder;
+       [Widget] Gtk.Button button_done_encoder;
+       [Widget] Gtk.ProgressBar progressbar_encoder;
+       [Widget] Gtk.TextView textview_detected_encoder;
 
        static ChronopicWizardWindow ChronopicWizardWindowBox;
 
@@ -73,14 +85,144 @@ public class ChronopicWizardWindow
 
        void initialize() 
        {
-               notebook.CurrentPage = 0;
-               button_next.Label = "Next";
+               notebook_main.CurrentPage = 0;
+               notebook_unplugged.CurrentPage = 0;
+               notebook_contacts.CurrentPage = 0;
+               notebook_encoder.CurrentPage = 0;
+               
+               button_done_contacts.Sensitive = true;
+               progressbar_contacts.Text = "";
+               
+               button_done_encoder.Sensitive = true;
+               progressbar_encoder.Text = "";
+
+               button_next.Label = Catalog.GetString("Next");
+               button_next.Sensitive = true;
+       }
+
+       string detectPorts()
+       {
+               string [] ports = {""};
+               if(UtilAll.IsWindows())
+                       ports = SerialPort.GetPortNames();
+               else
+                       ports = Directory.GetFiles("/dev/", "ttyUSB*");
+
+               string messageDetected = "";
+               string sep = "";
+               foreach (string port in ports) {
+                       messageDetected += sep + port;
+                       sep = "\n";
+               }
+
+               return messageDetected;
+       }
+       
+       bool progressbarContinue = true;
+       int progressbarCount;
+       
+       bool progressbarContactsDo() 
+       { 
+               LogB.Information("progressbarContactsDo");
+               if (! progressbarContinue) 
+                       return false;
+       
+               //will be each 500 ms (because progressbarContactsDo is called each 50 ms)
+               if(progressbarCount >= 10) 
+               {
+                       LogB.Information("Wizard detecting contacts");
+                       
+                       progressbarCount = 0;
+                       string detected = detectPorts();
+                       if(detected != "") {
+                               progressbarContinue = false;
+                               detected_contacts(detected);
+                               return false;
+                       }
+               } else
+                       progressbarCount ++;
+
+               progressbar_contacts.Pulse();
+               return true;
+       }      
+       
+       bool progressbarEncoderDo() 
+       { 
+               LogB.Information("progressbarEncoderDo");
+               if (! progressbarContinue) 
+                       return false;
+       
+               //will be each 500 ms (because progressbarEncoderDo is called each 50 ms)
+               if(progressbarCount >= 10) 
+               {
+                       LogB.Information("Wizard detecting encoder");
+                       
+                       progressbarCount = 0;
+                       string detected = detectPorts();
+                       if(detected != "") {
+                               progressbarContinue = false;
+                               detected_encoder(detected);
+                               return false;
+                       }
+               } else
+                       progressbarCount ++;
+
+               progressbar_encoder.Pulse();
+               return true;
+       }      
+
+
+       void on_button_done_unplugged_clicked (object o, EventArgs args)
+       {
+               string str = detectPorts();
+               if(str == "")
+                       str = "Correct! Nothing detected";
+               textview_detected_unplugged.Buffer.Text = str;
+               notebook_unplugged.CurrentPage = 1;
+               button_next.Sensitive = true;
+       }
+       
+       void on_button_done_contacts_clicked (object o, EventArgs args)
+       {
+               button_done_contacts.Sensitive = false;
+               progressbar_contacts.Text = "Detecting";
+               progressbarContinue = true;
+               progressbarCount = 0;
+               GLib.Timeout.Add(50, new GLib.TimeoutHandler(progressbarContactsDo)); //each 50 ms
+       }
+       void detected_contacts (string detected)
+       {
+               progressbarContinue = false;
+               textview_detected_contacts.Buffer.Text = detected;
+               notebook_contacts.CurrentPage = 1;
+               button_next.Sensitive = true;
        }
+       
+       void on_button_done_encoder_clicked (object o, EventArgs args)
+       {
+               button_done_encoder.Sensitive = false;
+               progressbar_encoder.Text = "Detecting";
+               progressbarContinue = true;
+               progressbarCount = 0;
+               GLib.Timeout.Add(50, new GLib.TimeoutHandler(progressbarEncoderDo)); //each 50 ms
+       }
+       void detected_encoder (string detected)
+       {
+               progressbarContinue = false;
+               textview_detected_encoder.Buffer.Text = detected;
+               notebook_encoder.CurrentPage = 1;
+               button_next.Label = Catalog.GetString("Finish");
+               button_next.Sensitive = true;
+       }
+       
 
        void on_button_next_clicked (object o, EventArgs args)
        {
-               //from page 0 to page 1 show unplug message:
-               if(notebook.CurrentPage == 0) {
+               int advancePages = 1;
+
+               if(notebook_main.CurrentPage == 0) 
+               {
+                       //from page 0 to page 1 show unplug message
                        int numCPs = 1;
                        if(radio_both.Active)
                                numCPs = 2;
@@ -88,42 +230,43 @@ public class ChronopicWizardWindow
                        label_unplug.Text = Catalog.GetPluralString(
                                        "Please unplug Chronopic USB cable.", 
                                        "Please unplug Chronopic USB cables.", numCPs);
+
+                       button_next.Sensitive = false; //unsensitive until click on Done
                }
+               else if(notebook_main.CurrentPage == 1) 
+               {
+                       //from page 1 to page 2 detect contacts
+                       button_next.Sensitive = false; //unsensitive until click on Done
 
-               //from page 1 to page 2 detect devices:
-               if(notebook.CurrentPage == 1) 
+                       if(radio_contacts.Active) {
+                               //if there will be no encoder, rename Next to Finish
+                               button_next.Label = Catalog.GetString("Finish");
+                       }
+                       else if(radio_encoder.Active) {
+                               //if there will be no contacts, jump to encoder page
+                               advancePages = 2;
+                       }
+               }
+               else if(notebook_main.CurrentPage == 2) 
                {
-                       //1 detected serial ports
-                       string [] ports = {""};
-                       if(UtilAll.IsWindows())
-                               ports = SerialPort.GetPortNames();
-                       else
-                               ports = Directory.GetFiles("/dev/", "ttyUSB*");
-
-                       string messageDetected = "";
-                       string sep = "";
-                       foreach (string port in ports) {
-                               messageDetected += sep + port;
-                               sep = "\n";
+                       //from page 2 to page 3 detect encoder
+                       //exit if there's no encoder
+                       if(radio_contacts.Active)
+                               on_button_cancel_clicked(o, args); //TODO
+                       else {
+                               button_next.Sensitive = false; //unsensitive until click on Done
+                               
+                               //rename Next to Finish
+                               button_next.Label = Catalog.GetString("Finish");
                        }
-                       if(messageDetected == "")
-                               messageDetected = "None";
-
-                       textview_detected_unplugged.Buffer.Text = messageDetected;
-
-                       //2 other widgets
-                       frame_detection_contacts.Visible = (radio_contacts.Active || radio_both.Active);
-                       frame_detection_encoder.Visible = (radio_encoder.Active || radio_both.Active);
-                       button_next.Label = "Finish"; //page 2 is last page, "Next" is changed to "finish"
                }
-               
-               //page 2 is last page, exit
-               if(notebook.CurrentPage == 2)
+               else if(notebook_main.CurrentPage == 3) {
+                       //exiting form encoder page
                        on_button_cancel_clicked(o, args); //TODO
-       
+               }
 
                //change the page               
-               notebook.CurrentPage ++;
+               notebook_main.CurrentPage += advancePages;
        }
 
        void on_button_cancel_clicked (object o, EventArgs args)


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