Files
RoboMovel/simulacao/robo-movel-godot/addons/claude_godot/ui/model_picker.gd
T
mguinhosandClaude Opus 5.5 393019705c Projeto: app demo, servidor/firmware em software/, simulacao Godot, planta do bloco D, chapas MDF da base, renders e slides
- app/: app demo (Kivy/buildozer) da API do robo
- software/: servidor RoboMovel (SLAM, profundidade, navegacao) e firmware da base movel (movido de firmware/)
- simulacao/: projeto Godot do robo e script de lancamento servidor + simulacao
- modelos/: planta do 5o andar do bloco D, cena Blender do corredor e modelo real do robo
- partes/mdf/: chapas identificadas e nesting da base do robo (DXF/SVG/FCStd)
- projeto/render, relatorio/imagens, slides: renders finais e apresentacoes de progresso
- ferramentas/scripts: encaixe de chapas, planta do bloco D e render do corredor no Blender
- .gitignore: ignora backups do Blender/FreeCAD e .godot/

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 23:38:16 -03:00

78 lines
2.1 KiB
GDScript

## A LineEdit with a filtered inline suggestion list below it — a searchable
## dropdown. Free text is always allowed (for one-off / self-hosted model
## names); the list is just a convenience for known models per provider.
@tool
class_name ClaudeGodotModelPicker
extends VBoxContainer
signal model_changed(model_name: String)
var _line: LineEdit
var _list: ItemList
var _all_models: Array = []
var _suppress_text_signal := false
func _ready() -> void:
_line = LineEdit.new()
_line.placeholder_text = "Model (type to search)"
_line.text_changed.connect(_on_text_changed)
_line.focus_entered.connect(_on_focus_entered)
_line.focus_exited.connect(_on_focus_exited)
add_child(_line)
_list = ItemList.new()
_list.custom_minimum_size = Vector2(0, 120)
_list.focus_mode = Control.FOCUS_ALL
_list.visible = false
_list.item_selected.connect(_on_item_selected)
add_child(_list)
## Replaces the known-model list for the active provider and sets the current text.
func set_models(models: Array, current: String) -> void:
_all_models = models.duplicate()
_suppress_text_signal = true
_line.text = current
_suppress_text_signal = false
_hide_list()
func get_model() -> String:
return _line.text
func set_model(text: String) -> void:
_suppress_text_signal = true
_line.text = text
_suppress_text_signal = false
_hide_list()
func _on_focus_entered() -> void:
_refresh_list(_line.text)
func _on_focus_exited() -> void:
await get_tree().process_frame
var focused := get_viewport().gui_get_focus_owner()
if focused != _list:
_hide_list()
func _on_text_changed(new_text: String) -> void:
if _suppress_text_signal:
return
model_changed.emit(new_text)
_refresh_list(new_text)
func _refresh_list(filter_text: String) -> void:
_list.clear()
var needle := filter_text.to_lower()
for m in _all_models:
if needle == "" or m.to_lower().find(needle) != -1:
_list.add_item(m)
_list.visible = _list.item_count > 0
func _on_item_selected(index: int) -> void:
var model_name := _list.get_item_text(index)
set_model(model_name)
model_changed.emit(model_name)
_line.grab_focus()
func _hide_list() -> void:
_list.visible = false