[chronojump] Person top window can load persons (useful for non UNIQUE session)



commit fd2104729d47f9d84b1c9f69ed89f32ccf6b1a20
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jul 20 17:21:37 2017 +0200

    Person top window can load persons (useful for non UNIQUE session)

 glade/app1.glade                 |    8 ++++-
 glade/person_select_window.glade |   75 ++++++++++++++++++++++++++++++++++----
 src/gui/chronojump.cs            |   43 +++++++++++++++++-----
 src/gui/personSelect.cs          |   17 ++++++++-
 4 files changed, 123 insertions(+), 20 deletions(-)
---
diff --git a/glade/app1.glade b/glade/app1.glade
index 74d5ada..bb4333f 100644
--- a/glade/app1.glade
+++ b/glade/app1.glade
@@ -1354,6 +1354,9 @@
                                                             <placeholder/>
                                                             </child>
                                                             <child>
+                                                            <placeholder/>
+                                                            </child>
+                                                            <child>
                                                             <widget class="GtkLabel" 
id="label_start_selector_jumps">
                                                             <property name="visible">True</property>
                                                             <property name="can_focus">False</property>
@@ -2360,7 +2363,7 @@ EncoderInertialCapture</property>
                                                             <property name="has_tooltip">True</property>
                                                             <property name="tooltip" translatable="yes">Load 
person</property>
                                                             <property name="relief">half</property>
-                                                            <signal name="clicked" 
handler="on_recuperate_person_clicked" swapped="no"/>
+                                                            <signal name="clicked" 
handler="on_recuperate_person_from_main_gui" swapped="no"/>
                                                             <child>
                                                             <widget class="GtkVBox" id="vbox98">
                                                             <property name="visible">True</property>
@@ -20987,6 +20990,9 @@ then click this button.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
diff --git a/glade/person_select_window.glade b/glade/person_select_window.glade
index ac9a5e8..5b1609a 100644
--- a/glade/person_select_window.glade
+++ b/glade/person_select_window.glade
@@ -2384,6 +2384,18 @@
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -2399,6 +2411,7 @@
           <widget class="GtkVBox" id="vbox1">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <property name="spacing">30</property>
             <child>
               <widget class="GtkVBox" id="vbox2">
                 <property name="visible">True</property>
@@ -2643,7 +2656,7 @@
               <widget class="GtkVBox" id="vbox4">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="spacing">60</property>
+                <property name="spacing">10</property>
                 <child>
                   <widget class="GtkButton" id="button_add">
                     <property name="visible">True</property>
@@ -2656,10 +2669,10 @@
                         <property name="can_focus">False</property>
                         <property name="spacing">4</property>
                         <child>
-                          <widget class="GtkImage" id="image3">
+                          <widget class="GtkImage" id="image_person_new">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="stock">gtk-add</property>
+                            <property name="stock">gtk-missing-image</property>
                             <property name="icon-size">3</property>
                           </widget>
                           <packing>
@@ -2684,12 +2697,57 @@
                     </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="GtkButton" id="button_load">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <signal name="clicked" handler="on_button_load_clicked" swapped="no"/>
+                    <child>
+                      <widget class="GtkVBox" id="vbox10">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="spacing">4</property>
+                        <child>
+                          <widget class="GtkImage" id="image_person_load">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="stock">gtk-missing-image</property>
+                            <property name="icon-size">3</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <widget class="GtkLabel" id="label7">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="label" translatable="yes">Load person</property>
+                          </widget>
+                          <packing>
+                            <property name="expand">True</property>
+                            <property name="fill">True</property>
+                            <property name="position">1</property>
+                          </packing>
+                        </child>
+                      </widget>
+                    </child>
+                  </widget>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
                   <widget class="GtkButton" id="button_close">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
@@ -2730,15 +2788,16 @@
                     </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="pack_type">end</property>
+                    <property name="position">2</property>
                   </packing>
                 </child>
               </widget>
               <packing>
-                <property name="expand">False</property>
-                <property name="fill">False</property>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
                 <property name="pack_type">end</property>
                 <property name="position">1</property>
               </packing>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 019bd3b..4395ad0 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2446,14 +2446,22 @@ public partial class ChronoJumpWindow
         *  --------------------------------------------------------
         */
        
-       private void on_recuperate_person_clicked (object o, EventArgs args) {
+       bool person_load_single_called_from_person_select_window;
+       private void on_recuperate_person_from_main_gui (object o, EventArgs args)
+       {
+               person_load_single_called_from_person_select_window = false;
+               person_load_single();
+       }
+
+       private void person_load_single ()
+       {
                LogB.Information("recuperate person");
                personRecuperateWin = PersonRecuperateWindow.Show(app1, currentSession, 
preferences.digitsNumber);
                personRecuperateWin.FakeButtonDone.Clicked += new EventHandler(on_recuperate_person_accepted);
        }
 
        private void on_recuperate_person_accepted (object o, EventArgs args) {
-               LogB.Information("here!!!");
+               LogB.Information("at: on_recuperate_person_accepted");
                currentPerson = personRecuperateWin.CurrentPerson;
                currentPersonSession = personRecuperateWin.CurrentPersonSession;
                label_person_change();
@@ -2465,6 +2473,9 @@ public partial class ChronoJumpWindow
                        selectRowTreeView_persons(treeview_persons, rowToSelect);
                        sensitiveGuiYesPerson();
                }
+
+               if(person_load_single_called_from_person_select_window)
+                       updatePersonSelectWin ();
        }
                
        private void on_recuperate_persons_from_session_clicked (object o, EventArgs args) {
@@ -2493,12 +2504,14 @@ public partial class ChronoJumpWindow
        }
 
        bool person_add_single_called_from_person_select_window;
-       private void on_person_add_single_from_main_gui (object o, EventArgs args) {
+       private void on_person_add_single_from_main_gui (object o, EventArgs args)
+       {
                person_add_single_called_from_person_select_window = false;
                person_add_single();
        }
 
-       private void person_add_single () {
+       private void person_add_single ()
+       {
                personAddModifyWin = PersonAddModifyWindow.Show(app1, 
                                currentSession, new Person(-1), 
                                preferences.digitsNumber, checkbutton_video, configChronojump.UseVideo
@@ -2551,12 +2564,16 @@ public partial class ChronoJumpWindow
                        //appbar2.Push( 1, Catalog.GetString("Successfully added") + " " + currentPerson.Name 
);
                }
 
-               if(person_add_single_called_from_person_select_window) {
-                       ArrayList myPersons = SqlitePersonSession.SelectCurrentSessionPersons(
-                                       currentSession.UniqueID,
-                                       false); //means: do not returnPersonAndPSlist
-                       personSelectWin.Update(myPersons);
-               }
+               if(person_add_single_called_from_person_select_window)
+                       updatePersonSelectWin ();
+       }
+
+       private void updatePersonSelectWin ()
+       {
+               ArrayList myPersons = SqlitePersonSession.SelectCurrentSessionPersons(
+                               currentSession.UniqueID,
+                               false); //means: do not returnPersonAndPSlist
+               personSelectWin.Update(myPersons);
        }
 
        //show spinbutton window asking for how many people to create   
@@ -2693,6 +2710,7 @@ public partial class ChronoJumpWindow
 
                personSelectWin = PersonSelectWindow.Show(app1, myPersons);
                personSelectWin.FakeButtonAddPerson.Clicked += new 
EventHandler(on_button_top_person_add_person);
+               personSelectWin.FakeButtonLoadPerson.Clicked += new 
EventHandler(on_button_top_person_load_person);
                personSelectWin.FakeButtonEditPerson.Clicked += new 
EventHandler(on_button_top_person_edit_person);
                personSelectWin.FakeButtonDeletePerson.Clicked += new 
EventHandler(on_button_top_person_delete_person);
                personSelectWin.FakeButtonDone.Clicked += new EventHandler(on_button_top_person_change_done);
@@ -2702,6 +2720,11 @@ public partial class ChronoJumpWindow
                person_add_single_called_from_person_select_window = true;
                person_add_single();
        }
+       private void on_button_top_person_load_person(object o, EventArgs args)
+       {
+               person_load_single_called_from_person_select_window = true;
+               person_load_single();
+       }
        private void on_button_top_person_edit_person(object o, EventArgs args)
        {
                currentPerson = personSelectWin.SelectedPerson; 
diff --git a/src/gui/personSelect.cs b/src/gui/personSelect.cs
index 850b5df..47a337b 100644
--- a/src/gui/personSelect.cs
+++ b/src/gui/personSelect.cs
@@ -35,12 +35,16 @@ public class PersonSelectWindow
        [Widget] Gtk.VBox vbox_button_delete_confirm;
        [Widget] Gtk.Label label_selected_person_name;
        [Widget] Gtk.Button button_add;
+       [Widget] Gtk.Button button_load;
+       [Widget] Gtk.Image image_person_new;
+       [Widget] Gtk.Image image_person_load;
        
        static PersonSelectWindow PersonSelectWindowBox;
        
        private ArrayList persons;
        public Person SelectedPerson;
        public Gtk.Button FakeButtonAddPerson;
+       public Gtk.Button FakeButtonLoadPerson;
        public Gtk.Button FakeButtonEditPerson;
        public Gtk.Button FakeButtonDeletePerson;
        public Gtk.Button FakeButtonDone;
@@ -56,9 +60,15 @@ public class PersonSelectWindow
                person_select_window.Parent = parent;
                
                FakeButtonAddPerson = new Gtk.Button();
+               FakeButtonLoadPerson = new Gtk.Button();
                FakeButtonEditPerson = new Gtk.Button();
                FakeButtonDeletePerson = new Gtk.Button();
                FakeButtonDone = new Gtk.Button();
+
+               Pixbuf pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_person_add.png");
+               image_person_new.Pixbuf = pixbuf;
+               pixbuf = new Pixbuf (null, Util.GetImagePath(false) + "image_person_outline.png");
+               image_person_load.Pixbuf = pixbuf;
        }
        
        static public PersonSelectWindow Show (Gtk.Window parent, ArrayList persons)
@@ -170,6 +180,9 @@ public class PersonSelectWindow
        private void on_button_add_clicked (object o, EventArgs args) {
                FakeButtonAddPerson.Click();
        }
+       private void on_button_load_clicked (object o, EventArgs args) {
+               FakeButtonLoadPerson.Click();
+       }
        private void on_button_edit_clicked (object o, EventArgs args) {
                FakeButtonEditPerson.Click();
        }
@@ -185,10 +198,12 @@ public class PersonSelectWindow
        private void on_button_delete_yes_clicked (object o, EventArgs args) {
                FakeButtonDeletePerson.Click();
        }
-       public void Button_delete_confirm_focus(bool doFocus, bool sensitivePersonButtons) {
+       public void Button_delete_confirm_focus(bool doFocus, bool sensitivePersonButtons)
+       {
                vbox_button_delete_confirm.Visible = doFocus;
                table1.Sensitive = ! doFocus;
                button_add.Sensitive = ! doFocus;
+               button_load.Sensitive = ! doFocus;
                
                personButtonsSensitive(sensitivePersonButtons);
        }


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