rio-labs / rio

WebApps in pure Python. No JavaScript, HTML and CSS needed
https://rio.dev
Apache License 2.0
1.52k stars 47 forks source link

[Feature Request] App Window: standardize on pywebview[qt] #164

Open iwr-redmond opened 17 hours ago

iwr-redmond commented 17 hours ago

Description

This request involves the window icon for local app mode.

According to the pyproject.toml, pywebview 4.2 is installed on Windows with cefpython and current (5.3.2) is installed on Linux with QT. However, of these two only the QT backend supports runtime icons, per the pywebview documentation.

Suggested Solution

Standardizing on the QT backend would allow for identical support on Windows, Mac, and Linux, with app icon support. QTPY is arguably better supported in general, as cefpython3 has not been updated in years.

Alternatives

N/A - see NiceGUI pull 634

Additional Context

The [window] subinstall is broken on Ubuntu 22.04, as the unsupported pywebview 4.2 is installed in addition to current. If this feature request is not accepted, please update pyproject.toml line 76 to read:

"pywebview~=4.2" ; sys_platform == 'win32'",

Separately, cefpython3 is available for Mac on Python 3.10.

Related Issues/Pull Requests

No response

mad-moo commented 17 hours ago

Hey, thanks for this.

When we originally added webview we've tried the different backends. The chromium backend works by far the best and behaves similar to what you'd expect from a browser. With the others we've seen issues like videos not playing.

The reason we've ultimately decided on the current selection is because there were the best implementations on each platform that were actually reasonable to install. We'd often get error messages that webview couldn't find something even though it was installed on the system, or we plain couldn't find a package to get it to work on a platform.

We can review this - maybe the situation has changed. Your note on ubuntu also needs attention, thanks for pointing that out.

Ultimately running well on a platform beats whether an icon can be displayed. Maybe we could also add an option to switch backents to run_in_window

iwr-redmond commented 16 hours ago

Take a look in the code for the QT backend, which has been updated recently for QT/Pyside6 (per issue 1520). It uses qtwebengine, i.e. Chromium, rather than qtwebkit.

mad-moo commented 16 hours ago

Very good! That sounds promising. I'll try webview again on different platforms tomorrow