Compare commits

..

1 commit

Author SHA1 Message Date
Matthijs Velsink
5b0efb325c docs: Small improvements for extensions
- Add Gtk.Scale mark example
- Add ExtScaleMarks to the index
- Keep the index alphabetically sorted
- Use the same order in the text
2025-06-13 01:51:42 +02:00
11 changed files with 10 additions and 35 deletions

View file

@ -21,15 +21,12 @@
from .binding import Binding
from .common import *
from .contexts import ValueTypeCtx
from .gtk_menu import menu
from .values import ArrayValue, ExprValue, ObjectValue, Value
class Property(AstNode):
grammar = Statement(
UseIdent("name"),
":",
AnyOf(Binding, ExprValue, menu, ObjectValue, Value, ArrayValue),
UseIdent("name"), ":", AnyOf(Binding, ExprValue, ObjectValue, Value, ArrayValue)
)
@property

View file

@ -60,6 +60,11 @@ class Menu(AstNode):
def items(self) -> T.List[T.Union["Menu", "MenuAttribute"]]:
return self.children
@validate("menu")
def has_id(self):
if self.tokens["tag"] == "menu" and self.tokens["id"] is None:
raise CompileError("Menu requires an ID")
@validate("id")
def object_id_not_reserved(self):
if self.id in RESERVED_IDS:

View file

@ -139,11 +139,6 @@ class XmlOutput(OutputFormat):
self._emit_expression(value.expression, xml)
xml.end_tag()
elif isinstance(value, Menu):
xml.start_tag("property", **props)
self._emit_menu(value, xml)
xml.end_tag()
elif isinstance(value, ObjectValue):
xml.start_tag("property", **props)
self._emit_object(value.object, xml)

View file

@ -58,7 +58,7 @@ Properties
.. rst-class:: grammar-block
Property = <name::ref:`IDENT<Syntax IDENT>`> ':' ( :ref:`Binding<Syntax Binding>` | :ref:`ExprValue<Syntax ExprValue>` | :ref:`Menu<Syntax Menu>` | :ref:`ObjectValue<Syntax ObjectValue>` | :ref:`Value<Syntax Value>` ) ';'
Property = <name::ref:`IDENT<Syntax IDENT>`> ':' ( :ref:`Binding<Syntax Binding>` | :ref:`ExprValue<Syntax ExprValue>` | :ref:`ObjectValue<Syntax ObjectValue>` | :ref:`Value<Syntax Value>` ) ';'
Properties specify the details of each object, like a label's text, an image's icon name, or the margins on a container.

View file

@ -1,5 +1,5 @@
project('blueprint-compiler',
version: '0.17.0',
version: '0.16.0',
)
prefix = get_option('prefix')

View file

@ -0,0 +1 @@
4,15,4,Namespace Gtk does not contain a type called menu

View file

@ -0,0 +1 @@
3,1,4,Menu requires an ID

View file

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT EDIT!
This file was @generated by blueprint-compiler. Instead, edit the
corresponding .blp file and regenerate this file with blueprint-compiler.
-->
<interface>
<requires lib="gtk" version="4.0"/>
<object class="GtkMenuButton">
<property name="menu-model">
<menu id="primary_menu"></menu>
</property>
</object>
</interface>

View file

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
DO NOT EDIT!
This file was @generated by blueprint-compiler. Instead, edit the
corresponding .blp file and regenerate this file with blueprint-compiler.
-->
<interface>
<requires lib="gtk" version="4.0"/>
<menu></menu>
</interface>