Skip to content

Commit de531bf

Browse files
Bring relevant changes to the v26 release branch (#24)
* Improve examples in docs (#16) * Fix return types and color band range (#5) * fix types and remove non-existing function * fix tests * fix color band range * increment patch number * fix range and tests * changelog * bring back function * more tests * missing include * typo * better docstrings * correctness * ws * docs only publish * more examples * point to pypi (#3) * remove multi-statement lines * remove vb references * better explanation * simpler * cleanup and make sure the scripts work * Update readme.rst * remove unnecessary fallback * Add convenience message boxes and input dialogs via Win32 (#15) * progress * order * allow ok for localisation * add integration test * format * lint * fix test * working * lint * i18n * format * lint * fnish lint * review * placement * omit test coverage for win32 ui heavy class * add to changelog * fix coverage * more friendly win32 error handling * Update src/moldflow/message_box.py Co-authored-by: Sankalp Shrivastava <sankalp.adsk.github@gmail.com> --------- Co-authored-by: Sankalp Shrivastava <sankalp.adsk.github@gmail.com> * Improve MessageBox documentation (#21) * progress * order * allow ok for localisation * add integration test * format * lint * fix test * working * lint * i18n * format * lint * fnish lint * review * placement * omit test coverage for win32 ui heavy class * add to changelog * fix coverage * more friendly win32 error handling * Update src/moldflow/message_box.py Co-authored-by: Sankalp Shrivastava <sankalp.adsk.github@gmail.com> * better doc --------- Co-authored-by: Sankalp Shrivastava <sankalp.adsk.github@gmail.com> * bump version * update changelog --------- Co-authored-by: Sankalp Shrivastava <sankalp.adsk.github@gmail.com>
1 parent cb5f8d1 commit de531bf

20 files changed

Lines changed: 2302 additions & 23 deletions

File tree

.coverage-config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
branch = True
33
source_pkgs =
44
moldflow
5+
omit =
6+
src/moldflow/message_box.py
7+
*/site-packages/moldflow/message_box.py
58

69
[paths]
710
source =
@@ -12,6 +15,9 @@ source =
1215
fail_under = 93
1316
show_missing = True
1417
precision = 2
18+
omit =
19+
src/moldflow/message_box.py
20+
*/site-packages/moldflow/message_box.py
1521

1622
[html]
1723
title = Moldflow API Unit Test Coverage

.github/workflows/publish.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ on:
77
description: "Confirm publish package"
88
required: true
99
type: boolean
10+
docs_only:
11+
description: "Only publish documentation (skip package publish)"
12+
required: false
13+
type: boolean
14+
default: false
1015

1116
jobs:
1217
guard-ci-success:
@@ -77,9 +82,16 @@ jobs:
7782
with:
7883
python-version: '3.13'
7984

85+
- name: Install dependencies for docs
86+
if: ${{ github.event.inputs.docs_only == 'true' }}
87+
run: |
88+
python -m pip install --upgrade pip
89+
pip install -r requirements.txt
90+
8091
- name: Check if version exists on PyPI
8192
id: pypi_check
8293
shell: pwsh
94+
if: ${{ github.event.inputs.docs_only != 'true' }}
8395
run: |
8496
$packageName = 'moldflow'
8597
@@ -100,30 +112,30 @@ jobs:
100112
"version=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append -Encoding utf8
101113
102114
- name: Skip publish, version already exists
103-
if: steps.pypi_check.outputs.exists == 'true'
115+
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'true' }}
104116
run: Write-Output "Version ${{ steps.pypi_check.outputs.version }} already exists on PyPI. Skipping publish."
105117

106118
- name: Install build dependencies
107-
if: steps.pypi_check.outputs.exists == 'false'
119+
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'false' }}
108120
run: |
109121
python -m pip install --upgrade pip
110122
pip install -r requirements.txt
111123
112124
- name: Build package
113-
if: steps.pypi_check.outputs.exists == 'false'
125+
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'false' }}
114126
run: |
115127
python run.py build
116128
117129
- name: Publish to PyPI
118-
if: steps.pypi_check.outputs.exists == 'false'
130+
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'false' }}
119131
env:
120132
TWINE_USERNAME: __token__
121133
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
122134
run: |
123135
python run.py publish --skip-build
124136
125137
- name: Create GitHub Release
126-
if: steps.pypi_check.outputs.exists == 'false'
138+
if: ${{ github.event.inputs.docs_only != 'true' && steps.pypi_check.outputs.exists == 'false' }}
127139
run: |
128140
python run.py release
129141
env:

CHANGELOG.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2525
### Security
2626
- N/A
2727

28+
## [26.0.2] - 2025-10-10
29+
30+
### Added
31+
- Added convenience class for showing message boxes and text input dialogs via Win32
32+
- Add more examples in the documentation
33+
34+
### Changed
35+
- N/A
36+
37+
### Deprecated
38+
- N/A
39+
40+
### Removed
41+
- N/A
42+
43+
### Fixed
44+
- N/A
45+
46+
### Security
47+
- N/A
48+
2849
## [26.0.1] - 2025-09-12
2950

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

