forked from pyarchinit/selectbyrelationship_repo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
select_by_relationship_settings.py
72 lines (54 loc) · 2.6 KB
/
select_by_relationship_settings.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
60
61
62
63
64
65
66
67
68
69
70
71
# -*- coding: utf-8 -*-
"""
***************************************************************************
select_by_relationship_settings.py
---------------------
Date : May 2018
Copyright : (C) 2018 by Salvatore Larosa
Email : lrssvtml at gmail dot 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; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""
__author__ = 'Salvatore Larosa'
__date__ = 'May 2018'
__copyright__ = '(C) 2018 by Salvatore Larosa'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
import os
from qgis.PyQt.QtWidgets import QDialog
from qgis.PyQt.uic import loadUiType
from qgis.core import QgsSettings
from .select_by_relationship_handler import QgsRelationSelector
MAIN_DIALOG_CLASS, _ = loadUiType(os.path.abspath(
os.path.join(os.path.dirname(__file__), 'settings.ui')))
class SettingsDialog(QDialog, MAIN_DIALOG_CLASS):
def __init__(self, dlg, parent=None):
super(SettingsDialog, self).__init__(parent)
self.setupUi(self)
self.parent = parent
self.dlg = dlg
self.s = QgsSettings()
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.chkActiveParent.setChecked(self.s.value('relate/activeParentLayer', False, type=bool))
self.chkZoomParent.setChecked(self.s.value('relate/zoomParentFeature', False, type=bool))
self.chkSelectParent.setChecked(self.s.value('relate/selectChildFromParent', False, type=bool))
def setZoomToParent(self, checkstate):
if checkstate:
enable = True
else:
enable = False
print(enable)
self.sFr.zoomParentFeature = enable
def accept(self):
self.s.setValue('relate/activeParentLayer', self.chkActiveParent.isChecked())
self.s.setValue('relate/zoomParentFeature', self.chkZoomParent.isChecked())
self.s.setValue('relate/selectChildFromParent', self.chkSelectParent.isChecked())
self.dlg.updateSettings()
super(SettingsDialog, self).accept()