[chronojump] Improvements on chronopic window



commit b18aa1c87581e01aec5018e9dd893c46247acfa4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Feb 21 19:21:21 2013 +0100

    Improvements on chronopic window

 glade/chronojump.glade |   86 +++++++++++++++++++++++++++++++++++++----------
 src/gui/chronopic.cs   |   43 ++++++++++++++++++-----
 src/gui/helpPorts.cs   |   22 ++++++++----
 3 files changed, 115 insertions(+), 36 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 78efa4a..99bb53a 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -14628,12 +14628,44 @@ Evaluator can use real name or nickname.</property>
       <widget class="GtkVBox" id="vbox1">
         <property name="visible">True</property>
         <property name="can_focus">False</property>
-        <property name="spacing">8</property>
+        <property name="spacing">12</property>
         <child>
-          <widget class="GtkImage" id="chronopic_image">
+          <widget class="GtkTable" id="table1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="stock">gtk-missing-image</property>
+            <property name="n_columns">2</property>
+            <property name="column_spacing">2</property>
+            <property name="row_spacing">2</property>
+            <child>
+              <widget class="GtkRadioButton" id="radio_contacts">
+                <property name="label" translatable="yes">Contacts
+(platform or photocell)</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="on_radio_contacts_toggled" swapped="no"/>
+              </widget>
+            </child>
+            <child>
+              <widget class="GtkRadioButton" id="radio_encoder">
+                <property name="label" translatable="yes">Linear encoder</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="use_action_appearance">False</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">radio_contacts</property>
+                <signal name="toggled" handler="on_radio_encoder_toggled" swapped="no"/>
+              </widget>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="right_attach">2</property>
+              </packing>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -14642,11 +14674,13 @@ Evaluator can use real name or nickname.</property>
           </packing>
         </child>
         <child>
-          <widget class="GtkNotebook" id="notebook1">
+          <widget class="GtkNotebook" id="notebook_main">
             <property name="visible">True</property>
             <property name="can_focus">True</property>
+            <property name="show_tabs">False</property>
             <property name="tab_border">4</property>
-            <property name="tab_hborder">12</property>
+            <property name="tab_hborder">8</property>
+            <property name="tab_vborder">0</property>
             <child>
               <widget class="GtkAlignment" id="alignment1">
                 <property name="visible">True</property>
@@ -15368,7 +15402,6 @@ Just select and then close this window.</property>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="padding">4</property>
             <property name="position">3</property>
           </packing>
         </child>
@@ -15968,11 +16001,10 @@ Just select and then close this window.</property>
           <widget class="GtkVBox" id="vbox71">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="spacing">10</property>
             <child>
               <widget class="GtkLabel" id="label205">
                 <property name="can_focus">False</property>
-                <property name="label" translatable="yes">This dialog explains which ports are suitable to 
be connected with Chronopic</property>
+                <property name="label">This dialog explains which ports are suitable to be connected with 
Chronopic</property>
                 <property name="wrap">True</property>
               </widget>
               <packing>
@@ -16004,7 +16036,7 @@ Just select and then close this window.</property>
                   <widget class="GtkLabel" id="label514">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Info</property>
+                    <property name="label">Info</property>
                     <property name="use_markup">True</property>
                   </widget>
                   <packing>
@@ -16041,7 +16073,7 @@ Just select and then close this window.</property>
                   <widget class="GtkLabel" id="label_detection">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Detection</property>
+                    <property name="label">Detection</property>
                     <property name="use_markup">True</property>
                   </widget>
                   <packing>
@@ -16070,9 +16102,23 @@ Just select and then close this window.</property>
                       <widget class="GtkVBox" id="vbox121">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
-                        <property name="spacing">8</property>
+                        <property name="spacing">12</property>
                         <child>
-                          <widget class="GtkHBox" id="hbox268">
+                          <widget class="GtkLabel" id="label_help_info">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                            <property name="use_markup">True</property>
+                            <property name="wrap">True</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">False</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkVBox" id="vbox1">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="spacing">8</property>
@@ -16081,7 +16127,7 @@ Just select and then close this window.</property>
                                 <property name="label" translatable="yes">Check Chronopic port</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
