Пример #1
0
class AccAssessDialog(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = Ui_AccAssess()
        self.ui.setupUi(self)
        
    def initLayerCombobox(self,combobox, default):
         combobox.clear()
         reg = QgsMapLayerRegistry.instance()
         for ( key, layer ) in reg.mapLayers().iteritems():
             
             if layer.type() == QgsMapLayer.RasterLayer: #This doesn't work in QGIS2.0. Can I do without?: and ( layer.usesProvider() and layer.providerKey() == 'gdal' ):
                 combobox.addItem( layer.name(), key )
         
         idx = combobox.findData( default )
         if idx != -1:
             combobox.setCurrentIndex( idx ) 
             
    def layerFromComboBox(self, combobox):
        layerID = str( combobox.itemData(combobox.currentIndex()) )
        return QgsMapLayerRegistry.instance().mapLayer( layerID )
Пример #2
0
class AccAssessDialog(QtGui.QDialog):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        # Set up the user interface from Designer.
        self.ui = Ui_AccAssess()
        self.ui.setupUi(self)

    def initLayerCombobox(self, combobox, default):
        combobox.clear()
        reg = QgsMapLayerRegistry.instance()
        for (key, layer) in reg.mapLayers().iteritems():

            if layer.type(
            ) == QgsMapLayer.RasterLayer:  #This doesn't work in QGIS2.0. Can I do without?: and ( layer.usesProvider() and layer.providerKey() == 'gdal' ):
                combobox.addItem(layer.name(), key)

        idx = combobox.findData(default)
        if idx != -1:
            combobox.setCurrentIndex(idx)

    def layerFromComboBox(self, combobox):
        layerID = str(combobox.itemData(combobox.currentIndex()))
        return QgsMapLayerRegistry.instance().mapLayer(layerID)
Пример #3
0
 def __init__(self):
     QtGui.QDialog.__init__(self)
     # Set up the user interface from Designer.
     self.ui = Ui_AccAssess()
     self.ui.setupUi(self)
Пример #4
0
 def __init__(self):
     QtGui.QDialog.__init__(self)
     # Set up the user interface from Designer.
     self.ui = Ui_AccAssess()
     self.ui.setupUi(self)