[chronojump] Fixed bug on combo jump types and startedt chronopicRegister gui



commit c74f12167e74eb8a3a6a6cdd82a73ef7d72ab17f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Oct 7 11:55:58 2016 +0200

    Fixed bug on combo jump types and startedt chronopicRegister gui

 src/Makefile.am              |    1 +
 src/chronopicRegister.cs     |    2 +-
 src/gui/chronojump.cs        |   15 ++++++
 src/gui/chronopicRegister.cs |  106 ++++++++++++++++++++++++++++++++++++++++++
 src/gui/stats.cs             |    9 +---
 5 files changed, 125 insertions(+), 8 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index 175960c..cd2a53e 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -7,6 +7,7 @@ LINK = $(REF_DEP_CHRONOJUMP)
 SOURCES = \
        gui/chronojump.cs\
        gui/chronopic.cs\
+       gui/chronopicRegister.cs\
        gui/chronopicWizard.cs\
        gui/confirm.cs\
        gui/encoder.cs\
diff --git a/src/chronopicRegister.cs b/src/chronopicRegister.cs
index 69e3e5b..a5fa1cf 100644
--- a/src/chronopicRegister.cs
+++ b/src/chronopicRegister.cs
@@ -32,7 +32,7 @@ public class ChronopicRegisterPort
        public string Port;
        public bool FTDI;
        public string SerialNumber;
-       public enum Types { UNKNOWN, CONTACTS, ENCODER }
+       public enum Types { UNKNOWN, NOT_CHRONOPIC, CONTACTS, ENCODER }
        public Types Type;
 
        //constructor when port is known (searching FTDI stuff on a serial port)
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 8eaf221..9880bdd 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -682,6 +682,8 @@ public partial class ChronoJumpWindow
                //testing ChronopicRegister
                ChronopicRegisterSelectOS cros = new ChronopicRegisterSelectOS();
                ChronopicRegister cr = cros.Do();
+
+               ChronopicRegisterWindow crw = new ChronopicRegisterWindow();
                
                //moveStartTestInitial();
        }
@@ -2417,7 +2419,20 @@ public partial class ChronoJumpWindow
                ChronojumpImporter.Result result = chronojumpImporter.import ();
 
                if (result.success) {
+                       //if a simple jump type has been added
+                       createComboSelectJumps(false); //this will update also the selectJumpsString
+                       UtilGtk.ComboUpdate(combo_result_jumps,
+                                       SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsName, "", 
true), ""); //without filter, only select name
+                       combo_select_jumps.Active = 0;
+                       combo_result_jumps.Active = 0;
+
+                       //TODO: RJ, run simple, run interval. See methods:
+                       //on_jump_type_add_accepted
+                       //on_run_type_add_accepted
+
+                       //update stats combos
                        updateComboStats ();
+
                        new DialogMessage (Constants.MessageTypes.INFO, Catalog.GetString ("Session 
imported."));
                } else {
                        LogB.Debug ("Chronojump Importer error: ", result.error);
diff --git a/src/gui/chronopicRegister.cs b/src/gui/chronopicRegister.cs
new file mode 100644
index 0000000..3dc1a75
--- /dev/null
+++ b/src/gui/chronopicRegister.cs
@@ -0,0 +1,106 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or   
+ *    (at your option) any later version.
+ *    
+ * ChronoJump is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+ *    GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ *  Copyright (C) 2016   Xavier de Blas <xaviblas gmail com> 
+ */
+
+using System;
+using Gtk;
+
+public class ChronopicRegisterWindow
+{
+       Gtk.Window chronopic_register_win;
+       Gtk.Table table;
+
+       public ChronopicRegisterWindow() 
+       {
+               createWindow();
+               //put an icon to window
+               UtilGtk.IconWindow(chronopic_register_win);
+
+               createTable();
+               chronopic_register_win.ShowAll();
+       }
+
+
+       private void createWindow()
+       {
+               chronopic_register_win = new Window ("Chronopic register");
+
+               /* Set a handler for delete_event that immediately
+                *                          * exits GTK. */ //TODO: change this
+//             chronopic_register_win.DeleteEvent += delete_event;
+
+               /* Sets the border width of the window. */
+               chronopic_register_win.BorderWidth= 20;
+       }
+
+       private void createTable()
+       {
+               table = new Table (3, 3, true); //rows, columns
+
+               createCells();
+
+               /* Put the table in the main window */
+               chronopic_register_win.Add(table);
+
+               table.Show();
+       }
+
+       private void createCells()
+       {
+               //headers
+               Label header1 = new Label("<b>SerialNumber</b>");
+               Label header2 = new Label("<b>Type</b>");
+               Label header3 = new Label("<b>Port</b>");
+               header1.UseMarkup = true;
+               header2.UseMarkup = true;
+               header3.UseMarkup = true;
+               table.Attach(header1, 0, 1, 0, 1); //left, right, top, bottom
+               table.Attach(header2, 1, 2, 0, 1);
+               table.Attach(header3, 2, 3, 0, 1);
+               //TODO: negretes
+
+
+               Label serialN1 = new Label("aa00");
+               table.Attach(serialN1, 0, 1, 1, 2);
+
+               Label serialN2 = new Label("aa01");
+               table.Attach(serialN2, 0, 1, 2, 3);
+
+               
+               ComboBox combo1 = ComboBox.NewText ();
+               foreach(string s in Enum.GetNames(typeof(ChronopicRegisterPort.Types)))
+                       combo1.AppendText (s);
+               combo1.Active = 0;
+               table.Attach(combo1, 1, 2, 1, 2);
+
+               ComboBox combo2 = ComboBox.NewText ();
+               foreach(string s in Enum.GetNames(typeof(ChronopicRegisterPort.Types)))
+                       combo2.AppendText (s);
+               combo2.Active = 0;
+               table.Attach(combo2, 1, 2, 2, 3);
+
+
+               Label port1 = new Label("COM1");
+               table.Attach(port1, 2, 3, 1, 2);
+
+               Label port2 = new Label("COM2");
+               table.Attach(port2, 2, 3, 2, 3);
+       }
+}
+
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index 3b653a0..90e91cb 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -598,13 +598,8 @@ public partial class ChronoJumpWindow {
                        
                        //by default show all simple nonTC jumps, but if combo_stats_subtype changed
                        //updateComboStatsSubType() will do the work
-
-                       
-                       string[] jumps = SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsName, 
"nonTC", true);
-
-                       UtilGtk.ComboUpdate(combo_stats_stat_apply_to, 
-                               jumps, ""); //only select name
-                       combo_select_jumps.Active = UtilGtk.ComboUpdate(combo_select_jumps, jumps, "");
+                       UtilGtk.ComboUpdate(combo_stats_stat_apply_to,
+                                       SqliteJumpType.SelectJumpTypes(false, Constants.AllJumpsName, 
"nonTC", true), ""); //only select name
 
                        combo_stats_stat_apply_to.Sensitive = true;
                        combo_stats_stat_apply_to.Active = 0;


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