35
35
36
36
class MultipleInputPanel (QtGui .QWidget ):
37
37
38
- def __init__ (self , options , datatype , parent = None ):
38
+ def __init__ (self , options , datatype = None , parent = None ):
39
39
super (MultipleInputPanel , self ).__init__ (parent )
40
40
self .options = options
41
41
self .datatype = datatype
@@ -54,17 +54,18 @@ def __init__(self, options, datatype, parent = None):
54
54
self .setLayout (self .horizontalLayout )
55
55
56
56
def showSelectionDialog (self ):
57
- if self .datatype == ParameterMultipleInput .TYPE_RASTER :
58
- options = QGisLayers .getRasterLayers ()
59
- elif self .datatype == ParameterMultipleInput .TYPE_VECTOR_ANY :
60
- options = QGisLayers .getVectorLayers ()
61
- else :
62
- options = QGisLayers .getVectorLayers (self .datatype )
63
- opts = []
64
- for opt in options :
65
- opts .append (opt .name ())
66
- self .options = opts
67
-
57
+ #If there is a datatype, we use it to create the list of options
58
+ if self .datatype is not None :
59
+ if self .datatype == ParameterMultipleInput .TYPE_RASTER :
60
+ options = QGisLayers .getRasterLayers ()
61
+ elif self .datatype == ParameterMultipleInput .TYPE_VECTOR_ANY :
62
+ options = QGisLayers .getVectorLayers ()
63
+ else :
64
+ options = QGisLayers .getVectorLayers (self .datatype )
65
+ opts = []
66
+ for opt in options :
67
+ opts .append (opt .name ())
68
+ self .options = opts
68
69
dlg = MultipleInputDialog (self .options , self .selectedoptions )
69
70
dlg .exec_ ()
70
71
if dlg .selectedoptions != None :
0 commit comments