Refactor viewer initialization and protocol.
Introduced a ViewerConfig dataclass to encapsulate common viewer window parameters. The NativeViewer now accepts a ViewerConfig and no longer requires a model at initialization. The Viewer protocol has been updated to include a close method (renamed from stop) and an upload_image method. Added checks for None models/data in studio event handling. PiperOrigin-RevId: 939631378 Change-Id: Ibc07d0e775efa0d79ce5552ee52102e943a9b290
This commit is contained in:
committed by
Copybara-Service
parent
79f6deac99
commit
f594778813
@@ -30,12 +30,12 @@ def main(argv: list[str]) -> None:
|
||||
app = studio_app.StudioApp.from_argv(argv)
|
||||
|
||||
# Initialize the viewer.
|
||||
viewer = native_viewer.NativeViewer(
|
||||
app.model,
|
||||
config = viewer_protocol.ViewerConfig(
|
||||
width=_WIDTH.value,
|
||||
height=_HEIGHT.value,
|
||||
gfx=_GFX.value,
|
||||
)
|
||||
viewer = native_viewer.NativeViewer(config)
|
||||
|
||||
# Main viewer loop.
|
||||
while viewer.is_running():
|
||||
|
||||
Reference in New Issue
Block a user