-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclear_features.py
237 lines (198 loc) · 8.03 KB
/
clear_features.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
'''
This python module is used to clear features such as combobox and QLineEditor
'''
from qgis.core import QgsProject
def clear_all_label(self):
'''
This function clear the label associated with ComboBox, as well as the label associated to extra QLineEditor.
'''
self.label_list = [self.moving_Label_1,self.moving_Label_2,self.moving_Label_3,self.moving_Label_4,self.moving_Label_5,self.moving_Label_6,self.moving_Label_7,self.moving_Label_8,self.moving_Label_9,self.moving_Label_10]
for i in range(len(self.label_list)):
self.label_list[i].clear()
self.Intrusion_Label.clear()
self.Sill_Label.clear()
def clear_partially_combo_list(self,break_id,flag):
'''
This function clear out partially in a reversed way a combobox list after it is used.
:flag =1: clear all.
:flag!=2: clear few and break by the value selected.
'''
for i in reversed(range(10)):
if flag==1:
self.my_combo_list[i].clear()
else:
self.my_combo_list[i].hide()
if i==break_id:
break
def combo_list(self):
'''
This function return a list combo elt .
'''
self.my_combo_list =[self.cmbFormationLayerIDName,self.cmbGroupLayerIDName,
self.cmbSupergroupLayerIDName,self.cmbDescriptionLayerIDName,
self.cmbFmLayerIDName, self.cmbRocktype1LayerIDName,
self.cmbRocktype2LayerIDName,self.cmbPointIDLayerIDName,
self.cmbMinAgeLayerIDName,self.cmbMaxAgeLayerIDName]
return self.my_combo_list
def hide_all_combo_list(self,flag):
'''
This function hide all unnecessary combo elt and label.
# flag: value(str) to make the activation selection
'''
self.my_combo_list =combo_list(self)
if flag==0:
for i in range(len(self.my_combo_list )):
self.my_combo_list[i].hide()
self.Sill_LineEditor.hide()
self.Intrusion_LineEditor.hide()
self.Verbose1_radioButton.hide()
self.Verbose2_radioButton.hide()
self.Verbose3_radioButton.hide()
self.Overwrite_checkBox.hide()
#self.Save_pushButton.hide()
#self.Saveconfig_pushButton.hide()
#self.Map2Loop_Button.hide()
#self.LoopStructural_Button.hide()
else:
for i in range(len(self.my_combo_list )):
self.my_combo_list[i].setVisible(True)
self.Sill_LineEditor.setVisible(True)
self.Intrusion_LineEditor.setVisible(True)
# self.Verbose1_radioButton.setVisible(True)
# self.Verbose2_radioButton.setVisible(True)
# self.Verbose3_radioButton.setVisible(True)
# self.Overwrite_checkBox.setVisible(True)
# self.Save_pushButton.setVisible(True)
# self.Saveconfig_pushButton.setVisible(True)
# self.Map2Loop_Button.setVisible(True)
# self.LoopStructural_Button.setVisible(True)
return
def hide_dtm_feature(self, dtm_flag):
'''
This function activate or desactivate the feature associated to the plugin layer loader options.
# dtm_flag: value (int) to setEnabled to False and True the various checkbox.
'''
load_features =[self.File_checkBox,self.Aus_checkBox,self.Http_checkBox,self.Qgis_checkBox,self.Qgis_comboBox,self.Ok_pushButton]
LL =len(load_features)
if dtm_flag ==0:
for i in range(LL):
load_features[i].hide()
elif dtm_flag ==1:
for i in range(LL):
load_features[i].setVisible(True)
elif dtm_flag ==2:
for i in range(LL):
load_features[i].setEnabled(False)
elif dtm_flag ==3:
self.File_checkBox.setEnabled(False)
self.Http_checkBox.setEnabled(False)
self.Qgis_checkBox.setEnabled(False)
self.Qgis_comboBox.setEnabled(False)
self.Ok_pushButton.setEnabled(False)
elif dtm_flag ==4:
self.File_checkBox.setEnabled(False)
self.Aus_checkBox.setEnabled(False)
self.Qgis_checkBox.setEnabled(False)
self.Qgis_comboBox.setEnabled(False)
self.Ok_pushButton.setEnabled(False)
elif dtm_flag ==5:
self.File_checkBox.setEnabled(False)
self.Aus_checkBox.setEnabled(False)
self.Http_checkBox.setEnabled(False)
self.Qgis_comboBox.setVisible(True)
self.Ok_pushButton.setVisible(True)
elif dtm_flag==6:
self.Http_checkBox.setEnabled(True)
self.File_checkBox.setEnabled(True)
self.Aus_checkBox.setEnabled(True)
self.Qgis_checkBox.setEnabled(False)
self.Qgis_checkBox.setCheckable(False)
self.Qgis_comboBox.setEnabled(False)
self.Ok_pushButton.setEnabled(False)
elif dtm_flag==7:
for i in range(LL-2):
load_features[i].setCheckable(True)
elif dtm_flag==8:
for i in range(LL-2):
load_features[i].setCheckable(False)
elif dtm_flag==9:
self.Http_checkBox.setEnabled(False)
self.File_checkBox.setEnabled(True)
self.Aus_checkBox.setEnabled(False)
self.Qgis_checkBox.setEnabled(False)
self.Qgis_checkBox.setCheckable(False)
self.Qgis_comboBox.setEnabled(False)
self.Ok_pushButton.setEnabled(False)
else:
pass
return
def reset_qgis_cbox(self,flag):
'''
This function is used to reset the various features when Qgis is chosen to load from a layer panel of QGIS.
# flag=2: to only enable 2 checkbox
# flag=4: to enable all the 4 checkbox
'''
if flag==2:
self.Qgis_comboBox.clear()
self.File_checkBox.setChecked(False)
self.Qgis_checkBox.setChecked(False)
self.File_checkBox.setEnabled(True)
self.Qgis_checkBox.setEnabled(True)
elif flag==4:
self.Qgis_comboBox.clear()
self.Http_checkBox.setEnabled(True)
self.Http_checkBox.setCheckable(True)
self.File_checkBox.setEnabled(True)
self.File_checkBox.setCheckable(True)
self.Aus_checkBox.setEnabled(True)
self.Aus_checkBox.setCheckable(True)
self.Qgis_checkBox.setEnabled(True)
self.Qgis_checkBox.setCheckable(True)
self.Qgis_comboBox.setEnabled(True)
self.Ok_pushButton.setEnabled(True)
else:
pass
return
def hide_http(self,flag):
'''
This function is used to reset the text editor features when Http is chosen to load your own server addres.
# flag=0: to hide all the features such as textlabel, qtexeditor and save button
# flag !=0: to enable all the 3 features above
'''
http_features =[self.Http_Label,self.Http_TextEdit, self.SaveHttp_pushButton]
LH = len(http_features)
if flag==0:
for i in range(LH):
http_features[i].hide()
else:
for i in range(LH):
http_features[i].setVisible(True)
if i==0:
http_features[i].move(131,140)
elif i==1:
self.Http_TextEdit.clear()
http_features[i].move(131,160)
elif i==2:
http_features[i].move(541,190)
else:
pass
return
def disabled_qgis_chkbox(self):
'''
This function setEnabled(False) for qgis chkbox option to False when no layer is available on the qgis main layer panel.
'''
if not QgsProject.instance().mapLayers().values() :
self.Qgis_checkBox.setEnabled(False)
return
def retry_function(self,label):
'''
After the data are uploaded using our plugin qgis option:
Once Retry function is activated, this function clear and hide all combo box when dtm is reloaded.
# label: In this case it is <Save Config File> qt feature
'''
try:
if label=='Saveconfig_pushButton':
hide_all_combo_list(self,0)
except:
pass
return