Commits

Anonymous committed 48c2a8e

[svn] Make tw.dynforms work with tw. namespace

Comments (0)

Files changed (1)

toscawidgets/widgets/dynforms/widgets.py

-import toscawidgets.api as tw, toscawidgets.widgets.forms as twf
+import tw, tw.forms as twf
 import sqlalchemy as sa, sqlalchemy.orm as sao, formencode as fe, turbojson
 
 __all__ = ['SmartList', 'WriteOnlyTextField', 'strip_wo_markers',
         return super(StripGrow, self)._to_python(value, state).get('grow', [])
 
 class GrowableTableFieldSet(twf.FieldSet):
-    javascript = [tw.JSLink(modname=__name__, filename="static/growing.js")]
+    javascript = [tw.api.JSLink(modname=__name__, filename="static/growing.js")]
     params = {
         'colspan': '',
         'dotitle': 'Whether to include a title row in the table',
     validator = StripGrow
 
     def __new__(cls, id=None, parent=None, children=[], **kw):        
-        #children.append(tw.Child(DelUndo, 'delundo'))
-        #children.append(tw.Child(twf.HiddenField, 'id', validator=fe.validators.Int))
+        #children.append(tw.api.Child(DelUndo, 'delundo'))
+        #children.append(tw.api.Child(twf.HiddenField, 'id', validator=fe.validators.Int))
         children.append(DelUndo('delundo'))
         children.append(twf.HiddenField('id', validator=fe.validators.Int))
-        children = [tw.Child(StrippingFieldRepeater, 'grow', widget=TrFieldSet('row', children=children))]
+        children = [tw.api.Child(StrippingFieldRepeater, 'grow', widget=TrFieldSet('row', children=children))]
         return twf.FieldSet.__new__(cls, id, parent, children, **kw)
 
 class GrowableTableForm(GrowableTableFieldSet):
 
 class GrowableRepeater(twf.FieldSet):   
     validator = StripRep
-    javascript = [tw.JSLink(modname=__name__, filename="static/growing.js")]
+    javascript = [tw.api.JSLink(modname=__name__, filename="static/growing.js")]
     template = 'toscawidgets.widgets.dynforms.templates.growablerepeater'
     params = ['button_text', 'widget']
     button_text = 'Add'
 
     def __new__(cls, id=None, parent=None, children=[], widget=None, **kw):
         children = [
-            tw.Child(twf.FormFieldRepeater, 'rep', widget=widget, extra=0, repetitions=1, max_repetitions=10),                        
-            tw.Child(widget, 'spare'),
-            tw.Child(twf.Button, 'add', default=cls.button_text, attrs={'onclick':"add_section(this, '')"}),
+            tw.api.Child(twf.FormFieldRepeater, 'rep', widget=widget, extra=0, repetitions=1, max_repetitions=10),                        
+            tw.api.Child(widget, 'spare'),
+            tw.api.Child(twf.Button, 'add', default=cls.button_text, attrs={'onclick':"add_section(this, '')"}),
         ]
         return twf.FieldSet.__new__(cls, id, parent, children, **kw)
 
 #--
 class HidingSingleSelectField(twf.SingleSelectField):
     template = 'genshi:toscawidgets.widgets.dynforms.templates.hiding_select_field'
-    javascript = [tw.JSLink(modname=__name__, filename='static/hiding.js')]
+    javascript = [tw.api.JSLink(modname=__name__, filename='static/hiding.js')]
     params = {
         'mapping': 'Dict that maps selection values to visible controls'
     }
 
 class LinkSingleSelectField(twf.SingleSelectField):
     template = "toscawidgets.widgets.dynforms.templates.link_select_field"
-    javascript = [tw.JSLink(modname=__name__, filename='static/hiding.js')]
+    javascript = [tw.api.JSLink(modname=__name__, filename='static/hiding.js')]
     params = {
         'link':         'Link target',
         'view_text':    'Allows you to override the text string "view"',
     fixed_fields = {}
 
     children = [
-        tw.Child(HidingSingleSelectField, 'select'),
-        tw.Child(twf.TextField, 'other'),
+        tw.api.Child(HidingSingleSelectField, 'select'),
+        tw.api.Child(twf.TextField, 'other'),
     ]
 
     # This is needed to avoid the value being coerced to a dict
 #--
 class AjaxLookupField(twf.FormField):
     "A text field that searches using AJAX"
-    javascript = [tw.JSLink(modname=__name__, filename="static/ajax_lookup.js"),
-                  tw.JSLink(modname=__name__, filename="static/hiding.js")] # just for hiding the view link
+    javascript = [tw.api.JSLink(modname=__name__, filename="static/ajax_lookup.js"),
+                  tw.api.JSLink(modname=__name__, filename="static/hiding.js")] # just for hiding the view link
     params = {
         'attrs':    '',
         'datasrc':  'SQLAlchemy data src',
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.