From cc1ef0b3dc1449242c23e3c3299c2f7bb803821d Mon Sep 17 00:00:00 2001 From: Noel Date: Wed, 7 Oct 2020 12:47:04 +0200 Subject: lint-ui: remove checks for top-level widgets lots of .ui files are loaded, and then widgets extracted by name by the code, so this check does not make sense. Change-Id: Ia8292c5808587d98f0015280ad17b00402c8b96d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104056 Tested-by: Jenkins Reviewed-by: Noel Grandin --- bin/lint-ui.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'bin/lint-ui.py') diff --git a/bin/lint-ui.py b/bin/lint-ui.py index 16feed37e678..0518bd5a7da4 100755 --- a/bin/lint-ui.py +++ b/bin/lint-ui.py @@ -59,8 +59,8 @@ def lint_assert(predicate, warning=DEFAULT_WARNING_STR, node=None): def check_top_level_widget(element): # check widget type widget_type = element.attrib['class'] - lint_assert(widget_type in POSSIBLE_TOP_LEVEL_WIDGETS, - "Top level widget should be 'GtkDialog', 'GtkFrame', 'GtkBox', or 'GtkGrid', but is " + widget_type) + if not(widget_type in POSSIBLE_TOP_LEVEL_WIDGETS): + return # check border_width property border_width_properties = element.findall("property[@name='border_width']") @@ -204,15 +204,12 @@ def main(): lint_assert('domain' in root.attrib, "interface needs to specify translation domain") top_level_widgets = [element for element in root.findall('object') if element.attrib['class'] not in IGNORED_TOP_LEVEL_WIDGETS] - lint_assert( len(top_level_widgets) <= 1, "should be only one top-level widget for us to analyze, found " + str(len(top_level_widgets))) - if len(top_level_widgets) > 1: - return # eg. one file contains only a Menu, which we don't check if len(top_level_widgets) == 0: return - top_level_widget = top_level_widgets[0] - check_top_level_widget(top_level_widget) + for top_level_widget in top_level_widgets: + check_top_level_widget(top_level_widget) # TODO - only do this if we have a GtkDialog? # check button box spacing -- cgit