Merge lp:~tealeg/landscape-client/switching-text-on-button into lp:~landscape/landscape-client/trunk

Proposed by Geoff Teale
Status: Merged
Approved by: Fernando Correa Neto
Approved revision: 515
Merged at revision: 516
Proposed branch: lp:~tealeg/landscape-client/switching-text-on-button
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 96 lines (+21/-7)
3 files modified
landscape/ui/view/configuration.py (+14/-6)
landscape/ui/view/tests/test_configuration.py (+6/-0)
landscape/ui/view/ui/landscape-client-settings.glade (+1/-1)
To merge this branch: bzr merge lp:~tealeg/landscape-client/switching-text-on-button
Reviewer Review Type Date Requested Status
Fernando Correa Neto (community) Approve
Chad Smith Approve
Review via email: mp+97463@code.launchpad.net

Description of the change

Fixes a point made in a comment on Bug #953065

Causes the text on the "OK" button on the dialog to show as either "Register" or "Disable" based on the selected management type.

To post a comment you must log in.
Revision history for this message
Chad Smith (chad.smith) wrote :

+1 looks & works great on precise & oneiric.

review: Approve
Revision history for this message
Fernando Correa Neto (fcorrea) wrote :

Looks good! +1!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/ui/view/configuration.py'
2--- landscape/ui/view/configuration.py 2012-03-14 10:00:01 +0000
3+++ landscape/ui/view/configuration.py 2012-03-14 17:10:37 +0000
4@@ -17,7 +17,8 @@
5 NO_SERVICE_TEXT = "None"
6 HOSTED_SERVICE_TEXT = "Landscape - hosted by Canonical"
7 LOCAL_SERVICE_TEXT = "Landscape - dedicated server"
8- REGISTER_BUTTON_TEXT = "Register this machine"
9+ REGISTER_BUTTON_TEXT = "Register"
10+ DISABLE_BUTTON_TEXT = "Disable"
11
12 def __init__(self, controller):
13 super(ClientSettingsDialog, self).__init__(
14@@ -127,6 +128,15 @@
15 def register_response(self, widget):
16 self.response(Gtk.ResponseType.OK)
17
18+ def set_button_text(self, management_type):
19+ [alignment] = self.register_button.get_children()
20+ [hbox] = alignment.get_children()
21+ [image, label] = hbox.get_children()
22+ if management_type == NOT_MANAGED:
23+ label.set_text(self.DISABLE_BUTTON_TEXT)
24+ else:
25+ label.set_text(self.REGISTER_BUTTON_TEXT)
26+
27 def setup_buttons(self):
28 self.revert_button = Gtk.Button(stock=Gtk.STOCK_REVERT_TO_SAVED)
29 self.action_area.pack_start(self.revert_button, True, True, 0)
30@@ -139,10 +149,6 @@
31 self.register_button = Gtk.Button(stock=Gtk.STOCK_OK)
32 self.action_area.pack_start(self.register_button, True, True, 0)
33 self.register_button.show()
34- [alignment] = self.register_button.get_children()
35- [hbox] = alignment.get_children()
36- [image, label] = hbox.get_children()
37- label.set_text(self.REGISTER_BUTTON_TEXT)
38 self.register_button.connect("clicked", self.register_response)
39
40 def setup_ui(self):
41@@ -166,8 +172,10 @@
42 iter = self.liststore.get_iter(combobox.get_active())
43 if not self.active_widget is None:
44 self._vbox.remove(self.active_widget)
45+ [management_type] = self.liststore.get(iter, 0)
46+ self.set_button_text(management_type)
47 if self._initialised:
48- [self.controller.management_type] = self.liststore.get(iter, 0)
49+ self.controller.management_type = management_type
50 self.controller.modify()
51 [self.active_widget] = self.liststore.get(iter, 2)
52 self.active_widget.unparent()
53
54=== modified file 'landscape/ui/view/tests/test_configuration.py'
55--- landscape/ui/view/tests/test_configuration.py 2012-03-14 10:05:30 +0000
56+++ landscape/ui/view/tests/test_configuration.py 2012-03-14 17:10:37 +0000
57@@ -78,20 +78,26 @@
58 local_service_frame = dialog.liststore.get(iter, 2)[0]
59
60 self.assertEqual(1, dialog.use_type_combobox.get_active())
61+ [alignment] = dialog.register_button.get_children()
62+ [hbox] = alignment.get_children()
63+ [image, label] = hbox.get_children()
64
65 while Gtk.events_pending():
66 Gtk.main_iteration()
67 self.assertIs(hosted_service_frame, dialog.active_widget)
68+ self.assertEqual(dialog.REGISTER_BUTTON_TEXT, label.get_text())
69
70 dialog.use_type_combobox.set_active(0)
71 while Gtk.events_pending():
72 Gtk.main_iteration()
73 self.assertIs(no_service_frame, dialog.active_widget)
74+ self.assertEqual(dialog.DISABLE_BUTTON_TEXT, label.get_text())
75
76 dialog.use_type_combobox.set_active(2)
77 while Gtk.events_pending():
78 Gtk.main_iteration()
79 self.assertIs(local_service_frame, dialog.active_widget)
80+ self.assertEqual(dialog.REGISTER_BUTTON_TEXT, label.get_text())
81
82 def test_modify(self):
83 """
84
85=== modified file 'landscape/ui/view/ui/landscape-client-settings.glade'
86--- landscape/ui/view/ui/landscape-client-settings.glade 2012-03-14 10:00:01 +0000
87+++ landscape/ui/view/ui/landscape-client-settings.glade 2012-03-14 17:10:37 +0000
88@@ -432,7 +432,7 @@
89 <property name="can_focus">False</property>
90 <property name="xalign">0.059999998658895493</property>
91 <property name="yalign">0</property>
92- <property name="label" translatable="yes">If you click "OK" the Landscape client on this machine will be disabled. You can reenable it later by revisiting this dialog.</property>
93+ <property name="label" translatable="yes">If you click "Disable" the Landscape client on this machine will be disabled. You can reenable it later by revisiting this dialog.</property>
94 <property name="wrap">True</property>
95 <property name="ellipsize">end</property>
96 </object>

Subscribers

People subscribed via source and target branches

to all changes: