MCPcopy Create free account
hub / github.com/NyarchLinux/DesktopPuppet / _launch_puppet

Method _launch_puppet

src/gui_controller.py:461–522  ·  view source on GitHub ↗

Launch the puppet.

(self)

Source from the content-addressed store, hash-verified

459 self._launch_puppet()
460
461 def _launch_puppet(self):
462 """Launch the puppet."""
463 # Check viewer installation
464 installed, message = self.launcher.ensure_viewer_installed()
465 if not installed:
466 self._show_status(message, "error")
467 return
468
469 # Get selected model
470 model_name = self.model_dropdown.get_selected_item()
471 if not model_name:
472 self._show_status("Please select a model first", "error")
473 return
474
475 model_path = self._model_paths.get(model_name.get_string())
476 if not model_path:
477 self._show_status("Invalid model selected", "error")
478 return
479
480 # Store current model path for settings
481 self.current_model_path = model_path
482
483 # Get parameters
484 scale = self.scale_row.get_value()
485 extra_w = self.extra_w_row.get_value()
486 extra_h = self.extra_h_row.get_value()
487 bg = self.bg_row.get_selected_item().get_string()
488
489 # Disable launch button
490 self.launch_button.set_label("Launching...")
491 self.launch_button.set_sensitive(False)
492
493 # Start webserver
494 try:
495 self.viewer_url = self.launcher.start_viewer_webserver(
496 model_path, scale, bg, extra_w, extra_h
497 )
498 except Exception as e:
499 self._show_status(f"Failed to start webserver: {e}", "error")
500 self.launch_button.set_label("Launch Puppet")
501 self.launch_button.set_sensitive(True)
502 return
503
504 # Start puppet process
505 try:
506 self.launcher.start_puppet()
507 except Exception as e:
508 self._show_status(f"Failed to start puppet: {e}", "error")
509 self.launch_button.set_label("Launch Puppet")
510 self.launch_button.set_sensitive(True)
511 return
512
513 # Update UI
514 self.launch_button.set_label("Stop Puppet")
515 self.launch_button.add_css_class("destructive-action")
516 self.launch_button.remove_css_class("suggested-action")
517 self.launch_button.set_sensitive(True)
518

Callers 1

_on_launch_clickedMethod · 0.95

Calls 5

_show_statusMethod · 0.95
_start_monitorMethod · 0.95
start_puppetMethod · 0.80

Tested by

no test coverage detected