+                                <property name="receives_default">True</property>
                                 <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <signal name="clicked" handler="on_button_check_port_clicked" swapped="no"/>
@@ -16097,7 +16143,7 @@ Just select and then close this window.</property>
                                 <property name="label" translatable="yes">Force Chronopic port to COM1 - 
COM4</property>
                                 <property name="visible">True</property>
                                 <property name="can_focus">True</property>
-                                <property name="receives_default">False</property>
+                                <property name="receives_default">True</property>
                                 <property name="use_action_appearance">False</property>
                                 <property name="use_underline">True</property>
                                 <signal name="clicked" handler="on_button_force_port_clicked" swapped="no"/>
@@ -16112,19 +16158,21 @@ Just select and then close this window.</property>
                           <packing>
                             <property name="expand">True</property>
                             <property name="fill">True</property>
-                            <property name="position">0</property>
+                            <property name="position">1</property>
                           </packing>
                         </child>
                         <child>
-                          <widget class="GtkLabel" id="label_manual">
+                          <widget class="GtkLabel" id="label_help_manual">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
                             <property name="use_markup">True</property>
+                            <property name="wrap">True</property>
                           </widget>
                           <packing>
                             <property name="expand">False</property>
                             <property name="fill">False</property>
-                            <property name="position">1</property>
+                            <property name="position">2</property>
                           </packing>
                         </child>
                       </widget>
@@ -16133,9 +16181,8 @@ Just select and then close this window.</property>
                 </child>
                 <child>
                   <widget class="GtkLabel" id="label508">
-                    <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="label" translatable="yes">Help</property>
+                    <property name="label">&lt;b&gt;Help&lt;/b&gt;</property>
                     <property name="use_markup">True</property>
                   </widget>
                   <packing>
@@ -16153,6 +16200,7 @@ Just select and then close this window.</property>
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
+            <property name="padding">10</property>
             <property name="position">2</property>
           </packing>
         </child>
diff --git a/src/gui/chronopic.cs b/src/gui/chronopic.cs
index 8575b22..3d80037 100644
--- a/src/gui/chronopic.cs
+++ b/src/gui/chronopic.cs
@@ -48,6 +48,11 @@ public class ChronopicWindow
        static ChronopicWindow ChronopicWindowBox;
        ChronopicConnection chronopicConnectionWin;
 
+       [Widget] Gtk.Notebook notebook_main;
+       [Widget] Gtk.RadioButton radio_contacts;
+       [Widget] Gtk.RadioButton radio_encoder;
+       //[Widget] Gtk.Image image_contact_modular;
+       //[Widget] Gtk.Image image_infrared;
 
        [Widget] Gtk.Image image_cp1_yes;
        [Widget] Gtk.Image image_cp1_no;
@@ -148,8 +153,15 @@ public class ChronopicWindow
 
                setDefaultValues();             
                
