teting gst
This commit is contained in:
@@ -29,70 +29,70 @@ class GSTModule(XModule):
|
||||
def __init__(self, system, location, definition, descriptor, instance_state=None,
|
||||
shared_state=None, **kwargs):
|
||||
"""
|
||||
pass
|
||||
# Definition should have....
|
||||
# sliders, text, module
|
||||
Definition should have....
|
||||
sliders, text, module
|
||||
|
||||
# Sample file:
|
||||
Sample file:
|
||||
|
||||
# <gst>
|
||||
# <h2> Plot... </h2>
|
||||
# <slider name="1" var="a"/>
|
||||
# <number name="1" var="a"/>
|
||||
# <plot/>
|
||||
# <sliders_info>
|
||||
# <sliders/>
|
||||
# <numbers_info>
|
||||
# </numbers_info
|
||||
# <plot_info>
|
||||
# </plot_info>
|
||||
# </gst>
|
||||
# """
|
||||
# XModule.__init__(self, system, location, definition, descriptor,
|
||||
# instance_state, shared_state, **kwargs)
|
||||
# import ipdb; ipdb.set_trace()
|
||||
# self.rendered = False
|
||||
<gst>
|
||||
<h2> Plot... </h2>
|
||||
<slider name="1" var="a"/>
|
||||
<number name="1" var="a"/>
|
||||
<plot/>
|
||||
<sliders_info>
|
||||
<sliders/>
|
||||
<numbers_info>
|
||||
</numbers_info
|
||||
<plot_info>
|
||||
</plot_info>
|
||||
</gst>
|
||||
"""
|
||||
XModule.__init__(self, system, location, definition, descriptor,
|
||||
instance_state, shared_state, **kwargs)
|
||||
# import ipdb; ipdb.set_trace()
|
||||
# self.rendered = False
|
||||
|
||||
# def get_html(self):
|
||||
# self.render()
|
||||
# return self.content
|
||||
def get_html(self):
|
||||
self.render()
|
||||
return self.content
|
||||
|
||||
# def render(self):
|
||||
# import ipdb; ipdb.set_trace()
|
||||
# if self.rendered:
|
||||
# return
|
||||
# ## Returns a set of all types of all sub-children
|
||||
# contents = []
|
||||
# # import ipdb; ipdb.set_trace()
|
||||
# for child in self.get_display_items():
|
||||
# progress = child.get_progress()
|
||||
# childinfo = {
|
||||
# 'gst': child.get_html(),
|
||||
# 'plot': "\n".join(
|
||||
# grand_child.display_name.strip()
|
||||
# for grand_child in child.get_children()
|
||||
# if 'display_name' in grand_child.metadata
|
||||
# ),
|
||||
# # 'progress_status': Progress.to_js_status_str(progress),
|
||||
# 'progress_detail': Progress.to_js_detail_str(progress),
|
||||
# 'type': child.get_icon_class(),
|
||||
# }
|
||||
# # if childinfo['title']=='':
|
||||
# # childinfo['title'] = child.metadata.get('display_name','')
|
||||
# contents.append(childinfo)
|
||||
def render(self):
|
||||
# import ipdb; ipdb.set_trace()
|
||||
# if self.rendered:
|
||||
return
|
||||
## Returns a set of all types of all sub-children
|
||||
# contents = []
|
||||
# # import ipdb; ipdb.set_trace()
|
||||
# for child in self.get_display_items():
|
||||
# progress = child.get_progress()
|
||||
# childinfo = {
|
||||
# 'gst': child.get_html(),
|
||||
# 'plot': "\n".join(
|
||||
# grand_child.display_name.strip()
|
||||
# for grand_child in child.get_children()
|
||||
# if 'display_name' in grand_child.metadata
|
||||
# ),
|
||||
# # 'progress_status': Progress.to_js_status_str(progress),
|
||||
# 'progress_detail': Progress.to_js_detail_str(progress),
|
||||
# 'type': child.get_icon_class(),
|
||||
# }
|
||||
# # if childinfo['title']=='':
|
||||
# # childinfo['title'] = child.metadata.get('display_name','')
|
||||
# contents.append(childinfo)
|
||||
|
||||
# params = {'items': contents,
|
||||
# 'element_id': self.location.html_id(),
|
||||
# 'item_id': self.id,
|
||||
# 'position': self.position,
|
||||
# 'tag': self.location.category
|
||||
# }
|
||||
|
||||
# self.content = self.system.render_template('seq_module.html', params)
|
||||
# self.rendered = True
|
||||
# params = {'items': contents,
|
||||
# 'element_id': self.location.html_id(),
|
||||
# 'item_id': self.id,
|
||||
# 'position': self.position,
|
||||
# 'tag': self.location.category
|
||||
# }
|
||||
params= {}
|
||||
self.content = self.system.render_template('gst_module.html', params)
|
||||
# self.rendered = True
|
||||
|
||||
|
||||
class GSTDescriptor(RawDescriptor):
|
||||
# class GSTDescriptor(RawDescriptor):
|
||||
class GSTDescriptor(MakoModuleDescriptor, XmlDescriptor):
|
||||
mako_template = "widgets/html-edit.html"
|
||||
module_class = GSTModule
|
||||
template_dir_name = 'gst'
|
||||
@@ -108,7 +108,7 @@ class GSTDescriptor(RawDescriptor):
|
||||
'def2': 'def2-some-html'
|
||||
}
|
||||
"""
|
||||
import ipdb; ipdb.set_trace()
|
||||
# import ipdb; ipdb.set_trace()
|
||||
children = []
|
||||
for child in xml_object:
|
||||
try:
|
||||
@@ -120,7 +120,7 @@ class GSTDescriptor(RawDescriptor):
|
||||
|
||||
def definition_to_xml(self, resource_fs):
|
||||
'''Return an xml element representing this definition.'''
|
||||
import ipdb; ipdb.set_trace()
|
||||
# import ipdb; ipdb.set_trace()
|
||||
xml_object = etree.Element('gst')
|
||||
|
||||
def add_child(k):
|
||||
@@ -135,8 +135,8 @@ class GSTDescriptor(RawDescriptor):
|
||||
return xml_object
|
||||
|
||||
|
||||
def __init__(self, system, definition, **kwargs):
|
||||
'''Render and save the template for this descriptor instance'''
|
||||
import ipdb; ipdb.set_trace()
|
||||
super(CustomTagDescriptor, self).__init__(system, definition, **kwargs)
|
||||
self.rendered_html = self.render_template(system, definition['data'])
|
||||
# def __init__(self, system, definition, **kwargs):
|
||||
# '''Render and save the template for this descriptor instance'''
|
||||
# # import ipdb; ipdb.set_trace()
|
||||
# super(GSTDescriptor, self).__init__(system, definition, **kwargs)
|
||||
# self.rendered_html = self.render_template(system, definition['data'])
|
||||
Reference in New Issue
Block a user