[Libreoffice-commits] core.git: bin/ui-rules-enforcer.py vcl/qa

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Thu Sep 23 07:56:08 UTC 2021


 bin/ui-rules-enforcer.py       |   40 ++++++++++++++++++++++++++++++++++++++++
 vcl/qa/cppunit/builder/demo.ui |   16 ++++++++++++++++
 2 files changed, 56 insertions(+)

New commits:
commit 9f8ec7fb5751e3e120d0e09466b006085cea13fe
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Wed Sep 22 20:54:26 2021 +0200
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Sep 23 09:55:34 2021 +0200

    Related tdf#144618: add check in bin/ui-rules-enforcer.py
    
    + fix vcl/qa/cppunit/builder/demo.ui
    
    Change-Id: I556cf99687f138e2d9667dc742dd44cafe7b1a02
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/122488
    Tested-by: Jenkins
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/bin/ui-rules-enforcer.py b/bin/ui-rules-enforcer.py
index ef73541958c8..1a7c814eb52a 100755
--- a/bin/ui-rules-enforcer.py
+++ b/bin/ui-rules-enforcer.py
@@ -388,6 +388,44 @@ def enforce_active_in_group_consistency(current):
       active.text = "True"
       current.insert(insertpos, active)
 
+def enforce_entry_text_column_id_column_for_gtkcombobox(current):
+  entrytextcolumn = None
+  idcolumn = None
+  isgtkcombobox = current.get('class') == "GtkComboBox"
+  insertpos = 0
+  for child in current:
+    enforce_entry_text_column_id_column_for_gtkcombobox(child)
+    if not isgtkcombobox:
+        continue
+    if child.tag == "property":
+      insertpos = insertpos + 1;
+      attributes = child.attrib
+      if attributes.get("name") == "entry_text_column":
+        entrytextcolumn = child
+      if attributes.get("name") == "id_column":
+        idcolumn = child
+
+  if isgtkcombobox:
+    if entrytextcolumn != None and entrytextcolumn.text != "0":
+      raise Exception(sys.argv[1] + ': non-standard entry_text_column value', entrytextcolumn.text)
+    if idcolumn != None and idcolumn.text != "1":
+      raise Exception(sys.argv[1] + ': non-standard id_column value', idcolumn.text)
+    if entrytextcolumn == None:
+      # if there is no entry_text_column, create one
+      entrytextcolumn = etree.Element("property")
+      attributes = entrytextcolumn.attrib
+      attributes["name"] = "entry_text_column"
+      entrytextcolumn.text = "0"
+      current.insert(insertpos, entrytextcolumn)
+      insertpos = insertpos + 1;
+    if idcolumn == None:
+      # if there is no id_column, create one
+      idcolumn = etree.Element("property")
+      attributes = idcolumn.attrib
+      attributes["name"] = "id_column"
+      idcolumn.text = "1"
+      current.insert(insertpos, idcolumn)
+
 with open(sys.argv[1], encoding="utf-8") as f:
   header = f.readline()
   f.seek(0)
@@ -417,9 +455,11 @@ remove_expander_label_fill(root)
 remove_expander_spacing(root)
 enforce_menubutton_indicator_consistency(root)
 enforce_active_in_group_consistency(root)
+enforce_entry_text_column_id_column_for_gtkcombobox(root)
 remove_double_buffered(root)
 remove_skip_pager_hint(root)
 
+
 with open(sys.argv[1], 'wb') as o:
   # without encoding='unicode' (and the matching encode("utf8")) we get &#XXXX replacements for non-ascii characters
   # which we don't want to see changed in the output
diff --git a/vcl/qa/cppunit/builder/demo.ui b/vcl/qa/cppunit/builder/demo.ui
index 5638a7dc4294..28d6fddb9e5a 100644
--- a/vcl/qa/cppunit/builder/demo.ui
+++ b/vcl/qa/cppunit/builder/demo.ui
@@ -199,6 +199,8 @@
                       <object class="GtkComboBox" id="combobox1">
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
+                        <property name="entry_text_column">0</property>
+                        <property name="id_column">1</property>
                       </object>
                       <packing>
                         <property name="expand">True</property>
@@ -733,6 +735,8 @@
                           <object class="GtkComboBox" id="LB_PAGE_PROPERTIES">
                             <property name="visible">True</property>
                             <property name="can-focus">False</property>
+                            <property name="entry_text_column">0</property>
+                            <property name="id_column">1</property>
                           </object>
                           <packing>
                             <property name="expand">True</property>
@@ -864,6 +868,8 @@
                         <property name="visible">True</property>
                         <property name="can-focus">False</property>
                         <property name="model">liststore1</property>
+                        <property name="entry_text_column">0</property>
+                        <property name="id_column">1</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -1299,6 +1305,8 @@
                                   <object class="GtkComboBox" id="combobox2">
                                     <property name="visible">True</property>
                                     <property name="can-focus">False</property>
+                                    <property name="entry_text_column">0</property>
+                                    <property name="id_column">1</property>
                                   </object>
                                   <packing>
                                     <property name="left-attach">0</property>
@@ -1362,6 +1370,8 @@
                                   <object class="GtkComboBox" id="combobox3">
                                     <property name="visible">True</property>
                                     <property name="can-focus">False</property>
+                                    <property name="entry_text_column">0</property>
+                                    <property name="id_column">1</property>
                                   </object>
                                   <packing>
                                     <property name="left-attach">1</property>
@@ -1372,6 +1382,8 @@
                                   <object class="GtkComboBox" id="combobox4">
                                     <property name="visible">True</property>
                                     <property name="can-focus">False</property>
+                                    <property name="entry_text_column">0</property>
+                                    <property name="id_column">1</property>
                                   </object>
                                   <packing>
                                     <property name="left-attach">1</property>
@@ -1628,6 +1640,8 @@
                           <object class="GtkComboBox" id="combobox5">
                             <property name="visible">True</property>
                             <property name="can-focus">False</property>
+                            <property name="entry_text_column">0</property>
+                            <property name="id_column">1</property>
                           </object>
                           <packing>
                             <property name="left-attach">1</property>
@@ -1684,6 +1698,8 @@
                           <object class="GtkComboBox" id="combobox6">
                             <property name="visible">True</property>
                             <property name="can-focus">False</property>
+                            <property name="entry_text_column">0</property>
+                            <property name="id_column">1</property>
                           </object>
                           <packing>
                             <property name="left-attach">1</property>


More information about the Libreoffice-commits mailing list