[billreminder/fresh] Added edit button and connected actions to add, edit and delete records.
- From: Og B. Maciel <ogmaciel src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [billreminder/fresh] Added edit button and connected actions to add, edit and delete records.
- Date: Fri, 22 Jan 2010 04:05:21 +0000 (UTC)
commit 1a29bcbbe1c13d26e5650375bc1a2dc835abbc12
Author: Og B. Maciel <ogmaciel gnome org>
Date: Thu Jan 21 23:04:44 2010 -0500
Added edit button and connected actions to add, edit and delete records.
data/new.ui | 17 ++++++++++++++++-
src/gui/new.py | 23 ++++++++++++++++++-----
2 files changed, 34 insertions(+), 6 deletions(-)
---
diff --git a/data/new.ui b/data/new.ui
index 4eedb02..78c05c0 100644
--- a/data/new.ui
+++ b/data/new.ui
@@ -59,6 +59,7 @@
<property name="label" translatable="yes">toolbutton4</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-add</property>
+ <signal name="clicked" handler="on_add_clicked"/>
</object>
<packing>
<property name="expand">False</property>
@@ -66,11 +67,25 @@
</packing>
</child>
<child>
- <object class="GtkToolButton" id="remove">
+ <object class="GtkToolButton" id="edit">
<property name="visible">True</property>
<property name="label" translatable="yes">toolbutton5</property>
<property name="use_underline">True</property>
+ <property name="stock_id">gtk-edit</property>
+ <signal name="clicked" handler="on_edit_clicked"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="remove">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">toolbutton6</property>
+ <property name="use_underline">True</property>
<property name="stock_id">gtk-remove</property>
+ <signal name="clicked" handler="on_remove_clicked"/>
</object>
<packing>
<property name="expand">False</property>
diff --git a/src/gui/new.py b/src/gui/new.py
index 22c0b7b..cd80a77 100755
--- a/src/gui/new.py
+++ b/src/gui/new.py
@@ -25,7 +25,6 @@ class MainWindow:
self.upcoming = widgets.BillTree()
self.ui.get_object("bill_box").add(self.upcoming)
-
today = dt.date.today()
self.start_date = today - dt.timedelta(today.day - 1) # beginning of month
first_weekday, days_in_month = calendar.monthrange(today.year, today.month)
@@ -158,10 +157,7 @@ class MainWindow:
bill = self.actions.add(rec)
if bill:
self.upcoming.add_bill(bill)
- #self.update_statusbar()
- # Reload records tree (something changed)
- #self.reloadTreeView()
- #self.reloadTimeline()
+ self.load_bills()
def on_edit_clicked(self, button):
current = self.upcoming.get_selected_bill()
@@ -175,6 +171,23 @@ class MainWindow:
for rec in records:
# Edit bill to database
rec = self.actions.edit(rec)
+ self.load_bills()
+
+ def on_remove_clicked(self, button):
+ current = self.upcoming.get_selected_bill()
+ if not current:
+ return
+
+ message = utils.Message()
+ resp = message.ShowQuestionYesNo(
+ _("Do you really want to delete \"%s\"?") % \
+ current.payee,
+ self.window, _("Confirmation"))
+ if not resp:
+ return
+
+ self.actions.delete(current)
+ self.load_bills()
def get_widget(self, name):
""" skip one variable (huh) """
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]