Best Python code snippet using lisa_python
vis-gui.py
Source:vis-gui.py
...410 w.set_on_menu_item_activated(AppWindow.MENU_SHOW_SETTINGS,411 self._on_menu_toggle_settings_panel)412 w.set_on_menu_item_activated(AppWindow.MENU_ABOUT, self._on_menu_about)413 # ----414 self._apply_settings()415 def _apply_settings(self):416 bg_color = [417 self.settings.bg_color.red, self.settings.bg_color.green,418 self.settings.bg_color.blue, self.settings.bg_color.alpha419 ]420 self._scene.scene.set_background(bg_color)421 self._scene.scene.show_skybox(self.settings.show_skybox)422 self._scene.scene.show_axes(self.settings.show_axes)423 if self.settings.new_ibl_name is not None:424 self._scene.scene.scene.set_indirect_light(425 self.settings.new_ibl_name)426 # Clear new_ibl_name, so we don't keep reloading this image every427 # time the settings are applied.428 self.settings.new_ibl_name = None429 self._scene.scene.scene.enable_indirect_light(self.settings.use_ibl)430 self._scene.scene.scene.set_indirect_light_intensity(431 self.settings.ibl_intensity)432 sun_color = [433 self.settings.sun_color.red, self.settings.sun_color.green,434 self.settings.sun_color.blue435 ]436 self._scene.scene.scene.set_sun_light(self.settings.sun_dir, sun_color,437 self.settings.sun_intensity)438 self._scene.scene.scene.enable_sun_light(self.settings.use_sun)439 if self.settings.apply_material:440 self._scene.scene.update_material(self.settings.material)441 self.settings.apply_material = False442 self._bg_color.color_value = self.settings.bg_color443 self._show_skybox.checked = self.settings.show_skybox444 self._show_axes.checked = self.settings.show_axes445 self._use_ibl.checked = self.settings.use_ibl446 self._use_sun.checked = self.settings.use_sun447 self._ibl_intensity.int_value = self.settings.ibl_intensity448 self._sun_intensity.int_value = self.settings.sun_intensity449 self._sun_dir.vector_value = self.settings.sun_dir450 self._sun_color.color_value = self.settings.sun_color451 self._material_prefab.enabled = (452 self.settings.material.shader == Settings.LIT)453 c = gui.Color(self.settings.material.base_color[0],454 self.settings.material.base_color[1],455 self.settings.material.base_color[2],456 self.settings.material.base_color[3])457 self._material_color.color_value = c458 self._point_size.double_value = self.settings.material.point_size459 def _on_layout(self, theme):460 # The on_layout callback should set the frame (position + size) of every461 # child correctly. After the callback is done the window will layout462 # the grandchildren.463 r = self.window.content_rect464 self._scene.frame = r465 width = 17 * theme.font_size466 height = min(r.height,467 self._settings_panel.calc_preferred_size(theme).height)468 self._settings_panel.frame = gui.Rect(r.get_right() - width, r.y, width,469 height)470 def _set_mouse_mode_rotate(self):471 self._scene.set_view_controls(gui.SceneWidget.Controls.ROTATE_CAMERA)472 def _set_mouse_mode_fly(self):473 self._scene.set_view_controls(gui.SceneWidget.Controls.FLY)474 def _set_mouse_mode_sun(self):475 self._scene.set_view_controls(gui.SceneWidget.Controls.ROTATE_SUN)476 def _set_mouse_mode_ibl(self):477 self._scene.set_view_controls(gui.SceneWidget.Controls.ROTATE_IBL)478 def _set_mouse_mode_model(self):479 self._scene.set_view_controls(gui.SceneWidget.Controls.ROTATE_MODEL)480 def _on_bg_color(self, new_color):481 self.settings.bg_color = new_color482 self._apply_settings()483 def _on_show_skybox(self, show):484 self.settings.show_skybox = show485 self._apply_settings()486 def _on_show_axes(self, show):487 self.settings.show_axes = show488 self._apply_settings()489 def _on_use_ibl(self, use):490 self.settings.use_ibl = use491 self._profiles.selected_text = Settings.CUSTOM_PROFILE_NAME492 self._apply_settings()493 def _on_use_sun(self, use):494 self.settings.use_sun = use495 self._profiles.selected_text = Settings.CUSTOM_PROFILE_NAME496 self._apply_settings()497 def _on_lighting_profile(self, name, index):498 if name != Settings.CUSTOM_PROFILE_NAME:499 self.settings.apply_lighting_profile(name)500 self._apply_settings()501 def _on_new_ibl(self, name, index):502 self.settings.new_ibl_name = gui.Application.instance.resource_path + "/" + name503 self._profiles.selected_text = Settings.CUSTOM_PROFILE_NAME504 self._apply_settings()505 def _on_ibl_intensity(self, intensity):506 self.settings.ibl_intensity = int(intensity)507 self._profiles.selected_text = Settings.CUSTOM_PROFILE_NAME508 self._apply_settings()509 def _on_sun_intensity(self, intensity):510 self.settings.sun_intensity = int(intensity)511 self._profiles.selected_text = Settings.CUSTOM_PROFILE_NAME512 self._apply_settings()513 def _on_sun_dir(self, sun_dir):514 self.settings.sun_dir = sun_dir515 self._profiles.selected_text = Settings.CUSTOM_PROFILE_NAME516 self._apply_settings()517 def _on_sun_color(self, color):518 self.settings.sun_color = color519 self._apply_settings()520 def _on_shader(self, name, index):521 self.settings.set_material(AppWindow.MATERIAL_SHADERS[index])522 self._apply_settings()523 def _on_material_prefab(self, name, index):524 self.settings.apply_material_prefab(name)525 self.settings.apply_material = True526 self._apply_settings()527 def _on_material_color(self, color):528 self.settings.material.base_color = [529 color.red, color.green, color.blue, color.alpha530 ]531 self.settings.apply_material = True532 self._apply_settings()533 def _on_point_size(self, size):534 self.settings.material.point_size = int(size)535 self.settings.apply_material = True536 self._apply_settings()537 def _on_menu_open(self):538 dlg = gui.FileDialog(gui.FileDialog.OPEN, "Choose file to load",539 self.window.theme)540 dlg.add_filter(541 ".ply .stl .fbx .obj .off .gltf .glb",542 "Triangle mesh files (.ply, .stl, .fbx, .obj, .off, "543 ".gltf, .glb)")544 dlg.add_filter(545 ".xyz .xyzn .xyzrgb .ply .pcd .pts",546 "Point cloud files (.xyz, .xyzn, .xyzrgb, .ply, "547 ".pcd, .pts)")548 dlg.add_filter(".ply", "Polygon files (.ply)")549 dlg.add_filter(".stl", "Stereolithography files (.stl)")550 dlg.add_filter(".fbx", "Autodesk Filmbox files (.fbx)")...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!