-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdialogs.py
More file actions
222 lines (170 loc) · 7.82 KB
/
dialogs.py
File metadata and controls
222 lines (170 loc) · 7.82 KB
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
"""Dialog wrappers for map2loop processing tools.
This module provides QDialog wrappers that use map2loop classes directly
instead of QGIS processing algorithms.
"""
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout
class SamplerDialog(QDialog):
"""Dialog for running samplers using map2loop classes directly."""
def __init__(self, parent=None, data_manager=None, debug_manager=None):
"""Initialize the sampler dialog."""
super().__init__(parent)
self.setWindowTitle("Map2Loop Sampler")
self.data_manager = data_manager
self.debug_manager = debug_manager
self.setup_ui()
def setup_ui(self):
"""Set up the dialog UI."""
from .sampler_widget import SamplerWidget
layout = QVBoxLayout(self)
self.widget = SamplerWidget(self, data_manager=self.data_manager, debug_manager=self.debug_manager)
layout.addWidget(self.widget)
# Replace the run button with dialog buttons
self.widget.runButton.hide()
self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
self.button_box.accepted.connect(self._run_and_accept)
self.button_box.rejected.connect(self.reject)
layout.addWidget(self.button_box)
def _run_and_accept(self):
"""Run the sampler and accept dialog if successful."""
self.widget._run_sampler()
# Dialog stays open so user can see the result
class SorterDialog(QDialog):
"""Dialog for running stratigraphic sorter using map2loop classes directly."""
def __init__(self, parent=None, data_manager=None, debug_manager=None):
"""Initialize the sorter dialog."""
super().__init__(parent)
self.setWindowTitle("Map2Loop Automatic Stratigraphic Sorter")
self.data_manager = data_manager
self.debug_manager = debug_manager
self.setup_ui()
def setup_ui(self):
"""Set up the dialog UI."""
from .sorter_widget import SorterWidget
layout = QVBoxLayout(self)
self.widget = SorterWidget(
self,
data_manager=self.data_manager,
debug_manager=self.debug_manager,
)
layout.addWidget(self.widget)
# Replace the run button with dialog buttons
self.widget.runButton.hide()
self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
self.button_box.accepted.connect(self._run_and_accept)
self.button_box.rejected.connect(self.reject)
layout.addWidget(self.button_box)
def _run_and_accept(self):
"""Run the sorter and accept dialog if successful."""
self.widget._run_sorter()
class UserDefinedSorterDialog(QDialog):
"""Dialog for user-defined stratigraphic column using map2loop classes directly."""
def __init__(self, parent=None, data_manager=None, debug_manager=None):
"""Initialize the user-defined sorter dialog."""
super().__init__(parent)
self.setWindowTitle("Map2Loop User-Defined Stratigraphic Column")
self.data_manager = data_manager
self.debug_manager = debug_manager
self.setup_ui()
def setup_ui(self):
"""Set up the dialog UI."""
from .user_defined_sorter_widget import UserDefinedSorterWidget
layout = QVBoxLayout(self)
self.widget = UserDefinedSorterWidget(
self,
data_manager=self.data_manager,
debug_manager=self.debug_manager,
)
layout.addWidget(self.widget)
# Replace the run button with dialog buttons
# self.widget.runButton.hide()
# self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
# self.button_box.accepted.connect(self._run_and_accept)
# self.button_box.rejected.connect(self.reject)
# layout.addWidget(self.button_box)
def _run_and_accept(self):
"""Run the sorter and accept dialog if successful."""
self.widget._run_sorter()
class BasalContactsDialog(QDialog):
"""Dialog for extracting basal contacts using map2loop classes directly."""
def __init__(self, parent=None, data_manager=None, debug_manager=None):
"""Initialize the basal contacts dialog."""
super().__init__(parent)
self.setWindowTitle("Map2Loop Basal Contacts Extractor")
self.data_manager = data_manager
self.debug_manager = debug_manager
self.setup_ui()
def setup_ui(self):
"""Set up the dialog UI."""
from .basal_contacts_widget import BasalContactsWidget
layout = QVBoxLayout(self)
self.widget = BasalContactsWidget(
self,
data_manager=self.data_manager,
debug_manager=self.debug_manager,
)
layout.addWidget(self.widget)
# Replace the run button with dialog buttons
self.widget.runButton.hide()
self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
self.button_box.accepted.connect(self._run_and_accept)
self.button_box.rejected.connect(self.reject)
layout.addWidget(self.button_box)
def _run_and_accept(self):
"""Run the extractor and accept dialog if successful."""
self.widget._run_extractor()
class ThicknessCalculatorDialog(QDialog):
"""Dialog for calculating thickness using map2loop classes directly."""
def __init__(self, parent=None, data_manager=None, debug_manager=None):
"""Initialize the thickness calculator dialog."""
super().__init__(parent)
self.setWindowTitle("Map2Loop Thickness Calculator")
self.data_manager = data_manager
self.debug_manager = debug_manager
self.setup_ui()
def setup_ui(self):
"""Set up the dialog UI."""
from .thickness_calculator_widget import ThicknessCalculatorWidget
layout = QVBoxLayout(self)
self.widget = ThicknessCalculatorWidget(
self,
data_manager=self.data_manager,
debug_manager=self.debug_manager,
)
layout.addWidget(self.widget)
# Replace the run button with dialog buttons
self.widget.runButton.hide()
self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
self.button_box.accepted.connect(self._run_and_accept)
self.button_box.rejected.connect(self.reject)
layout.addWidget(self.button_box)
def _run_and_accept(self):
"""Run the calculator and accept dialog if successful."""
self.widget._run_calculator()
class PaintStratigraphicOrderDialog(QDialog):
"""Dialog for painting stratigraphic order onto geology polygons."""
def __init__(self, parent=None, data_manager=None, debug_manager=None):
"""Initialize the paint stratigraphic order dialog."""
super().__init__(parent)
self.setWindowTitle("Paint Stratigraphic Order")
self.data_manager = data_manager
self.debug_manager = debug_manager
self.setup_ui()
def setup_ui(self):
"""Set up the dialog UI."""
from .paint_stratigraphic_order_widget import PaintStratigraphicOrderWidget
layout = QVBoxLayout(self)
self.widget = PaintStratigraphicOrderWidget(
self,
data_manager=self.data_manager,
debug_manager=self.debug_manager,
)
layout.addWidget(self.widget)
# Replace the run button with dialog buttons
self.widget.runButton.hide()
self.button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel, self)
self.button_box.accepted.connect(self._run_and_accept)
self.button_box.rejected.connect(self.reject)
layout.addWidget(self.button_box)
def _run_and_accept(self):
"""Run the painter and accept dialog if successful."""
self.widget._run_painter()