chore: prune boilerplate and refresh stale docs

- Remove 257 redundant per-definition comment stubs across the package
- Drop dead nonlocal declarations in autoslicer_detection.py
- Document the swapped flag and swap_left_right in architecture docs
- Remove unsupported 'legacy override' claims from autotune/runtime docs
This commit is contained in:
dan 2026-09-11 23:07:30 +02:00
parent 929c828438
commit 426a18f342
24 changed files with 5 additions and 264 deletions

View file

@ -6,22 +6,18 @@ from PySide6.QtGui import QImage
from PySide6.QtWidgets import QMessageBox
# DetectionTaskSignals: class definition for ScanSlicer behavior.
class DetectionTaskSignals(QObject):
status = Signal(str)
finished = Signal(object, object, object)
failed = Signal(str)
# DetectionTask: class definition for ScanSlicer behavior.
class DetectionTask(QRunnable):
# __init__: function definition for ScanSlicer behavior.
def __init__(self, autoslicer):
super().__init__()
self.autoslicer = autoslicer
self.signals = DetectionTaskSignals()
# run: function definition for ScanSlicer behavior.
def run(self):
try:
boxes, filter_preview_image = self.autoslicer.autodetect_slices(
@ -35,23 +31,19 @@ class DetectionTask(QRunnable):
self.signals.failed.emit(details)
# AutotuneTaskSignals: class definition for ScanSlicer behavior.
class AutotuneTaskSignals(QObject):
status = Signal(str)
finished = Signal(object)
failed = Signal(str)
# AutotuneTask: class definition for ScanSlicer behavior.
class AutotuneTask(QRunnable):
# __init__: function definition for ScanSlicer behavior.
def __init__(self, autoslicer, profile_name):
super().__init__()
self.autoslicer = autoslicer
self.profile_name = profile_name
self.signals = AutotuneTaskSignals()
# run: function definition for ScanSlicer behavior.
def run(self):
try:
result = self.autoslicer.autotune_for_current_image(
@ -64,16 +56,13 @@ class AutotuneTask(QRunnable):
self.signals.failed.emit(details)
# rgb_array_to_qimage: function definition for ScanSlicer behavior.
def rgb_array_to_qimage(image):
h, w, c = image.shape
bytes_per_line = c * w
return QImage(image.data, w, h, bytes_per_line, QImage.Format_RGB888).copy()
# ScanSlicerDetectionMixin: class definition for ScanSlicer behavior.
class ScanSlicerDetectionMixin:
# _get_worker_pool: function definition for ScanSlicer behavior.
def _get_worker_pool(self):
pool = getattr(self, "_worker_pool", None)
if pool is None:
@ -83,13 +72,11 @@ class ScanSlicerDetectionMixin:
self._worker_pool = pool
return pool
# invalidate_preview_cache: function definition for ScanSlicer behavior.
def invalidate_preview_cache(self):
self.last_detected_boxes = None
self.last_preview_normal_image = None
self.last_preview_filter_image = None
# has_preview_cache: function definition for ScanSlicer behavior.
def has_preview_cache(self):
return (
self.last_detected_boxes is not None
@ -97,7 +84,6 @@ class ScanSlicerDetectionMixin:
and self.last_preview_filter_image is not None
)
# render_cached_preview: function definition for ScanSlicer behavior.
def render_cached_preview(self, new_image=False):
if not self.has_preview_cache():
return False
@ -105,7 +91,6 @@ class ScanSlicerDetectionMixin:
self.slicing_canvas.set_image(rgb_array_to_qimage(image), new_image)
return True
# update_preview: function definition for ScanSlicer behavior.
def update_preview(self, new_image=False, run_detection=True):
if self.processing_busy:
return
@ -121,7 +106,6 @@ class ScanSlicerDetectionMixin:
if run_detection:
self._start_detection_worker(new_image=bool(new_image))
# _start_detection_worker: function definition for ScanSlicer behavior.
def _start_detection_worker(self, new_image=False):
if getattr(self, "_is_closing", False):
return
@ -148,7 +132,6 @@ class ScanSlicerDetectionMixin:
self._get_worker_pool().start(task)
# _is_active_detection_task: function definition for ScanSlicer behavior.
def _is_active_detection_task(self, task_id):
return (
task_id is not None
@ -156,7 +139,6 @@ class ScanSlicerDetectionMixin:
and bool(getattr(self, "_detection_running", False))
)
# _on_detection_status: function definition for ScanSlicer behavior.
def _on_detection_status(self, task_id, text):
if getattr(self, "_is_closing", False):
return
@ -164,7 +146,6 @@ class ScanSlicerDetectionMixin:
return
self.update_statusbar(text)
# _on_detection_finished: function definition for ScanSlicer behavior.
def _on_detection_finished(self, task_id, bbxs, filter_preview_image, normal_preview_image):
if not self._is_active_detection_task(task_id):
return
@ -196,7 +177,6 @@ class ScanSlicerDetectionMixin:
if not getattr(self, "_is_closing", False):
self.set_processing_busy(False)
# _on_detection_failed: function definition for ScanSlicer behavior.
def _on_detection_failed(self, task_id, error_text):
if not self._is_active_detection_task(task_id):
return
@ -209,7 +189,6 @@ class ScanSlicerDetectionMixin:
self.update_statusbar("Detection failed.")
self.set_processing_busy(False)
# _start_autotune_worker: function definition for ScanSlicer behavior.
def _start_autotune_worker(self):
if getattr(self, "_is_closing", False):
return
@ -235,7 +214,6 @@ class ScanSlicerDetectionMixin:
self._get_worker_pool().start(task)
# _is_active_autotune_task: function definition for ScanSlicer behavior.
def _is_active_autotune_task(self, task_id):
return (
task_id is not None
@ -243,7 +221,6 @@ class ScanSlicerDetectionMixin:
and bool(getattr(self, "_autotune_running", False))
)
# _on_autotune_status: function definition for ScanSlicer behavior.
def _on_autotune_status(self, task_id, text):
if getattr(self, "_is_closing", False):
return
@ -251,7 +228,6 @@ class ScanSlicerDetectionMixin:
return
self.update_statusbar(text)
# _on_autotune_finished: function definition for ScanSlicer behavior.
def _on_autotune_finished(self, task_id, result):
if not self._is_active_autotune_task(task_id):
return
@ -283,7 +259,6 @@ class ScanSlicerDetectionMixin:
)
self.update_preview(new_image=False, run_detection=True)
# _on_autotune_failed: function definition for ScanSlicer behavior.
def _on_autotune_failed(self, task_id, error_text):
if not self._is_active_autotune_task(task_id):
return