Skip to content

Commit

Permalink
improve architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzovecchietti committed Apr 30, 2024
1 parent 10d6606 commit a4dba12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
12 changes: 4 additions & 8 deletions pyaedt/application/Design.py
Original file line number Diff line number Diff line change
Expand Up @@ -4020,14 +4020,10 @@ def set_temporary_directory(self, temp_dir_path):
self.odesktop.SetTempDirectory(temp_dir_path)
return True

@pyaedt_function_handler()
def _manipulate_design_settings_inputs(self, k, v):
return v

@property
def design_settings(self):
"""Design settings for the AEDT app."""
return DesignSettings(self, self._manipulate_design_settings_inputs)
return DesignSettings(self)


class DesignSettings:
Expand All @@ -4039,9 +4035,9 @@ class DesignSettings:
>>> oDesign.GetChildObject("Design Settings")
"""

def __init__(self, app, manipulate_inputs):
def __init__(self, app):
self._app = app
self._manipulate_inputs = manipulate_inputs
self.manipulate_inputs = None
try:
self.design_settings = self._app.odesign.GetChildObject("Design Settings")
except GrpcApiError: # pragma: no cover
Expand All @@ -4062,7 +4058,7 @@ def __repr__(self):

def __setitem__(self, key, value):
if key in self.available_properties:
value = self._manipulate_inputs(key, value)
value = self.manipulate_inputs.execute(key, value)
key_choices = "{}/Choices".format(key)
if key_choices in self.design_settings.GetPropNames():
value_choices = self.design_settings.GetPropValue(key_choices)
Expand Down
6 changes: 4 additions & 2 deletions pyaedt/icepak.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def __init__(
)
self._monitor = Monitor(self)
self._configurations = ConfigurationsIcepak(self)
self.design_settings.manipulate_inputs = IcepakDesignSettingsManipulation()

def _init_from_design(self, *args, **kwargs):
self.__init__(*args, **kwargs)
Expand Down Expand Up @@ -6425,8 +6426,9 @@ def create_square_wave_transient_assignment(self, on_value, initial_time_off, on
"""
return SquareWaveDictionary(on_value, initial_time_off, on_time, off_time, off_value)

@pyaedt_function_handler()
def _manipulate_design_settings_inputs(self, k, v):

class IcepakDesignSettingsManipulation:
def execute(self, k, v):
if k in ["AmbTemp", "AmbRadTemp"]:
if k == "AmbTemp" and isinstance(v, (dict, BoundaryDictionary)):
self.logger.error("Failed. Use `edit_design_settings` function.")
Expand Down

0 comments on commit a4dba12

Please sign in to comment.