Philipp Hörist pushed to branch gtk4 at gajim / gajim
Commits:
f434cb7f by Philipp Hörist at 2024-10-20T09:00:14+02:00
cfix: Fix generate ui types
- - - - -
2 changed files:
- gajim/gtk/builder.pyi
- scripts/generate_ui_types.py
Changes:
=====================================
gajim/gtk/builder.pyi
=====================================
@@ -971,7 +971,6 @@ class StartChatDialogBuilder(Builder):
filter_bar_revealer: Gtk.Revealer
list_stack: Gtk.Stack
contact_scrolled: Gtk.ScrolledWindow
- listbox: Gtk.ListBox
global_scrolled: Gtk.ScrolledWindow
spinner: Gtk.Spinner
error_label: Gtk.Label
=====================================
scripts/generate_ui_types.py
=====================================
@@ -49,6 +49,10 @@ def get_builder(file_name: Literal['%s'], instance: Any =
None, widgets: list[st
def get_builder(file_name: str, instance: Any = None, widgets: list[str] =
...) -> Builder: ...'''
+class InvalidFile(Exception):
+ pass
+
+
def make_class_name(path: Path) -> str:
name = path.name.removesuffix('.ui')
names = name.split('_')
@@ -60,6 +64,9 @@ def parse(path: Path, file: TextIOWrapper) -> str:
log.info('Read %s', path)
lines: list[str] = []
tree = ElementTree.parse(path)
+ if tree.find('template'):
+ raise InvalidFile
+
for node in tree.iter(tag='object'):
id_ = node.attrib.get('id')
if id_ is None:
@@ -96,7 +103,12 @@ def parse(path: Path, file: TextIOWrapper) -> str:
if path.name.startswith('#'):
continue
- name = parse(path, file)
+
+ try:
+ name = parse(path, file)
+ except InvalidFile:
+ continue
+
builder_names.append((name, path.name))
for name, file_name in builder_names:
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f434cb7fa104cc8228fc27fb17840094c6096f35
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/f434cb7fa104cc8228fc27fb17840094c6096f35
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]