-
Notifications
You must be signed in to change notification settings - Fork 2
/
carregar_estilos.py
49 lines (42 loc) · 1.82 KB
/
carregar_estilos.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
"""
/***************************************************************************
LEOXINGU
-------------------
begin : 2018-03-20
copyright : (C) 2018 by Leandro Franca - Cartographic Engineer
email : geoleandro.franca@gmail.com
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
"""
# Carregar Estilos
##2. Carregar Estilos=name
##LF10) Cartografia=group
##Pasta_com_estilos=folder
from PyQt4.QtCore import *
from qgis.gui import QgsMessageBar
from qgis.utils import iface
from qgis.core import *
import time
import processing
import os
lista = os.listdir(Pasta_com_estilos)
camadas = []
for item in lista:
if item[-4:] == '.qml':
camadas += [item[:-4]]
for layer in QgsMapLayerRegistry.instance().mapLayers().values():
if layer.type() in [0, 1]:
nome = layer.name()
if nome in camadas:
layer.loadNamedStyle(Pasta_com_estilos+'/'+ nome + '.qml')
layer.triggerRepaint()
progress.setInfo('<br/>Estilo da camada %s carregado.' %nome)
progress.setInfo('<br/><br/><b>Leandro França - Eng Cart</b><br/>')
time.sleep(5)
iface.messageBar().pushMessage(u'Situacao', "Operacao Concluida com Sucesso!", level=QgsMessageBar.INFO, duration=5)