[Libreoffice-commits] core.git: 2 commits - bin/lint-ui.py cui/uiconfig sw/uiconfig
Caolán McNamara
caolanm at redhat.com
Thu Aug 8 00:49:56 PDT 2013
bin/lint-ui.py | 25 +++++++++++++++++----
cui/uiconfig/ui/querychangelineenddialog.ui | 2 -
cui/uiconfig/ui/queryduplicatedialog.ui | 4 +--
sw/uiconfig/swriter/ui/querydefaultcompatdialog.ui | 4 +--
sw/uiconfig/swriter/ui/querysavelabeldialog.ui | 4 +--
5 files changed, 28 insertions(+), 11 deletions(-)
New commits:
commit 07e1a8a5c68643d43fe729e623dca9e876f2772e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Aug 7 20:34:22 2013 +0100
update lint-ui to know about message box HIG rules
Change-Id: Ic283d4d15154308a441905d095096c3e11f50477
diff --git a/bin/lint-ui.py b/bin/lint-ui.py
index 0c8a9ac..cef326c 100755
--- a/bin/lint-ui.py
+++ b/bin/lint-ui.py
@@ -14,11 +14,14 @@ import xml.etree.ElementTree as ET
DEFAULT_WARNING_STR = 'Lint assertion failed'
-POSSIBLE_TOP_LEVEL_WIDGETS = ['GtkDialog', 'GtkBox', 'GtkFrame', 'GtkGrid']
+POSSIBLE_TOP_LEVEL_WIDGETS = ['GtkDialog', 'GtkMessageDialog', 'GtkBox', 'GtkFrame', 'GtkGrid']
IGNORED_TOP_LEVEL_WIDGETS = ['GtkAdjustment', 'GtkImage', 'GtkListStore', 'GtkSizeGroup', 'GtkMenu', 'GtkTextBuffer']
BORDER_WIDTH = '6'
BUTTON_BOX_SPACING = '12'
ALIGNMENT_TOP_PADDING = '6'
+#https://developer.gnome.org/hig-book/3.0/windows-alert.html.en#alert-spacing
+MESSAGE_BOX_SPACING = '24'
+MESSAGE_BORDER_WIDTH = '12'
def lint_assert(predicate, warning=DEFAULT_WARNING_STR):
if not predicate:
@@ -36,14 +39,23 @@ def check_top_level_widget(element):
lint_assert(False, "No border_width set on top level widget. Should probably be " + BORDER_WIDTH)
if len(border_width_properties) == 1:
border_width = border_width_properties[0]
- lint_assert(border_width.text == BORDER_WIDTH,
- "Top level 'border_width' property should be " + BORDER_WIDTH)
+ if widget_type == "GtkMessageDialog":
+ lint_assert(border_width.text == MESSAGE_BORDER_WIDTH,
+ "Top level 'border_width' property should be " + MESSAGE_BORDER_WIDTH)
+ else:
+ lint_assert(border_width.text == BORDER_WIDTH,
+ "Top level 'border_width' property should be " + BORDER_WIDTH)
def check_button_box_spacing(element):
spacing = element.findall("property[@name='spacing']")[0]
lint_assert(spacing.text == BUTTON_BOX_SPACING,
"Button box 'spacing' should be " + BUTTON_BOX_SPACING)
+def check_message_box_spacing(element):
+ spacing = element.findall("property[@name='spacing']")[0]
+ lint_assert(spacing.text == MESSAGE_BOX_SPACING,
+ "Button box 'spacing' should be " + MESSAGE_BOX_SPACING)
+
def check_frames(root):
frames = [element for element in root.findall('.//object') if element.attrib['class'] == 'GtkFrame']
for frame in frames:
@@ -78,11 +90,16 @@ def main():
# TODO - only do this if we have a GtkDialog?
# check button box spacing
- button_box = top_level_widget.findall("child[@id='dialog-vbox1']")
+ button_box = top_level_widget.findall("./child/object[@id='dialog-vbox1']")
if len(button_box) > 0:
element = button_box[0]
check_button_box_spacing(element)
+ message_box = top_level_widget.findall("./child/object[@id='messagedialog-vbox']")
+ if len(message_box) > 0:
+ element = message_box[0]
+ check_message_box_spacing(element)
+
check_frames(root)
if __name__ == "__main__":
commit e57828a66cb4e5ce583aa3fda0376721ff19f112
Author: Caolán McNamara <caolanm at redhat.com>
Date: Wed Aug 7 20:20:34 2013 +0100
HIG: alerts should have 12 border and 24 spacing
Change-Id: I09aade1d7a63f9e1cda54ecdb2e32d2589ecb450
diff --git a/cui/uiconfig/ui/querychangelineenddialog.ui b/cui/uiconfig/ui/querychangelineenddialog.ui
index ead7828..397afaf 100644
--- a/cui/uiconfig/ui/querychangelineenddialog.ui
+++ b/cui/uiconfig/ui/querychangelineenddialog.ui
@@ -15,7 +15,7 @@
<object class="GtkBox" id="messagedialog-vbox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">2</property>
+ <property name="spacing">24</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
diff --git a/cui/uiconfig/ui/queryduplicatedialog.ui b/cui/uiconfig/ui/queryduplicatedialog.ui
index b1ee98e..79905ef 100644
--- a/cui/uiconfig/ui/queryduplicatedialog.ui
+++ b/cui/uiconfig/ui/queryduplicatedialog.ui
@@ -3,7 +3,7 @@
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkMessageDialog" id="DuplicateNameDialog">
<property name="can_focus">False</property>
- <property name="border_width">6</property>
+ <property name="border_width">12</property>
<property name="title" translatable="yes">Duplicate name</property>
<property name="type_hint">dialog</property>
<property name="skip_taskbar_hint">True</property>
@@ -15,7 +15,7 @@
<object class="GtkBox" id="messagedialog-vbox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">6</property>
+ <property name="spacing">24</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
diff --git a/sw/uiconfig/swriter/ui/querydefaultcompatdialog.ui b/sw/uiconfig/swriter/ui/querydefaultcompatdialog.ui
index a6446ff..f1565d7 100644
--- a/sw/uiconfig/swriter/ui/querydefaultcompatdialog.ui
+++ b/sw/uiconfig/swriter/ui/querydefaultcompatdialog.ui
@@ -3,7 +3,7 @@
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkMessageDialog" id="QueryDefaultCompatDialog">
<property name="can_focus">False</property>
- <property name="border_width">6</property>
+ <property name="border_width">12</property>
<property name="title" translatable="yes">Use as default?</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
@@ -16,7 +16,7 @@
<object class="GtkBox" id="messagedialog-vbox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">2</property>
+ <property name="spacing">24</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
diff --git a/sw/uiconfig/swriter/ui/querysavelabeldialog.ui b/sw/uiconfig/swriter/ui/querysavelabeldialog.ui
index 32e8955..711879c 100644
--- a/sw/uiconfig/swriter/ui/querysavelabeldialog.ui
+++ b/sw/uiconfig/swriter/ui/querysavelabeldialog.ui
@@ -3,7 +3,7 @@
<!-- interface-requires gtk+ 3.6 -->
<object class="GtkMessageDialog" id="QuerySaveLabelDialog">
<property name="can_focus">False</property>
- <property name="border_width">6</property>
+ <property name="border_width">12</property>
<property name="title" translatable="yes">Save label?</property>
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
@@ -16,7 +16,7 @@
<object class="GtkBox" id="messagedialog-vbox">
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
- <property name="spacing">2</property>
+ <property name="spacing">24</property>
<child internal-child="action_area">
<object class="GtkButtonBox" id="messagedialog-action_area">
<property name="can_focus">False</property>
More information about the Libreoffice-commits
mailing list