diff -r cb044ec27c24 -r 4f53795beff0 RefactoringRope/ProgressHandle.py --- a/RefactoringRope/ProgressHandle.py Sat Jun 25 18:06:56 2022 +0200 +++ b/RefactoringRope/ProgressHandle.py Wed Sep 21 15:30:34 2022 +0200 @@ -13,13 +13,14 @@ class ProgressHandle(rope.base.taskhandle.TaskHandle): """ Class implementing distributed TaskHandle with a progress dialog. - + This is the client side. """ + def __init__(self, client, title, interruptable=True): """ Constructor - + @param client reference to the JSON client @type EricJsonClient @param title title for the taskhandle @@ -29,17 +30,20 @@ @type bool """ rope.base.taskhandle.TaskHandle.__init__(self, title, interruptable) - + self.__client = client - - self.__client.sendJson("Progress", { - "Subcommand": "Init", - "Title": title, - "Interruptable": interruptable, - }) - + + self.__client.sendJson( + "Progress", + { + "Subcommand": "Init", + "Title": title, + "Interruptable": interruptable, + }, + ) + self.add_observer(self.__updateProgress) - + def __updateProgress(self): """ Private slot to handle the task progress. @@ -47,27 +51,30 @@ params = { "Subcommand": "Progress", } - + jobset = self.current_jobset() if jobset: - text = '' + text = "" if jobset.get_name() is not None: text += jobset.get_name() if jobset.get_active_job_name() is not None: - text += ': ' + jobset.get_active_job_name() + text += ": " + jobset.get_active_job_name() params["Text"] = text if jobset.count is not None: params["Maximum"] = jobset.count params["Value"] = jobset.done - + self.__client.sendJson("Progress", params) self.__client.poll() - + def reset(self): """ Public slot to reset the progress dialog. """ - self.__client.sendJson("Progress", { - "Subcommand": "Reset", - }) + self.__client.sendJson( + "Progress", + { + "Subcommand": "Reset", + }, + ) self.__client.poll()