[hamster-applet] fixes bug 587275: switched cancel and save, wrapping categories + categories are now check boxes,
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Subject: [hamster-applet] fixes bug 587275: switched cancel and save, wrapping categories + categories are now check boxes,
- Date: Sun, 12 Jul 2009 17:13:51 +0000 (UTC)
commit ae6c3a3f055d0ea39aaa0ae82f103df74cfe60b9
Author: Toms Bauģis <toms baugis gmail com>
Date: Sun Jul 12 18:13:34 2009 +0100
fixes bug 587275: switched cancel and save, wrapping categories + categories are now check boxes,
data/stats.ui | 20 +++++++++++++-------
hamster/stats.py | 35 +++++++++++++++++++++++++----------
2 files changed, 38 insertions(+), 17 deletions(-)
---
diff --git a/data/stats.ui b/data/stats.ui
index a00695a..6af8dc0 100644
--- a/data/stats.ui
+++ b/data/stats.ui
@@ -701,6 +701,7 @@
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="xalign">0</property>
+ <property name="yalign">0</property>
<property name="label" translatable="yes">Categories:</property>
</object>
<packing>
@@ -764,9 +765,14 @@
<property name="xalign">0</property>
<property name="xscale">0</property>
<child>
- <object class="GtkHBox" id="category_box">
+ <object class="GtkTable" id="category_box">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="n_columns">3</property>
+ <property name="column_spacing">12</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <placeholder/>
+ </child>
<child>
<placeholder/>
</child>
@@ -796,8 +802,8 @@
<property name="visible">True</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="save_button">
- <property name="label">gtk-save</property>
+ <object class="GtkButton" id="cancel_button">
+ <property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -810,8 +816,8 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="cancel_button">
- <property name="label">gtk-cancel</property>
+ <object class="GtkButton" id="save_button">
+ <property name="label">gtk-save</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@@ -833,8 +839,8 @@
</object>
</child>
<action-widgets>
- <action-widget response="0">save_button</action-widget>
<action-widget response="0">cancel_button</action-widget>
+ <action-widget response="0">save_button</action-widget>
</action-widgets>
</object>
<object class="GtkImage" id="week_icon">
diff --git a/hamster/stats.py b/hamster/stats.py
index 6391329..4b20ed6 100644
--- a/hamster/stats.py
+++ b/hamster/stats.py
@@ -116,16 +116,31 @@ class ReportChooserDialog(gtk.Dialog):
self.end_date.set_date(end_date)
#add unsorted category
- button_all = gtk.RadioButton(None, _("All").encode("utf-8"))
+ button_all = gtk.CheckButton(_("All").encode("utf-8"))
button_all.value = None
button_all.set_active(True)
- self.category_box.pack_start(button_all)
+
+ def on_category_all_clicked(checkbox):
+ active = checkbox.get_active()
+ for checkbox in self.category_box.get_children():
+ checkbox.set_active(active)
+
+ button_all.connect("clicked", on_category_all_clicked)
+ self.category_box.attach(button_all, 0, 1, 0, 1)
categories = runtime.storage.get_category_list()
+ col, row = 0, 0
for category in categories:
- button = gtk.RadioButton(button_all, category['name'].encode("utf-8"))
+ col +=1
+ if col % 4 == 0:
+ col = 0
+ row +=1
+
+ button = gtk.CheckButton(category['name'].encode("utf-8"))
button.value = category['id']
- self.category_box.pack_start(button)
+ button.set_active(True)
+ self.category_box.attach(button, col, col+1, row, row+1)
+
response = self.dialog.show_all()
@@ -141,16 +156,16 @@ class ReportChooserDialog(gtk.Dialog):
format = self.filters[self.dialog.get_filter()]
path = self.dialog.get_filename()
- category = None
+ categories = []
for button in self.category_box.get_children():
- if button.get_active():
- category = button.value
+ if button.get_active() and button.value:
+ categories.append(button.value)
# format, path, start_date, end_date
self.emit("report-chosen", format, path,
self.start_date.get_date().date(),
self.end_date.get_date().date(),
- category)
+ categories)
self.dialog.destroy()
@@ -1199,10 +1214,10 @@ than 15 minutes you seem to be a busy bee." % ("<b>%d</b>" % short_percent))
chooser.add_filter(filter)
def on_report_chosen(self, widget, format, path, start_date, end_date,
- category):
+ categories):
self.report_chooser = None
- facts = runtime.storage.get_facts(start_date, end_date, category_id = category)
+ facts = runtime.storage.get_facts(start_date, end_date, category_id = categories)
reports.simple(facts,
self.start_date,
self.end_date,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]