[PATCH 3/5] Move formating markup out of python where possible

David Shea dshea at redhat.com
Wed Oct 16 17:27:21 UTC 2013


For strings where python is used to wrap a string in formatting markup,
set pango attributes on the label in glade, instead.
---
 pyanaconda/ui/gui/spokes/custom.glade  |  5 ++++-
 pyanaconda/ui/gui/spokes/custom.py     |  3 +--
 pyanaconda/ui/gui/spokes/filter.glade  |  5 ++++-
 pyanaconda/ui/gui/spokes/filter.py     |  3 +--
 pyanaconda/ui/gui/spokes/network.py    |  2 --
 pyanaconda/ui/gui/spokes/storage.glade | 18 ++++++++++++------
 pyanaconda/ui/gui/spokes/storage.py    | 16 +++++++---------
 7 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/pyanaconda/ui/gui/spokes/custom.glade b/pyanaconda/ui/gui/spokes/custom.glade
index f8004c2..c269be0 100644
--- a/pyanaconda/ui/gui/spokes/custom.glade
+++ b/pyanaconda/ui/gui/spokes/custom.glade
@@ -1860,8 +1860,11 @@ until you click on the main menu's 'Begin Installation' button.</property>
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="label">%d _storage devices selected</property>
-                            <property name="use_markup">True</property>
                             <property name="use_underline">True</property>
+                            <attributes>
+                              <attribute name="underline" value="True"/>
+                              <attribute name="foreground" value="#00000000ffff"/>
+                            </attributes>
                           </object>
                         </child>
                       </object>
diff --git a/pyanaconda/ui/gui/spokes/custom.py b/pyanaconda/ui/gui/spokes/custom.py
index cc757b5..9fd7a42 100644
--- a/pyanaconda/ui/gui/spokes/custom.py
+++ b/pyanaconda/ui/gui/spokes/custom.py
@@ -842,8 +842,7 @@ class CustomPartitioningSpoke(NormalSpoke, StorageChecker):
                      "%d _storage devices selected",
                      count) % count
 
-        self._summaryLabel.set_markup("<span foreground='blue'><u>%s</u></span>" % summary)
-        self._summaryLabel.set_use_underline(True)
+        self._summaryLabel.set_text(summary)
 
     def _reset_storage(self):
         self.__storage = self.storage.copy()
diff --git a/pyanaconda/ui/gui/spokes/filter.glade b/pyanaconda/ui/gui/spokes/filter.glade
index 5c07071..0f60bb9 100644
--- a/pyanaconda/ui/gui/spokes/filter.glade
+++ b/pyanaconda/ui/gui/spokes/filter.glade
@@ -1554,8 +1554,11 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="label">%d _storage devices selected</property>
-                        <property name="use_markup">True</property>
                         <property name="use_underline">True</property>
+                        <attributes>
+                          <attribute name="underline" value="True"/>
+                          <attribute name="foreground" value="#00000000ffff"/>
+                        </attributes>
                       </object>
                     </child>
                   </object>
diff --git a/pyanaconda/ui/gui/spokes/filter.py b/pyanaconda/ui/gui/spokes/filter.py
index 26d583b..1adb2c9 100644
--- a/pyanaconda/ui/gui/spokes/filter.py
+++ b/pyanaconda/ui/gui/spokes/filter.py
@@ -509,8 +509,7 @@ class FilterSpoke(NormalSpoke):
                      "%d _storage devices selected",
                      count) % count
 
-        label.set_markup("<span foreground='blue'><u>%s</u></span>" % summary)
-        label.set_use_underline(True)
+        label.set_text(summary)
 
         summaryButton.set_visible(count > 0)
         label.set_sensitive(count > 0)
diff --git a/pyanaconda/ui/gui/spokes/network.py b/pyanaconda/ui/gui/spokes/network.py
index a2dbdcb..d4d1803 100644
--- a/pyanaconda/ui/gui/spokes/network.py
+++ b/pyanaconda/ui/gui/spokes/network.py
@@ -1051,8 +1051,6 @@ class SecretAgentDialog(GUIObject):
         img = self.builder.get_object("image_password_dialog")
         img.set_from_icon_name("dialog-password-symbolic", Gtk.IconSize.DIALOG)
         self.builder.get_object("label_message").set_text(self._content['message'])
