@@ -18,18 +18,42 @@ def __init__(self, iface):
18
18
self .setupUi (self )
19
19
BasePluginWidget .__init__ (self , self .iface , "gdalbuildvrt" )
20
20
21
+ self .recurseCheck .hide ()
22
+
21
23
self .setParamsStatus (
22
24
[
23
25
(self .inputFilesEdit , SIGNAL ("textChanged(const QString &)" )),
24
26
(self .outputFileEdit , SIGNAL ("textChanged(const QString &)" )),
25
27
(self .resolutionComboBox , SIGNAL ("currentIndexChanged(int)" ), self .resolutionCheck ),
26
28
(self .srcNoDataSpin , SIGNAL ("valueChanged(int)" ), self .srcNoDataCheck , "1.7.0" ),
27
- (self .separateCheck , SIGNAL ("stateChanged(int)" ), None , "1.7.0" )
29
+ (self .separateCheck , SIGNAL ("stateChanged(int)" ), None , "1.7.0" ),
30
+ (self .inputDirCheck , SIGNAL ("stateChanged(int)" )),
31
+ (self .recurseCheck , SIGNAL ("stateChanged(int)" ), self .inputDirCheck )
28
32
]
29
33
)
30
34
31
35
self .connect (self .selectInputFilesButton , SIGNAL ("clicked()" ), self .fillInputFilesEdit )
32
36
self .connect (self .selectOutputFileButton , SIGNAL ("clicked()" ), self .fillOutputFileEdit )
37
+ self .connect ( self .inputDirCheck , SIGNAL ( "stateChanged( int )" ), self .switchToolMode )
38
+
39
+ def switchToolMode (self ):
40
+ self .inputFilesEdit .clear ()
41
+
42
+ if self .inputDirCheck .isChecked ():
43
+ self .inFileLabel = self .label .text ()
44
+ self .label .setText ( QCoreApplication .translate ( "GdalTools" , "&Input directory" ) )
45
+
46
+ self .recurseCheck .show ()
47
+
48
+ QObject .disconnect ( self .selectInputFilesButton , SIGNAL ( "clicked()" ), self .fillInputFilesEdit )
49
+ QObject .connect ( self .selectInputFilesButton , SIGNAL ( "clicked()" ), self .fillInputDir )
50
+ else :
51
+ self .label .setText ( self .inFileLabel )
52
+
53
+ self .recurseCheck .hide ()
54
+
55
+ QObject .connect ( self .selectInputFilesButton , SIGNAL ( "clicked()" ), self .fillInputFilesEdit )
56
+ QObject .disconnect ( self .selectInputFilesButton , SIGNAL ( "clicked()" ), self .fillInputDir )
33
57
34
58
def fillInputFilesEdit (self ):
35
59
lastUsedFilter = Utils .FileFilter .lastUsedRasterFilter ()
@@ -47,6 +71,13 @@ def fillOutputFileEdit(self):
47
71
48
72
self .outputFileEdit .setText (outputFile )
49
73
74
+ def fillInputDir ( self ):
75
+ inputDir = Utils .FileDialog .getExistingDirectory ( self , self .tr ( "Select the input directory with files for VRT" ))
76
+ if inputDir .isEmpty ():
77
+ return
78
+
79
+ self .inputFilesEdit .setText ( inputDir )
80
+
50
81
def getArguments (self ):
51
82
arguments = QStringList ()
52
83
if self .resolutionCheck .isChecked () and self .resolutionComboBox .currentIndex () >= 0 :
@@ -58,7 +89,10 @@ def getArguments(self):
58
89
arguments << "-srcnodata"
59
90
arguments << str (self .srcNoDataSpin .value ())
60
91
arguments << self .outputFileEdit .text ()
61
- arguments << self .inputFilesEdit .text ().split ("," )
92
+ if self .inputDirCheck .isChecked ():
93
+ arguments << Utils .getRasterFiles ( self .inputFilesEdit .text (), self .recurseCheck .isChecked () )
94
+ else :
95
+ arguments << self .inputFilesEdit .text ().split ("," )
62
96
return arguments
63
97
64
98
def getOutputFileName (self ):
0 commit comments