changeset 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 97c5a9092bee
children 30d03d9f07e4
files browser_side/xmlui.py public/libervia.css
diffstat 2 files changed, 17 insertions(+), 3 deletions(-) [+]
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)]
--- a/public/libervia.css	Sun Feb 23 15:00:42 2014 +0100
+++ b/public/libervia.css	Sun Feb 23 16:20:03 2014 +0100
@@ -1513,3 +1513,12 @@
 
 [contenteditable="true"] {
 }
+
+/* XMLUI styles */
+.AdvancedListSelectableRow {
+   cursor: pointer;
+}
+.AdvancedListSelectableRow-selected {
+   text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
+   color: red;
+}