Mercurial > libervia-web
diff browser_side/xmlui.py @ 376:ab923b870fb0
browser side: XMLUI AdvancedListContainer: rows are highlighted when there are selectable
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 25 Feb 2014 02:13:53 +0100 |
parents | 678d1739bbf2 |
children | 3dd0b5334aef |
line wrap: on
line diff
--- a/browser_side/xmlui.py Mon Feb 24 22:30:01 2014 +0100 +++ b/browser_side/xmlui.py Tue Feb 25 02:13:53 2014 +0100 @@ -171,31 +171,28 @@ self._xmlui_selectable = selectable != 'no' self._xmlui_selected_row = None self.addTableListener(self) + if self._xmlui_selectable: + self.addStyleName('AdvancedListSelectable') def onCellClicked(self, grid, row, col): if not self._xmlui_selectable: return - if self._xmlui_selected_row != row: - for widget in self._xmluiGetSelectedWidgets(): - widget.removeStyleName('AdvancedListSelectableRow-selected') - self._xmlui_selected_row = row - for widget in self._xmluiGetSelectedWidgets(): - widget.addStyleName('AdvancedListSelectableRow-selected') + self._xmlui_selected_row = row try: self._xmlui_select_cb(self) except AttributeError: print "WARNING: no select callback set" + def _xmluiAppend(self, widget): self.setWidget(self.row, self.col, widget) - widget.addStyleName('AdvancedListSelectableRow') self.col += 1 def _xmluiAddRow(self, idx): self.row += 1 self.col = 0 self._xmlui_rows_idx.insert(self.row, idx) - self.resizeRows(self.row + 1) + self.resizeRows(self.row+1) def _xmluiGetSelectedWidgets(self): return [self.getWidget(self._xmlui_selected_row, col) for col in range(self.columns)]