@@ -40,18 +40,19 @@ def name(self, value: str):
4040 self ._name = str (value )
4141
4242 def set_thickness (self , thickness : float ):
43- """
44- Set the thickness of the stratigraphic unit.
45- :param thickness: The thickness value to set.
43+ """Set the thickness of the stratigraphic unit.
44+
45+ Parameters
46+ ----------
47+ thickness : float
48+ The thickness value to set.
4649 """
4750 self .thickness = thickness
4851 self .spinBoxThickness .setValue (thickness )
4952 self .validateFields ()
5053
5154 def onColourSelectClicked (self ):
52- """
53- Open a color dialog to select a color for the stratigraphic unit.
54- """
55+ """Open a color dialog to select a color for the stratigraphic unit."""
5556 from PyQt5 .QtWidgets import QColorDialog
5657
5758 color = QColorDialog .getColor ()
@@ -60,19 +61,19 @@ def onColourSelectClicked(self):
6061 self .buttonColor .setStyleSheet (f"background-color: { self .colour } ;" )
6162
6263 def onThicknessChanged (self , thickness : float ):
63- """
64- Update the thickness of the stratigraphic unit.
65- :param thickness: The new thickness value.
64+ """Handle changes to the thickness spinbox.
65+
66+ Parameters
67+ ----------
68+ thickness : float
69+ The new thickness value.
6670 """
6771 self .thickness = thickness
6872 self .validateFields ()
6973 self .thicknessChanged .emit (thickness )
7074
7175 def onNameChanged (self ):
72- """
73- Update the name of the stratigraphic unit.
74- :param name: The new name value.
75- """
76+ """Handle name edit completion and emit nameChanged if modified."""
7677 name = self .lineEditName .text ().strip ()
7778 if name != self .name :
7879 self .name = name
@@ -84,9 +85,7 @@ def request_delete(self):
8485 self .deleteRequested .emit (self )
8586
8687 def validateFields (self ):
87- """
88- Validate the fields and update the widget's appearance.
89- """
88+ """Validate the widget fields and update UI hints."""
9089 # Reset all styles first
9190 self .lineEditName .setStyleSheet ("" )
9291 self .spinBoxThickness .setStyleSheet ("" )
@@ -101,9 +100,12 @@ def validateFields(self):
101100 self .spinBoxThickness .setToolTip ("Thickness must be greater than zero." )
102101
103102 def setData (self , data : Optional [dict ] = None ):
104- """
105- Set the data for the stratigraphic unit widget.
106- :param data: A dictionary containing 'name' and 'colour' keys.
103+ """Set the data for the stratigraphic unit widget.
104+
105+ Parameters
106+ ----------
107+ data : dict or None
108+ Dictionary containing 'name' and 'colour' keys. If None, defaults are used.
107109 """
108110 if data :
109111 self .name = str (data .get ("name" , "" ))
@@ -119,9 +121,12 @@ def setData(self, data: Optional[dict] = None):
119121 self .validateFields ()
120122
121123 def getData (self ) -> dict :
122- """
123- Get the data from the stratigraphic unit widget.
124- :return: A dictionary containing 'name', 'colour', and 'thickness'.
124+ """Return the widget data as a dictionary.
125+
126+ Returns
127+ -------
128+ dict
129+ Dictionary containing 'uuid', 'name', 'colour', and 'thickness'.
125130 """
126131 return {
127132 "uuid" : self .uuid ,
0 commit comments