hamster-applet r638 - in trunk: data hamster
- From: tbaugis svn gnome org
- To: svn-commits-list gnome org
- Subject: hamster-applet r638 - in trunk: data hamster
- Date: Fri, 21 Nov 2008 18:46:15 +0000 (UTC)
Author: tbaugis
Date: Fri Nov 21 18:46:15 2008
New Revision: 638
URL: http://svn.gnome.org/viewvc/hamster-applet?rev=638&view=rev
Log:
editing activity descriptions!
Modified:
trunk/data/add_custom_fact.glade
trunk/hamster/add_custom_fact.py
Modified: trunk/data/add_custom_fact.glade
==============================================================================
--- trunk/data/add_custom_fact.glade (original)
+++ trunk/data/add_custom_fact.glade Fri Nov 21 18:46:15 2008
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.5 on Fri Aug 15 20:23:30 2008 -->
+<!--Generated with glade3 3.4.5 on Fri Nov 21 18:23:51 2008 -->
<glade-interface>
<requires lib="gnome"/>
<widget class="GtkWindow" id="custom_fact_window">
@@ -193,17 +193,75 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="left_padding">12</property>
<child>
- <widget class="GtkComboBoxEntry" id="activity-list">
+ <widget class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <signal name="changed" handler="on_combo_changed"/>
- <signal name="editing_done" handler="on_combo_changed"/>
- <child internal-child="entry">
- <widget class="GtkEntry" id="activity_name">
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">4</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <widget class="GtkComboBoxEntry" id="activity-list">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <signal name="changed" handler="on_combo_changed"/>
+ <signal name="editing_done" handler="on_combo_changed"/>
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="activity_name">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ </widget>
+ </child>
</widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="activity_name_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Name:</property>
+ </widget>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="label" translatable="yes">Description:</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="height_request">50</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_IN</property>
+ <child>
+ <widget class="GtkTextView" id="description">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </widget>
+ </child>
+ </widget>
+ <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>
</widget>
</child>
Modified: trunk/hamster/add_custom_fact.py
==============================================================================
--- trunk/hamster/add_custom_fact.py (original)
+++ trunk/hamster/add_custom_fact.py Fri Nov 21 18:46:15 2008
@@ -70,6 +70,11 @@
self.get_widget('start_time').set_text("%02d:%02d" % (fact["start_time"].hour, fact["start_time"].minute))
self.get_widget('activity_name').set_text(fact["name"])
+
+ buf = gtk.TextBuffer()
+ buf.set_text(fact["description"] or "")
+ self.get_widget('description').set_buffer(buf)
+
self.get_widget("ok").set_sensitive(True)
self.get_widget("ok").set_label("gtk-save")
self.window.set_title(_("Update activity"))
@@ -211,6 +216,27 @@
def on_ok_clicked(self, button):
activity = self.get_widget("activity-list").get_child().get_text()
+
+ # juggle with description - break into parts and then put together
+ buf = self.get_widget('description').get_buffer()
+ description = buf.get_text(buf.get_start_iter(), buf.get_end_iter(), 0)
+ description = description.strip()
+
+ # user might also type description in the activity name - strip it here
+ # and remember value
+ inline_description = None
+ if activity.find(",") != -1:
+ activity, inline_description = activity.split(",", 1)
+ inline_description = inline_description.strip()
+
+ # description field is prior to inline description
+ description = description or inline_description
+
+ if description:
+ activity = "%s, %s" % (activity, description)
+
+
+
start_time = self._get_datetime("start")
end_time = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]