35
35
from qgis .utils import iface
36
36
from qgis .core import (QgsApplication ,
37
37
QgsProcessingAlgorithm )
38
- from qgis .gui import QgsDockWidget
38
+ from qgis .gui import (QgsGui ,
39
+ QgsDockWidget )
39
40
40
41
from processing .gui .Postprocessing import handleAlgorithmResults
41
42
from processing .core .ProcessingLog import ProcessingLog
@@ -107,6 +108,7 @@ def openSettings(url):
107
108
108
109
QgsApplication .processingRegistry ().providerRemoved .connect (self .removeProvider )
109
110
QgsApplication .processingRegistry ().providerAdded .connect (self .addProvider )
111
+ QgsGui .instance ().processingRecentAlgorithmLog ().changed .connect (self .addRecentAlgorithms )
110
112
settingsWatcher .settingsChanged .connect (self .fillTree )
111
113
112
114
def showDisabled (self ):
@@ -349,11 +351,6 @@ def executeAlgorithm(self):
349
351
except :
350
352
pass
351
353
canvas .setMapTool (prevMapTool )
352
- if dlg .wasExecuted ():
353
- showRecent = ProcessingConfig .getSetting (
354
- ProcessingConfig .SHOW_RECENT_ALGORITHMS )
355
- if showRecent :
356
- self .addRecentAlgorithms (True )
357
354
else :
358
355
feedback = MessageBarProgress ()
359
356
context = dataobjects .createContext (feedback )
@@ -366,11 +363,11 @@ def fillTree(self):
366
363
self .fillTreeUsingProviders ()
367
364
self .addRecentAlgorithms (False )
368
365
369
- def addRecentAlgorithms (self , updating ):
366
+ def addRecentAlgorithms (self , updating = True ):
370
367
showRecent = ProcessingConfig .getSetting (
371
368
ProcessingConfig .SHOW_RECENT_ALGORITHMS )
372
369
if showRecent :
373
- recent = ProcessingLog . getRecentAlgorithms ()
370
+ recent = QgsGui . instance (). processingRecentAlgorithmLog (). recentAlgorithmIds ()
374
371
if len (recent ) != 0 :
375
372
found = False
376
373
if updating :
@@ -382,8 +379,8 @@ def addRecentAlgorithms(self, updating):
382
379
383
380
recentItem = QTreeWidgetItem ()
384
381
recentItem .setText (0 , self .tr ('Recently used' ))
385
- for algname in recent :
386
- alg = QgsApplication .processingRegistry ().createAlgorithmById (algname )
382
+ for algorithm_id in recent :
383
+ alg = QgsApplication .processingRegistry ().createAlgorithmById (algorithm_id )
387
384
if alg is not None :
388
385
algItem = TreeAlgorithmItem (alg )
389
386
recentItem .addChild (algItem )
0 commit comments