gtg team mailing list archive
-
gtg team
-
Mailing list archive
-
Message #03466
[Merge] lp:~nimit-svnit/gtg/bug into lp:gtg
Nimit Shah has proposed merging lp:~nimit-svnit/gtg/bug into lp:gtg.
Requested reviews:
Gtg developers (gtg)
For more details, see:
https://code.launchpad.net/~nimit-svnit/gtg/bug/+merge/98586
In the deletion UI class,
I have made the task array "tasklist" global instead of local to the delete_tasks method
I have added on_delete_cancel handler to the cancel signal which empties the tasklist so the task window is not closed when deletion is cancelled
--
https://code.launchpad.net/~nimit-svnit/gtg/bug/+merge/98586
Your team Gtg developers is requested to review the proposed merge of lp:~nimit-svnit/gtg/bug into lp:gtg.
=== modified file 'GTG/gtk/delete_dialog.py'
--- GTG/gtk/delete_dialog.py 2012-03-05 15:23:05 +0000
+++ GTG/gtk/delete_dialog.py 2012-03-21 08:32:19 +0000
@@ -26,18 +26,21 @@
class DeletionUI():
MAXIMUM_TIDS_TO_SHOW = 5
-
def __init__(self, req):
self.req = req
self.tids_todelete = []
# Tags which must be updated
self.update_tags = []
+ self.tasklist=[]
# Load window tree
self.builder = gtk.Builder()
self.builder.add_from_file(ViewConfig.DELETE_GLADE_FILE)
signals = { "on_delete_confirm": self.on_delete_confirm,
- "on_delete_cancel": lambda x: x.hide,}
+ "on_delete_cancel": self.on_delete_cancel}
self.builder.connect_signals(signals)
+
+ def on_delete_cancel(self, widget):
+ self.tasklist=[]
def on_delete_confirm(self, widget):
"""if we pass a tid as a parameter, we delete directly
@@ -58,7 +61,6 @@
self.tids_todelete = tids
#We must at least have something to delete !
if len(self.tids_todelete) > 0:
- tasklist = []
self.update_tags = []
for tid in self.tids_todelete:
def recursive_list_tasks(task_list, root):
@@ -77,7 +79,7 @@
recursive_list_tasks(task_list, i)
task = self.req.get_task(tid)
- recursive_list_tasks(tasklist, task)
+ recursive_list_tasks(self.tasklist, task)
# We fill the text and the buttons' labels according to the number
# of tasks to delete
@@ -86,7 +88,7 @@
cdlabel2 = self.builder.get_object("cd-label2")
cdlabel3 = self.builder.get_object("cd-label3")
cdlabel4 = self.builder.get_object("cd-label4")
- singular = len(tasklist)
+ singular = len(self.tasklist)
label_text = ngettext("Deleting a task cannot be undone, "
"and will delete the following task: ",
"Deleting a task cannot be undone, "
@@ -109,12 +111,12 @@
#we don't want to end with just one task that doesn't fit the
# screen and a line saying "And one more task", so we go a
# little over our limit
- missing_titles_count = len(tasklist) - self.MAXIMUM_TIDS_TO_SHOW
+ missing_titles_count = len(self.tasklist) - self.MAXIMUM_TIDS_TO_SHOW
if missing_titles_count >= 2:
tasks = tasklist[: self.MAXIMUM_TIDS_TO_SHOW]
titles_suffix = _("\nAnd %d more tasks" % missing_titles_count)
else:
- tasks = tasklist
+ tasks = self.tasklist
titles_suffix = ""
titles = "".join("\n - " + task.get_title() for task in tasks)
@@ -125,6 +127,6 @@
cancel_button.grab_focus()
delete_dialog.run()
delete_dialog.hide()
- return tasklist
+ return self.tasklist
else:
return []