Add GtkComboBoxText items

This commit is contained in:
James Westman 2021-11-12 18:40:26 -06:00
parent f1e1811e1f
commit aa447466c0
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6
12 changed files with 137 additions and 17 deletions

View file

@ -40,9 +40,16 @@ def applies_to(*ast_types):
return func
return decorator
def completer(applies_in: T.List, matches: T.List=[]):
def completer(applies_in: T.List, matches: T.List=[], applies_in_subclass=None):
def decorator(func):
def inner(prev_tokens: T.List[Token], ast_node: ast.AstNode):
# For completers that apply in ObjectContent nodes, we can further
# check that the object is the right class
if applies_in_subclass is not None:
type = ast_node.root.gir.get_type(applies_in_subclass[1], applies_in_subclass[0])
if ast_node.gir_class and not ast_node.gir_class.assignable_to(type):
return
any_match = len(matches) == 0
match_variables: T.List[str] = []