Skip to content

FEAT: Add a Message Manager for App#1068

Merged
dipinknair merged 27 commits intomainfrom
fix/add_message
Feb 10, 2025
Merged

FEAT: Add a Message Manager for App#1068
dipinknair merged 27 commits intomainfrom
fix/add_message

Conversation

@dipinknair
Copy link
Collaborator

@dipinknair dipinknair commented Jan 27, 2025

Fixes #440

from ansys.mechanical.core import App
app =App()

# Add a custom message
app.messages.add("info", "User clicked the start button.")

# check number of messages
len(app.messages)
... 1

# returns panda data frame representation
app.messages
... Severity             TimeStamp                   DisplayString Source StringID                                Location RelatedObjects
... 0     INFO  1/30/2025 1:46:14 PM  User clicked the start button.   None     None  Ansys.ACT.Core.Utilities.SelectionInfo             []
# print minimalistic view (severity and message)
app.messages.show()
... Severity: info
... DisplayString: User clicked the start button.

# prints all information including location, time, source etc of all message available
app.messages.show(filter='*")
... TimeStamp: 1/30/2025 1:42:01 PM
... Severity: info
... DisplayString: User clicked the start button.
... Source: None
... StringID: None
... Location: Ansys.ACT.Core.Utilities.SelectionInfo
... RelatedObjects: System.Collections.Generic.List`1[Ansys.Mechanical.DataModel.Interfaces.IDataModelObject]

# gets specific message in datafram row representation
print(app.messages[1].Severity)
... Info

# Remove specific message
app.messages.remove(1)

# Clear all messages
app.messages.clear()

@dipinknair dipinknair marked this pull request as ready for review January 27, 2025 22:26
@dipinknair dipinknair requested a review from a team as a code owner January 27, 2025 22:26
@github-actions github-actions bot added the bug Something isn't working label Jan 27, 2025
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jan 27, 2025
@koubaa

This comment was marked as resolved.

@koubaa
Copy link
Collaborator

koubaa commented Jan 28, 2025

An on/off for complete_info seems inflexible. How about this:

app.messages.show(filter="*") # filter defaults to "severity;message". Accepts a semicolon delimited list of columns or a wildcard.

@dipinknair dipinknair requested a review from koubaa January 30, 2025 19:49
@dipinknair
Copy link
Collaborator Author

An on/off for complete_info seems inflexible. How about this:

app.messages.show(filter="*") # filter defaults to "severity;message". Accepts a semicolon delimited list of columns or a wildcard.

Added this feature and updated the PR descriptions as well

@github-actions github-actions bot added the dependencies Related with project dependencies label Jan 30, 2025
@dipinknair dipinknair requested a review from a team January 30, 2025 19:51
@dipinknair dipinknair self-assigned this Jan 30, 2025
@codecov
Copy link

codecov bot commented Feb 5, 2025

Codecov Report

Attention: Patch coverage is 94.82759% with 3 lines in your changes missing coverage. Please review.

Project coverage is 81.58%. Comparing base (4c5d966) to head (17c3196).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1068      +/-   ##
==========================================
+ Coverage   81.37%   81.58%   +0.20%     
==========================================
  Files          40       41       +1     
  Lines        2755     2813      +58     
==========================================
+ Hits         2242     2295      +53     
- Misses        513      518       +5     

@dipinknair
Copy link
Collaborator Author

@koubaa When app starts there is already a warning message saying license checkout is delayed. This was causing all the tests to fail because how test is written assuming zero message at the beginning.

@dipinknair dipinknair merged commit 6f71d2e into main Feb 10, 2025
61 of 62 checks passed
@dipinknair dipinknair deleted the fix/add_message branch February 10, 2025 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working dependencies Related with project dependencies documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add an API to list messages

3 participants