import ast from .values import get_variable_name def handle_method_call(analyzer, node: ast.Call): if not isinstance(node.func, ast.Attribute): return method_name = node.func.attr target_var = get_variable_name(node.func.value) if target_var.startswith('self.'): target_var = target_var[5:] if method_name == 'title' and node.args: arg0 = node.args[0] if isinstance(arg0, ast.Constant): analyzer.window_config['title'] = arg0.value elif method_name == 'geometry' and node.args: arg0 = node.args[0] if isinstance(arg0, ast.Constant): geometry = arg0.value else: return if 'x' in str(geometry): try: width, height = str(geometry).split('x') analyzer.window_config['width'] = int(width) analyzer.window_config['height'] = int(height) except ValueError: pass elif method_name == 'place': analyzer.update_widget_placement(target_var, node, 'place') elif method_name == 'grid': analyzer.update_widget_placement(target_var, node, 'grid') elif method_name == 'bind': analyzer.analyze_bind_event(target_var, node) elif method_name == 'config': analyzer.analyze_config_command(target_var, node)