changeset 489:1ce6133993e4

browser side (XMLUI): implementation of read_only attribute
author Goffi <goffi@goffi.org>
date Wed, 25 Jun 2014 14:02:50 +0200
parents 747eaa662353
children c4d6d1254ec1
files src/browser/sat_browser/xmlui.py
diffstat 1 files changed, 13 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/browser/sat_browser/xmlui.py	Tue Jun 24 00:42:45 2014 +0200
+++ b/src/browser/sat_browser/xmlui.py	Wed Jun 25 14:02:50 2014 +0200
@@ -68,11 +68,11 @@
 
         @param parent
         @param style (string): one of:
-                               - line: a simple line
-                               - dot: a line of dots
-                               - dash: a line of dashes
-                               - plain: a full thick line
-                               - blank: a blank line/space
+            - line: a simple line
+            - dot: a line of dots
+            - dash: a line of dashes
+            - plain: a full thick line
+            - blank: a blank line/space
         """
         HTML.__init__(self, "<hr/>")
         self.addStyleName(style)
@@ -80,9 +80,10 @@
 
 class StringWidget(xmlui.StringWidget, TextBox):
 
-    def __init__(self, parent, value):
+    def __init__(self, parent, value, read_only=False):
         TextBox.__init__(self)
         self.setText(value)
+        self.setReadonly(read_only)
 
     def _xmluiSetValue(self, value):
         self.setText(value)
@@ -96,9 +97,10 @@
 
 class PasswordWidget(xmlui.PasswordWidget, PasswordTextBox):
 
-    def __init__(self, parent, value):
+    def __init__(self, parent, value, read_only=False):
         PasswordTextBox.__init__(self)
         self.setText(value)
+        self.setReadonly(read_only)
 
     def _xmluiSetValue(self, value):
         self.setText(value)
@@ -112,9 +114,10 @@
 
 class TextBoxWidget(xmlui.TextBoxWidget, TextArea):
 
-    def __init__(self, parent, value):
+    def __init__(self, parent, value, read_only=False):
         TextArea.__init__(self)
         self.setText(value)
+        self.setReadonly(read_only)
 
     def _xmluiSetValue(self, value):
         self.setText(value)
@@ -128,9 +131,10 @@
 
 class BoolWidget(xmlui.BoolWidget, CheckBox):
 
-    def __init__(self, parent, state):
+    def __init__(self, parent, state, read_only=False):
         CheckBox.__init__(self)
         self.setChecked(state)
+        self.setReadonly(read_only)
 
     def _xmluiSetValue(self, value):
         self.setChecked(value == "true")