Ticket #4352: 0005-Hide-the-Remove-button-if-there-is-only-one-language.patch

File 0005-Hide-the-Remove-button-if-there-is-only-one-language.patch, 1.9 KB (added by manuq, 11 years ago)

Patch.

  • extensions/cpsection/language/view.py

    From a6fb2fb0b9531112be47eeaed2101fb1dbfb84c2 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
    Date: Thu, 24 Jan 2013 12:35:50 -0300
    Subject: [PATCH shell 5/5] Hide the Remove button if there is only one
     language - SL #4352
    MIME-Version: 1.0
    Content-Type: text/plain; charset=UTF-8
    Content-Transfer-Encoding: 8bit
    Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
    
    This behaviour was removed along with other code in a removal commit
    4ae3bf07 .
    
    Signed-off-by: Manuel Quiñones <manuq@laptop.org>
    ---
     extensions/cpsection/language/view.py | 15 +++++++++++++++
     1 file changed, 15 insertions(+)
    
    diff --git a/extensions/cpsection/language/view.py b/extensions/cpsection/language/view.py
    index 77f7207..99275d4 100644
    a b class Language(SectionView): 
    136136            previous_add_removes = self._add_remove_boxes[-2]
    137137            previous_add_removes.hide()
    138138
     139        # Hide the Remove button if the new added row is the only
     140        # language.
     141        elif self._selected_lang_count == 1:
     142            add_button_, remove_button = add_remove_box.get_children()
     143            remove_button.props.visible = False
     144
    139145        combobox.show()
    140146
    141147    def _attach_to_table(self, widget, row, column, padding=20, \
    class Language(SectionView): 
    160166
    161167        self._add_remove_boxes[-1].show_all()
    162168
     169        # Hide or show the Remove button in the new last row,
     170        # depending if it is the only language.
     171        add_remove_box = self._add_remove_boxes[-1]
     172        add_button_, remove_button = add_remove_box.get_children()
     173        if self._selected_lang_count == 1:
     174            remove_button.props.visible = False
     175        else:
     176            remove_button.props.visible = True
     177
    163178    def _get_last_row(self):
    164179        label = self._labels.pop()
    165180        add_remove_box = self._add_remove_boxes.pop()