Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .coverage-config
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
branch = True
source_pkgs =
moldflow
omit =
src/moldflow/message_box.py
*/site-packages/moldflow/message_box.py

[paths]
source =
Expand All @@ -12,6 +15,9 @@ source =
fail_under = 93
show_missing = True
precision = 2
omit =
src/moldflow/message_box.py
*/site-packages/moldflow/message_box.py

[html]
title = Moldflow API Unit Test Coverage
22 changes: 17 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@
description: "Confirm publish package"
required: true
type: boolean
docs_only:

Check notice on line 10 in .github/workflows/publish.yml

View check run for this annotation

Autodesk Chorus / security/checkov

CKV_GHA_7

The build output cannot be affected by user parameters other than the build entry point and the top-level source location. GitHub Actions workflow_dispatch inputs MUST be empty.
description: "Only publish documentation (skip package publish)"
required: false
type: boolean
default: false

jobs:
guard-ci-success:
Expand Down Expand Up @@ -77,9 +82,16 @@
with:
python-version: '3.13'

- name: Install dependencies for docs
if: ${{ github.event.inputs.docs_only == 'true' }}
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Check if version exists on PyPI
id: pypi_check
shell: pwsh
if: ${{ github.event.inputs.docs_only != 'true' }}
run: |
$packageName = 'moldflow'

Expand All @@ -100,30 +112,30 @@
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8

- name: Skip publish, version already exists
if: steps.pypi_check.outputs.exists == 'true'
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'true' }}
run: Write-Output "Version ${{ steps.pypi_check.outputs.version }} already exists on PyPI. Skipping publish."

- name: Install build dependencies
if: steps.pypi_check.outputs.exists == 'false'
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'false' }}
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Build package
if: steps.pypi_check.outputs.exists == 'false'
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'false' }}
run: |
python run.py build

- name: Publish to PyPI
if: steps.pypi_check.outputs.exists == 'false'
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'false' }}
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python run.py publish --skip-build

- name: Create GitHub Release
if: steps.pypi_check.outputs.exists == 'false'
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'false' }}
run: |
python run.py release
env:
Expand Down
24 changes: 23 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Security
- N/A

## [26.0.2] - 2025-10-10

### Added
- Added convenience class for showing message boxes and text input dialogs via Win32
- Add more examples in the documentation

### Changed
- N/A

### Deprecated
- N/A

### Removed
- N/A

### Fixed
- N/A

### Security
- N/A

## [26.0.1] - 2025-09-12

### Added
Expand Down Expand Up @@ -52,6 +73,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Initial version aligned with Moldflow Synergy 2026.0.1
- Python 3.10-3.13 compatibility

[Unreleased]: https://github.com/Autodesk/moldflow-api/compare/v26.0.1...HEAD
[Unreleased]: https://github.com/Autodesk/moldflow-api/compare/v26.0.2...HEAD
[26.0.2]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.2
[26.0.1]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.1
[26.0.0]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.0
139 changes: 139 additions & 0 deletions docs/source/components/wrapper/message_box.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
MessageBox
==========

Convenience wrapper to display message boxes and a simple
text input dialog from Python scripts using the ``moldflow`` package.

Usage
-----

.. code-block:: python

from moldflow import (
MessageBox,
MessageBoxType,
MessageBoxResult,
MessageBoxOptions,
MessageBoxIcon,
MessageBoxDefaultButton,
MessageBoxModality,
)

# Informational message
MessageBox("Operation completed.", MessageBoxType.INFO).show()

# Confirmation
result = MessageBox("Proceed with analysis?", MessageBoxType.YES_NO).show()
if result == MessageBoxResult.YES:
pass

# Text input
material_id = MessageBox("Enter your material ID:", MessageBoxType.INPUT).show()
if material_id:
pass

# Advanced options
opts = MessageBoxOptions(
icon=MessageBoxIcon.WARNING,
default_button=MessageBoxDefaultButton.BUTTON2,
modality=MessageBoxModality.TASK,
topmost=True,
right_align=False,
rtl_reading=False,
help_button=False,
set_foreground=True,
owner_hwnd=None,
)
result = MessageBox(
"Retry failed operation?",
MessageBoxType.RETRY_CANCEL,
title="Moldflow",
options=opts,
).show()

Convenience methods
-------------------

.. code-block:: python

MessageBox.info("Saved")
MessageBox.warning("Low disk space")
MessageBox.error("Failed to save")
if MessageBox.confirm_yes_no("Proceed?") == MessageBoxResult.YES:
pass

# Prompt text with validation
def is_nonempty(s: str) -> bool:
return bool(s.strip())

value = MessageBox.prompt_text(
"Enter ID:",
default_text="",
placeholder="e.g. MAT-123",
validator=is_nonempty,
)
if value is not None:
pass

Options
-------

.. list-table:: MessageBoxOptions
:header-rows: 1

* - Parameter
- Type
- Description
* - icon
- MessageBoxIcon | None
- Override default icon
* - default_button
- MessageBoxDefaultButton | None
- Set default button (2/3/4). Validated vs type
* - modality
- MessageBoxModality | None
- Application (default), Task-modal, System-modal
* - topmost
- bool
- Keep message box on top (standard MessageBox only)
* - set_foreground
- bool
- Force foreground (standard MessageBox only)
* - right_align / rtl_reading
- bool
- Layout flags for right-to-left locales (standard MessageBox only)
* - help_button
- bool
- Show Help button
* - owner_hwnd
- int | None
- Owner window handle (standard MessageBox only, improves modality/Z-order)
* - default_text / placeholder
- str | None
- Prefill text and cue banner for input dialog
* - is_password
- bool
- Mask input characters
* - char_limit
- int | None
- Maximum characters accepted (client-side)
* - width_dlu / height_dlu
- int | None
- Size the input dialog (pixels; DLUs in legacy template path)
* - validator
- Callable[[str], bool] | None
- Enable OK only when input satisfies predicate
* - font_face / font_size_pt
- str / int
- Font for legacy template; CreateWindowEx path uses system dialog font

API
---

.. automodule:: moldflow.message_box

Notes
-----

- Localization: action button captions (e.g., "OK", "Cancel", "Submit") are localized via the package i18n system. Title and prompt are not localized automatically.
- Return type: ``MessageBox.show()`` returns ``MessageBoxReturn`` (``MessageBoxResult | str | None``).
Loading