[chronojump] personSelectWindow can edit person now
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] personSelectWindow can edit person now
- Date: Fri, 26 Jun 2015 18:58:59 +0000 (UTC)
commit 8585cf8300af1d23fac3bbe265360bb069b8bb83
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Jun 26 20:57:57 2015 +0200
personSelectWindow can edit person now
glade/chronojump.glade | 449 ++++++++++++++++++++++++++++++++++++++++++-----
src/gui/chronojump.cs | 25 +++-
src/gui/personSelect.cs | 44 ++++-
3 files changed, 461 insertions(+), 57 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index c1eba8e..205c7db 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -1335,7 +1335,7 @@
<property name="has_tooltip">True</property>
<property name="tooltip" translatable="yes">Edit
selected person
<Control>p</property>
- <signal name="clicked"
handler="on_edit_current_person_clicked" swapped="no"/>
+ <signal name="clicked"
handler="on_edit_current_person_clicked_from_main_gui" swapped="no"/>
<accelerator key="p" signal="clicked"
modifiers="GDK_CONTROL_MASK"/>
<child>
<widget class="GtkImage" id="image1977">
@@ -7358,6 +7358,15 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -8391,6 +8400,15 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
<child>
@@ -9676,6 +9694,15 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">2</property>
@@ -10602,6 +10629,15 @@ Second Chronopic to platforms.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="position">4</property>
@@ -21910,6 +21946,15 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -22741,6 +22786,15 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -24064,6 +24118,15 @@ by you</property>
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
<widget class="GtkButton" id="button_video_url">
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -24444,6 +24507,15 @@ by you</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="expand">True</property>
@@ -35276,6 +35348,60 @@ options</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -36439,23 +36565,24 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
</widget>
<widget class="GtkWindow" id="person_select_window">
<property name="width_request">800</property>
- <property name="height_request">600</property>
+ <property name="height_request">550</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">10</property>
+ <property name="title" translatable="yes">Select person</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<signal name="delete_event" handler="on_delete_event" swapped="no"/>
<child>
- <widget class="GtkVBox" id="vbox1">
+ <widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">12</property>
+ <property name="spacing">10</property>
<child>
<widget class="GtkScrolledWindow" id="scrolledwindow1">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="hscrollbar_policy">never</property>
+ <property name="hscrollbar_policy">automatic</property>
<property name="vscrollbar_policy">automatic</property>
<child>
<widget class="GtkViewport" id="viewport1">
@@ -36562,6 +36689,42 @@ 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>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -36574,66 +36737,226 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
</packing>
</child>
<child>
- <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <widget class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="layout_style">spread</property>
<child>
- <widget class="GtkButton" id="button_add">
+ <widget class="GtkVBox" id="vbox2">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked" handler="on_button_add_clicked" swapped="no"/>
+ <property name="can_focus">False</property>
+ <property name="border_width">4</property>
+ <property name="spacing">20</property>
<child>
- <widget class="GtkHBox" id="hbox2">
+ <widget class="GtkLabel" id="label_selected_person_name">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">12</property>
+ <property name="ellipsize">end</property>
+ <property name="width_chars">16</property>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_select">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button_select_clicked" swapped="no"/>
<child>
- <widget class="GtkImage" id="image1">
+ <widget class="GtkVBox" id="vbox3">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="stock">gtk-add</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-yes</property>
+ <property name="icon-size">6</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="label1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Select</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>
+ </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_edit">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button_edit_clicked" swapped="no"/>
<child>
- <widget class="GtkLabel" id="label1">
+ <widget class="GtkVBox" id="vbox5">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="label" translatable="yes">Add person</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-edit</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="label2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Edit</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">1</property>
- </packing>
</child>
</widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">2</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="GtkButton" id="button_close">
- <property name="label" translatable="yes">Close</property>
+ <widget class="GtkVBox" id="vbox4">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <signal name="clicked" handler="on_button_close_clicked" swapped="no"/>
- <accelerator key="Escape" signal="clicked"/>
+ <property name="can_focus">False</property>
+ <property name="spacing">60</property>
+ <child>
+ <widget class="GtkButton" id="button_add">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button_add_clicked" swapped="no"/>
+ <child>
+ <widget class="GtkVBox" id="vbox6">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-add</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="label3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Add new 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">True</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="button_close">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <signal name="clicked" handler="on_button_cancel_clicked" swapped="no"/>
+ <accelerator key="Escape" signal="clicked"/>
+ <child>
+ <widget class="GtkVBox" id="vbox7">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-cancel</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="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Cancel</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">True</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="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
@@ -36644,17 +36967,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
<property name="position">1</property>
</packing>
</child>
- <child>
- <widget class="GtkHBox" id="hbox1">
- <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">2</property>
- </packing>
- </child>
</widget>
</child>
</widget>
@@ -37708,6 +38020,15 @@ 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>
</widget>
</child>
</widget>
@@ -38577,6 +38898,15 @@ 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>
</widget>
</child>
</widget>
@@ -41904,6 +42234,15 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
<property name="left_attach">2</property>
@@ -42399,6 +42738,15 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -42909,6 +43257,15 @@ It starts before and arrives there with some speed.</property>
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 5a99ddf..4a7205a 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -1110,7 +1110,7 @@ public partial class ChronoJumpWindow
Gtk.MenuItem myItem;
myItem = new MenuItem ( Catalog.GetString("Edit") + " " + myPerson.Name);
- myItem.Activated += on_edit_current_person_clicked;
+ myItem.Activated += on_edit_current_person_clicked_from_main_gui;
myMenu.Attach( myItem, 0, 1, 0, 1 );
myItem = new MenuItem ( Catalog.GetString("Show all tests of") + " " + myPerson.Name);
@@ -2695,7 +2695,13 @@ public partial class ChronoJumpWindow
}
}
- private void on_edit_current_person_clicked (object o, EventArgs args) {
+ bool person_edit_single_called_from_person_select_window;
+ private void on_edit_current_person_clicked_from_main_gui (object o, EventArgs args) {
+ person_edit_single_called_from_person_select_window = false;
+ person_edit_single();
+ }
+
+ private void person_edit_single() {
LogB.Information("modify person");
personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, currentPerson,
@@ -2732,6 +2738,13 @@ public partial class ChronoJumpWindow
}
// personAddModifyWin.Destroy();
+
+ if(person_edit_single_called_from_person_select_window) {
+ ArrayList myPersons = SqlitePersonSession.SelectCurrentSessionPersons(
+ currentSession.UniqueID,
+ false); //means: do not returnPersonAndPSlist
+ personSelectWin.Update(myPersons);
+ }
}
}
@@ -2780,6 +2793,7 @@ public partial class ChronoJumpWindow
personSelectWin = PersonSelectWindow.Show(app1, myPersons);
personSelectWin.FakeButtonAddPerson.Clicked += new
EventHandler(on_button_encoder_person_add_person);
+ personSelectWin.FakeButtonEditPerson.Clicked += new
EventHandler(on_button_encoder_person_edit_person);
personSelectWin.FakeButtonDone.Clicked += new
EventHandler(on_button_encoder_person_change_done);
}
private void on_button_encoder_person_add_person(object o, EventArgs args)
@@ -2787,6 +2801,13 @@ public partial class ChronoJumpWindow
person_add_single_called_from_person_select_window = true;
person_add_single();
}
+ private void on_button_encoder_person_edit_person(object o, EventArgs args)
+ {
+ currentPerson = personSelectWin.SelectedPerson;
+
+ person_edit_single_called_from_person_select_window = true;
+ person_edit_single();
+ }
private void on_button_encoder_person_change_done(object o, EventArgs args)
{
currentPerson = personSelectWin.SelectedPerson;
diff --git a/src/gui/personSelect.cs b/src/gui/personSelect.cs
index 7829af1..7213192 100644
--- a/src/gui/personSelect.cs
+++ b/src/gui/personSelect.cs
@@ -29,6 +29,9 @@ public class PersonSelectWindow
{
[Widget] Gtk.Window person_select_window;
[Widget] Gtk.Table table1;
+ [Widget] Gtk.Button button_select;
+ [Widget] Gtk.Button button_edit;
+ [Widget] Gtk.Label label_selected_person_name;
static PersonSelectWindow PersonSelectWindowBox;
Gtk.Window parent;
@@ -36,6 +39,7 @@ public class PersonSelectWindow
private ArrayList persons;
public Person SelectedPerson;
public Gtk.Button FakeButtonAddPerson;
+ public Gtk.Button FakeButtonEditPerson;
public Gtk.Button FakeButtonDone;
@@ -48,6 +52,7 @@ public class PersonSelectWindow
UtilGtk.IconWindow(person_select_window);
FakeButtonAddPerson = new Gtk.Button();
+ FakeButtonEditPerson = new Gtk.Button();
FakeButtonDone = new Gtk.Button();
}
@@ -77,6 +82,9 @@ public class PersonSelectWindow
LogB.Debug("Recreating table");
createTable();
table1.Visible = true;
+
+ button_select.Sensitive = false;
+ button_edit.Sensitive = false;
}
private void removeTable()
@@ -89,11 +97,14 @@ public class PersonSelectWindow
private void createTable()
{
LogB.Debug("Persons count" + persons.Count.ToString());
- uint padding = 8;
+ uint padding = 4;
uint cols = 4; //each row has 4 columns
uint rows = Convert.ToUInt32(Math.Floor(persons.Count / (1.0 * cols) ) +1);
int count = 0;
+ button_select.Sensitive = false;
+ button_edit.Sensitive = false;
+
for (int row_i = 0; row_i < rows; row_i ++) {
for (int col_i = 0; col_i < cols; col_i ++)
{
@@ -104,19 +115,23 @@ public class PersonSelectWindow
PersonPhotoButton ppb = new PersonPhotoButton(p);
Gtk.Button b = ppb.CreateButton();
-
- b.Clicked += new EventHandler(on_button_select_portrait_clicked);
b.Show();
+
+ b.Clicked += new EventHandler(on_button_portrait_clicked);
+ b.CanFocus=true;
table1.Attach (b, (uint) col_i, (uint) col_i +1, (uint) row_i, (uint) row_i
+1,
Gtk.AttachOptions.Fill,
Gtk.AttachOptions.Fill,
padding, padding);
+
}
}
+
+ table1.ShowAll();
}
- private void on_button_select_portrait_clicked (object o, EventArgs args)
+ private void on_button_portrait_clicked (object o, EventArgs args)
{
LogB.Information("Clicked");
@@ -126,19 +141,29 @@ public class PersonSelectWindow
int personID = PersonPhotoButton.GetPersonID(b);
LogB.Information("UniqueID: " + personID.ToString());
-
+
//TODO: now need to process the signal and close
foreach(Person p in persons)
if(p.UniqueID == personID) {
SelectedPerson = p;
- FakeButtonDone.Click();
- close_window();
+ label_selected_person_name.Text = p.Name;
+
+ button_select.Sensitive = true;
+ button_edit.Sensitive = true;
}
}
+ protected virtual void on_button_select_clicked (object o, EventArgs args) {
+ FakeButtonDone.Click();
+ close_window();
+ }
+
protected virtual void on_button_add_clicked (object o, EventArgs args) {
FakeButtonAddPerson.Click();
}
+ protected virtual void on_button_edit_clicked (object o, EventArgs args) {
+ FakeButtonEditPerson.Click();
+ }
private void close_window() {
PersonSelectWindowBox.person_select_window.Hide();
@@ -146,7 +171,7 @@ public class PersonSelectWindow
}
//ESC is enabled
- protected virtual void on_button_close_clicked (object o, EventArgs args) {
+ protected virtual void on_button_cancel_clicked (object o, EventArgs args) {
close_window();
}
@@ -191,11 +216,12 @@ public class PersonPhotoButton
vbox.PackStart(image);
vbox.PackStart(label_id);
- vbox.PackStart(label_name);
+ vbox.PackEnd(label_name, false, false, 1);
vbox.Show();
Button b = new Button(vbox);
+ b.WidthRequest=150;
return b;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]