def addAttributes(self, attributes, vectorLayerDescriptor):        
     for attribute in attributes:
         # : :type attribute: QgsField  
         vectorLayerDescriptor.addAttribute(GeoCSVAttribute.createFromQgsField(attribute))
     try:
         self.csvDataSourceHandler.updateCsvtFile(vectorLayerDescriptor.getAttributeTypes())
         NotificationHandler.pushInfo(QApplication.translate('GeoCsvNewController', 'CSVT File created/updated.'), QApplication.translate('GeoCsvNewController', 'The CSVT file was successfully created/updated on disk.'))            
     except:
         NotificationHandler.pushWarning(QApplication.translate('GeoCsvNewController', 'CSVT File Error'), QApplication.translate('GeoCsvNewController', 'An error occured while trying to update the CSVT file according to the new attribute types. Please update the csvt file manually.'))            
 def createCsvVectorLayer(self, csvVectorLayers, qgsVectorLayer=None, customTitle=None):
     if self.newDialog.isVisible():
         self.newDialog.reject()                                
     # enable help hyperlink
     self.newDialog.helpLabel.setOpenExternalLinks(True)                            
     self.dataSourceHandler = None
     self.vectorDescriptor = None 
     self.csvtFileIsDirty = False                       
     if customTitle:
         self.newDialog.setWindowTitle(customTitle)
     if qgsVectorLayer:
         csvPath = qgsVectorLayer.customProperty('editablegeocsv_path')
         if csvPath:
             self.newDialog.filePath.setText(csvPath)
     self._updateAcceptButton()
     self._analyseCsv()
     self.newDialog.show()        
     #wait for user input
     result = self.newDialog.exec_()
     #if user pressed ok
     if result == 1:
         if self.dataSourceHandler and self.vectorDescriptor:                                
             csvVectorLayer = GeoCsvVectorLayerFactory.createCsvVectorLayer(self.dataSourceHandler, self.vectorDescriptor, qgsVectorLayer)
             vectorLayerController = VectorLayerController(csvVectorLayer, self.dataSourceHandler)
             csvVectorLayer.initController(vectorLayerController)                                                                        
             QgsMapLayerRegistry.instance().addMapLayer(csvVectorLayer.qgsVectorLayer)
             NotificationHandler.pushSuccess(QApplication.translate('GeoCsvNewController', 'GeoCSV Layer created'), QApplication.translate('GeoCsvNewController', 'The layer "{}" was created successfully.').format(csvVectorLayer.qgsVectorLayer.name()))                
             csvVectorLayers.append(csvVectorLayer)
             if self.csvtFileIsDirty:
                 try:
                     self.dataSourceHandler.updateCsvtFile(self.vectorDescriptor.getAttributeTypes())
                     NotificationHandler.pushInfo(QApplication.translate('GeoCsvNewController', 'CSVT File created/updated.'), QApplication.translate('GeoCsvNewController', 'The CSVT file was successfully created/updated on disk.'))
                 except FileIOException:                                                
                     NotificationHandler.pushWarning(QApplication.translate('GeoCsvNewController', 'CSVT File Error'), QApplication.translate('GeoCsvNewController', 'The csvt file couldn\'t be updated on disk.'))         
             if not self.dataSourceHandler.hasPrj():
                 self.dataSourceHandler.updatePrjFile(csvVectorLayer.qgsVectorLayer.crs().toWkt())
                 NotificationHandler.pushInfo(QApplication.translate('GeoCsvNewController', 'PRJ File created.'), QApplication.translate('GeoCsvNewController', 'The PRJ file was successfully created on disk.'))