[chronojump] PersonSelectWindow with a selector to show images or not. TODO: SQL
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] PersonSelectWindow with a selector to show images or not. TODO: SQL
- Date: Mon, 8 Mar 2021 20:58:11 +0000 (UTC)
commit 60a1f1cd7259d34ca43b5d6701a3c10b25ee30fb
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Mar 8 21:57:53 2021 +0100
PersonSelectWindow with a selector to show images or not. TODO: SQL
glade/person_select_window.glade | 193 +++++++++++++++++++++++----------------
src/gui/person/personSelect.cs | 38 +++++---
2 files changed, 141 insertions(+), 90 deletions(-)
---
diff --git a/glade/person_select_window.glade b/glade/person_select_window.glade
index 89944a32..dc3138e4 100644
--- a/glade/person_select_window.glade
+++ b/glade/person_select_window.glade
@@ -2600,6 +2600,18 @@
<child>
<placeholder/>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</widget>
</child>
</widget>
@@ -3116,7 +3128,7 @@
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_button_delete_no_clicked"
swapped="no"/>
- <accelerator key="Escape" signal="clicked"/>
+ <accelerator key="Escape" signal="clicked"/>
</widget>
<packing>
<property name="expand">True</property>
@@ -3451,69 +3463,18 @@
</packing>
</child>
<child>
- <widget class="GtkHBox" id="hbox_up_down_close">
+ <widget class="GtkVBox" id="vbox_corner_controls">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">10</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkVBox" id="vbox3">
+ <widget class="GtkCheckButton" id="check_show_images">
+ <property name="label" translatable="yes">Show images</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
- <widget class="GtkButton" id="button_up">
- <property name="width_request">40</property>
- <property name="height_request">40</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">True</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip"><Control>Up</property>
- <property name="relief">half</property>
- <signal name="clicked" handler="on_button_up_clicked" swapped="no"/>
- <accelerator key="Up" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
- <child>
- <widget class="GtkArrow" id="arrow_up1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="arrow_type">up</property>
- </widget>
- </child>
- </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_down">
- <property name="width_request">40</property>
- <property name="height_request">40</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">True</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip"><Control>Down</property>
- <property name="relief">half</property>
- <signal name="clicked" handler="on_button_down_clicked" swapped="no"/>
- <accelerator key="Down" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
- <child>
- <widget class="GtkArrow" id="arrow_down1">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="arrow_type">down</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="on_check_show_images_toggled" swapped="no"/>
</widget>
<packing>
<property name="expand">False</property>
@@ -3522,43 +3483,121 @@
</packing>
</child>
<child>
- <widget class="GtkButton" id="button_close">
+ <widget class="GtkHBox" id="hbox_up_down_close">
<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">10</property>
<child>
<widget class="GtkVBox" id="vbox7">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="spacing">4</property>
+ <property name="spacing">6</property>
<child>
- <widget class="GtkImage" id="image_close">
+ <widget class="GtkButton" id="button_up">
+ <property name="width_request">40</property>
+ <property name="height_request">40</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="stock">gtk-close</property>
- <property name="icon-size">3</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip"><Control>Up</property>
+ <property name="relief">half</property>
+ <signal name="clicked" handler="on_button_up_clicked" swapped="no"/>
+ <accelerator key="Up" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkArrow" id="arrow_up1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="arrow_type">up</property>
+ </widget>
+ </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>
<child>
- <widget class="GtkLabel" id="label4">
+ <widget class="GtkButton" id="button_down">
+ <property name="width_request">40</property>
+ <property name="height_request">40</property>
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Close</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="tooltip"><Control>Down</property>
+ <property name="relief">half</property>
+ <signal name="clicked" handler="on_button_down_clicked" swapped="no"/>
+ <accelerator key="Down" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
+ <child>
+ <widget class="GtkArrow" id="arrow_down1">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="arrow_type">down</property>
+ </widget>
+ </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">1</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="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_close_clicked" swapped="no"/>
+ <accelerator key="Escape" signal="clicked"/>
+ <child>
+ <widget class="GtkVBox" id="vbox15">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">4</property>
+ <child>
+ <widget class="GtkImage" id="image_close">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-close</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="label4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Close</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">True</property>
+ <property name="position">1</property>
+ </packing>
</child>
</widget>
<packing>
diff --git a/src/gui/person/personSelect.cs b/src/gui/person/personSelect.cs
index a7f45874..ab7b298b 100644
--- a/src/gui/person/personSelect.cs
+++ b/src/gui/person/personSelect.cs
@@ -50,10 +50,11 @@ public class PersonSelectWindow
[Widget] Gtk.Image image_all_persons_events;
[Widget] Gtk.Image image_person_delete;
[Widget] Gtk.Image image_manage_persons_cancel;
- [Widget] Gtk.HBox hbox_up_down_close;
+ [Widget] Gtk.VBox vbox_corner_controls;
[Widget] Gtk.Image image_close;
[Widget] Gtk.Label label_manage_persons;
[Widget] Gtk.Label label_delete_person;
+ [Widget] Gtk.CheckButton check_show_images;
static PersonSelectWindow PersonSelectWindowBox;
@@ -82,6 +83,8 @@ public class PersonSelectWindow
if(raspberry)
slidebarSize = 40;
+ check_show_images.Active = false;
+
scrolled1.WidthRequest = 150 * 4 + 8 * 2 + 12 * 2 + slidebarSize; //150 is button width, 8 is
padding left and right (4+4), 12 the left and right of scrolled1
int rowsShown = 3;
@@ -101,6 +104,7 @@ public class PersonSelectWindow
//UtilGtk.ContrastLabelsLabel(Config.ColorBackgroundIsDark, label_confirm);
UtilGtk.ContrastLabelsLabel(Config.ColorBackgroundIsDark, label_manage_persons);
UtilGtk.ContrastLabelsLabel(Config.ColorBackgroundIsDark, label_delete_person);
+ UtilGtk.ContrastLabelsVBox(Config.ColorBackgroundIsDark, vbox_corner_controls);
}
label_manage_persons.Text = "<b>" + label_manage_persons.Text + "</b>";
@@ -154,7 +158,7 @@ public class PersonSelectWindow
PersonSelectWindowBox.notebook.CurrentPage = 0;
PersonSelectWindowBox.button_manage_persons.Sensitive = true;
- PersonSelectWindowBox.hbox_up_down_close.Sensitive = true;
+ PersonSelectWindowBox.vbox_corner_controls.Sensitive = true;
PersonSelectWindowBox.createTable();
@@ -186,7 +190,7 @@ public class PersonSelectWindow
table1.Visible = true;
table1.Sensitive = true;
button_manage_persons.Sensitive = true;
- hbox_up_down_close.Sensitive = true;
+ vbox_corner_controls.Sensitive = true;
if(currentPerson != null)
assignPersonSelectedStuff(currentPerson);
@@ -195,6 +199,11 @@ public class PersonSelectWindow
person_select_window.Visible = true;
}
+ private void on_check_show_images_toggled (object o, EventArgs args)
+ {
+ Update(persons);
+ }
+
private void removeTable()
{
Array buttons = table1.Children;
@@ -234,7 +243,7 @@ public class PersonSelectWindow
Person p = (Person) persons[count ++];
- PersonPhotoButton ppb = new PersonPhotoButton(p.UniqueID, p.Name); //creates
the button
+ PersonPhotoButton ppb = new PersonPhotoButton(p.UniqueID, p.Name,
check_show_images.Active); //creates the button
//select currentPerson
if(selectedFirstClickPersonID != -1 && selectedFirstClickPersonID ==
p.UniqueID)
@@ -322,7 +331,7 @@ public class PersonSelectWindow
personButtonsSensitive (false);
button_manage_persons.Sensitive = false;
- hbox_up_down_close.Sensitive = false;
+ vbox_corner_controls.Sensitive = false;
}
private void on_button_manage_persons_cancel_clicked (object o, EventArgs args)
@@ -331,7 +340,7 @@ public class PersonSelectWindow
personButtonsSensitive (SelectedPerson != null);
button_manage_persons.Sensitive = true;
- hbox_up_down_close.Sensitive = true;
+ vbox_corner_controls.Sensitive = true;
}
private void on_button_add_clicked (object o, EventArgs args)
@@ -413,7 +422,7 @@ public class PersonSelectWindow
//vbox_button_delete_confirm.Visible = doFocus;
table1.Sensitive = ! doFocus;
button_manage_persons.Sensitive = ! doFocus;
- hbox_up_down_close.Sensitive = ! doFocus;
+ vbox_corner_controls.Sensitive = ! doFocus;
personButtonsSensitive(sensitivePersonButtons);
}
@@ -463,12 +472,12 @@ public class PersonPhotoButton
*/
//used to create button
- public PersonPhotoButton (int id, string name)
+ public PersonPhotoButton (int id, string name, bool showImage)
{
personID = id;
personName = name;
- createButton();
+ createButton(showImage);
Selected = false;
}
@@ -517,14 +526,15 @@ public class PersonPhotoButton
//LogB.Information("Name: " + l.Text.ToString());
}
- private void createButton ()
+ private void createButton (bool showImage)
{
Gtk.VBox vbox = new Gtk.VBox();
Gtk.Image image = new Gtk.Image();
addUserPhotoIfExists(image);
- image.HeightRequest = 150;
- image.Visible = true;
+ if(showImage)
+ image.HeightRequest = 150;
+ image.Visible = showImage;
Gtk.Label label_select = new Gtk.Label("Select !");
label_select.Visible = false; //hide this to the user until button is clicked first time
@@ -552,7 +562,9 @@ public class PersonPhotoButton
button = new Button(vbox);
button.WidthRequest = 150; //commentin this will make columns longer with enough space for
labels
- button.HeightRequest = 170; //commenting this will make the rows be of different height
depending on image and lines of text
+
+ if(showImage)
+ button.HeightRequest = 170; //commenting this will make the rows be of different
height depending on image and lines of text
}
private Array getButtonBoxElements (Gtk.Button button)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]