Skip to content

Porting EasyDialogs to Micropython 68k#32

Draft
smallsco wants to merge 1 commit intom68k-micropython:mainfrom
smallsco:easydialogs
Draft

Porting EasyDialogs to Micropython 68k#32
smallsco wants to merge 1 commit intom68k-micropython:mainfrom
smallsco:easydialogs

Conversation

@smallsco
Copy link

Summary

This is a port of MacPython's EasyDialogs library to Micropython 68k.

It's still in progress, but some early feedback would be great as it's not quite working yet.

Testing

Tested on Mac OS 7.6.1 using Basilisk II.

Right now we raise an exception because this doesn't work:

            dialogmgr.ModalDialog(
                uctypes.struct(None, dialogmgr.ModalFilterUPP),  # FIXME: not working
                itemHit
            )

which is probably just me calling the struct function incorrectly rather than a problem with micropython itself.

Also, the Control Manager is required in order to set the text of the "OK" button, so that doesn't work at the moment either.

Setting the default dialog item doesn't seem to work - but I suspect that it actually does work, and the dialog just isn't being redrawn by the OS after we set this (since we immediately throw an exception in ModalDialog right after).

Only the Message() function is currently implemented. I'll work on the others once this one is working.

You'll need to decompress the EasyDialogs.rsrc file and place it in the same location as the Micropython application, or the app will bomb when trying to load resources. I need to research how to do error handling for Toolbox functions so we can catch it (and raise a Python exception instead). This isn't a priority though.

Trade-offs and Alternatives

For the simplest of dialogs you can use the built-in Toolbox functions. This goes one step further and implements some additional common dialog types (and eventually it will implement a progress bar window as well).

@jepler
Copy link

jepler commented Aug 25, 2025

fwiw I think there's also a problem with how I've implemented GetDialogItem / parameters of Pascal type VAR Handle...

image

I don't think my implementation is succeeding in "returning" the found handle. But I could be wrong, I didn't do the step where I make sure the accompanying resource is actually on my test media.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants