[Libreoffice-commits] core.git: Branch 'libreoffice-7-0' - bin/lint-ui.py uui/uiconfig writerperfect/uiconfig

Noel (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 6 07:14:48 UTC 2020


 bin/lint-ui.py                                  |   12 +++++++++++-
 uui/uiconfig/ui/simplenameclash.ui              |    1 +
 writerperfect/uiconfig/ui/wpftencodingdialog.ui |    1 +
 3 files changed, 13 insertions(+), 1 deletion(-)

New commits:
commit d471c802e8a3a4299e122cc05900bdab6ed67a00
Author:     Noel <noelgrandin at gmail.com>
AuthorDate: Fri Oct 2 13:22:04 2020 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Oct 6 09:14:12 2020 +0200

    lint-ui: validate has_default and can_default
    
    check that if a widget has has_default=='True', then it also
    has can_default=='True'
    
    Change-Id: Ie51d9d8fff6d7cc0cc42a09331f59e7ef6d559be
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103834
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Jenkins
    (cherry picked from commit 68961653f9af29b332039e50459e29d33c623013)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103989

diff --git a/bin/lint-ui.py b/bin/lint-ui.py
index 91c68bb0af60..d9d0784dfb7b 100755
--- a/bin/lint-ui.py
+++ b/bin/lint-ui.py
@@ -49,6 +49,17 @@ def check_top_level_widget(element):
             lint_assert(border_width.text == BORDER_WIDTH,
                         "Top level 'border_width' property should be " + BORDER_WIDTH)
 
+    # check that any widget which has 'has-default' also has 'can-default'
+    for widget in element.findall('.//object'):
+        if not widget.attrib['class']:
+            continue
+        widget_type = widget.attrib['class']
+        has_defaults = widget.findall("./property[@name='has_default']")
+        if len(has_defaults) > 0 and has_defaults[0].text == "True":
+            can_defaults = widget.findall("./property[@name='can_default']")
+            lint_assert(len(can_defaults)>0 and can_defaults[0].text == "True",
+                "has_default without can_default in " + widget_type + " with id = '" + widget.attrib['id'] + "'", widget)
+
 def check_button_box_spacing(element):
     spacing = element.findall("property[@name='spacing']")[0]
     lint_assert(spacing.text == BUTTON_BOX_SPACING,
@@ -75,7 +86,6 @@ def check_check_buttons(root):
         if len(radio_underlines) < 1:
             lint_assert(False, "No use_underline in GtkCheckButton with id = '" + radio.attrib['id'] + "'")
 
-
 def check_frames(root):
     frames = [element for element in root.findall('.//object') if element.attrib['class'] == 'GtkFrame']
     for frame in frames:
diff --git a/uui/uiconfig/ui/simplenameclash.ui b/uui/uiconfig/ui/simplenameclash.ui
index 9c5f39213e0c..04d0bb16ef8f 100644
--- a/uui/uiconfig/ui/simplenameclash.ui
+++ b/uui/uiconfig/ui/simplenameclash.ui
@@ -56,6 +56,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="has_default">True</property>
+                <property name="can_default">True</property>
                 <property name="receives_default">True</property>
               </object>
               <packing>
diff --git a/writerperfect/uiconfig/ui/wpftencodingdialog.ui b/writerperfect/uiconfig/ui/wpftencodingdialog.ui
index 067cfb72bad3..d0aff9435ac2 100644
--- a/writerperfect/uiconfig/ui/wpftencodingdialog.ui
+++ b/writerperfect/uiconfig/ui/wpftencodingdialog.ui
@@ -28,6 +28,7 @@
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="has_default">True</property>
+                <property name="can_default">True</property>
                 <property name="receives_default">True</property>
                 <property name="use_stock">True</property>
                 <property name="yalign">0.62000000476837158</property>


More information about the Libreoffice-commits mailing list