16
16
* *
17
17
***************************************************************************
18
18
"""
19
+ from processing import interface
19
20
20
21
__author__ = 'Victor Olaya'
21
22
__date__ = 'August 2012'
24
25
__revision__ = '$Format:%H$'
25
26
26
27
import shutil
27
- import os , sys
28
28
import inspect
29
29
from PyQt4 .QtCore import *
30
30
from PyQt4 .QtGui import *
31
31
from qgis .core import *
32
- from PyQt4 import QtGui
33
32
from processing .commander .CommanderWindow import CommanderWindow
34
33
from processing .core .Processing import Processing
35
- from processing .core . QGisLayers import QGisLayers
36
- from processing .core . ProcessingUtils import ProcessingUtils
34
+ from processing .tools import dataobjects
35
+ from processing .tools . system import *
37
36
from processing .gui .ProcessingToolbox import ProcessingToolbox
38
37
from processing .gui .HistoryDialog import HistoryDialog
39
38
from processing .gui .ConfigDialog import ConfigDialog
40
39
from processing .gui .ResultsDialog import ResultsDialog
41
40
from processing .modeler .ModelerDialog import ModelerDialog
42
41
import processing .resources_rc
43
42
43
+
44
44
cmd_folder = os .path .split (inspect .getfile ( inspect .currentframe () ))[0 ]
45
45
if cmd_folder not in sys .path :
46
46
sys .path .insert (0 , cmd_folder )
47
47
48
48
class ProcessingPlugin :
49
49
50
50
def __init__ (self , iface ):
51
- self .iface = iface
52
- QGisLayers .setInterface (iface )
53
- Processing .initialize ()
54
- Processing .setInterface (iface )
55
- Processing .setPlugin (self )
51
+ interface .iface = iface
52
+ Processing .initialize ()
56
53
57
54
def initGui (self ):
58
55
self .commander = None
59
- self .toolbox = ProcessingToolbox (self . iface )
60
- self .iface .addDockWidget (Qt .RightDockWidgetArea , self .toolbox )
56
+ self .toolbox = ProcessingToolbox ()
57
+ interface .iface .addDockWidget (Qt .RightDockWidgetArea , self .toolbox )
61
58
self .toolbox .hide ()
62
59
Processing .addAlgListListener (self .toolbox )
63
60
64
- self .menu = QMenu (self .iface .mainWindow ())
61
+ self .menu = QMenu (interface .iface .mainWindow ())
65
62
self .menu .setTitle (QCoreApplication .translate ("Processing" , "Processing" ))
66
63
67
64
self .toolboxAction = self .toolbox .toggleViewAction ()
@@ -71,51 +68,51 @@ def initGui(self):
71
68
72
69
self .modelerAction = QAction (QIcon (":/processing/images/model.png" ),
73
70
QCoreApplication .translate ("Processing" , "Graphical modeler" ),
74
- self .iface .mainWindow ())
71
+ interface .iface .mainWindow ())
75
72
self .modelerAction .triggered .connect (self .openModeler )
76
73
self .menu .addAction (self .modelerAction )
77
74
78
75
self .historyAction = QAction (QIcon (":/processing/images/history.gif" ),
79
76
QCoreApplication .translate ("Processing" , "History and log" ),
80
- self .iface .mainWindow ())
77
+ interface .iface .mainWindow ())
81
78
self .historyAction .triggered .connect (self .openHistory )
82
79
self .menu .addAction (self .historyAction )
83
80
84
81
self .configAction = QAction (QIcon (":/processing/images/config.png" ),
85
82
QCoreApplication .translate ("Processing" , "Options and configuration" ),
86
- self .iface .mainWindow ())
83
+ interface .iface .mainWindow ())
87
84
self .configAction .triggered .connect (self .openConfig )
88
85
self .menu .addAction (self .configAction )
89
86
90
87
self .resultsAction = QAction (QIcon (":/processing/images/results.png" ),
91
88
QCoreApplication .translate ("Processing" , "&Results viewer" ),
92
- self .iface .mainWindow ())
89
+ interface .iface .mainWindow ())
93
90
self .resultsAction .triggered .connect (self .openResults )
94
91
self .menu .addAction (self .resultsAction )
95
92
96
- menuBar = self .iface .mainWindow ().menuBar ()
97
- menuBar .insertMenu (self .iface .firstRightStandardMenu ().menuAction (), self .menu )
93
+ menuBar = interface .iface .mainWindow ().menuBar ()
94
+ menuBar .insertMenu (interface .iface .firstRightStandardMenu ().menuAction (), self .menu )
98
95
99
96
self .commanderAction = QAction (QIcon (":/processing/images/commander.png" ),
100
97
QCoreApplication .translate ("Processing" , "&Commander" ),
101
- self .iface .mainWindow ())
98
+ interface .iface .mainWindow ())
102
99
self .commanderAction .triggered .connect (self .openCommander )
103
100
self .menu .addAction (self .commanderAction )
104
- self .iface .registerMainWindowAction (self .commanderAction , "Ctrl+Alt+M" )
101
+ interface .iface .registerMainWindowAction (self .commanderAction , "Ctrl+Alt+M" )
105
102
106
103
def unload (self ):
107
104
self .toolbox .setVisible (False )
108
105
self .menu .deleteLater ()
109
106
#delete temporary output files
110
- folder = ProcessingUtils . tempFolder ()
107
+ folder = tempFolder ()
111
108
if QDir (folder ).exists ():
112
109
shutil .rmtree (folder , True )
113
110
114
- self .iface .unregisterMainWindowAction (self .commanderAction )
111
+ interface .iface .unregisterMainWindowAction (self .commanderAction )
115
112
116
113
def openCommander (self ):
117
114
if self .commander is None :
118
- self .commander = CommanderWindow (self .iface .mainWindow (), self .iface .mapCanvas ())
115
+ self .commander = CommanderWindow (interface .iface .mainWindow (), interface .iface .mapCanvas ())
119
116
Processing .addAlgListListener (self .commander )
120
117
self .commander .prepareGui ()
121
118
self .commander .show ()
0 commit comments