This repository has been archived by the owner on Jun 3, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDICT_dialog_composer.py
59 lines (48 loc) · 2.2 KB
/
DICT_dialog_composer.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
58
59
# -*- coding: utf-8 -*-
"""
/***************************************************************************
DICT_dialog_composer
A QGIS plugin
DICT
-------------------
begin : 2015-08-19
git sha : $Format:%H$
copyright : (C) 2015 by Loïc BARTOLETTI
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. *
* *
***************************************************************************/
"""
import os
from PyQt5 import uic, QtCore, QtWidgets
from qgis.utils import iface
from qgis.core import QgsLayoutManager, QgsProject
FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'DICT_dialog_composer.ui'))
class DICTDialogComposer(QtWidgets.QDialog, FORM_CLASS):
def __init__(self, taillePlan, parent=None):
"""Constructor."""
super(DICTDialogComposer, self).__init__(parent)
self.setupUi(self)
projectInstance = QgsProject.instance()
manager = projectInstance.layoutManager()
layouts_list = manager.printLayouts()
layout_listArray = []
for layout in layouts_list:
layout_listArray.append(layout.name())
self.layout_listArray = layout_listArray
self.listComposers.addItems(layout_listArray)
self.listComposers.setSelectionMode(
QtWidgets.QAbstractItemView.ExtendedSelection)
j = 0
for i in layout_listArray:
if i.find(taillePlan) != -1:
self.listComposers.setCurrentRow(j)
break
j += 1