|
1 | 1 | # -*- coding: utf-8 -*- |
| 2 | + |
2 | 3 | from guidata.configtools import get_icon |
3 | 4 | from guidata.qthelpers import add_actions, create_action |
4 | 5 | from guidata.utils.misc import assert_interfaces_valid |
|
18 | 19 |
|
19 | 20 |
|
20 | 21 | class CrossSectionWidget(PanelWidget): |
21 | | - """ """ |
| 22 | + """Base class for cross section panels |
| 23 | +
|
| 24 | + Args: |
| 25 | + parent: parent widget |
| 26 | + """ |
22 | 27 |
|
| 28 | + SIG_RESIZED = QC.Signal() # emitted when the widget is resized |
23 | 29 | PANEL_ID = None |
24 | 30 | PANEL_TITLE = _("Cross section tool") |
25 | 31 | PANEL_ICON = "csection.png" |
@@ -53,6 +59,15 @@ def __init__(self, parent=None): |
53 | 59 |
|
54 | 60 | self.setup_widget() |
55 | 61 |
|
| 62 | + # Reimplement Qt method for sending a signal when the widget is resized |
| 63 | + def resizeEvent(self, event): |
| 64 | + """ |
| 65 | +
|
| 66 | + :param event: |
| 67 | + """ |
| 68 | + super().resizeEvent(event) |
| 69 | + self.SIG_RESIZED.emit() |
| 70 | + |
56 | 71 | def set_options(self, autoscale=None, autorefresh=None, lockscales=None): |
57 | 72 | """ |
58 | 73 |
|
@@ -193,7 +208,11 @@ def update_plot(self, obj=None): |
193 | 208 |
|
194 | 209 |
|
195 | 210 | class XCrossSection(CrossSectionWidget): |
196 | | - """X-axis cross section widget""" |
| 211 | + """X-axis cross section panel |
| 212 | +
|
| 213 | + Args: |
| 214 | + parent: parent widget |
| 215 | + """ |
197 | 216 |
|
198 | 217 | PANEL_ID = ID_XCS |
199 | 218 | OTHER_PANEL_ID = ID_YCS |
@@ -319,10 +338,12 @@ def setup_actions(self): |
319 | 338 |
|
320 | 339 |
|
321 | 340 | class YCrossSection(XCrossSection): |
322 | | - """ |
323 | | - Y-axis cross section widget |
324 | | - parent (QWidget): parent widget |
325 | | - position (string): "left" or "right" |
| 341 | + """Y-axis cross section panel |
| 342 | +
|
| 343 | + Args: |
| 344 | + parent: parent widget |
| 345 | + position: position of the panel ('left' or 'right') |
| 346 | + xsection_pos: position of the cross section plot ('top' or 'bottom') |
326 | 347 | """ |
327 | 348 |
|
328 | 349 | PANEL_ID = ID_YCS |
@@ -360,7 +381,11 @@ def adjust_height(self, height): |
360 | 381 |
|
361 | 382 | # Oblique cross section panel |
362 | 383 | class ObliqueCrossSection(CrossSectionWidget): |
363 | | - """Oblique averaged cross section widget""" |
| 384 | + """Oblique averaged cross section panel |
| 385 | +
|
| 386 | + Args: |
| 387 | + parent: parent widget |
| 388 | + """ |
364 | 389 |
|
365 | 390 | PANEL_ID = ID_OCS |
366 | 391 | CrossSectionPlotKlass = ObliqueCrossSectionPlot |
|
0 commit comments