-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhover_event.py
217 lines (206 loc) · 7.93 KB
/
hover_event.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
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Loop_plugin
A QGIS plugin
This plugin preprocess shapefile inputs to generate python script and json file that are used as input for map2loop
Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
-------------------
begin : 2022-10-13
git sha : $Format:%H$
copyright : (C) 2022 by Michel M. Nzikou / CET - UWA
email : michel.nzikou@alumni.uleth.ca
***************************************************************************/
/***************************************************************************
* *
* 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
import json
#
BASE_DIR = os.path.dirname(__file__)
help_config_path = str(BASE_DIR) + "/help_config.json"
def show_my_info(self):
"""
This function is used to populate text information once the mouse is hovering a button.
"""
button_list = [
self.PrjImage,
self.Project_Label,
self.SearchFolder,
self.FolderSearch_Button,
self.GeolButton,
self.FaultButton,
self.StructButton,
self.DTMButton,
self.OrientationButton,
self.ROIButton,
self.DrillholesButton,
self.SectionsButton,
self.FoldButton,
self.ConfigButton,
self.Saveconfig_pushButton,
self.Map2Loop_Button,
self.LoopStructural_Button,
self.btnPush,
self.Qgis_checkBox,
self.Aus_checkBox,
self.File_checkBox,
self.Http_checkBox,
self.Qgis_comboBox,
self.Ok_pushButton,
self.map2loop_label_2,
self.map2loop_label_1,
self.map2loop_label_3,
self.map2loop_Ok_pushButton,
self.Loop3dviz_Button,
self.docker_btnPush,
self.Reload_btnPush,
]
button_text = [
"Project directory icon",
"Project directory name",
"To be filled by the project directory path",
"Click to select your project directory",
"Click to load your Geology layer",
"click to load your Fault layer",
"click to load your Structure Point layer",
"Click to load your DTM or Map layer",
"Orientation layer",
"To create a Region of interest",
"To load Drill Hole data",
"Section layer",
"To load your Fold layer",
"To create your configuration parameters",
"To create and save the configuration file in the project directory",
"To run map2loop",
"To run loopstructural",
"To close the plugin",
"To select layers from QGIS panel",
"To select layer from GA webserver",
"To select a layer from your pc",
"To select layer from your own web address",
"To be filled with available layers on QGIS panel",
"To save selected layer in combobox above",
"Your name or computer name",
"remote server ip address",
"default port: Enter 8000",
"Click OK to execute map2loop",
"Launch the 3D visuaization on your default browser",
"Turn ON/OFF your docker container",
"Reload the QPushButton",
]
label_tool_tip(button_list, button_text)
def layer_show_tooltype(self, sender):
# Here we define the info that are attached to the layer associated to individual Qpush button such as:
# Geol...>[Formation*,Group, Supergroup, Description, Fm code, Rocktype 1, Rocktype 2, Polygon ID, Min Age, Max Age ]
# uniqueID[]
with open(help_config_path) as complex_data:
data = json.load(complex_data)
for majorkey in data:
if majorkey == "struct_params":
struct_param_help = [a for a in data[majorkey].values()]
if majorkey == "fault_params":
fault_param_help = [a for a in data[majorkey].values()]
if majorkey == "Orientations_dictionary":
if "_help" in str(data[majorkey].keys()):
fault_layer_help = [
a for a in data[majorkey].values() if type(a) is not list
]
if majorkey == "Fault_and_folds":
if "_help" in str(data[majorkey].keys()):
ffault_layer_help = [
a for a in data[majorkey].values() if type(a) is not list
]
if majorkey == "geology_params":
geol_param_help = [a for a in data[majorkey].values()]
if majorkey == "ids_dictionary":
layer_id = [a for a in data[majorkey].values() if type(a) is not list]
if majorkey == "timing":
max_min_help = [a for a in data[majorkey].values() if type(a) is not list]
if majorkey == "stratigraphy_dictionary":
if "_help" in str(data[majorkey].keys()):
geol_layer_help = [
a for a in data[majorkey].values() if type(a) is not list
]
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,
self.Sill_Label,
self.Intrusion_Label,
]
param_list = [
self.param_label1,
self.param_label2,
self.param_label3,
self.param_label4,
self.param_label5,
self.param_label6,
self.param_label7,
self.param_label8,
self.param_label9,
]
if sender == "GeolButton":
self.ImageLabel.move(600, 285)
# slicing the list
lay = geol_layer_help[:-1]
lay_part1 = lay[:-2]
lay_part2 = lay[-2:]
geol_lay_tooltype = lay_part1 + layer_id[:-1] + max_min_help + lay_part2
# Appending info to Qt feature
label_tool_tip(label_list, geol_lay_tooltype)
label_tool_tip(param_list, geol_param_help)
return
elif sender == "FaultButton":
self.ImageLabel.move(600, 285)
fault_lay_tooltype = (
fault_layer_help[0:4]
+ [ffault_layer_help[-1]]
+ layer_id[:-1]
+ [fault_layer_help[4]]
+ ffault_layer_help[0:2]
)
# slicing the list
flabel_list = label_list[0:7] + label_list[-2:]
fpar_list = param_list[0:3]
label_tool_tip(flabel_list, fault_lay_tooltype)
label_tool_tip(fpar_list, fault_param_help)
return
elif sender == "StructButton":
self.ImageLabel.move(600, 285)
slabel_list = label_list[0:6] + label_list[len(label_list) - 2 :]
spar_list = param_list[0:]
struct_lay_tooltype = (
fault_layer_help[0:3]
+ [fault_layer_help[4]]
+ fault_layer_help[-1:]
+ layer_id[:-1]
+ fault_layer_help[-2:]
)
label_tool_tip(slabel_list, struct_lay_tooltype)
label_tool_tip(spar_list, struct_param_help)
return
else:
pass
return
def label_tool_tip(param_list, tooltype_text):
"""
This function set the text into qtooltype feature
# param_list: It contain the list of dt feature to show info once mouse hover onto it
# tooltype_text: It contain the list of text (str) associated to feature in the above list
"""
for label, text in zip(param_list, tooltype_text):
label.setToolTip(str(text))