dymokomi/luce-dialogs
Native open and save file panels for Luce programs: macOS and Windows panels, zenity or kdialog on Linux.
A library written in luce-base. Latest release 0.6.1.
Install#
luc add dymokomi/luce-dialogsDocumentation#
luce-dialogs
Native panels for choosing files and folders: the desktop's own, run modally from the UI thread.
from luce_dialogs import dialogs
let photo = dialogs.open_file("Choose a photo") else return # one file, or none when cancelled
let several = dialogs.open_files("Choose photos") else return # paths, one a line
let folder = dialogs.choose_folder("Choose a folder") else return # a folder
let target = dialogs.save_file("Save as", "untitled.png") else return
| function | macOS | Windows | Linux |
|---|---|---|---|
open_file, open_files | NSOpenPanel | GetOpenFileNameW | zenity, else kdialog |
choose_folder | NSOpenPanel, folders only | SHBrowseForFolderW | zenity --directory, else kdialog --getexistingdirectory |
save_file | NSSavePanel | GetSaveFileNameW | zenity, else kdialog |
Modules
| import | what it holds |
|---|---|
import dialogs | Native file dialogs |
Using it
Add the dependency to package.prisma; the modules keep their short names:
def dependency "luce-dialogs" {
str owner = "dymokomi"
}
Depends on
- luce-window
Platforms
macOS, Windows, and Linux through the desktop's helper (zenity or kdialog, whichever is installed).
Native libraries it links, by platform (declared in package.prisma, linked only when the program reaches code that needs them):
- macos: AppKit, Foundation
- windows: comdlg32, user32, shell32, ole32
Tests
luc test runs the tests in tests/dialogs/: how a Linux helper's answer is read, with a shell standing in for zenity and kdialog, and the refusal of a dialog off the UI thread. A panel itself needs a person to answer it, so it is not tested.
License
MIT or Apache-2.0, at your option.
Dependencies#
| Package | Version |
|---|---|
| dymokomi/luce-std | newest |
| dymokomi/luce-window | newest |
Versions#
0.6.1
Browse source · pack · commit b5041b5fb8b6
SHA-256 219c6439bbafdcdeb21b6f73a724083eeefb038cc62e4e8d741f8d144f84206a
luce-dialogs 0.6.1: batch release
0.6.0
Browse source · pack · commit 4cc28ff7fe60
SHA-256 19ccf3472be7f38458daa0d0a1ca98df85386d6257ed4a3b03c394265fcdcc1d
choose_folder on every OS; Linux helper failures fail instead of reading as a cancel; collections.Buffer; dependencies name no version