flexxui / flexx

Write desktop and web apps in pure Python
http://flexx.readthedocs.io
BSD 2-Clause "Simplified" License
3.26k stars 258 forks source link

Getting a full filepath #443

Open Korijn opened 6 years ago

Korijn commented 6 years ago

Electron apparently inserts an additional property path into File objects: https://github.com/electron/electron/blob/v1.2.8/docs/api/file-object.md

Does flexx support running inside Electron?

almarklein commented 6 years ago

At this point, the flexx.webruntime module does not support electron yet (only nw.js and Xul/Firefox as app runtimes).

Korijn commented 6 years ago

https://github.com/nwjs/nw.js/wiki/file-dialogs

nw.js supports it!

almarklein commented 6 years ago

I haven't looked at the nwjs runtime in about a year, but everything still works, including the installation/update process: simply download the archive, and Flexx will pick it up ...

... Running a Flexx app ...

[I 14:26:00 flexx.webruntime] launched as nw app: http://localhost:49190/ImageTest/?session_id=eeB2EnmVWD4VFKIWpo9AISCo

>>> m.session.runtime
<flexx.webruntime._nw.NWRuntime object at 0x000001E8CDAC30B8>

>>> m.session.runtime.get_install_instuctions()
'Download the NW.js archive for your platform from "http://nwjs.io". Flexx will find the file if it is placed in your home dir, desktop, downloads dir (where most browser save it) or the default temp dir.'

>>> m.session.runtime.get_version()
'0.20.2'

... goto nwjs.io and hit the download button ...
... rerun app ...

[I 14:27:26 flexx.webruntime] Performing update of runtime nw
[I 14:27:29 flexx.webruntime] Extracted archive into nw_0.28.2 in 2.7 s
[I 14:27:29 flexx.webruntime] launched as nw app: http://localhost:49190/ImageTest/?session_id=b8zd65z3azl3xMeYL4n5pS94

>>> m.session.runtime.get_version()
'0.28.2'
almarklein commented 5 years ago

550 implements an experimental FileBrowserWidget that could be used as a basis for a file selection dialog.

rojerian commented 4 years ago

Almar, It seems necessary to include the ability to browse and ‘upload’ a file and path to the core app. Do you have an example of the FileBrowserWidget usage ?

almarklein commented 4 years ago

No, but an example in the flexxamples directory would be a welcome addition :)