diff options
author | Manuel QuiƱones <manuq@laptop.org> | 2013-01-24 15:35:50 (GMT) |
---|---|---|
committer | Ajay Garg <ajay@activitycentral.com> | 2013-02-23 07:50:56 (GMT) |
commit | acdf8d22b5f99aa0c8097f3f2e2a55b230d958cb (patch) | |
tree | fd1ebf338370c6a8e300c5183f5928c824068b83 | |
parent | 4bd368a7b5adc069a246113653c7b9535a5a10f8 (diff) |
Hide the Remove button if there is only one language - SL #4352
This behaviour was removed along with other code in a removal commit
4ae3bf07 .
Signed-off-by: Manuel QuiƱones <manuq@laptop.org>
Acked-by: Simon Schampijer <simon@laptop.org>
Signed-off-by: Ajay Garg <ajay@activitycentral.com>
-rw-r--r-- | extensions/cpsection/language/view.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/extensions/cpsection/language/view.py b/extensions/cpsection/language/view.py index 77f7207..99275d4 100644 --- a/extensions/cpsection/language/view.py +++ b/extensions/cpsection/language/view.py @@ -136,6 +136,12 @@ class Language(SectionView): previous_add_removes = self._add_remove_boxes[-2] previous_add_removes.hide() + # Hide the Remove button if the new added row is the only + # language. + elif self._selected_lang_count == 1: + add_button_, remove_button = add_remove_box.get_children() + remove_button.props.visible = False + combobox.show() def _attach_to_table(self, widget, row, column, padding=20, \ @@ -160,6 +166,15 @@ class Language(SectionView): self._add_remove_boxes[-1].show_all() + # Hide or show the Remove button in the new last row, + # depending if it is the only language. + add_remove_box = self._add_remove_boxes[-1] + add_button_, remove_button = add_remove_box.get_children() + if self._selected_lang_count == 1: + remove_button.props.visible = False + else: + remove_button.props.visible = True + def _get_last_row(self): label = self._labels.pop() add_remove_box = self._add_remove_boxes.pop() |