[PR #2185] make_game --pick: on macOS, the folder dialog is osascript's choose folder, so it needs no Tkinter (MAKE-GAME-PICK-MACOS) #2189

Open
opened 2026-11-26 21:20:21 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2185
Author: @Tauwni
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: fix/make-game-pick-macos-osascript


📝 Commits (2)

  • 9af0a22 make_game --pick: on macOS, the folder dialog is osascript's choose folder, so it needs no Tkinter
  • 13909f8 Merge main into fix/make-game-pick-macos-osascript

📊 Changes

2 files changed (+56 additions, -11 deletions)

View changed files

📝 make_game.py (+23 -6)
📝 tests/test_make_game_pick.py (+33 -5)

📄 Description

Claimed in the coordination issue as: MAKE-GAME-PICK-MACOS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7181407725)

What and why

make_game.py --pick opens its folder dialog through Tk on macOS. Homebrew's Python ships without Tkinter (it's a separate [email protected] formula), so on a Mac with Homebrew's Python --pick stops:

The folder dialog couldn't open (No module named '_tkinter'). Give the folder with --game.

osascript is on every Mac, and its choose folder is the system folder dialog. native_picker() now returns it on macOS, the way kdialog and zenity are the native tools on Linux:

  • native_ask: choose folder with prompt … default location …. The prompt and the start folder are passed as argv, not pasted into the script, so a path with quotes needs no escaping. Cancel is AppleScript error -128, which osascript exits 1 with, the code native_ask already treats as cancelled.
  • native_warn: display dialog … with icon caution, also with the message passed as argv.
  • The flow is the same as on Linux: it asks again from the last folder after a warning. If osascript fails to run, it falls back to Tk as before.

Tested

Apple M3, macOS 26.5.1:

  • Both scripts compile with osacompile. The warning dialog showed a message with quotes, a backslash and a newline, passed as argv (run with giving up after 1). The choose folder dialog opened on the home folder. Cancel (error number -128) exits 1.
  • tests/test_make_game_pick.py: 17 tests OK on Python 3.12 and 3.15. New tests cover macOS picking osascript (and nothing when it's missing), the arguments of the ask and the warning, and cancel. The old "None on macOS" case now only covers Windows. All tests/test_make_game*.py are OK.

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly.
  • One topic.
  • No game data, keys or decryption.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2185 **Author:** [@Tauwni](https://github.com/Tauwni) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/make-game-pick-macos-osascript` --- ### 📝 Commits (2) - [`9af0a22`](https://github.com/ubiquitarianism/leonida/commit/9af0a227682963cbfe8c1724312520556a00f7f3) make_game --pick: on macOS, the folder dialog is osascript's choose folder, so it needs no Tkinter - [`13909f8`](https://github.com/ubiquitarianism/leonida/commit/13909f88e65b9518d3206bf4ba7d2df5fa81495b) Merge main into fix/make-game-pick-macos-osascript ### 📊 Changes **2 files changed** (+56 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `make_game.py` (+23 -6) 📝 `tests/test_make_game_pick.py` (+33 -5) </details> ### 📄 Description Claimed in the coordination issue as: MAKE-GAME-PICK-MACOS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7181407725) ### What and why `make_game.py --pick` opens its folder dialog through Tk on macOS. Homebrew's Python ships without Tkinter (it's a separate `[email protected]` formula), so on a Mac with Homebrew's Python `--pick` stops: ``` The folder dialog couldn't open (No module named '_tkinter'). Give the folder with --game. ``` `osascript` is on every Mac, and its `choose folder` is the system folder dialog. `native_picker()` now returns it on macOS, the way kdialog and zenity are the native tools on Linux: - `native_ask`: `choose folder with prompt … default location …`. The prompt and the start folder are passed as `argv`, not pasted into the script, so a path with quotes needs no escaping. Cancel is AppleScript error -128, which `osascript` exits 1 with, the code `native_ask` already treats as cancelled. - `native_warn`: `display dialog … with icon caution`, also with the message passed as `argv`. - The flow is the same as on Linux: it asks again from the last folder after a warning. If `osascript` fails to run, it falls back to Tk as before. ### Tested Apple M3, macOS 26.5.1: - Both scripts compile with `osacompile`. The warning dialog showed a message with quotes, a backslash and a newline, passed as `argv` (run with `giving up after 1`). The `choose folder` dialog opened on the home folder. Cancel (`error number -128`) exits 1. - `tests/test_make_game_pick.py`: 17 tests OK on Python 3.12 and 3.15. New tests cover macOS picking osascript (and nothing when it's missing), the arguments of the ask and the warning, and cancel. The old "None on macOS" case now only covers Windows. All `tests/test_make_game*.py` are OK. AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly. - [x] One topic. - [x] No game data, keys or decryption. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2189
No description provided.