def setup(self, state, available_pages): # the group of radio buttons is named after the first check button for radio in self.load_connection.get_group(): isAvailable = radio.get_name() in available_pages radio.set_sensitive(isAvailable) hasRecent = hasRecentConnections() self.load_connection.set_sensitive(hasRecent) if hasRecent: self.load_connection.set_active(True) else: self.connect_to_existing.set_active(True) # Find which radio button should be focused: for radioName in available_pages: radio = getattr(self, radioName) if radio.get_active(): break else: raise AssertionError("no button to focus") radio.grab_focus()
def _updateButtons(self): canClear = hasRecentConnections() self.button_clear.set_sensitive(canClear) self.button_clear_all.set_sensitive(canClear) if not canClear: self.emit('connections-cleared')