Skip to content

Added viewer#34

Merged
Jegp merged 2 commits into
mainfrom
viewer
Nov 2, 2025
Merged

Added viewer#34
Jegp merged 2 commits into
mainfrom
viewer

Conversation

@Jegp

@Jegp Jegp commented Sep 22, 2025

Copy link
Copy Markdown
Contributor

Adds a visualizer that takes a FrameStream and dumps it into a Slint window. The viewer has rudimentary playback control to permit freezing and going back and forth for some frames (by default: 1024).

Also fixes some flake issues where the environment wouldn't be correctly activated. rustup would install a user-wide configuration, which clashed with the project-specific environment.

@Jegp Jegp requested a review from aMarcireau September 22, 2025 10:17
@Jegp Jegp added the enhancement New feature or request label Sep 22, 2025
@aMarcireau

Copy link
Copy Markdown
Contributor

I just tried this on my machine and it worked out-of-the-box! This is no small feat given that I am using a different operating system and arch.

However, playback was really fast (the window pretty much exited immediately. I tried the viewer with the following snippet. I am using a very slow frame-rate as workaround but we may need a frame rate limiter somewhere?

import faery

(
    faery.events_stream_from_file(
        faery.dirname.parent / "tests" / "data" / "dvs.es",
    )
    .regularize(frequency_hz=60000.0)
    .render(
        decay="exponential",
        tau="00:00:00.200000",
        colormap=faery.colormaps.managua.flipped(),
    )
    .view()
)

@aMarcireau

Copy link
Copy Markdown
Contributor

Nonetheless, this is a very strong start. I think that we can merge (merge early, merge often!) and add further features down the line.

Comment thread python/faery/frame_stream.py Outdated
"""
Display frames in a GUI viewer using Slint
"""
from . import extension

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"from . import extension" should be moved to lines 13 to 16. The double-import is a bit ugly but it keeps type checkers happy. You may need to add type declarations for the Rust functions to "python/faery/types".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a type file now.

@Jegp

Jegp commented Oct 30, 2025

Copy link
Copy Markdown
Contributor Author

I just tried this on my machine and it worked out-of-the-box! This is no small feat given that I am using a different operating system and arch.

Very very cool! I think the Rust-bet is paying off.

However, playback was really fast (the window pretty much exited immediately. I tried the viewer with the following snippet. I am using a very slow frame-rate as workaround but we may need a frame rate limiter somewhere?

That's an excellent point! I wasn't taking into account that the frequency that we generate frames with might be disjoint from the frequency that we want to display frames. I added a frame_rate parameter which defaults to 30, but can be set to None (as quick as possible).

I also added a few quality-of-life improvements, like avoiding the GUI closing when the stream ends and closing the GUI when hitting escape.

@Jegp Jegp merged commit f1003bc into main Nov 2, 2025
112 checks passed
@Jegp Jegp deleted the viewer branch November 2, 2025 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants