summaryrefslogtreecommitdiff
path: root/bin/lint-ui.py
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-07 12:47:04 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-07 18:42:44 +0200
commitcc1ef0b3dc1449242c23e3c3299c2f7bb803821d (patch)
treef28f08490f68b3dc2b4fb28236c2a12f93777eaa /bin/lint-ui.py
parent242e90f16bc23eb85941b0bf13c5350375ce3837 (diff)
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 <noel.grandin@collabora.co.uk>
Diffstat (limited to 'bin/lint-ui.py')
-rwxr-xr-xbin/lint-ui.py11
1 files changed, 4 insertions, 7 deletions
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