Can't reference custom widget inside UI file
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- desktop
调研方向
先从 issue 中的 JavaScript 和 Blueprint 复现程序开始,然后将 Blueprint 的行为与报告的 XML 行为进行比较。重新运行示例,并检查 namespace 警告以及不断变化的 MyBin 类型名称;当可以在没有警告的情况下从 UI 文件引用自定义 widget 时,即表示完成。
由索引模型根据 Issue 内容生成。
描述
Problem: I've defined a widget MyBin but using it inside a UI file brings up an error.
JS code
import GObject from "gi://GObject";
import Gtk from "gi://Gtk?version=4.0";
import Adw from "gi://Adw";
Gtk.init();
const MyBin = GObject.registerClass(
{
GTypeName: "MyBin",
},
class MyBin extends Adw.Bin {},
);
const MyBox = GObject.registerClass(
{
GTypeName: "MyBox",
Template: workbench.template,
},
class MyBox extends Gtk.Box {},
);
const b = new MyBox();
workbench.preview(b);
blueprint (but the problem seems to be present even with normal XML. You can translate between the two...).
using Gtk 4.0;
template MyBox : Gtk.Box {
.MyBin {}
}
Error:
(re.sonny.Workbench:4): re.sonny.Workbench-WARNING **: 22:51:26.278: Requiring My, version none: Typelib file for namespace 'My' (any version) not found
Notes:
console.log(MyBin.$gtype.name) outputs MyBin1, MyBin2, ..., MyBin${i}, incrementing every time I click run. The name of the type seems to be changing. Even knowing that, setting in the UI file the type MyBin3 and trying to hit run until MyBin.$gtype.name == 'MyBin3' doesn't fix anything.
- 主要语言
- JavaScript
- 星标
- 846
- 派生
- 91
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
workbenchdev/Workbench 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
workbenchdev/Workbench#1028 · 11 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
workbenchdev/Workbench#1019 ·
-
难度 4/5 3-5 天 新手友好度 30/100
workbenchdev/Workbench#1014 ·
-
难度 4/5 3-5 天 新手友好度 35/100
workbenchdev/Workbench#1007 · 1 条评论 ·
-
How could I work with multiple user interfaces (e.g. multiple .ui files, or multiple blueprints)?未关闭
难度 5/5 一周以上 新手友好度 25/100
workbenchdev/Workbench#1006 · 1 条评论 · 1 个 reaction ·
查看 workbenchdev/Workbench 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 65/100
NaturalIntelligence/fast-xml-parser#888 · 1 条评论 ·
维护者通常 2 天内回复
-
bug callouts regression revealjs
难度 2/5 1-3 小时 新手友好度 72/100
quarto-dev/quarto-cli#15014 ·
维护者通常 1 天内回复
-
check:passed feeds:remove
难度 1/5 1 小时以内 新手友好度 65/100
iptv-org/database#37176 · 1 条评论 · 1 个 reaction ·
维护者通常 9 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
hawk-digital-environments/HAWKI#443 ·
维护者通常 1 天内回复
-
documentation v2
难度 2/5 1-3 小时 新手友好度 82/100
modelcontextprotocol/python-sdk#3662 ·
维护者通常 1 天内回复