[hamster-applet] rubbish
- From: Toms Baugis <tbaugis src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [hamster-applet] rubbish
- Date: Wed, 18 Nov 2009 18:32:36 +0000 (UTC)
commit 96e39a19f10b2cc6172b53ec11d11e97f762c0ae
Author: Toms Bauģis <toms baugis gmail com>
Date: Wed Nov 18 18:30:47 2009 +0000
rubbish
data/hamster.ui | 127 +++++++++++++++++++++++--------------------------
hamster/standalone.py | 66 ++++++++++++++++++++++++-
2 files changed, 123 insertions(+), 70 deletions(-)
---
diff --git a/data/hamster.ui b/data/hamster.ui
index d22b614..673ed7b 100644
--- a/data/hamster.ui
+++ b/data/hamster.ui
@@ -21,38 +21,20 @@
<object class="GtkHBox" id="current_activity_box">
<property name="visible">True</property>
<child>
- <object class="GtkTable" id="table1">
+ <object class="GtkVBox" id="vbox6">
<property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">16</property>
- <property name="row_spacing">4</property>
+ <property name="orientation">vertical</property>
<child>
- <object class="GtkLabel" id="last_activity_name">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Hamster</property>
- <attributes>
- <attribute name="weight" value="bold"/>
- <attribute name="size" value="15000"/>
- </attributes>
- </object>
- <packing>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkHBox" id="hbox1">
<property name="visible">True</property>
- <property name="spacing">4</property>
<child>
- <object class="GtkLabel" id="last_activity_duration">
+ <object class="GtkLabel" id="last_activity_name">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">1h 23m</property>
+ <property name="label">Just an activity</property>
<attributes>
<attribute name="weight" value="bold"/>
+ <attribute name="size" value="15000"/>
</attributes>
</object>
<packing>
@@ -60,37 +42,15 @@
<property name="position">0</property>
</packing>
</child>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="spacing">4</property>
<child>
<object class="GtkLabel" id="last_activity_category">
<property name="visible">True</property>
- <property name="no_show_all">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes"><small><i>Hacking</i></small></property>
- <property name="use_markup">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="last_activity_description">
- <property name="visible">True</property>
- <property name="no_show_all">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes"><small>shing, chang, chong</small></property>
- <property name="use_markup">True</property>
- <property name="wrap">True</property>
+ <property name="label"> - Work</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ <attribute name="size" value="15000"/>
+ </attributes>
</object>
<packing>
<property name="position">1</property>
@@ -98,10 +58,34 @@
</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>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="last_activity_duration">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label">1h 23m</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="last_activity_description">
+ <property name="visible">True</property>
+ <property name="no_show_all">True</property>
+ <property name="xalign">0</property>
+ <property name="label"><small>one, two, three</small></property>
+ <property name="use_markup">True</property>
+ <property name="wrap">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
</packing>
</child>
</object>
@@ -110,21 +94,28 @@
</packing>
</child>
<child>
- <object class="GtkHButtonBox" id="hbuttonbox1">
+ <object class="GtkAlignment" id="alignment5">
<property name="visible">True</property>
- <property name="spacing">4</property>
+ <property name="yalign">0</property>
+ <property name="yscale">0</property>
<child>
- <object class="GtkButton" id="button2">
- <property name="label" translatable="yes">Stop</property>
+ <object class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">True</property>
+ <property name="spacing">4</property>
+ <child>
+ <object class="GtkButton" id="button2">
+ <property name="label" translatable="yes">Stop tracking</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
</child>
</object>
<packing>
@@ -188,6 +179,7 @@
<property name="label" translatable="yes">Switch</property>
<property name="width_request">80</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
@@ -505,8 +497,9 @@
<child>
<object class="GtkLabel" id="label18">
<property name="visible">True</property>
+ <property name="xalign">0</property>
<property name="yalign">0</property>
- <property name="label" translatable="yes">13:15 - 14:20</property>
+ <property name="label" translatable="yes">13:15</property>
</object>
<packing>
<property name="top_attach">2</property>
diff --git a/hamster/standalone.py b/hamster/standalone.py
index 66f584a..7f10f1e 100755
--- a/hamster/standalone.py
+++ b/hamster/standalone.py
@@ -39,8 +39,15 @@ class MainWindow(object):
self.get_widget("tabs").set_current_page(1)
self.set_last_activity()
+ self.load_today()
+
+ gtk.link_button_set_uri_hook(self.magic)
+
self._gui.connect_signals(self)
+ def magic(self, button, uri):
+ print uri, button
+
def style_widgets(self):
#TODO - replace with the tree background color (can't get it atm!)
self.get_widget("todays_activities_ebox").modify_bg(gtk.STATE_NORMAL,
@@ -60,11 +67,10 @@ class MainWindow(object):
self.get_widget("last_activity_name").set_text(activity['name'])
if activity['category'] != _("Unsorted"):
self.get_widget("last_activity_category") \
- .set_markup("<small>%s</small>" %
- stuff.escape_pango(activity['category']))
+ .set_text(" - %s" % activity['category'])
self.get_widget("last_activity_category").show()
else:
- self.get_widget("last_activity_category").show()
+ self.get_widget("last_activity_category").hide()
if activity['description']:
self.get_widget("last_activity_description").set_text(activity['description'])
@@ -72,6 +78,60 @@ class MainWindow(object):
else:
self.get_widget("last_activity_description").hide()
+ def load_today(self):
+ todays_facts = runtime.storage.get_facts(dt.date.today())
+ grid = self.get_widget("activities_today")
+
+ #clear
+ for child in grid.get_children(): grid.remove(child)
+
+
+ def add_cell(cell, x, y, expandX = gtk.FILL,
+ expandY = gtk.FILL):
+
+ if isinstance(cell, str) or isinstance(cell, unicode):
+ cell = gtk.Label(cell)
+ cell.set_alignment(0.0, 0.0)
+
+ grid.attach(cell, x, x + 1, y, y + 1, expandX, expandY)
+
+
+ for rownum, fact in enumerate(todays_facts):
+ if fact["end_time"]:
+ fact_time = "%s - %s " % (fact["start_time"].strftime("%H:%M"),
+ fact["end_time"].strftime("%H:%M"))
+ else:
+ fact_time = fact["start_time"].strftime("%H:%M ")
+
+ duration = 24 * 60 * fact["delta"].days + fact["delta"].seconds / 60
+
+ add_cell(fact_time, 0, rownum)
+
+ name_tags = gtk.VBox()
+ name_label = gtk.Label(fact['name'])
+ name_label.set_alignment(0, 0)
+ name_tags.pack_start(name_label)
+
+ description_label = gtk.Label(fact['category'])
+ description_label.set_alignment(0, 0)
+ name_tags.pack_start(description_label)
+
+ add_cell(name_tags, 1, rownum, (gtk.EXPAND | gtk.FILL), ())
+
+ add_cell(stuff.format_duration(duration), 2, rownum, gtk.FILL, ())
+
+ resume_button = gtk.LinkButton("resume:%d" % fact['id'])
+ resume_button.set_label(_("Resume"))
+ add_cell(resume_button, 3, rownum, (), ())
+
+ resume_button = gtk.LinkButton("edit:%d" % fact['id'])
+ resume_button.set_label(_("Edit"))
+ add_cell(resume_button, 4, rownum, (), ())
+
+
+
+
+
def on_switch_activity_clicked(self, widget):
self.get_widget("new_entry_box").show()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]