Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Can't reference custom widget inside UI file

オープン
#267 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
javascript
領域
desktop

調査の方向性

Issue にある JavaScript と Blueprint の再現例から始め、Blueprint の動作を報告されている XML の動作と比較します。例を再実行し、namespace の警告と変化する MyBin 型名を調べます。カスタムウィジェットを警告なしで UI ファイルから参照できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug

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 はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

workbenchdev/Workbench のほかの issue

workbenchdev/Workbench の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。