-        self.builder.get_object("label_title").set_use_markup(True)
-        self.builder.get_object("label_title").set_markup("<b>%s</b>" % self._content['title'])
         self._connect_button = self.builder.get_object("connect_button")
 
     def initialize(self):
diff --git a/pyanaconda/ui/gui/spokes/storage.glade b/pyanaconda/ui/gui/spokes/storage.glade
index 2e8ee48..9f908a2 100644
--- a/pyanaconda/ui/gui/spokes/storage.glade
+++ b/pyanaconda/ui/gui/spokes/storage.glade
@@ -115,10 +115,12 @@
                   <object class="GtkLabel" id="options1_autopart_label">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label">&lt;span font-desc="Cantarell 11"&gt;A_utomatically configure my %(productName)s installation to the disk(s) I selected and return me to the main menu.&lt;/span&gt;</property>
-                    <property name="use_markup">True</property>
+                    <property name="label">A_utomatically configure my %(productName)s installation to the disk(s) I selected and return me to the main menu.</property>
                     <property name="use_underline">True</property>
                     <property name="wrap">True</property>
+                    <attributes>
+                      <attribute name="font-desc" value="Cantarell 11"/>
+                    </attributes>
                   </object>
                 </child>
               </object>
@@ -142,10 +144,12 @@
                   <object class="GtkLabel" id="options1_reclaim_label">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label">&lt;span font-desc="Cantarell 11"&gt;I want more space. _Guide me through shrinking and/or removing partitions so I can have more space for %(productName)s.&lt;/span&gt;</property>
-                    <property name="use_markup">True</property>
+                    <property name="label">I want more space. _Guide me through shrinking and/or removing partitions so I can have more space for %(productName)s.</property>
                     <property name="use_underline">True</property>
                     <property name="wrap">True</property>
+                    <attributes>
+                      <attribute name="font-desc" value="Cantarell 11"/>
+                    </attributes>
                   </object>
                 </child>
               </object>
@@ -169,10 +173,12 @@
                   <object class="GtkLabel" id="options1_custom_label">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
-                    <property name="label">&lt;span font-desc="Cantarell 11"&gt;I want to review/_modify my disk partitions before continuing.&lt;/span&gt;</property>
-                    <property name="use_markup">True</property>
+                    <property name="label">I want to review/_modify my disk partitions before continuing.</property>
                     <property name="use_underline">True</property>
                     <property name="wrap">True</property>
+                    <attributes>
+                      <attribute name="font-desc" value="Cantarell 11"/>
+                    </attributes>
                   </object>
                 </child>
               </object>
diff --git a/pyanaconda/ui/gui/spokes/storage.py b/pyanaconda/ui/gui/spokes/storage.py
index 5f5f217..99450b9 100644
--- a/pyanaconda/ui/gui/spokes/storage.py
+++ b/pyanaconda/ui/gui/spokes/storage.py
@@ -130,25 +130,23 @@ class InstallOptions1Dialog(GUIObject):
         options_label.set_markup(options_text)
 
         label = self.builder.get_object("options1_autopart_label")
-        label.set_markup(_("<span font-desc=\"Cantarell 11\">A_utomatically "
-                           "configure my %(productName)s installation to the "
-                           "disk(s) I selected and return me to the main "
-                           "menu.</span>") % {"productName": productName})
+        label.set_text(_("A_utomatically configure my %(productName)s installation to the "
+                           "disk(s) I selected and return me to the main menu.") %
+                           {"productName": productName})
         label.set_use_underline(True)
 
         radio = self.builder.get_object("options1_reclaim_radio")
         if self.showReclaim:
             label = self.builder.get_object("options1_reclaim_label")
-            label.set_markup(_("<span font-desc=\"Cantarell 11\">I want more space. "
-                               "_Guide me through shrinking and/or removing partitions "
-                               "so I can have more space for %(productName)s.</span>") % {"productName": productName})
+            label.set_text(_("I want more space. _Guide me through shrinking and/or removing "
+                               "partitions so I can have more space for %(productName)s.") %
+                               {"productName": productName})
             label.set_use_underline(True)
         else:
             radio.hide()
 
         label = self.builder.get_object("options1_custom_label")
-        label.set_markup(_("<span font-desc=\"Cantarell 11\">I want to review/_modify "
-                           "my disk partitions before continuing.</span>"))
+        label.set_text(_("I want to review/_modify my disk partitions before continuing."))
         label.set_use_underline(True)
 
     @property
-- 
1.8.3.1



More information about the anaconda-patches mailing list