-
Notifications
You must be signed in to change notification settings - Fork 4
/
qgridder_dialog_base.py
57 lines (48 loc) · 2.21 KB
/
qgridder_dialog_base.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# -*- coding: utf-8 -*-
"""
/***************************************************************************
qgridderdialog_base.py
Qgridder - A QGIS plugin
This file handles Qgridder graphical user interface
Qgridder Builds 2D regular and unstructured grids and comes together with
pre- and post-processing capabilities for spatially distributed modeling.
-------------------
begin : 2013-04-08
copyright : (C) 2013 by Pryet
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"""
from qgis.PyQt.QtCore import *
from qgis.PyQt.QtGui import *
from qgis.PyQt.QtWidgets import *
from qgis.core import *
class QGridderDialog(QDialog):
"""
Qgridder base dialog
"""
def __init__(self,iface):
# Set up the user interface from Designer.
self.iface = iface
# ======= Populate input layer list
def populate_layer_list(self,listOfLayers):
listOfLayers.clear()
layermap = QgsProject.instance().mapLayers()
if type(layermap)==dict :
if len(layermap) > 0:
listOfLayers.setEnabled(True)
for name, layer in layermap.items():
listOfLayers.addItem( unicode( layer.name() ) )
if layer == self.iface.activeLayer():
listOfLayers.setCurrentIndex( listOfLayers.count() -1 )
else :
listOfLayers.setEnabled(False)
else :
listOfLayers.setEnabled(False)