[hamster-applet] add summary line and show overview and add-earlier-activity buttons. this is preliminary get-the-bas
- From: Toms Baugis <tbaugis src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [hamster-applet] add summary line and show overview and add-earlier-activity buttons. this is preliminary get-the-bas
- Date: Fri, 10 Feb 2012 21:28:34 +0000 (UTC)
commit c3ccbcc219efe097d84ec2ef1d16b3231ccbdcb8
Author: Toms BauÄis <toms baugis gmail com>
Date: Fri Feb 10 23:28:24 2012 +0200
add summary line and show overview and add-earlier-activity buttons. this is preliminary get-the-basics-in fix
data/hamster.ui | 80 ++++++++++++++++++++++++++++++++++++++++++++++
src/hamster-time-tracker | 21 +++++++++++-
2 files changed, 100 insertions(+), 1 deletions(-)
---
diff --git a/data/hamster.ui b/data/hamster.ui
index 77ad45e..d8e1b9b 100644
--- a/data/hamster.ui
+++ b/data/hamster.ui
@@ -342,6 +342,7 @@
<object class="GtkAlignment" id="new_entry_box">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="top_padding">5</property>
<property name="left_padding">12</property>
<child>
<object class="GtkHBox" id="bleh1">
@@ -382,6 +383,7 @@
<object class="GtkHButtonBox" id="hbuttonbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="spacing">5</property>
<child>
<object class="GtkButton" id="switch_activity">
<property name="label" translatable="yes">S_witch</property>
@@ -456,6 +458,7 @@
<object class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="can_focus">False</property>
+ <property name="top_padding">5</property>
<property name="left_padding">12</property>
<child>
<object class="GtkScrolledWindow" id="today_box">
@@ -488,6 +491,83 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <child>
+ <object class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <child>
+ <object class="GtkLabel" id="fact_totals">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">totals</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox4">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">5</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="add_activity_button">
+ <property name="label" translatable="yes">Add Earlier Activity</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="on_add_activity_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="overview_button">
+ <property name="label" translatable="yes">Show Overview</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="no_show_all">True</property>
+ <property name="use_action_appearance">False</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="on_show_overview_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="expand">True</property>
diff --git a/src/hamster-time-tracker b/src/hamster-time-tracker
index b92cec0..e605c8d 100755
--- a/src/hamster-time-tracker
+++ b/src/hamster-time-tracker
@@ -25,6 +25,7 @@ import datetime as dt
import gtk, gobject
import glib
import dbus, dbus.service, dbus.mainloop.glib
+import locale
class ProjectHamsterStatusIcon(gtk.StatusIcon):
def __init__(self, project):
@@ -275,9 +276,21 @@ class ProjectHamster(object):
if not facts:
self._gui.get_object("today_box").hide()
- #self._gui.get_object("fact_totals").set_text(_("No records today"))
+ self._gui.get_object("fact_totals").set_text(_("No records today"))
else:
self._gui.get_object("today_box").show()
+ total_strings = []
+ for category in by_category:
+ # listing of today's categories and time spent in them
+ duration = locale.format("%.1f", (by_category[category] / 60.0))
+ total_strings.append(_("%(category)s: %(duration)s") % \
+ ({'category': category,
+ #duration in main drop-down per category in hours
+ 'duration': _("%sh") % duration
+ }))
+
+ total_string = ", ".join(total_strings)
+ self._gui.get_object("fact_totals").set_text(total_string)
self.set_last_activity()
@@ -341,6 +354,12 @@ class ProjectHamster(object):
if fact.activity:
runtime.storage.add_fact(fact)
+ def on_add_activity_clicked(self, button):
+ dialogs.edit.show(self.window)
+
+ def on_show_overview_clicked(self, button):
+ dialogs.overview.show(self.window)
+
"""button events"""
def on_menu_add_earlier_activate(self, menu):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]