[hamster-applet] what you see is what you report. no more magic options in the report dialog (finally!)
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [hamster-applet] what you see is what you report. no more magic options in the report dialog (finally!)
- Date: Tue, 22 Dec 2009 23:43:44 +0000 (UTC)
commit c80c8c947bb041aecee16a14fedcb323accb4c2b
Author: Toms Bauģis <toms baugis gmail com>
Date: Tue Dec 22 23:43:35 2009 +0000
what you see is what you report. no more magic options in the report dialog (finally!)
data/stats_reports.ui | 122 +-------------------------------
hamster/stats_reports.py | 11 +---
hamster/widgets/reportchooserdialog.py | 55 +--------------
3 files changed, 6 insertions(+), 182 deletions(-)
---
diff --git a/data/stats_reports.ui b/data/stats_reports.ui
index 5268c4c..96fd7b9 100644
--- a/data/stats_reports.ui
+++ b/data/stats_reports.ui
@@ -192,127 +192,7 @@
<property name="orientation">vertical</property>
<property name="spacing">2</property>
<child>
- <object class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="top_padding">8</property>
- <property name="left_padding">8</property>
- <property name="right_padding">8</property>
- <child>
- <object class="GtkTable" id="table1">
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">8</property>
- <property name="row_spacing">8</property>
- <child>
- <object class="GtkLabel" id="date_interval_label">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Date interval:</property>
- </object>
- <packing>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
- <property name="label" translatable="yes">Categories:</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment6">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="xscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox2">
- <property name="visible">True</property>
- <child>
- <object class="GtkAlignment" id="from_date_box">
- <property name="visible">True</property>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label11">
- <property name="visible">True</property>
- <property name="xpad">6</property>
- <property name="label" translatable="yes">to</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="to_date_box">
- <property name="visible">True</property>
- <child>
- <placeholder/>
- </child>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkAlignment" id="alignment8">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="xscale">0</property>
- <child>
- <object class="GtkTable" id="category_box">
- <property name="visible">True</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>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">2</property>
- </packing>
+ <placeholder/>
</child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area1">
diff --git a/hamster/stats_reports.py b/hamster/stats_reports.py
index cad043a..890271d 100644
--- a/hamster/stats_reports.py
+++ b/hamster/stats_reports.py
@@ -334,16 +334,9 @@ class ReportsBox(gtk.VBox):
filter.add_pattern("*")
chooser.add_filter(filter)
- def on_report_chosen(self, widget, format, path, start_date, end_date,
- categories):
+ def on_report_chosen(self, widget, format, path):
self.report_chooser = None
-
- facts = runtime.storage.get_facts(start_date, end_date)
- reports.simple(facts,
- start_date,
- end_date,
- format,
- path)
+ reports.simple(self.facts, self.start_date, self.end_date, format, path)
if format == ("html"):
webbrowser.open_new("file://%s" % path)
diff --git a/hamster/widgets/reportchooserdialog.py b/hamster/widgets/reportchooserdialog.py
index b54feb0..a6239f7 100644
--- a/hamster/widgets/reportchooserdialog.py
+++ b/hamster/widgets/reportchooserdialog.py
@@ -34,9 +34,7 @@ class ReportChooserDialog(gtk.Dialog):
__gsignals__ = {
# format, path, start_date, end_date
'report-chosen': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE,
- (gobject.TYPE_STRING, gobject.TYPE_STRING,
- gobject.TYPE_PYOBJECT, gobject.TYPE_PYOBJECT,
- gobject.TYPE_PYOBJECT)),
+ (gobject.TYPE_STRING, gobject.TYPE_STRING)),
'report-chooser-closed': (gobject.SIGNAL_RUN_LAST, gobject.TYPE_NONE, ()),
}
def __init__(self):
@@ -84,13 +82,6 @@ class ReportChooserDialog(gtk.Dialog):
filter.add_pattern("*")
self.dialog.add_filter(filter)
- self.start_date = DateInput()
- ui.get_object('from_date_box').add(self.start_date)
- self.end_date = DateInput()
- ui.get_object('to_date_box').add(self.end_date)
-
- self.category_box = ui.get_object('category_box')
-
ui.get_object('save_button').connect("clicked", self.on_save_button_clicked)
ui.get_object('cancel_button').connect("clicked", self.on_cancel_button_clicked)
@@ -102,37 +93,6 @@ class ReportChooserDialog(gtk.Dialog):
end_date.strftime("%x").replace("/", "."))
self.dialog.set_current_name(filename)
- self.start_date.set_date(start_date)
- self.end_date.set_date(end_date)
-
- #add unsorted category
- button_all = gtk.CheckButton(C_("categories", "All").encode("utf-8"))
- button_all.value = None
- button_all.set_active(True)
-
- 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:
- col +=1
- if col % 4 == 0:
- col = 0
- row +=1
-
- button = gtk.CheckButton(category['name'].encode("utf-8"))
- button.value = category['id']
- button.set_active(True)
- self.category_box.attach(button, col, col+1, row, row+1)
-
-
-
response = self.dialog.show_all()
def present(self):
@@ -153,18 +113,9 @@ class ReportChooserDialog(gtk.Dialog):
path = "%s.%s" % (path.rstrip("."), format)
categories = []
- for button in self.category_box.get_children():
- if button.get_active():
- categories.append(button.value)
-
- if None in categories:
- categories = None # nothing is everything
-
+
# format, path, start_date, end_date
- self.emit("report-chosen", format, path,
- self.start_date.get_date().date(),
- self.end_date.get_date().date(),
- categories)
+ self.emit("report-chosen", format, path)
self.dialog.destroy()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]