11 |
11 |
12 |
12 |
13 class ProgressHandle(rope.base.taskhandle.TaskHandle): |
13 class ProgressHandle(rope.base.taskhandle.TaskHandle): |
14 """ |
14 """ |
15 Class implementing distributed TaskHandle with a progress dialog. |
15 Class implementing distributed TaskHandle with a progress dialog. |
16 |
16 |
17 This is the client side. |
17 This is the client side. |
18 """ |
18 """ |
|
19 |
19 def __init__(self, client, title, interruptable=True): |
20 def __init__(self, client, title, interruptable=True): |
20 """ |
21 """ |
21 Constructor |
22 Constructor |
22 |
23 |
23 @param client reference to the JSON client |
24 @param client reference to the JSON client |
24 @type EricJsonClient |
25 @type EricJsonClient |
25 @param title title for the taskhandle |
26 @param title title for the taskhandle |
26 @type str |
27 @type str |
27 @param interruptable flag indicating, that the task may be |
28 @param interruptable flag indicating, that the task may be |
28 interrupted |
29 interrupted |
29 @type bool |
30 @type bool |
30 """ |
31 """ |
31 rope.base.taskhandle.TaskHandle.__init__(self, title, interruptable) |
32 rope.base.taskhandle.TaskHandle.__init__(self, title, interruptable) |
32 |
33 |
33 self.__client = client |
34 self.__client = client |
34 |
35 |
35 self.__client.sendJson("Progress", { |
36 self.__client.sendJson( |
36 "Subcommand": "Init", |
37 "Progress", |
37 "Title": title, |
38 { |
38 "Interruptable": interruptable, |
39 "Subcommand": "Init", |
39 }) |
40 "Title": title, |
40 |
41 "Interruptable": interruptable, |
|
42 }, |
|
43 ) |
|
44 |
41 self.add_observer(self.__updateProgress) |
45 self.add_observer(self.__updateProgress) |
42 |
46 |
43 def __updateProgress(self): |
47 def __updateProgress(self): |
44 """ |
48 """ |
45 Private slot to handle the task progress. |
49 Private slot to handle the task progress. |
46 """ |
50 """ |
47 params = { |
51 params = { |
48 "Subcommand": "Progress", |
52 "Subcommand": "Progress", |
49 } |
53 } |
50 |
54 |
51 jobset = self.current_jobset() |
55 jobset = self.current_jobset() |
52 if jobset: |
56 if jobset: |
53 text = '' |
57 text = "" |
54 if jobset.get_name() is not None: |
58 if jobset.get_name() is not None: |
55 text += jobset.get_name() |
59 text += jobset.get_name() |
56 if jobset.get_active_job_name() is not None: |
60 if jobset.get_active_job_name() is not None: |
57 text += ': ' + jobset.get_active_job_name() |
61 text += ": " + jobset.get_active_job_name() |
58 params["Text"] = text |
62 params["Text"] = text |
59 if jobset.count is not None: |
63 if jobset.count is not None: |
60 params["Maximum"] = jobset.count |
64 params["Maximum"] = jobset.count |
61 params["Value"] = jobset.done |
65 params["Value"] = jobset.done |
62 |
66 |
63 self.__client.sendJson("Progress", params) |
67 self.__client.sendJson("Progress", params) |
64 self.__client.poll() |
68 self.__client.poll() |
65 |
69 |
66 def reset(self): |
70 def reset(self): |
67 """ |
71 """ |
68 Public slot to reset the progress dialog. |
72 Public slot to reset the progress dialog. |
69 """ |
73 """ |
70 self.__client.sendJson("Progress", { |
74 self.__client.sendJson( |
71 "Subcommand": "Reset", |
75 "Progress", |
72 }) |
76 { |
|
77 "Subcommand": "Reset", |
|
78 }, |
|
79 ) |
73 self.__client.poll() |
80 self.__client.poll() |