comparison browser_side/xmlui.py @ 369:678d1739bbf2

browser_side: CSS for the selectable rows of AdvancedListContainer: change the cursor and highlight the selected row
author souliane <souliane@mailoo.org>
date Sun, 23 Feb 2014 16:20:03 +0100
parents ce5b33f499c5
children ab923b870fb0
comparison
equal deleted inserted replaced
368:97c5a9092bee 369:678d1739bbf2
173 self.addTableListener(self) 173 self.addTableListener(self)
174 174
175 def onCellClicked(self, grid, row, col): 175 def onCellClicked(self, grid, row, col):
176 if not self._xmlui_selectable: 176 if not self._xmlui_selectable:
177 return 177 return
178 self._xmlui_selected_row = row 178 if self._xmlui_selected_row != row:
179 for widget in self._xmluiGetSelectedWidgets():
180 widget.removeStyleName('AdvancedListSelectableRow-selected')
181 self._xmlui_selected_row = row
182 for widget in self._xmluiGetSelectedWidgets():
183 widget.addStyleName('AdvancedListSelectableRow-selected')
179 try: 184 try:
180 self._xmlui_select_cb(self) 185 self._xmlui_select_cb(self)
181 except AttributeError: 186 except AttributeError:
182 print "WARNING: no select callback set" 187 print "WARNING: no select callback set"
183 188
184
185 def _xmluiAppend(self, widget): 189 def _xmluiAppend(self, widget):
186 self.setWidget(self.row, self.col, widget) 190 self.setWidget(self.row, self.col, widget)
191 widget.addStyleName('AdvancedListSelectableRow')
187 self.col += 1 192 self.col += 1
188 193
189 def _xmluiAddRow(self, idx): 194 def _xmluiAddRow(self, idx):
190 self.row += 1 195 self.row += 1
191 self.col = 0 196 self.col = 0
192 self._xmlui_rows_idx.insert(self.row, idx) 197 self._xmlui_rows_idx.insert(self.row, idx)
193 self.resizeRows(self.row+1) 198 self.resizeRows(self.row + 1)
194 199
195 def _xmluiGetSelectedWidgets(self): 200 def _xmluiGetSelectedWidgets(self):
196 return [self.getWidget(self._xmlui_selected_row, col) for col in range(self.columns)] 201 return [self.getWidget(self._xmlui_selected_row, col) for col in range(self.columns)]
197 202
198 def _xmluiGetSelectedIndex(self): 203 def _xmluiGetSelectedIndex(self):