diff 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
line wrap: on
line diff
--- a/browser_side/xmlui.py	Sun Feb 23 15:00:42 2014 +0100
+++ b/browser_side/xmlui.py	Sun Feb 23 16:20:03 2014 +0100
@@ -175,22 +175,27 @@
     def onCellClicked(self, grid, row, col):
         if not self._xmlui_selectable:
             return
-        self._xmlui_selected_row = row
+        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')
         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)]