Luce packages
LuceLuce BaseLuciaOS

dymokomi/luce-dialogs

Source of release 0.6.0

0.6.0 / README.md

# luce-dialogs

Native panels for choosing files and folders: the desktop's own, run modally
from the UI thread.

```luce
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:

```prisma
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

`./test.sh` runs every module's `test` blocks and the unit tests through the native and C backends, then the program checks under `tests/programs`. It expects the compiler beside this checkout at `../luce-base/build/luce-base` (or `--base PATH`).

## License

MIT or Apache-2.0, at your option.