diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-06 16:19:19 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-07 08:14:42 +0200 |
commit | 3d056824c687df567c05bf31554fa40ea2baef18 (patch) | |
tree | 45b9617119cc57542f441de6f4d9eaf20f5041ef | |
parent | a927e0964ba0442d53fffb22c577e54bcf183ed7 (diff) |
Revert "lint-ui: check that we only have one has_default==True"
This reverts commit c9e3952e76a9c06d5a1d2f583829ce9eb5b9df64.
Reason for revert: Some of the code manipulates visibility programmatically, and it is quite fine to has more than one has_default if only one of them is visible at a time.
Change-Id: Ia4f565c7d21d232d3038c3489952782c8e2a7be5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103977
Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
23 files changed, 29 insertions, 10 deletions
diff --git a/bin/lint-ui.py b/bin/lint-ui.py index c3344c3a3b51..124e1bf58316 100755 --- a/bin/lint-ui.py +++ b/bin/lint-ui.py @@ -76,23 +76,16 @@ def check_top_level_widget(element): # lint_assert(border_width.text == BORDER_WIDTH, # "Top level 'border_width' property should be " + BORDER_WIDTH, border_width) - # check that - # (*) any widget which has 'has-default' also has 'can-default' - # (*) we have at most one has-default widget - # 'has-default' means that when ENTER is pressed, this widget is triggered, normally the OK button - has_default_count = 0 + # check that any widget which has 'has-default' also has 'can-default' for widget in element.findall('.//object'): if not widget.attrib['class']: continue - child_widget_type = widget.attrib['class'] + widget_type = widget.attrib['class'] has_defaults = widget.findall("./property[@name='has_default']") if len(has_defaults) > 0 and has_defaults[0].text == "True": - has_default_count += 1 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 " + child_widget_type + " with id = '" + widget.attrib['id'] + "'", widget) - lint_assert(has_default_count <= 1, - "more than one child with has_default=='True' in top-level widget " + widget_type, element) + "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']") diff --git a/cui/uiconfig/ui/certdialog.ui b/cui/uiconfig/ui/certdialog.ui index 0794e6278c4b..39d84c5df216 100644 --- a/cui/uiconfig/ui/certdialog.ui +++ b/cui/uiconfig/ui/certdialog.ui @@ -41,6 +41,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_underline">True</property> <child internal-child="accessible"> diff --git a/cui/uiconfig/ui/macroselectordialog.ui b/cui/uiconfig/ui/macroselectordialog.ui index d9757531fd3e..ea485c283a37 100644 --- a/cui/uiconfig/ui/macroselectordialog.ui +++ b/cui/uiconfig/ui/macroselectordialog.ui @@ -42,6 +42,7 @@ <property name="label" translatable="yes" context="macroselectordialog|add">Add</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="no_show_all">True</property> </object> diff --git a/cui/uiconfig/ui/specialcharacters.ui b/cui/uiconfig/ui/specialcharacters.ui index 684031a9fe53..9e8e5323828c 100644 --- a/cui/uiconfig/ui/specialcharacters.ui +++ b/cui/uiconfig/ui/specialcharacters.ui @@ -24,6 +24,7 @@ <property name="label" translatable="yes" context="specialcharacters|insert">_Insert</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_underline">True</property> </object> diff --git a/cui/uiconfig/ui/tsaurldialog.ui b/cui/uiconfig/ui/tsaurldialog.ui index 6bcceb4bfeeb..3d005f3faa22 100644 --- a/cui/uiconfig/ui/tsaurldialog.ui +++ b/cui/uiconfig/ui/tsaurldialog.ui @@ -51,6 +51,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_underline">True</property> <property name="use_stock">True</property> @@ -67,6 +68,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_underline">True</property> </object> diff --git a/dbaccess/uiconfig/ui/collectionviewdialog.ui b/dbaccess/uiconfig/ui/collectionviewdialog.ui index 73302a721fe9..0ffb48584773 100644 --- a/dbaccess/uiconfig/ui/collectionviewdialog.ui +++ b/dbaccess/uiconfig/ui/collectionviewdialog.ui @@ -66,6 +66,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -134,6 +135,7 @@ <property name="can_focus">True</property> <property name="focus_on_click">False</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="collectionviewdialog|newFolderButton|tooltip_text">Create New Directory</property> <property name="image">image1</property> @@ -150,6 +152,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="tooltip_text" translatable="yes" context="collectionviewdialog|upButton|tooltip_text">Up One Level</property> <property name="image">image2</property> diff --git a/fpicker/uiconfig/ui/remotefilesdialog.ui b/fpicker/uiconfig/ui/remotefilesdialog.ui index c2c8ef330194..e721340710e6 100644 --- a/fpicker/uiconfig/ui/remotefilesdialog.ui +++ b/fpicker/uiconfig/ui/remotefilesdialog.ui @@ -157,6 +157,7 @@ <property name="label">gtk-save</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/analysisofvariancedialog.ui b/sc/uiconfig/scalc/ui/analysisofvariancedialog.ui index 314dc2e78060..ee263c911ad0 100644 --- a/sc/uiconfig/scalc/ui/analysisofvariancedialog.ui +++ b/sc/uiconfig/scalc/ui/analysisofvariancedialog.ui @@ -48,6 +48,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/chisquaretestdialog.ui b/sc/uiconfig/scalc/ui/chisquaretestdialog.ui index 00091703893f..ea334c67fe6c 100644 --- a/sc/uiconfig/scalc/ui/chisquaretestdialog.ui +++ b/sc/uiconfig/scalc/ui/chisquaretestdialog.ui @@ -41,6 +41,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/correlationdialog.ui b/sc/uiconfig/scalc/ui/correlationdialog.ui index 0bb9e8a9dd8d..83032f964929 100644 --- a/sc/uiconfig/scalc/ui/correlationdialog.ui +++ b/sc/uiconfig/scalc/ui/correlationdialog.ui @@ -41,6 +41,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/covariancedialog.ui b/sc/uiconfig/scalc/ui/covariancedialog.ui index 4bd5e8071fcd..28fc81770450 100644 --- a/sc/uiconfig/scalc/ui/covariancedialog.ui +++ b/sc/uiconfig/scalc/ui/covariancedialog.ui @@ -41,6 +41,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/descriptivestatisticsdialog.ui b/sc/uiconfig/scalc/ui/descriptivestatisticsdialog.ui index 12e96f98b6a5..5f3975b57020 100644 --- a/sc/uiconfig/scalc/ui/descriptivestatisticsdialog.ui +++ b/sc/uiconfig/scalc/ui/descriptivestatisticsdialog.ui @@ -41,6 +41,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/exponentialsmoothingdialog.ui b/sc/uiconfig/scalc/ui/exponentialsmoothingdialog.ui index 1d2d82ba0547..d10bac1fb7ad 100644 --- a/sc/uiconfig/scalc/ui/exponentialsmoothingdialog.ui +++ b/sc/uiconfig/scalc/ui/exponentialsmoothingdialog.ui @@ -47,6 +47,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/fourieranalysisdialog.ui b/sc/uiconfig/scalc/ui/fourieranalysisdialog.ui index 4d6fc8dbe490..7401b7d6b388 100644 --- a/sc/uiconfig/scalc/ui/fourieranalysisdialog.ui +++ b/sc/uiconfig/scalc/ui/fourieranalysisdialog.ui @@ -48,6 +48,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/movingaveragedialog.ui b/sc/uiconfig/scalc/ui/movingaveragedialog.ui index 797a5fcacdd8..9fddb83520bd 100644 --- a/sc/uiconfig/scalc/ui/movingaveragedialog.ui +++ b/sc/uiconfig/scalc/ui/movingaveragedialog.ui @@ -48,6 +48,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/randomnumbergenerator.ui b/sc/uiconfig/scalc/ui/randomnumbergenerator.ui index f108a8baa05b..098725594fee 100644 --- a/sc/uiconfig/scalc/ui/randomnumbergenerator.ui +++ b/sc/uiconfig/scalc/ui/randomnumbergenerator.ui @@ -48,6 +48,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -79,6 +80,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/regressiondialog.ui b/sc/uiconfig/scalc/ui/regressiondialog.ui index 4dc08afc4cd4..474044b27549 100644 --- a/sc/uiconfig/scalc/ui/regressiondialog.ui +++ b/sc/uiconfig/scalc/ui/regressiondialog.ui @@ -46,6 +46,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/samplingdialog.ui b/sc/uiconfig/scalc/ui/samplingdialog.ui index db1ce5b4e8e9..1c81619cd41f 100644 --- a/sc/uiconfig/scalc/ui/samplingdialog.ui +++ b/sc/uiconfig/scalc/ui/samplingdialog.ui @@ -53,6 +53,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/ttestdialog.ui b/sc/uiconfig/scalc/ui/ttestdialog.ui index fcf4192ea555..f00421866eb9 100644 --- a/sc/uiconfig/scalc/ui/ttestdialog.ui +++ b/sc/uiconfig/scalc/ui/ttestdialog.ui @@ -39,6 +39,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sc/uiconfig/scalc/ui/ztestdialog.ui b/sc/uiconfig/scalc/ui/ztestdialog.ui index 0106f1700de4..d9009414c965 100644 --- a/sc/uiconfig/scalc/ui/ztestdialog.ui +++ b/sc/uiconfig/scalc/ui/ztestdialog.ui @@ -39,6 +39,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sfx2/uiconfig/ui/versioncommentdialog.ui b/sfx2/uiconfig/ui/versioncommentdialog.ui index 46ca82b19f2f..2c74db6c5ec4 100644 --- a/sfx2/uiconfig/ui/versioncommentdialog.ui +++ b/sfx2/uiconfig/ui/versioncommentdialog.ui @@ -42,6 +42,7 @@ <property name="visible">True</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> diff --git a/sw/uiconfig/swriter/ui/bibliographyentry.ui b/sw/uiconfig/swriter/ui/bibliographyentry.ui index 88ec49871559..165e8aa74f0c 100644 --- a/sw/uiconfig/swriter/ui/bibliographyentry.ui +++ b/sw/uiconfig/swriter/ui/bibliographyentry.ui @@ -112,6 +112,7 @@ <property name="label" translatable="yes" context="bibliographyentry|modify">Apply</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="no_show_all">True</property> </object> diff --git a/sw/uiconfig/swriter/ui/indexentry.ui b/sw/uiconfig/swriter/ui/indexentry.ui index dd7d118f36ab..931792bf62e3 100644 --- a/sw/uiconfig/swriter/ui/indexentry.ui +++ b/sw/uiconfig/swriter/ui/indexentry.ui @@ -92,6 +92,7 @@ <property name="label" translatable="yes" context="indexentry|insert">Insert</property> <property name="can_focus">True</property> <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="no_show_all">True</property> </object> |