示例#1
0
 def __init__(self,
              name,
              options=None,
              size=None,
              desc=None,
              prop=None,
              style=None,
              attr=None,
              readonly=False,
              disabled=False,
              required=False,
              css_cls=None):
     Widget.__init__(self,
                     name,
                     desc=desc,
                     prop=prop,
                     style=style,
                     attr=attr,
                     css_cls=css_cls)
     if readonly:
         self.add_attribute('readonly')
     if disabled:
         self.add_attribute('disabled')
     if required:
         self.add_attribute('required')
     if size is not None:
         self.add_property('size', size)
     if options is not None:
         self._options = options
     else:
         self._options = {}
示例#2
0
 def __init__(self,
              name,
              value=None,
              desc=None,
              prop=None,
              style=None,
              attr=None,
              title=None,
              readonly=False,
              disabled=False,
              required=False,
              css_cls=None):
     Widget.__init__(self,
                     name,
                     desc=desc,
                     prop=prop,
                     style=style,
                     attr=attr,
                     css_cls=css_cls)
     self._title = title
     self.add_property('type', 'checkbox')
     if value is not None:
         self.add_property('value', value)
     if readonly:
         self.add_attribute('readonly')
     if disabled:
         self.add_attribute('disabled')
     if required:
         self.add_attribute('required')
示例#3
0
 def __init__(self,
              name,
              value=None,
              desc=None,
              prop=None,
              style=None,
              attr=None,
              min=None,
              max=None,
              readonly=False,
              disabled=False,
              required=False,
              css_cls=None):
     Widget.__init__(self,
                     name,
                     desc=desc,
                     prop=prop,
                     style=style,
                     attr=attr,
                     css_cls=css_cls)
     self.add_property('type', 'range')
     if value is not None:
         self.add_property('value', value)
     if min is not None:
         self.add_property('min', min)
     if max is not None:
         self.add_property('max', max)
     if readonly:
         self.add_attribute('readonly')
     if disabled:
         self.add_attribute('disabled')
     if required:
         self.add_attribute('required')
示例#4
0
 def __init__(self,
              name,
              text=None,
              desc=None,
              prop=None,
              style=None,
              attr=None,
              readonly=False,
              disabled=False,
              required=False,
              css_cls=None):
     Widget.__init__(self,
                     name,
                     desc=desc,
                     prop=prop,
                     style=style,
                     attr=attr,
                     css_cls=css_cls)
     self.add_property('type', 'text')
     if text is not None:
         self.add_property('value', text)
     if readonly:
         self.add_attribute('readonly')
     if disabled:
         self.add_attribute('disabled')
     if required:
         self.add_attribute('required')
示例#5
0
 def __init__(self,
              name,
              desc=None,
              prop=None,
              style=None,
              attr=None,
              readonly=False,
              disabled=False,
              required=False,
              multiple=False,
              css_cls=None):
     Widget.__init__(self,
                     name,
                     desc=desc,
                     prop=prop,
                     style=style,
                     attr=attr,
                     css_cls=css_cls)
     self.add_property('type', 'file')
     if readonly:
         self.add_attribute('readonly')
     if disabled:
         self.add_attribute('disabled')
     if required:
         self.add_attribute('required')
     if multiple:
         self.add_attribute('multiple')
示例#6
0
 def __init__(self, name, rows, columns, row_ratio=None, col_ratio=None,
              desc=None, prop=None, style=None, css_cls=None):
     """Default constructor with rows and columns parameters"""
     Widget.__init__(self, name, desc=desc, tag='table', prop=prop,
                     style=style, css_cls=css_cls)
     self._number_of_columns = columns
     self._number_of_rows = rows
     self._child_widgets = {}
     if row_ratio is not None:
         self._rows_ratio = row_ratio
     else:
         self._rows_ratio = []
     if col_ratio is not None:
         self._columns_ratio = col_ratio
     else:
         self._columns_ratio = []
     self.add_css_class('ui-widget')
     self.add_css_class('ui-widget-content')
示例#7
0
 def __init__(self,
              name,
              desc=None,
              prop=None,
              style=None,
              attr=None,
              action=None,
              target=None,
              method=None,
              use_fieldset=False,
              legend=None,
              app=None,
              submit_callback=None,
              css_cls=None):
     Widget.__init__(self,
                     name,
                     desc=desc,
                     prop=prop,
                     style=style,
                     attr=attr,
                     css_cls=css_cls)
     if submit_callback is not None:
         self._on_form_submitted = submit_callback
     if app is not None:
         self._app = app
     if target is not None:
         self.add_property('target', target)
     if method is not None:
         self.add_property('method', method)
     self._use_fieldset = use_fieldset
     self._legend = legend
     if app is not None and submit_callback is not None:
         self._register_rule()
     else:
         if action is not None:
             self.add_property('action', action)
示例#8
0
 def __init__(self, name, text, for_widget):
     Widget.__init__(self, name)
     self._text = text
     self._for_widget = for_widget
     self.add_property('for', for_widget.get_name())
示例#9
0
 def __init__(self, name, desc=None, prop=None, style=None, css_cls=None):
     """Default constructor with rows and columns parameters"""
     Widget.__init__(self, name, desc=desc, tag='div', prop=prop,
                     style=style, css_cls=css_cls)
     self.add_css_class('ui-widget')
     self.add_css_class('ui-widget-content')