Bump version to 0.10.11 and update installation instructions; enhance progress reporting and estimated time features
This commit is contained in:
@@ -475,23 +475,53 @@ class RunJob(bpy.types.Operator):
|
||||
if status is None:
|
||||
return
|
||||
settings = context.scene.snapform_settings
|
||||
settings.progress = float(status.get("progress", settings.progress))
|
||||
reported_progress = float(
|
||||
status.get("progress", settings.progress)
|
||||
)
|
||||
settings.progress = max(
|
||||
settings.progress,
|
||||
min(max(reported_progress, 0.0), 1.0),
|
||||
)
|
||||
settings.status = self._format_status(status, settings.status)
|
||||
self._redraw_ui(context, force=True)
|
||||
|
||||
def _format_status(self, status, fallback):
|
||||
message = status.get("message", fallback)
|
||||
message = status.get("message")
|
||||
stage = status.get("stage")
|
||||
stages = status.get("stages")
|
||||
stage_label = status.get("stage_label")
|
||||
if not stage or not stages:
|
||||
return message
|
||||
text = (
|
||||
f"{stage}/{stages} {stage_label}"
|
||||
if stage_label
|
||||
else f"{stage}/{stages}"
|
||||
)
|
||||
return f"{text}: {message}" if message else text
|
||||
parts = []
|
||||
if stage and stages:
|
||||
stage_text = f"{stage}/{stages}"
|
||||
if stage_label:
|
||||
stage_text = f"{stage_text} {stage_label}"
|
||||
parts.append(stage_text)
|
||||
elif stage_label:
|
||||
parts.append(str(stage_label))
|
||||
if message:
|
||||
normalized = str(message).strip()
|
||||
if normalized.lower() != str(stage_label or "").lower():
|
||||
parts.append(normalized)
|
||||
eta = self._format_eta(status.get("eta_seconds"))
|
||||
if eta:
|
||||
parts.append(eta)
|
||||
return " | ".join(parts) if parts else (message or fallback)
|
||||
|
||||
@staticmethod
|
||||
def _format_eta(seconds):
|
||||
if seconds is None:
|
||||
return ""
|
||||
seconds = max(float(seconds), 0.0)
|
||||
if seconds <= 10:
|
||||
return "A few seconds left"
|
||||
if seconds < 60:
|
||||
rounded = max(5, int((seconds + 2.5) // 5) * 5)
|
||||
return f"About {rounded} sec left"
|
||||
if seconds < 3600:
|
||||
minutes = int((seconds + 59) // 60)
|
||||
return f"About {minutes} min left"
|
||||
hours = int((seconds + 3599) // 3600)
|
||||
return f"About {hours} hr left"
|
||||
|
||||
def _finish(self, context, job, return_code):
|
||||
settings = context.scene.snapform_settings
|
||||
|
||||
Reference in New Issue
Block a user