-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
25e620e
commit 46f905b
Showing
28 changed files
with
463 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import json | ||
import os | ||
|
||
from pydantic import BaseModel | ||
|
||
from ansys.aedt.toolkits.common.backend.models import CommonProperties | ||
from ansys.aedt.toolkits.common.backend.models import common_properties | ||
|
||
|
||
class BackendProperties(BaseModel): | ||
"""Store toolkit properties.""" | ||
|
||
multiplier: float = 1.0 | ||
geometry: str = "Box" | ||
|
||
|
||
class Properties(BackendProperties, CommonProperties, validate_assignment=True): | ||
"""Store all properties.""" | ||
|
||
|
||
backend_properties = {} | ||
if os.path.expanduser(os.path.join(os.path.dirname(__file__), "backend_properties.json")): | ||
with open(os.path.join(os.path.dirname(__file__), "backend_properties.json")) as file_handler: | ||
backend_properties = json.load(file_handler) | ||
|
||
toolkit_property = {} | ||
if backend_properties: | ||
for backend_key in backend_properties: | ||
if hasattr(common_properties, backend_key): | ||
setattr(common_properties, backend_key, backend_properties[backend_key]) | ||
else: | ||
toolkit_property[backend_key] = backend_properties[backend_key] | ||
|
||
new_common_properties = {} | ||
for common_key in common_properties: | ||
new_common_properties[common_key[0]] = common_key[1] | ||
|
||
properties = Properties(**toolkit_property, **new_common_properties) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import json | ||
import os | ||
from typing import List | ||
|
||
from pydantic import BaseModel | ||
from pydantic import Field | ||
|
||
from ansys.aedt.toolkits.common.ui.models import UIProperties | ||
from ansys.aedt.toolkits.common.ui.models import general_settings | ||
|
||
|
||
class FrontendProperties(BaseModel): | ||
"""Store toolkit properties.""" | ||
|
||
primitives_created: List[str] = Field(default_factory=list) | ||
|
||
|
||
class Properties(FrontendProperties, UIProperties, validate_assignment=True): | ||
"""Store all properties.""" | ||
|
||
|
||
backend_properties = {} | ||
if os.path.exists(os.path.join(os.path.dirname(__file__), "frontend_properties.json")): | ||
with open(os.path.join(os.path.dirname(__file__), "frontend_properties.json")) as file_handler: | ||
backend_properties = json.load(file_handler) | ||
|
||
toolkit_property = {} | ||
if backend_properties: | ||
for backend_key in backend_properties: | ||
if hasattr(general_settings, backend_key): | ||
setattr(general_settings, backend_key, backend_properties[backend_key]) | ||
else: | ||
toolkit_property[backend_key] = backend_properties[backend_key] | ||
|
||
new_common_properties = {} | ||
for common_key in general_settings: | ||
new_common_properties[common_key[0]] = common_key[1] | ||
|
||
properties = Properties(**toolkit_property, **new_common_properties) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.