From 830e9ccb6247e25c39f7883f411e2c2ef281b103 Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Wed, 13 Jun 2012 12:24:30 -0400 Subject: [PATCH 1/2] 830949: add accessibility locators for registration widgets Also, clean up some of the widget names to be a little more consistent. Update registergui.py for some of the widget name changes. --- .../gui/data/registration.glade | 257 ++++++++++++++---- src/subscription_manager/gui/registergui.py | 4 +- 2 files changed, 207 insertions(+), 54 deletions(-) diff --git a/src/subscription_manager/gui/data/registration.glade b/src/subscription_manager/gui/data/registration.glade index 571e341d4a..0db1863d2e 100644 --- a/src/subscription_manager/gui/data/registration.glade +++ b/src/subscription_manager/gui/data/registration.glade @@ -28,24 +28,27 @@ True False False + + register_notebook + - + True 25 vertical 7 - initialLoginWindowVbox1 + initial_login_window_vbox - + True 0 0 True True - instructionsLabel1 + registration_header_label @@ -56,35 +59,35 @@ - + True 12 - alignment1 + initial_login_window_alignment - + True 3 2 15 15 - table1 + initial_login_window_table - + True - forgotInfoHbox1 + forgot_info_hbox - + True 0 gtk-info - tipIconHosted1 + tip_icon_hosted @@ -94,7 +97,7 @@ - + True 0 0 @@ -103,7 +106,7 @@ True True - forgotInfoHosted1 + registration_tip_label @@ -157,13 +160,13 @@ - + True 1 Password: True - loginPasswordEntryLabel1 + login_password_entry_label @@ -174,13 +177,13 @@ - + True 0 Login: True - loginUserEntryLabel1 + login_user_entry_label @@ -211,12 +214,15 @@ - + True 0 0 <b>Please enter the following for this system:</b> True + + system_instructions_label + False @@ -224,21 +230,30 @@ - + True 12 + + system_name_alignment + - + True 2 2 15 10 + + system_name_table + - + True 1 System Name: + + system_name_label + GTK_FILL @@ -296,6 +311,9 @@ True page 1 + + page1 + False @@ -308,12 +326,18 @@ 25 vertical 7 + + progressVbox + - + True 0 <b>Registering</b> True + + progress_label + False @@ -330,6 +354,9 @@ True True + + register_progressbar + @@ -344,6 +371,9 @@ True 0.11999999731779099 True + + register_details_label + False @@ -360,6 +390,9 @@ True page 2 + + page2 + 1 @@ -368,20 +401,23 @@ - + True 25 vertical 7 - ownerSelectVbox + owner_select_vbox - + True 0 <b>Organization Selection</b> True + + org_selection_label + False @@ -389,17 +425,23 @@ - + True True 8 automatic automatic etched-in + + org_selection_scrolledwindow + True True + + owner_treeview + @@ -416,6 +458,9 @@ True page 3 + + page3 + 2 @@ -424,20 +469,23 @@ - + True 25 vertical 7 - envSelectVbox + env_select_vbox - + True 0 <b>Environment Selection</b> True + + env_select_vbox_label + False @@ -445,17 +493,23 @@ - + True True 8 automatic automatic etched-in + + env_select_vbox_scrolledwindow + True True + + environment_treeview + @@ -472,6 +526,9 @@ True page 4 + + page4 + 3 @@ -480,29 +537,38 @@ - + True vertical + + choose_server_toplevel_vbox + True vertical 16 - + True 0 12 Please select if you would like to receive software updates through the Customer Portal or through another Subscription Management Service. True + + choose_server_vbox_label + 0 - + True + + choose_server_proxy_hbox + True @@ -510,6 +576,9 @@ 11 If you must connect through a proxy, please configure this before moving forward. True + + proxy_label + False @@ -517,15 +586,21 @@ - + True vertical + + proxy_config_button_vbox + Proxy Configuration True True True + + proxy_config_button + @@ -548,9 +623,12 @@ - + True 6 + + rhn_radio_hbox + True @@ -558,6 +636,9 @@ False True True + + rhn_radio + @@ -567,10 +648,13 @@ - + True I'd like to receive updates from the Customer Portal. True + + rhn_radio_label + False @@ -583,18 +667,27 @@ - + True vertical 6 + + local_radio_vbox + - + True 6 + + local_radio_hbox + True 36 + + local_radio_alignment + True @@ -602,6 +695,9 @@ False True rhn_radio + + local_radio + @@ -613,15 +709,21 @@ - + True vertical + + local_radio_label_vbox + - + True 0 I have access to a Subscription Management Service. I'd like to receive software updates from the server below. True + + local_radio_label + False @@ -629,14 +731,20 @@ - + True + + local_radio_server_hbox + - + True 0 0.25 Subscription Management Service: + + local_radio_server_label + False @@ -644,15 +752,21 @@ - + True vertical + + local_radio_server_vbox + True True 30 + + + False @@ -660,10 +774,13 @@ - + True <small><i>hostname[:port][/prefix]</i></small> True + + local_entry_label + False @@ -701,18 +818,27 @@ - + True vertical 6 + + offline_radio_vbox + - + True 7 + + local_offline_hbox + - + True 44 + + local_offline_hbox_alignment + True @@ -720,6 +846,9 @@ False True rhn_radio + + + @@ -731,16 +860,22 @@ - + True vertical 6 + + offline_radio_label_vbox + - + True 0 I want to manually import my existing certificate files, which contain subscription information for this machine. True + + offline_radio_label + False @@ -748,13 +883,19 @@ - + True 12 + + offline_radio_info_label_vbox + True gtk-info + + image1 + False @@ -768,6 +909,9 @@ <small>This could be the certificate(s) that you exported from the Customer Portal after registering the system as a consumer</small> True True + + offline_radio_info_label_vbox + False @@ -786,15 +930,21 @@ - + True vertical + + import_certs_button_vbox + Import Certificates True True True + + import_certs_button + @@ -836,6 +986,9 @@ True page 5 + + page_5 + 4 diff --git a/src/subscription_manager/gui/registergui.py b/src/subscription_manager/gui/registergui.py index 13acc6183d..904bb8841a 100644 --- a/src/subscription_manager/gui/registergui.py +++ b/src/subscription_manager/gui/registergui.py @@ -133,12 +133,12 @@ def __init__(self, backend, consumer, facts=None, callbacks=None): self.cancel_button = registration_xml.get_widget("cancel_button") self.register_button = registration_xml.get_widget("register_button") - register_tip_label = registration_xml.get_widget("registrationTip") + register_tip_label = registration_xml.get_widget("registration_tip_label") register_tip_label.set_label("%s" % \ get_branding().GUI_FORGOT_LOGIN_TIP) register_header_label = \ - registration_xml.get_widget("registrationHeader") + registration_xml.get_widget("registration_header_label") register_header_label.set_label("%s" % \ get_branding().GUI_REGISTRATION_HEADER) From ee158bbe68c12dbb41134a3b76e822e8f408556d Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Wed, 13 Jun 2012 12:25:50 -0400 Subject: [PATCH 2/2] Add a "find-missing-widgets" target to makefile This trys to find all the widget's references with get_widget() and makes sure they are defined in glade somewhere. --- Makefile | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index eddb1c126c..10b8ef141e 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,7 @@ RHSMCERTD_FLAGS=`pkg-config --cflags --libs glib-2.0` PYFILES=`find src/ -name "*.py"` TESTFILES=`find test/ -name "*.py"` STYLEFILES=$(PYFILES) $(BIN_FILES) +GLADEFILES=`find src/subscription_manager/gui/data -name "*.glade"` # note, set STYLETEST to something if you want # make stylish to check the tests code @@ -323,6 +324,24 @@ trailinglint: whitespacelint: tablint trailinglint +# find widgets used via get_widget +# find widgets used as passed to init of SubscriptionManagerTab, +# find the widgets we actually find in the glade files +# see if any used ones are not defined +find-missing-widgets: + @TMPFILE=`mktemp` || exit 1; \ + USED_WIDGETS="used_widgets_make.txt" ||exit 1; \ + DEFINED_WIDGETS=`mktemp` ||exit 1; \ + perl -n -e "if (/get_widget\([\'|\"](.*?)[\'|\"]\)/) { print(\"\$$1\n\")}" $(STYLEFILES) > $$USED_WIDGETS; \ + pcregrep -h -o -M "(?:widgets|widget_names) = \[.*\s*.*?\s*.*\]" $(STYLEFILES) | perl -0 -n -e "my @matches = /[\'|\"](.*?)[\'|\"]/sg ; $$,=\"\n\"; print(@matches);" >> $$USED_WIDGETS; \ + perl -n -e "if (//) { print(\"\$$1\n\")}" $(GLADEFILES) > $$DEFINED_WIDGETS; \ + while read line; do grep -F "$$line" $$DEFINED_WIDGETS > /dev/null ; STAT="$$?"; if [ "$$STAT" -ne "0" ] ; then echo "$$line"; fi; done < $$USED_WIDGETS | tee $$TMPFILE; \ + ! test -s $$TMPFILE + +# look for python string formats that are known to break xgettext +# namely constructs of the forms: _("a" + "b") +# _("a" + \ +# "b") gettext_lint: @TMPFILE=`mktemp` || exit 1; \ pcregrep -n --color=auto -M "_\(.*[\'|\"].*[\'|\"]\s*\+.*?\s*[\"|\'].*[\"|\'].*\)" $(STYLEFILES) | tee $$TMPFILE; \ @@ -338,6 +357,8 @@ rpmlint: rpmlint -f rpmlint.config subscription-manager.spec | grep -v "^.*packages and .* specfiles checked\;" | tee $$TMPFILE; \ ! test -s $$TMPFILE -stylish: pyflakes whitespacelint pep8 gettext_lint rpmlint +stylish: find-missing-widgets pyflakes whitespacelint pep8 gettext_lint rpmlint jenkins: stylish coverage-jenkins + +