Merge lp:~alecu/ubuntuone-control-panel/simplify-title-label into lp:ubuntuone-control-panel

Proposed by Alejandro J. Cura
Status: Merged
Approved by: Alejandro J. Cura
Approved revision: 99
Merged at revision: 103
Proposed branch: lp:~alecu/ubuntuone-control-panel/simplify-title-label
Merge into: lp:ubuntuone-control-panel
Diff against target: 106 lines (+16/-24)
4 files modified
ubuntuone/controlpanel/gtk/gui.py (+1/-1)
ubuntuone/controlpanel/gtk/tests/test_gui_basic.py (+2/-2)
ubuntuone/controlpanel/gtk/tests/test_widgets.py (+6/-12)
ubuntuone/controlpanel/gtk/widgets.py (+7/-9)
To merge this branch: bzr merge lp:~alecu/ubuntuone-control-panel/simplify-title-label
Reviewer Review Type Date Requested Status
Roberto Alsina (community) Approve
Natalia Bidart (community) Approve
Review via email: mp+54223@code.launchpad.net

Commit message

Simplify the PanelTitle; instead of a Label within an EventBox, it will just be a Label (LP: #737336).

Description of the change

simplify the PanelTitle; instead of a Label within an EventBox, it will just be a Label (LP: #737336)

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve
Revision history for this message
Roberto Alsina (ralsina) wrote :

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'ubuntuone/controlpanel/gtk/gui.py'
--- ubuntuone/controlpanel/gtk/gui.py 2011-03-18 21:01:49 +0000
+++ ubuntuone/controlpanel/gtk/gui.py 2011-03-21 15:15:53 +0000
@@ -164,7 +164,7 @@
164 self.message = LabelLoading(LOADING)164 self.message = LabelLoading(LOADING)
165 self.pack_start(self.message, expand=False)165 self.pack_start(self.message, expand=False)
166166
167 self.connect('size-allocate', on_size_allocate, self.title.label)167 self.connect('size-allocate', on_size_allocate, self.title)
168 self.show_all()168 self.show_all()
169169
170 def _get_is_processing(self):170 def _get_is_processing(self):
171171
=== modified file 'ubuntuone/controlpanel/gtk/tests/test_gui_basic.py'
--- ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-03-04 13:15:01 +0000
+++ ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-03-21 15:15:53 +0000
@@ -238,12 +238,12 @@
238238
239 def test_title_markup_is_correct(self):239 def test_title_markup_is_correct(self):
240 """The title markup is correctly set when passed as argument."""240 """The title markup is correctly set when passed as argument."""
241 self.assertEqual(self.ui.title.label.get_text(), self.kwargs['title'])241 self.assertEqual(self.ui.title.get_text(), self.kwargs['title'])
242242
243 def test_title_is_correct(self):243 def test_title_is_correct(self):
244 """The title markup is correctly set when defined at class level."""244 """The title markup is correctly set when defined at class level."""
245 ui = self.klass() # no title given245 ui = self.klass() # no title given
246 self.assertEqual(ui.title.label.get_text(), '')246 self.assertEqual(ui.title.get_text(), '')
247247
248 def test_message_is_a_label_loading(self):248 def test_message_is_a_label_loading(self):
249 """Message is the correct widget."""249 """Message is the correct widget."""
250250
=== modified file 'ubuntuone/controlpanel/gtk/tests/test_widgets.py'
--- ubuntuone/controlpanel/gtk/tests/test_widgets.py 2011-02-24 12:24:20 +0000
+++ ubuntuone/controlpanel/gtk/tests/test_widgets.py 2011-03-21 15:15:53 +0000
@@ -158,7 +158,7 @@
158158
159 def setUp(self):159 def setUp(self):
160 super(PanelTitleTestCase, self).setUp()160 super(PanelTitleTestCase, self).setUp()
161 self.widget = widgets.PanelTitle(markup=self.TITLE, change_bg=True)161 self.widget = widgets.PanelTitle(markup=self.TITLE)
162162
163 win = widgets.gtk.Window()163 win = widgets.gtk.Window()
164 win.add(self.widget)164 win.add(self.widget)
@@ -167,28 +167,22 @@
167 def test_visibility(self):167 def test_visibility(self):
168 """The widget and children visibility is correct."""168 """The widget and children visibility is correct."""
169 self.assertTrue(self.widget.get_visible())169 self.assertTrue(self.widget.get_visible())
170 for child in self.widget.get_children():
171 self.assertTrue(child.get_visible())
172
173 def test_label_is_packed(self):
174 """The label is packed in the widget."""
175 self.assertIn(self.widget.label, self.widget.get_children())
176170
177 def test_label_markup(self):171 def test_label_markup(self):
178 """The label markup is correct."""172 """The label markup is correct."""
179 self.assertEqual(self.widget.label.get_label(), self.TITLE)173 self.assertEqual(self.widget.get_label(), self.TITLE)
180174
181 def test_label_xalign(self):175 def test_label_xalign(self):
182 """The label is left aligned."""176 """The label is left aligned."""
183 self.assertEqual(self.widget.label.get_property('xalign'), 0.0)177 self.assertEqual(self.widget.get_property('xalign'), 0.0)
184178
185 def test_label_line_wrap(self):179 def test_label_line_wrap(self):
186 """The label is left aligned."""180 """The label is left aligned."""
187 self.assertTrue(self.widget.label.get_line_wrap())181 self.assertTrue(self.widget.get_line_wrap())
188 self.assertEqual(self.widget.label.get_line_wrap_mode(),182 self.assertEqual(self.widget.get_line_wrap_mode(),
189 widgets.pango.WRAP_WORD)183 widgets.pango.WRAP_WORD)
190184
191 def test_label_padding(self):185 def test_label_padding(self):
192 """The label padding is correct."""186 """The label padding is correct."""
193 self.assertEqual(self.widget.label.get_padding(),187 self.assertEqual(self.widget.get_padding(),
194 widgets.DEFAULT_PADDING)188 widgets.DEFAULT_PADDING)
195189
=== modified file 'ubuntuone/controlpanel/gtk/widgets.py'
--- ubuntuone/controlpanel/gtk/widgets.py 2011-02-24 12:24:20 +0000
+++ ubuntuone/controlpanel/gtk/widgets.py 2011-03-21 15:15:53 +0000
@@ -103,18 +103,16 @@
103 return self.label.get_label()103 return self.label.get_label()
104104
105105
106class PanelTitle(gtk.EventBox):106class PanelTitle(gtk.Label):
107 """A box with a given color and text."""107 """A box with a given color and text."""
108108
109 def __init__(self, markup='', change_bg=False, *args, **kwargs):109 def __init__(self, markup='', *args, **kwargs):
110 super(PanelTitle, self).__init__(*args, **kwargs)110 super(PanelTitle, self).__init__(*args, **kwargs)
111 self.label = gtk.Label()111 self.set_markup(markup)
112 self.label.set_markup(markup)112 self.set_padding(*DEFAULT_PADDING)
113 self.label.set_padding(*DEFAULT_PADDING)113 self.set_property('xalign', 0.0)
114 self.label.set_property('xalign', 0.0)114 self.set_line_wrap(True)
115 self.label.set_line_wrap(True)115 self.set_line_wrap_mode(pango.WRAP_WORD)
116 self.label.set_line_wrap_mode(pango.WRAP_WORD)
117 self.add(self.label)
118 self.show_all()116 self.show_all()
119117
120118

Subscribers

People subscribed via source and target branches