31
31
import sys
32
32
33
33
from PyQt4 .QtCore import Qt , QCoreApplication , QDir
34
-
35
34
from PyQt4 .QtGui import QMenu , QAction , QIcon
35
+
36
36
from processing .core .Processing import Processing
37
37
from processing .gui .ProcessingToolbox import ProcessingToolbox
38
38
from processing .gui .HistoryDialog import HistoryDialog
39
39
from processing .gui .ConfigDialog import ConfigDialog
40
40
from processing .gui .ResultsDialog import ResultsDialog
41
- from processing .modeler .ModelerDialog import ModelerDialog
42
41
from processing .gui .CommanderWindow import CommanderWindow
42
+ from processing .modeler .ModelerDialog import ModelerDialog
43
43
from processing .tools .system import tempFolder
44
44
45
- # import processing.resources_rc
45
+ import processing .resources_rc
46
46
47
47
cmd_folder = os .path .split (inspect .getfile (inspect .currentframe ()))[0 ]
48
48
if cmd_folder not in sys .path :
@@ -63,45 +63,36 @@ def initGui(self):
63
63
Processing .addAlgListListener (self .toolbox )
64
64
65
65
self .menu = QMenu (self .iface .mainWindow ().menuBar ())
66
- self .menu .setObjectName ( 'processing' )
67
- self .menu .setTitle (QCoreApplication .translate ('Processing' ,
68
- 'Pro&cessing' ))
66
+ self .menu .setObjectName ('processing' )
67
+ self .menu .setTitle (self .tr ('Pro&cessing' ))
69
68
70
69
self .toolboxAction = self .toolbox .toggleViewAction ()
71
- self .toolboxAction .setObjectName ( 'toolboxAction' )
70
+ self .toolboxAction .setObjectName ('toolboxAction' )
72
71
self .toolboxAction .setIcon (QIcon (':/processing/images/alg.png' ))
73
- self .toolboxAction .setText (QCoreApplication .translate ('Processing' ,
74
- '&Toolbox' ))
72
+ self .toolboxAction .setText (self .tr ('&Toolbox' ))
75
73
self .menu .addAction (self .toolboxAction )
76
74
77
75
self .modelerAction = QAction (QIcon (':/processing/images/model.png' ),
78
- QCoreApplication .translate ('Processing' ,
79
- 'Graphical &Modeler...' ),
80
- self .iface .mainWindow ())
81
- self .modelerAction .setObjectName ( 'modelerAction' )
76
+ self .tr ('Graphical &Modeler...' ), self .iface .mainWindow ())
77
+ self .modelerAction .setObjectName ('modelerAction' )
82
78
self .modelerAction .triggered .connect (self .openModeler )
83
79
self .menu .addAction (self .modelerAction )
84
80
85
81
self .historyAction = QAction (QIcon (':/processing/images/history.gif' ),
86
- QCoreApplication .translate ('Processing' ,
87
- '&History and Log...' ),
88
- self .iface .mainWindow ())
89
- self .historyAction .setObjectName ( 'historyAction' )
82
+ self .tr ('&History and Log...' ), self .iface .mainWindow ())
83
+ self .historyAction .setObjectName ('historyAction' )
90
84
self .historyAction .triggered .connect (self .openHistory )
91
85
self .menu .addAction (self .historyAction )
92
86
93
87
self .configAction = QAction (QIcon (':/processing/images/config.png' ),
94
- QCoreApplication .translate ('Processing' ,
95
- '&Options...' ),
96
- self .iface .mainWindow ())
97
- self .configAction .setObjectName ( 'configAction' )
88
+ self .tr ('&Options...' ), self .iface .mainWindow ())
89
+ self .configAction .setObjectName ('configAction' )
98
90
self .configAction .triggered .connect (self .openConfig )
99
91
self .menu .addAction (self .configAction )
100
92
101
93
self .resultsAction = QAction (QIcon (':/processing/images/results.png' ),
102
- QCoreApplication .translate ('Processing' , '&Results Viewer...' ),
103
- self .iface .mainWindow ())
104
- self .resultsAction .setObjectName ( 'resultsAction' )
94
+ self .tr ('&Results Viewer...' ), self .iface .mainWindow ())
95
+ self .resultsAction .setObjectName ('resultsAction' )
105
96
self .resultsAction .triggered .connect (self .openResults )
106
97
self .menu .addAction (self .resultsAction )
107
98
@@ -111,14 +102,12 @@ def initGui(self):
111
102
112
103
self .commanderAction = QAction (
113
104
QIcon (':/processing/images/commander.png' ),
114
- QCoreApplication .translate ('Processing' , '&Commander' ),
115
- self .iface .mainWindow ())
116
- self .commanderAction .setObjectName ( 'commanderAction' )
105
+ self .tr ('&Commander' ), self .iface .mainWindow ())
106
+ self .commanderAction .setObjectName ('commanderAction' )
117
107
self .commanderAction .triggered .connect (self .openCommander )
118
108
self .menu .addAction (self .commanderAction )
119
- self .iface .registerMainWindowAction (
120
- self .commanderAction ,
121
- QCoreApplication .translate ('Processing' , 'Ctrl+Alt+M' ) )
109
+ self .iface .registerMainWindowAction (self .commanderAction ,
110
+ self .tr ('Ctrl+Alt+M' ))
122
111
123
112
def unload (self ):
124
113
self .toolbox .setVisible (False )
@@ -165,3 +154,6 @@ def openHistory(self):
165
154
def openConfig (self ):
166
155
dlg = ConfigDialog (self .toolbox )
167
156
dlg .exec_ ()
157
+
158
+ def tr (self , message ):
159
+ return QCoreApplication .translate ('Processing' , message )
0 commit comments