55-
[Unreleased]: https://github.com/Autodesk/moldflow-api/compare/v26.0.1...HEAD
76+
[Unreleased]: https://github.com/Autodesk/moldflow-api/compare/v26.0.2...HEAD
77+
[26.0.2]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.2
5678
[26.0.1]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.1
5779
[26.0.0]: https://github.com/Autodesk/moldflow-api/releases/tag/v26.0.0
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
MessageBox
2+
==========
3+
4+
Convenience wrapper to display message boxes and a simple
5+
text input dialog from Python scripts using the ``moldflow`` package.
6+
7+
Usage
8+
-----
9+
10+
.. code-block:: python
11+
12+
from moldflow import (
13+
MessageBox,
14+
MessageBoxType,
15+
MessageBoxResult,
16+
MessageBoxOptions,
17+
MessageBoxIcon,
18+
MessageBoxDefaultButton,
19+
MessageBoxModality,
20+
)
21+
22+
# Informational message
23+
MessageBox("Operation completed.", MessageBoxType.INFO).show()
24+
25+
# Confirmation
26+
result = MessageBox("Proceed with analysis?", MessageBoxType.YES_NO).show()
27+
if result == MessageBoxResult.YES:
28+
pass
29+
30+
# Text input
31+
material_id = MessageBox("Enter your material ID:", MessageBoxType.INPUT).show()
32+
if material_id:
33+
pass
34+
35+
# Advanced options
36+
opts = MessageBoxOptions(
37+
icon=MessageBoxIcon.WARNING,
38+
default_button=MessageBoxDefaultButton.BUTTON2,
39+
modality=MessageBoxModality.TASK,
40+
topmost=True,
41+
right_align=False,
42+
rtl_reading=False,
43+
help_button=False,
44+
set_foreground=True,
45+
owner_hwnd=None,
46+
)
47+
result = MessageBox(
48+
"Retry failed operation?",
49+
MessageBoxType.RETRY_CANCEL,
50+
title="Moldflow",
51+
options=opts,
52+
).show()
53+
54+
Convenience methods
55+
-------------------
56+
57+
.. code-block:: python
58+
59+
MessageBox.info("Saved")
60+
MessageBox.warning("Low disk space")
61+
MessageBox.error("Failed to save")
62+
if MessageBox.confirm_yes_no("Proceed?") == MessageBoxResult.YES:
63+
pass
64+
65+
# Prompt text with validation
66+
def is_nonempty(s: str) -> bool:
67+
return bool(s.strip())
68+
69+
value = MessageBox.prompt_text(
70+
"Enter ID:",
71+
default_text="",
72+
placeholder="e.g. MAT-123",
73+
validator=is_nonempty,
74+
)
75+
if value is not None:
76+
pass
77+
78+
Options
79+
-------
80+
81+
.. list-table:: MessageBoxOptions
82+
:header-rows: 1
83+
84+
* - Parameter
85+
- Type
86+
- Description
87+
* - icon
88+
- MessageBoxIcon | None
89+
- Override default icon
90+
* - default_button
91+
- MessageBoxDefaultButton | None
92+
- Set default button (2/3/4). Validated vs type
93+
* - modality
94+
- MessageBoxModality | None
95+
- Application (default), Task-modal, System-modal
96+
* - topmost
97+
- bool
98+
- Keep message box on top (standard MessageBox only)
99+
* - set_foreground
100+
- bool
101+
- Force foreground (standard MessageBox only)
102+
* - right_align / rtl_reading
103+
- bool
104+
- Layout flags for right-to-left locales (standard MessageBox only)
105+
* - help_button
106+
- bool
107+
- Show Help button
108+
* - owner_hwnd
109+
- int | None
110+
- Owner window handle (standard MessageBox only, improves modality/Z-order)
111+
* - default_text / placeholder
112+
- str | None
113+
- Prefill text and cue banner for input dialog
114+
* - is_password
115+
- bool
116+
- Mask input characters
117+
* - char_limit
118+
- int | None
119+
- Maximum characters accepted (client-side)
120+
* - width_dlu / height_dlu
121+
- int | None
122+
- Size the input dialog (pixels; DLUs in legacy template path)
123+
* - validator
124+
- Callable[[str], bool] | None
125+
- Enable OK only when input satisfies predicate
126+
* - font_face / font_size_pt
127+
- str / int
128+
- Font for legacy template; CreateWindowEx path uses system dialog font
129+
130+
API
131+
---
132+
133+
.. automodule:: moldflow.message_box
134+
135+
Notes
136+
-----
137+
138+
- Localization: action button captions (e.g., "OK", "Cancel", "Submit") are localized via the package i18n system. Title and prompt are not localized automatically.
139+
- Return type: ``MessageBox.show()`` returns ``MessageBoxReturn`` (``MessageBoxResult | str | None``).

0 commit comments

Comments
 (0)