@@ -66,117 +66,124 @@ def getThemeIcon( self, icon ):
66
66
return QIcon ( ":" + defaultPath )
67
67
else :
68
68
return QIcon ()
69
+
70
+ def updateThemeIcons ( self , theme ):
71
+ self .analysisMenu .setIcon ( QIcon ( self .getThemeIcon ( "analysis.png" ) ) )
72
+ self .distMatrix .setIcon ( QIcon ( self .getThemeIcon ( "matrix.png" ) ) )
73
+ self .sumLines .setIcon ( QIcon ( self .getThemeIcon ( "sum_lines.png" ) ) )
74
+ self .pointsPoly .setIcon ( QIcon ( self .getThemeIcon ( "sum_points.png" ) ) )
75
+ self .compStats .setIcon ( QIcon ( self .getThemeIcon ( "basic_statistics.png" ) ) )
76
+ self .listUnique .setIcon ( QIcon ( self .getThemeIcon ( "unique.png" ) ) )
77
+ self .nearestNeigh .setIcon ( QIcon ( self .getThemeIcon ( "neighbour.png" ) ) )
78
+ self .meanCoords .setIcon ( QIcon ( self .getThemeIcon ( "mean.png" ) ) )
79
+ self .intLines .setIcon ( QIcon ( self .getThemeIcon ( "intersections.png" ) ) )
80
+
81
+ self .researchMenu .setIcon ( QIcon ( self .getThemeIcon ( "sampling.png" ) ) )
82
+ self .randSel .setIcon ( QIcon ( self .getThemeIcon ( "random_selection.png" ) ) )
83
+ self .randSub .setIcon ( QIcon ( self .getThemeIcon ( "sub_selection.png" ) ) )
84
+ self .randPoints .setIcon ( QIcon ( self .getThemeIcon ( "random_points.png" ) ) )
85
+ self .regPoints .setIcon ( QIcon ( self .getThemeIcon ( "regular_points.png" ) ) )
86
+ self .vectGrid .setIcon ( QIcon ( self .getThemeIcon ( "vector_grid.png" ) ) )
87
+ self .selectLocation .setIcon ( QIcon ( self .getThemeIcon ( "select_location.png" ) ) )
88
+ self .layerExtent .setIcon ( QIcon ( self .getThemeIcon ( "layer_extent.png" ) ) )
89
+
90
+ self .geoMenu .setIcon ( QIcon ( self .getThemeIcon ( "geoprocessing.png" ) ) )
91
+ self .minConvex .setIcon ( QIcon ( self .getThemeIcon ( "convex_hull.png" ) ) )
92
+ self .dynaBuffer .setIcon ( QIcon ( self .getThemeIcon ( "buffer.png" ) ) )
93
+ self .intersect .setIcon ( QIcon ( self .getThemeIcon ( "intersect.png" ) ) )
94
+ self .union .setIcon ( QIcon ( self .getThemeIcon ( "union.png" ) ) )
95
+ self .symDifference .setIcon ( QIcon ( self .getThemeIcon ( "sym_difference.png" ) ) )
96
+ self .clip .setIcon ( QIcon ( self .getThemeIcon ( "clip.png" ) ) )
97
+ self .dissolve .setIcon ( QIcon ( self .getThemeIcon ( "dissolve.png" ) ) )
98
+ self .erase .setIcon ( QIcon ( self .getThemeIcon ( "difference.png" ) ) )
99
+
100
+ self .conversionMenu .setIcon ( QIcon ( self .getThemeIcon ( "geometry.png" ) ) )
101
+ self .compGeo .setIcon ( QIcon ( self .getThemeIcon ( "export_geometry.png" ) ) )
102
+ self .checkGeom .setIcon ( QIcon ( self .getThemeIcon ( "check_geometry.png" ) ) )
103
+ self .centroids .setIcon ( QIcon ( self .getThemeIcon ( "centroids.png" ) ) )
104
+ self .delaunay .setIcon ( QIcon ( self .getThemeIcon ( "delaunay.png" ) ) )
105
+ self .extNodes .setIcon ( QIcon ( self .getThemeIcon ( "extract_nodes.png" ) ) )
106
+ self .simplify .setIcon ( QIcon ( self .getThemeIcon ( "simplify.png" ) ) )
107
+ self .multiToSingle .setIcon ( QIcon ( self .getThemeIcon ( "multi_to_single.png" ) ) )
108
+ self .singleToMulti .setIcon ( QIcon ( self .getThemeIcon ( "single_to_multi.png" ) ) )
109
+ self .polysToLines .setIcon ( QIcon ( self .getThemeIcon ( "to_lines.png" ) ) )
110
+
111
+ self .dataManageMenu .setIcon ( QIcon ( self .getThemeIcon ( "management.png" ) ) )
112
+ self .project .setIcon ( QIcon ( self .getThemeIcon ( "export_projection.png" ) ) )
113
+ self .define .setIcon ( QIcon ( self .getThemeIcon ( "define_projection.png" ) ) )
114
+ self .joinAttr .setIcon ( QIcon ( self .getThemeIcon ( "join_attributes.png" ) ) )
115
+ self .spatJoin .setIcon ( QIcon ( self .getThemeIcon ( "join_location.png" ) ) )
116
+ self .splitVect .setIcon ( QIcon ( self .getThemeIcon ( "split_layer.png" ) ) )
117
+ self .ftools_aboot .setIcon ( QIcon ( self .getThemeIcon ( "ftools_logo.png" ) ) )
69
118
70
119
def initGui ( self ):
71
120
if int ( self .QgisVersion ) < 1 :
72
121
QMessageBox .warning ( self .iface .getMainWindow (), "fTools" ,
73
122
QCoreApplication .translate ( "fTools" , "Quantum GIS version detected: " ) + unicode ( self .QgisVersion )+ ".xx\n "
74
123
+ QCoreApplication .translate ( "fTools" , "This version of fTools requires at least QGIS version 1.0.0\n Plugin will not be enabled." ) )
75
124
return None
76
-
125
+ QObject . connect ( self . iface , SIGNAL ( "currentThemeChanged ( QString )" ), self . updateThemeIcons )
77
126
self .menu = QMenu ()
78
127
self .menu .setTitle ( QCoreApplication .translate ( "fTools" , "&Tools" ) )
128
+
79
129
self .analysisMenu = QMenu ( QCoreApplication .translate ( "fTools" , "&Analysis Tools" ) )
80
- self .analysisMenu .setIcon ( QIcon ( self .getThemeIcon ( "analysis.png" ) ) )
81
- self .distMatrix = QAction ( QIcon ( self .getThemeIcon ( "matrix.png" ) ),
82
- QCoreApplication .translate ( "fTools" , "Distance matrix" ),self .iface .mainWindow ( ) )
83
- self .sumLines = QAction ( QIcon ( self .getThemeIcon ( "sum_lines.png" ) ),
84
- QCoreApplication .translate ( "fTools" , "Sum line lengths" ), self .iface .mainWindow () )
85
- self .pointsPoly = QAction ( QIcon ( self .getThemeIcon ( "sum_points.png" ) ),
86
- QCoreApplication .translate ( "fTools" , "Points in polygon" ),self .iface .mainWindow () )
87
- self .compStats = QAction ( QIcon ( self .getThemeIcon ( "basic_statistics.png" ) ),
88
- QCoreApplication .translate ( "fTools" , "Basic statistics" ),self .iface .mainWindow () )
89
- self .listUnique = QAction ( QIcon ( self .getThemeIcon ( "unique.png" ) ),
90
- QCoreApplication .translate ( "fTools" , "List unique values" ),self .iface .mainWindow () )
91
- self .nearestNeigh = QAction ( QIcon ( self .getThemeIcon ( "neighbour.png" ) ),
92
- QCoreApplication .translate ( "fTools" , "Nearest neighbour analysis" ),self .iface .mainWindow () )
93
- self .meanCoords = QAction ( QIcon ( self .getThemeIcon ( "mean.png" ) ),
94
- QCoreApplication .translate ( "fTools" , "Mean coordinate(s)" ),self .iface .mainWindow () )
95
- self .intLines = QAction ( QIcon ( self .getThemeIcon ( "intersections.png" ) ),
96
- QCoreApplication .translate ( "fTools" , "Line intersections" ) ,self .iface .mainWindow () )
130
+ self .distMatrix = QAction ( QCoreApplication .translate ( "fTools" , "Distance matrix" ),self .iface .mainWindow ( ) )
131
+ self .sumLines = QAction ( QCoreApplication .translate ( "fTools" , "Sum line lengths" ), self .iface .mainWindow () )
132
+ self .pointsPoly = QAction ( QCoreApplication .translate ( "fTools" , "Points in polygon" ),self .iface .mainWindow () )
133
+ self .compStats = QAction ( QCoreApplication .translate ( "fTools" , "Basic statistics" ),self .iface .mainWindow () )
134
+ self .listUnique = QAction ( QCoreApplication .translate ( "fTools" , "List unique values" ),self .iface .mainWindow () )
135
+ self .nearestNeigh = QAction ( QCoreApplication .translate ( "fTools" , "Nearest neighbour analysis" ), self .iface .mainWindow () )
136
+ self .meanCoords = QAction ( QCoreApplication .translate ( "fTools" , "Mean coordinate(s)" ),self .iface .mainWindow () )
137
+ self .intLines = QAction ( QCoreApplication .translate ( "fTools" , "Line intersections" ) ,self .iface .mainWindow () )
97
138
self .analysisMenu .addActions ( [ self .distMatrix , self .sumLines , self .pointsPoly ,
98
139
self .listUnique , self .compStats , self .nearestNeigh , self .meanCoords , self .intLines ] )
99
140
100
141
self .researchMenu = QMenu ( QCoreApplication .translate ( "fTools" , "&Research Tools" ) )
101
- self .researchMenu .setIcon ( QIcon ( self .getThemeIcon ( "sampling.png" ) ) )
102
- self .randSel = QAction ( QIcon ( self .getThemeIcon ( "random_selection.png" ) ),
103
- QCoreApplication .translate ( "fTools" , "Random selection" ),self .iface .mainWindow () )
104
- self .randSub = QAction ( QIcon ( self .getThemeIcon ( "sub_selection.png" ) ),
105
- QCoreApplication .translate ( "fTools" , "Random selection within subsets" ),self .iface .mainWindow () )
106
- self .randPoints = QAction ( QIcon ( self .getThemeIcon ( "random_points.png" ) ),
107
- QCoreApplication .translate ( "fTools" , "Random points" ),self .iface .mainWindow () )
108
- self .regPoints = QAction ( QIcon ( self .getThemeIcon ( "regular_points.png" ) ),
109
- QCoreApplication .translate ( "fTools" , "Regular points" ), self .iface .mainWindow () )
110
- self .vectGrid = QAction ( QIcon ( self .getThemeIcon ( "vector_grid.png" ) ),
111
- QCoreApplication .translate ( "fTools" , "Vector grid" ), self .iface .mainWindow () )
112
- self .selectLocation = QAction ( QIcon ( self .getThemeIcon ( "select_location.png" ) ),
113
- QCoreApplication .translate ( "fTools" , "Select by location" ), self .iface .mainWindow () )
114
- self .layerExtent = QAction ( QIcon ( self .getThemeIcon ( "layer_extent.png" ) ),
115
- QCoreApplication .translate ( "fTools" , "Polygon from layer extent" ), self .iface .mainWindow () )
142
+ self .randSel = QAction ( QCoreApplication .translate ( "fTools" , "Random selection" ),self .iface .mainWindow () )
143
+ self .randSub = QAction ( QCoreApplication .translate ( "fTools" , "Random selection within subsets" ),self .iface .mainWindow () )
144
+ self .randPoints = QAction ( QCoreApplication .translate ( "fTools" , "Random points" ),self .iface .mainWindow () )
145
+ self .regPoints = QAction ( QCoreApplication .translate ( "fTools" , "Regular points" ), self .iface .mainWindow () )
146
+ self .vectGrid = QAction ( QCoreApplication .translate ( "fTools" , "Vector grid" ), self .iface .mainWindow () )
147
+ self .selectLocation = QAction ( QCoreApplication .translate ( "fTools" , "Select by location" ), self .iface .mainWindow () )
148
+ self .layerExtent = QAction ( QCoreApplication .translate ( "fTools" , "Polygon from layer extent" ), self .iface .mainWindow () )
116
149
self .researchMenu .addActions ( [ self .randSel , self .randSub , self .randPoints ,
117
150
self .regPoints , self .vectGrid , self .selectLocation , self .layerExtent ] )
118
151
119
152
self .geoMenu = QMenu ( QCoreApplication .translate ( "fTools" , "&Geoprocessing Tools" ) )
120
- self .geoMenu .setIcon ( QIcon ( self .getThemeIcon ( "geoprocessing.png" ) ) )
121
- self .minConvex = QAction ( QIcon ( self .getThemeIcon ( "convex_hull.png" ) ),
122
- QCoreApplication .translate ( "fTools" , "Convex hull(s)" ),self .iface .mainWindow () )
123
- self .dynaBuffer = QAction ( QIcon ( self .getThemeIcon ( "buffer.png" ) ),
124
- QCoreApplication .translate ( "fTools" , "Buffer(s)" ),self .iface .mainWindow () )
125
- self .intersect = QAction ( QIcon ( self .getThemeIcon ( "intersect.png" ) ),
126
- QCoreApplication .translate ( "fTools" , "Intersect" ),self .iface .mainWindow () )
127
- self .union = QAction ( QIcon ( self .getThemeIcon ( "union.png" ) ),
128
- QCoreApplication .translate ( "fTools" , "Union" ),self .iface .mainWindow () )
129
- self .symDifference = QAction ( QIcon ( self .getThemeIcon ( "sym_difference.png" ) ),
130
- QCoreApplication .translate ( "fTools" , "Symetrical difference" ),self .iface .mainWindow () )
131
- self .clip = QAction ( QIcon ( self .getThemeIcon ( "clip.png" ) ),
132
- QCoreApplication .translate ( "fTools" , "Clip" ),self .iface .mainWindow () )
133
- self .dissolve = QAction ( QIcon ( self .getThemeIcon ( "dissolve.png" ) ),
134
- QCoreApplication .translate ( "fTools" , "Dissolve" ),self .iface .mainWindow () )
135
- self .erase = QAction ( QIcon ( self .getThemeIcon ( "difference.png" ) ),
136
- QCoreApplication .translate ( "fTools" , "Difference" ),self .iface .mainWindow () )
153
+ self .minConvex = QAction ( QCoreApplication .translate ( "fTools" , "Convex hull(s)" ),self .iface .mainWindow () )
154
+ self .dynaBuffer = QAction ( QCoreApplication .translate ( "fTools" , "Buffer(s)" ),self .iface .mainWindow () )
155
+ self .intersect = QAction ( QCoreApplication .translate ( "fTools" , "Intersect" ),self .iface .mainWindow () )
156
+ self .union = QAction ( QCoreApplication .translate ( "fTools" , "Union" ),self .iface .mainWindow () )
157
+ self .symDifference = QAction ( QCoreApplication .translate ( "fTools" , "Symetrical difference" ),self .iface .mainWindow () )
158
+ self .clip = QAction ( QCoreApplication .translate ( "fTools" , "Clip" ),self .iface .mainWindow () )
159
+ self .dissolve = QAction ( QCoreApplication .translate ( "fTools" , "Dissolve" ),self .iface .mainWindow () )
160
+ self .erase = QAction ( QCoreApplication .translate ( "fTools" , "Difference" ),self .iface .mainWindow () )
137
161
self .geoMenu .addActions ( [ self .minConvex , self .dynaBuffer , self .intersect ,
138
162
self .union , self .symDifference , self .clip , self .erase , self .dissolve ] )
139
163
140
164
self .conversionMenu = QMenu ( QCoreApplication .translate ( "fTools" , "G&eometry Tools" ) )
141
- self .conversionMenu .setIcon ( QIcon ( self .getThemeIcon ( "geometry.png" ) ) )
142
- self .compGeo = QAction ( QIcon ( self .getThemeIcon ( "export_geometry.png" ) ),
143
- QCoreApplication .translate ( "fTools" , "Export/Add geometry columns" ),self .iface .mainWindow () )
144
- self .checkGeom = QAction ( QIcon ( self .getThemeIcon ( "check_geometry.png" ) ),
145
- QCoreApplication .translate ( "fTools" , "Check geometry validity" ),self .iface .mainWindow () )
146
- self .centroids = QAction ( QIcon ( self .getThemeIcon ( "centroids.png" ) ),
147
- QCoreApplication .translate ( "fTools" , "Polygon centroids" ),self .iface .mainWindow () )
148
- self .delaunay = QAction ( QIcon ( self .getThemeIcon ( "delaunay.png" ) ),
149
- QCoreApplication .translate ( "fTools" , "Delaunay triangulation" ),self .iface .mainWindow () )
150
- self .extNodes = QAction ( QIcon ( self .getThemeIcon ( "extract_nodes.png" ) ),
151
- QCoreApplication .translate ( "fTools" , "Extract nodes" ),self .iface .mainWindow () )
152
- self .simplify = QAction ( QIcon ( self .getThemeIcon ( "simplify.png" ) ),
153
- QCoreApplication .translate ( "fTools" , "Simplify geometries" ),self .iface .mainWindow () )
154
- self .multiToSingle = QAction ( QIcon ( self .getThemeIcon ( "multi_to_single.png" ) ),
155
- QCoreApplication .translate ( "fTools" , "Multipart to singleparts" ),self .iface .mainWindow () )
156
- self .singleToMulti = QAction ( QIcon ( self .getThemeIcon ( "single_to_multi.png" ) ),
157
- QCoreApplication .translate ( "fTools" , "Singleparts to multipart" ),self .iface .mainWindow () )
158
- self .polysToLines = QAction ( QIcon ( self .getThemeIcon ( "to_lines.png" ) ),
159
- QCoreApplication .translate ( "fTools" , "Polygons to lines" ),self .iface .mainWindow () )
165
+ self .compGeo = QAction ( QCoreApplication .translate ( "fTools" , "Export/Add geometry columns" ),self .iface .mainWindow () )
166
+ self .checkGeom = QAction ( QCoreApplication .translate ( "fTools" , "Check geometry validity" ),self .iface .mainWindow () )
167
+ self .centroids = QAction ( QCoreApplication .translate ( "fTools" , "Polygon centroids" ),self .iface .mainWindow () )
168
+ self .delaunay = QAction ( QCoreApplication .translate ( "fTools" , "Delaunay triangulation" ),self .iface .mainWindow () )
169
+ self .extNodes = QAction ( QCoreApplication .translate ( "fTools" , "Extract nodes" ),self .iface .mainWindow () )
170
+ self .simplify = QAction ( QCoreApplication .translate ( "fTools" , "Simplify geometries" ),self .iface .mainWindow () )
171
+ self .multiToSingle = QAction ( QCoreApplication .translate ( "fTools" , "Multipart to singleparts" ),self .iface .mainWindow () )
172
+ self .singleToMulti = QAction ( QCoreApplication .translate ( "fTools" , "Singleparts to multipart" ),self .iface .mainWindow () )
173
+ self .polysToLines = QAction ( QCoreApplication .translate ( "fTools" , "Polygons to lines" ),self .iface .mainWindow () )
160
174
self .conversionMenu .addActions ( [ self .checkGeom , self .compGeo , self .centroids , self .delaunay ,
161
175
self .simplify , self .multiToSingle , self .singleToMulti , self .polysToLines , self .extNodes ] )
162
176
163
177
self .dataManageMenu = QMenu ( QCoreApplication .translate ( "fTools" , "&Data Management Tools" ) )
164
- self .dataManageMenu .setIcon ( QIcon ( self .getThemeIcon ( "management.png" ) ) )
165
- self .project = QAction ( QIcon ( self .getThemeIcon ( "export_projection.png" ) ),
166
- QCoreApplication .translate ( "fTools" , "Export to new projection" ), self .iface .mainWindow () )
167
- self .define = QAction ( QIcon ( self .getThemeIcon ( "define_projection.png" ) ),
168
- QCoreApplication .translate ( "fTools" , "Define current projection" ), self .iface .mainWindow () )
169
- self .joinAttr = QAction ( QIcon ( self .getThemeIcon ( "join_attributes.png" ) ),
170
- QCoreApplication .translate ( "fTools" , "Join attributes" ), self .iface .mainWindow () )
171
- self .spatJoin = QAction ( QIcon ( self .getThemeIcon ( "join_location.png" ) ),
172
- QCoreApplication .translate ( "fTools" , "Join attributes by location" ), self .iface .mainWindow () )
173
- self .splitVect = QAction ( QIcon ( self .getThemeIcon ( "split_layer.png" ) ),
174
- QCoreApplication .translate ( "fTools" , "Split vector layer" ), self .iface .mainWindow () )
178
+ self .project = QAction ( QCoreApplication .translate ( "fTools" , "Export to new projection" ), self .iface .mainWindow () )
179
+ self .define = QAction ( QCoreApplication .translate ( "fTools" , "Define current projection" ), self .iface .mainWindow () )
180
+ self .joinAttr = QAction ( QCoreApplication .translate ( "fTools" , "Join attributes" ), self .iface .mainWindow () )
181
+ self .spatJoin = QAction ( QCoreApplication .translate ( "fTools" , "Join attributes by location" ), self .iface .mainWindow () )
182
+ self .splitVect = QAction ( QCoreApplication .translate ( "fTools" , "Split vector layer" ), self .iface .mainWindow () )
175
183
self .dataManageMenu .addActions ( [ self .project , self .define , self .joinAttr , self .spatJoin , self .splitVect ] )
176
-
177
- self .ftools_aboot = QAction ( QIcon ( self .getThemeIcon ( "ftools_logo.png" ) ),
178
- QCoreApplication .translate ( "fTools" , "fTools Information" ), self .iface .mainWindow () )
179
-
184
+ self .ftools_aboot = QAction ( QCoreApplication .translate ( "fTools" , "fTools Information" ), self .iface .mainWindow () )
185
+ self .updateThemeIcons ( "theme" )
186
+
180
187
self .menu .addMenu ( self .analysisMenu )
181
188
self .menu .addMenu ( self .researchMenu )
182
189
self .menu .addMenu ( self .geoMenu )
0 commit comments