@@ -89,12 +89,6 @@ def get_child_names(self) -> Iterable[str]:
8989 def get_doc_string (self ) -> str :
9090 return self ._menu .get_doc_string (True )
9191
92- def is_extended_tui (self ) -> bool :
93- return self ._menu .is_extended_tui (True )
94-
95- def is_container (self ) -> bool :
96- return self ._menu .is_container (True )
97-
9892
9993class _TUIMenu :
10094 """Class representing Fluent's TUI menu."""
@@ -109,8 +103,6 @@ def __init__(self, path: str):
109103 del _XML_HELPSTRINGS [tui_path ]
110104 self .children = {}
111105 self .is_command = False
112- self .is_extended_tui = False
113- self .is_container = False
114106
115107 def get_command_path (self , command : str ) -> str :
116108 return convert_path_to_grpc_path (self .path + [(command , None )])
@@ -136,61 +128,44 @@ def _populate_menu(self, menu: _TUIMenu):
136128 menugen = _TUIMenuGenerator (menu .path , self ._service )
137129 if not menu .doc :
138130 menu .doc = menugen .get_doc_string ()
139- menu .is_extended_tui = menugen .is_extended_tui ()
140- menu .is_container = menugen .is_container ()
141131 child_names = menugen .get_child_names ()
142132 if child_names :
143133 for child_name in child_names :
144134 if child_name :
145135 child_menu = _TUIMenu (menu .path + [(child_name , None )])
146136 menu .children [child_menu .name ] = child_menu
147137 self ._populate_menu (child_menu )
148- elif not menu . is_extended_tui :
138+ else :
149139 menu .is_command = True
150140
151141 def _write_code_to_tui_file (self , code : str , indent : int = 0 ):
152142 self .__writer .write (" " * _INDENT_STEP * indent + code )
153143
154144 def _write_menu_to_tui_file (self , menu : _TUIMenu , indent : int = 0 ):
155145 self ._write_code_to_tui_file ("\n " )
156- if menu .is_container :
157- self ._write_code_to_tui_file (
158- f"class { menu .name } (metaclass=PyNamedObjectMeta):\n " ,
159- indent ,
160- )
161- else :
162- self ._write_code_to_tui_file (
163- f"class { menu .name } (metaclass=PyMenuMeta):\n " , indent
164- )
146+ self ._write_code_to_tui_file (f"class { menu .name } (TUIMenu):\n " , indent )
165147 indent += 1
166148 self ._write_code_to_tui_file ('"""\n ' , indent )
167149 doc_lines = menu .doc .splitlines ()
168150 for line in doc_lines :
169151 self ._write_code_to_tui_file (f"{ line } \n " , indent )
170152 self ._write_code_to_tui_file ('"""\n ' , indent )
171- if menu .is_extended_tui :
172- self ._write_code_to_tui_file ("is_extended_tui = True\n " , indent )
173153 self ._write_code_to_tui_file (
174154 "def __init__(self, path, service):\n " , indent
175155 )
176156 indent += 1
177157 self ._write_code_to_tui_file ("self.path = path\n " , indent )
178158 self ._write_code_to_tui_file ("self.service = service\n " , indent )
179159 for k , v in menu .children .items ():
180- if v .is_command :
181- continue
182- elif v .is_container :
183- self ._write_code_to_tui_file (
184- f"self.{ k } = self.__class__.{ k } "
185- f'(path + [("{ v .tui_name } ", None)], None, service)\n ' ,
186- indent ,
187- )
188- else :
160+ if not v .is_command :
189161 self ._write_code_to_tui_file (
190162 f"self.{ k } = self.__class__.{ k } "
191163 f'(path + [("{ v .tui_name } ", None)], service)\n ' ,
192164 indent ,
193165 )
166+ self ._write_code_to_tui_file (
167+ "super().__init__(path, service)\n " , indent
168+ )
194169 indent -= 1
195170
196171 command_names = [
@@ -236,10 +211,8 @@ def generate(self) -> None:
236211 "# This is an auto-generated file. DO NOT EDIT!\n "
237212 "#\n "
238213 "# pylint: disable=line-too-long\n \n "
239- "from ansys.fluent.core.meta "
240- "import PyMenuMeta, PyNamedObjectMeta\n "
241214 "from ansys.fluent.core.services.datamodel_tui "
242- "import PyMenu\n \n \n "
215+ "import PyMenu, TUIMenu \n \n \n "
243216 )
244217 self ._main_menu .name = "main_menu"
245218 self ._write_menu_to_tui_file (self ._main_menu )
0 commit comments