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
1=== modified file 'ubuntuone/controlpanel/gtk/gui.py'
2--- ubuntuone/controlpanel/gtk/gui.py 2011-03-18 21:01:49 +0000
3+++ ubuntuone/controlpanel/gtk/gui.py 2011-03-21 15:15:53 +0000
4@@ -164,7 +164,7 @@
5 self.message = LabelLoading(LOADING)
6 self.pack_start(self.message, expand=False)
7
8- self.connect('size-allocate', on_size_allocate, self.title.label)
9+ self.connect('size-allocate', on_size_allocate, self.title)
10 self.show_all()
11
12 def _get_is_processing(self):
13
14=== modified file 'ubuntuone/controlpanel/gtk/tests/test_gui_basic.py'
15--- ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-03-04 13:15:01 +0000
16+++ ubuntuone/controlpanel/gtk/tests/test_gui_basic.py 2011-03-21 15:15:53 +0000
17@@ -238,12 +238,12 @@
18
19 def test_title_markup_is_correct(self):
20 """The title markup is correctly set when passed as argument."""
21- self.assertEqual(self.ui.title.label.get_text(), self.kwargs['title'])
22+ self.assertEqual(self.ui.title.get_text(), self.kwargs['title'])
23
24 def test_title_is_correct(self):
25 """The title markup is correctly set when defined at class level."""
26 ui = self.klass() # no title given
27- self.assertEqual(ui.title.label.get_text(), '')
28+ self.assertEqual(ui.title.get_text(), '')
29
30 def test_message_is_a_label_loading(self):
31 """Message is the correct widget."""
32
33=== modified file 'ubuntuone/controlpanel/gtk/tests/test_widgets.py'
34--- ubuntuone/controlpanel/gtk/tests/test_widgets.py 2011-02-24 12:24:20 +0000
35+++ ubuntuone/controlpanel/gtk/tests/test_widgets.py 2011-03-21 15:15:53 +0000
36@@ -158,7 +158,7 @@
37
38 def setUp(self):
39 super(PanelTitleTestCase, self).setUp()
40- self.widget = widgets.PanelTitle(markup=self.TITLE, change_bg=True)
41+ self.widget = widgets.PanelTitle(markup=self.TITLE)
42
43 win = widgets.gtk.Window()
44 win.add(self.widget)
45@@ -167,28 +167,22 @@
46 def test_visibility(self):
47 """The widget and children visibility is correct."""
48 self.assertTrue(self.widget.get_visible())
49- for child in self.widget.get_children():
50- self.assertTrue(child.get_visible())
51-
52- def test_label_is_packed(self):
53- """The label is packed in the widget."""
54- self.assertIn(self.widget.label, self.widget.get_children())
55
56 def test_label_markup(self):
57 """The label markup is correct."""
58- self.assertEqual(self.widget.label.get_label(), self.TITLE)
59+ self.assertEqual(self.widget.get_label(), self.TITLE)
60
61 def test_label_xalign(self):
62 """The label is left aligned."""
63- self.assertEqual(self.widget.label.get_property('xalign'), 0.0)
64+ self.assertEqual(self.widget.get_property('xalign'), 0.0)
65
66 def test_label_line_wrap(self):
67 """The label is left aligned."""
68- self.assertTrue(self.widget.label.get_line_wrap())
69- self.assertEqual(self.widget.label.get_line_wrap_mode(),
70+ self.assertTrue(self.widget.get_line_wrap())
71+ self.assertEqual(self.widget.get_line_wrap_mode(),
72 widgets.pango.WRAP_WORD)
73
74 def test_label_padding(self):
75 """The label padding is correct."""
76- self.assertEqual(self.widget.label.get_padding(),
77+ self.assertEqual(self.widget.get_padding(),
78 widgets.DEFAULT_PADDING)
79
80=== modified file 'ubuntuone/controlpanel/gtk/widgets.py'
81--- ubuntuone/controlpanel/gtk/widgets.py 2011-02-24 12:24:20 +0000
82+++ ubuntuone/controlpanel/gtk/widgets.py 2011-03-21 15:15:53 +0000
83@@ -103,18 +103,16 @@
84 return self.label.get_label()
85
86
87-class PanelTitle(gtk.EventBox):
88+class PanelTitle(gtk.Label):
89 """A box with a given color and text."""
90
91- def __init__(self, markup='', change_bg=False, *args, **kwargs):
92+ def __init__(self, markup='', *args, **kwargs):
93 super(PanelTitle, self).__init__(*args, **kwargs)
94- self.label = gtk.Label()
95- self.label.set_markup(markup)
96- self.label.set_padding(*DEFAULT_PADDING)
97- self.label.set_property('xalign', 0.0)
98- self.label.set_line_wrap(True)
99- self.label.set_line_wrap_mode(pango.WRAP_WORD)
100- self.add(self.label)
101+ self.set_markup(markup)
102+ self.set_padding(*DEFAULT_PADDING)
103+ self.set_property('xalign', 0.0)
104+ self.set_line_wrap(True)
105+ self.set_line_wrap_mode(pango.WRAP_WORD)
106 self.show_all()
107
108

Subscribers

People subscribed via source and target branches