Merge lp://staging/~jtatum/quidgets/params-bug into lp://staging/~rick-rickspencer3/quidgets/trunk

Proposed by James Tatum
Status: Needs review
Proposed branch: lp://staging/~jtatum/quidgets/params-bug
Merge into: lp://staging/~rick-rickspencer3/quidgets/trunk
Diff against target: 44 lines (+5/-3)
1 file modified
quickly/widgets/asynch_task_progressbox.py (+5/-3)
To merge this branch: bzr merge lp://staging/~jtatum/quidgets/params-bug
Reviewer Review Type Date Requested Status
Rick Spencer Pending
Review via email: mp+19248@code.staging.launchpad.net
To post a comment you must log in.
Revision history for this message
James Tatum (jtatum) wrote :

Params is optional. If params isn't specified, the code for adding the update_progress_function param would throw an exception. This is already handled for the case of params["kill"], so moving the code down there. Hopefully this is the last of the bugs that I added :)

Unmerged revisions

82. By James Tatum

Moving the update_progress_function param setting to killablethread where the kill param is set.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'quickly/widgets/asynch_task_progressbox.py'
2--- quickly/widgets/asynch_task_progressbox.py 2010-02-11 22:49:17 +0000
3+++ quickly/widgets/asynch_task_progressbox.py 2010-02-13 01:34:14 +0000
4@@ -50,7 +50,6 @@
5 self.cancel_button = gtk.Button(stock=gtk.STOCK_CANCEL)
6 if cancelable:
7 self.cancel_button.show()
8- params["update_progress_function"] = self.update
9 self.cancel_button.set_sensitive(False)
10 self.cancel_button.connect("clicked",self.__stop_clicked)
11 self.pack_end(self.cancel_button, False)
12@@ -79,7 +78,8 @@
13
14 #Create and start a thread to run the users task
15 #pass in a callback and the user's params
16- self.work_thread = KillableThread(self.run_function, self.__on_complete, self.params)
17+ self.work_thread = KillableThread(self.run_function, self.__on_complete,
18+ self.update, self.params)
19 self.work_thread.start()
20
21 #create a thread to display the user feedback
22@@ -190,12 +190,13 @@
23 """Class for use by AsynchTaskProgressBox. Not for general use.
24
25 """
26- def __init__(self,run_function, on_complete, params = None):
27+ def __init__(self,run_function, on_complete, update, params = None):
28 threading.Thread.__init__(self)
29 self.setDaemon(False)
30 self.run_function = run_function
31 self.params = params
32 self.on_complete = on_complete
33+ self.update = update
34
35 #As a subclass of Thread, this function runs when start() is called
36 #It will run the user's function on this thread
37@@ -204,6 +205,7 @@
38 if self.params == None:
39 self.params = {}
40 self.params["kill"] = False
41+ self.params["update_progress_function"] = self.update
42 #tell the function to run
43 data = self.run_function(self.params)
44 #return any data from the function so it can be sent in the complete signal

Subscribers

People subscribed via source and target branches

to all changes: