|
5 | 5 | Based on Lead-DBS repository models |
6 | 6 | """ |
7 | 7 |
|
| 8 | +import typing |
| 9 | + |
8 | 10 | from PySide6.QtCore import QPointF, QRectF, Qt |
9 | 11 | from PySide6.QtGui import ( |
10 | 12 | QBrush, |
@@ -188,7 +190,7 @@ def set_ring_state(self, ring_idx, state): |
188 | 190 | new_states[contact_id] = state |
189 | 191 |
|
190 | 192 | self._apply_change_if_valid(new_states, self.case_state) |
191 | | - |
| 193 | + @typing.override |
192 | 194 | def mousePressEvent(self, event): |
193 | 195 | """Handle clicks on contacts, rings and case""" |
194 | 196 | if event.button() == Qt.LeftButton: |
@@ -223,6 +225,7 @@ def mousePressEvent(self, event): |
223 | 225 | self.cycle_case_state() |
224 | 226 | return |
225 | 227 |
|
| 228 | + @typing.override |
226 | 229 | def mouseMoveEvent(self, event): |
227 | 230 | """Handle hover over contacts, rings and case""" |
228 | 231 | old_hovered_contact = self.hovered_contact |
@@ -260,6 +263,7 @@ def get_state_color(self, state, is_hovered=False): |
260 | 263 |
|
261 | 264 | return base_color, border_color, border_width |
262 | 265 |
|
| 266 | + @typing.override |
263 | 267 | def paintEvent(self, event): |
264 | 268 | """Render the electrode lead, contacts, case, and labels.""" |
265 | 269 | if not self.model: |
@@ -336,7 +340,7 @@ def paintEvent(self, event): |
336 | 340 | contact_height_px = self.model.contact_height * scale |
337 | 341 | # E0 is the last contact (index 0), positioned after all other contacts and their spacing |
338 | 342 | e0_y_position = start_y + 2 * scale # Initial offset |
339 | | - for i in range(self.model.num_contacts - 1): # All contacts except E0 |
| 343 | + for _ in range(self.model.num_contacts - 1): # All contacts except E0 |
340 | 344 | e0_y_position += contact_height_px + (self.model.contact_spacing + 1.0) * scale |
341 | 345 |
|
342 | 346 | # Lead body end position depends on electrode type |
@@ -445,7 +449,7 @@ def paintEvent(self, event): |
445 | 449 | self.ring_rects[contact_idx] = ring_cap_rect |
446 | 450 |
|
447 | 451 | # Directional electrode with 3D metallic segments |
448 | | - segment_width = lead_width * 0.5 |
| 452 | + lead_width * 0.5 |
449 | 453 | extension = base_extension |
450 | 454 |
|
451 | 455 | # Helper function to draw 3D segment |
@@ -784,6 +788,7 @@ def draw_3d_segment(poly, state, is_hovered, contact_id, label): |
784 | 788 | painter.drawText(ring_cap_rect, Qt.AlignCenter, "Ring") |
785 | 789 |
|
786 | 790 |
|
| 791 | + @typing.override |
787 | 792 | def resizeEvent(self, event): |
788 | 793 | """Redraw when window is resized""" |
789 | 794 | super().resizeEvent(event) |
|
0 commit comments