45 |
45 |
46 class RadonMetricsPlugin(QObject): |
46 class RadonMetricsPlugin(QObject): |
47 """ |
47 """ |
48 Class implementing the radon code metrics plug-in. |
48 Class implementing the radon code metrics plug-in. |
49 |
49 |
50 @signal metricsDone(str, list) emitted when the code metrics were |
50 @signal metricsDone(str, dict) emitted when the code metrics were |
51 determined for a file |
51 determined for a file |
52 @signal metricsError(str, str) emitted in case of an error |
52 @signal metricsError(str, str) emitted in case of an error |
53 @signal batchFinished() emitted when a code metrics batch is done |
53 @signal batchFinished() emitted when a code metrics batch is done |
54 """ |
54 """ |
55 metricsDone = pyqtSignal(str, list) |
55 metricsDone = pyqtSignal(str, dict) |
56 metricsError = pyqtSignal(str, str) |
56 metricsError = pyqtSignal(str, str) |
57 batchFinished = pyqtSignal() |
57 batchFinished = pyqtSignal() |
58 |
58 |
59 def __init__(self, ui): |
59 def __init__(self, ui): |
60 """ |
60 """ |
68 self.__initialize() |
68 self.__initialize() |
69 |
69 |
70 self.backgroundService = e5App().getObject("BackgroundService") |
70 self.backgroundService = e5App().getObject("BackgroundService") |
71 |
71 |
72 path = os.path.join(os.path.dirname(__file__), packageName) |
72 path = os.path.join(os.path.dirname(__file__), packageName) |
73 self.backgroundService.serviceConnect( |
73 try: |
74 'radon', 'Python2', path, 'CodeMetricsCalculator', |
74 self.backgroundService.serviceConnect( |
75 lambda *args: self.metricsDone.emit(*args), |
75 'radon', 'Python2', path, 'CodeMetricsCalculator', |
76 onErrorCallback=self.serviceErrorPy2, |
76 lambda *args: self.metricsDone.emit(*args), |
77 onBatchDone=self.batchJobDone) |
77 onErrorCallback=self.serviceErrorPy2, |
78 self.backgroundService.serviceConnect( |
78 onBatchDone=self.batchJobDone) |
79 'radon', 'Python3', path, 'CodeMetricsCalculator', |
79 self.backgroundService.serviceConnect( |
80 lambda *args: self.metricsDone.emit(*args), |
80 'radon', 'Python3', path, 'CodeMetricsCalculator', |
81 onErrorCallback=self.serviceErrorPy3, |
81 lambda *args: self.metricsDone.emit(*args), |
82 onBatchDone=self.batchJobDone) |
82 onErrorCallback=self.serviceErrorPy3, |
|
83 onBatchDone=self.batchJobDone) |
|
84 self.hasBatch = True |
|
85 except TypeError: |
|
86 self.backgroundService.serviceConnect( |
|
87 'radon', 'Python2', path, 'CodeMetricsCalculator', |
|
88 lambda *args: self.metricsDone.emit(*args), |
|
89 onErrorCallback=self.serviceErrorPy2) |
|
90 self.backgroundService.serviceConnect( |
|
91 'radon', 'Python3', path, 'CodeMetricsCalculator', |
|
92 lambda *args: self.metricsDone.emit(*args), |
|
93 onErrorCallback=self.serviceErrorPy3) |
|
94 self.hasBatch = False |
83 |
95 |
84 self.queuedBatches = [] |
96 self.queuedBatches = [] |
85 self.batchesFinished = True |
97 self.batchesFinished = True |
86 |
98 |
87 self.__translator = None |
99 self.__translator = None |