def _getSelectionObject(self, selected): rows = getSelectionRows(selected) if not rows: return None row = rows[0] try: return self.objects[row] except IndexError: # Invalid index: ignore return None
def currentAcls(self): selections = self.table.selectionModel().selection() acls = [] for row in getSelectionRows(selections): try: acl_id = self.acl_row2id[row] except KeyError: # It's an header: skip it continue acls.append(acl_id) return acls
def delete(self): table = self.ui.table selection = table.selectionModel().selection() rows = getSelectionRows(selection) row = rows[0] self.saveTableLinks() host = unicode(table.item(row, 0).text()) type = unicode(table.item(row, 1).text()) generic = unicode(table.item(row, 2).text()) del self.links_list[host][type][generic] self.fillTable()
def selectionChanged(self, selected=None, deselected=None): rows = getSelectionRows(selected) self.ui.delete_button.setEnabled(bool(rows))