-               Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "chronopic_128.png");
-               chronopic_image.Pixbuf = pixbuf;
+               //Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "chronopic_128.png");
+               //chronopic_image.Pixbuf = pixbuf;
+               /*
+               Pixbuf pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(true) + 
Constants.FileNameContactPlatformModular);
+               image_contact_modular.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(true) + Constants.FileNameInfrared);
+               image_infrared.Pixbuf = pixbuf;
+               */
 
                /*
                if(chronopicPort1 != Constants.ChronopicDefaultPortWindows && 
@@ -194,9 +206,8 @@ public class ChronopicWindow
                ChronopicWindowBox.checkChronopicDisconnected();
                ChronopicWindowBox.createCombos();
 
-               //findPorts only puts info on textview
                //ports info comes from gui/chronojump.cs to Create mehod
-               ChronopicWindowBox.findPorts();
+               ChronopicWindowBox.info();
 
                ChronopicWindowBox.chronopic_window.Show();
                ChronopicWindowBox.chronopic_window.Present();
@@ -246,6 +257,15 @@ Log.WriteLine("bbb");
                //fakeButtonCancelled = new Gtk.Button();
        }
        
+       private void on_radio_contacts_toggled(object o, EventArgs args) {
+               if(radio_contacts.Active && notebook_main.CurrentPage == 1)
+                       notebook_main.PrevPage();
+       }
+       private void on_radio_encoder_toggled(object o, EventArgs args) {
+               if(radio_encoder.Active && notebook_main.CurrentPage == 0)
+                       notebook_main.NextPage();
+       }
+       
        //check if user has disconnected chronopic or port has changed
        private void checkChronopicDisconnected() {
                foreach(ChronopicPortData a in cpd) {
@@ -441,17 +461,20 @@ Log.WriteLine("bbb");
                }
        }
        
-       private void findPorts() {
-               string saferPorts = "";
-               if(Util.IsWindows())
+       private void info() {
+//             string saferPorts = "";
+//             if(Util.IsWindows())
+               /*
                        saferPorts =
-                               "\n\n" + Catalog.GetString("If you have problems connecting with Chronopic, 
ensure you have the driver installed at 'Windows Start Menu / Chronojump / Install Chronopic driver'.") + 
"\n" + 
+                               "\n" + Catalog.GetString("If you have problems connecting with Chronopic, 
ensure you have the driver installed at 'Windows Start Menu / Chronojump / Install Chronopic driver'.") + 
"\n" + 
                                Catalog.GetString("Ports above COM4 may not work.") + "\n" + 
                                Catalog.GetString("If you want a safer port, press help button and press 
'Force Chronopic to port COM1 - COM4'.");
+                               */
 
                textview_ports_found_explanation.Buffer = UtilGtk.TextViewPrint(
-                               Catalog.GetString("If you just plugged Chronopic cable and expected port is 
not listed, close and open again this window.") +
-                               saferPorts
+                               Catalog.GetString("If you just plugged Chronopic cable and expected port is 
not listed, close and open again this window.") + "\n" + 
+                               Catalog.GetString("If you have problems connecting with Chronopic, press help 
button.")  
+                               //saferPorts
                                );
        }
 
diff --git a/src/gui/helpPorts.cs b/src/gui/helpPorts.cs
index ec02923..50d8a9c 100644
--- a/src/gui/helpPorts.cs
+++ b/src/gui/helpPorts.cs
@@ -33,7 +33,8 @@ public class HelpPorts
        [Widget] Gtk.Label label_info;
        [Widget] Gtk.Label label_detection;
        [Widget] Gtk.Label label_detected;
-       [Widget] Gtk.Label label_manual;
+       [Widget] Gtk.Label label_help_info;
+       [Widget] Gtk.Label label_help_manual;
        [Widget] Gtk.Button button_check_port;
        [Widget] Gtk.Button button_force_port;
 
@@ -66,22 +67,29 @@ public class HelpPorts
                } else {
                        messageInfo = Constants.PortNamesLinux;
                        messageDetected = Util.DetectPortsLinux(true); //formatting
-                       button_check_port.Hide();
-                       button_force_port.Hide();
+//                     button_check_port.Hide();
+//                     button_force_port.Hide();
                }
                
                label_info.Text = messageInfo;
                label_info.UseMarkup = true;
                label_detected.Text = messageDetected;
                label_detected.UseMarkup = true;
-               
-               label_manual.Text = 
+       
+//             if(Util.IsWindows())
+               label_help_info.Text = 
+                       Catalog.GetString("If you have problems connecting with Chronopic, ensure you have 
the <b>driver</b> installed at 'Windows Start Menu / Chronojump / Install Chronopic driver'.") + "\n\n" + 
+                       Catalog.GetString("Ports above COM4 may not work.") + "\n" + 
+                       Catalog.GetString("If you want a safer port, press:") + "\n" +
+                       Catalog.GetString("Force Chronopic to port <b>COM1 - COM4</b>'.");
+               label_help_info.UseMarkup = true;
+
+               label_help_manual.Text = 
                        Catalog.GetString("More information on <b>Chronojump Manual</b>") + "\n" +
                        "<i>" + Path.GetFullPath(Util.GetManualDir()) + "</i>\n\n" + 
                        Catalog.GetString("Newer versions will be on this site:") +"\n" + 
                        "<i>http://chronojump.org/documents.html</i>";
-               label_manual.UseMarkup = true;
-               
+               label_help_manual.UseMarkup = true;
        }
        
        private void on_button_check_port_clicked (object o, EventArgs args)


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