760 def elem(elemtype,innerHTML='',html_class='',**kwargs):
762 kwargs[
'class']=html_class
763 return "<%s %s>%s</%s>\n" % (elemtype,
' '.
join([
'%s="%s"'%(k,v)
for k,v
in kwargs.items()]),innerHTML,elemtype)
764 def div(innerHTML='',html_class='',**kwargs):
765 return elem(
'div',innerHTML,html_class,**kwargs)
768 def linkInputTag(tag):
770 if isinstance(tag,typ.InputTag):
771 inputtag = tag.pythonValue()
779 for k,v
in pset.items():
780 if isinstance(v,mix._ParameterTypeBase):
781 if isinstance(v,mix._SimpleParameterTypeBase):
783 if isinstance(v,typ.bool):
785 if isinstance(v,typ.double):
787 if isinstance(v,typ.string):
789 if isinstance(v,(typ.int32, typ.uint32, typ.int64, typ.uint64)):
791 pset_items_html+=
elem(
'tr',
792 elem(
'td',k,
'param-name')
793 +
elem(
'td',v.pythonTypeName(),
'param-class')
794 +
elem(
'td',v.pythonValue(),
'param-value-%s'%item_class),
797 if isinstance(v,typ.InputTag):
798 pset_items_html+=
elem(
'tr',
799 elem(
'td',k,
'param-name')
800 +
elem(
'td',v.pythonTypeName(),
'param-class')
801 +
elem(
'td',linkInputTag(v),
'param-value-inputtag'),
804 if isinstance(v,typ.PSet):
806 if len(v.parameters_())==0:
807 pset_items_html+=
elem(
'tr',
808 elem(
'td',k,
'param-name')
809 +
elem(
'td',v.pythonTypeName(),
'param-class')
810 +
elem(
'td',
'(empty)',
'label'),
814 pset_items_html+=
elem(
'tr',
815 elem(
'td',k,
'param-name')
816 +
elem(
'td',v.pythonTypeName(),
'param-class')
817 +
elem(
'td',htmlPSet(v.parameters_())),
820 if isinstance(v,mix._ValidatingListBase):
823 list_html =
elem(
'li',
'(empty)',
'label')
825 if isinstance(v,typ.VInputTag):
827 list_html +=
elem(
'li',linkInputTag(vv),
'param-value-inputtag pset-list-item')
828 elif isinstance(v,typ.VPSet):
830 list_html +=
elem(
'li',htmlPSet(vv.parameters_()),
'pset-list-item')
833 if isinstance(v,typ.vbool):
835 if isinstance(v,typ.vdouble):
837 if isinstance(v,typ.vstring):
839 if isinstance(v,(typ.vint32,typ.vuint32,typ.vint64,typ.vuint64)):
844 list_html +=
elem(
'li',vv,
'pset-list-item param-value-%s'%item_class)
845 pset_items_html+=
elem(
'tr',
846 elem(
'td',k,
'param-name')
847 +
elem(
'td',
'%s[%s]'%(v.pythonTypeName(),len(v)),
'param-class')
848 +
elem(
'td',
elem(
'ol',list_html,
'pset-list')),
853 return elem(
'table',pset_items_html,
'pset')
856 mod_label_html = div(
elem(
'a',data.label(mod),
'title',name=data.label(mod)),
'module_label '+data.type(mod),onClick=
'return toggleModuleVisible(\'%s\')'%(
'mod_%s'%(data.label(mod))))
858 mod_table =
elem(
'table',
859 elem(
'tr',
elem(
'td',
'Type',
'label')+
elem(
'td',data.type(mod)))
860 +
elem(
'tr',
elem(
'td',
'Class',
'label')+
elem(
'td',data.classname(mod))),
863 mod_pset = htmlPSet(mod.parameters_())
865 mod_content_html = div(mod_table+mod_pset,
'module_area',id=
'mod_%s'%data.label(mod))
866 return div(mod_label_html+mod_content_html,
'module',id=
'module_'+data.label(mod))
868 def htmlPathRecursive(p):
869 children = data.children(p)
872 if isinstance(p,sqt.Path):
874 if isinstance(p,sqt.EndPath):
876 seq_label_html = div(seq_name+
' '+
elem(
'span',data.label(p),
'title')+
' '+
elem(
'span',
'[%s children hidden]'%len(children),
'hidden',id=
'seq_hidden_%s'%data.label(p)),
'sequence_label',onClick=
'return toggleSequenceVisible(\'%s\')'%data.label(p),id=
'seq_label_%s'%data.label(p))
877 seq_inner_content_html =
''.
join([htmlPathRecursive(c)
for c
in children])
878 seq_content_html = div(seq_inner_content_html,
'sequence_area',id=
'seq_%s'%data.label(p))
879 return div(seq_label_html+seq_content_html,
'sequence')
887 filter_html =
elem(
'span',
'Filter '+
888 elem(
'input',type=
'text',width=50,onkeyup=
"return doFilter();",id=
'input-filter'),
891 header_html = div(
'Config File Visualisation'+filter_html,
'header')
894 for tlo
in data.children(data.topLevelObjects()[0]):
895 children = data.children(tlo)
897 toplevel[tlo._label]=children
899 if 'paths' in toplevel:
900 for path
in toplevel[
'paths']:
901 path_html += div(htmlPathRecursive(path),
'path')
903 file_html = div(
elem(
'span',
'Process:')
904 +
elem(
'span',data.process().name_(),
'title')
905 +
elem(
'span',data._filename,
'right'),
907 head_html =
elem(
'head',
elem(
'title',data.process().name_()))
909 toplevel[
'sequences']=[]
911 toplevel[
'modules']=[]
912 for tlo
in data.topLevelObjects():
913 if data.type(tlo)==
'Sequence':
914 toplevel[
'sequences']+=[tlo]
915 if data.type(tlo)==
'Path':
916 toplevel[
'paths']+=[tlo]
917 if data.type(tlo)
in (
'EDAnalyzer',
'EDFilter',
'EDProducer',
'OutputModule'):
918 toplevel[
'modules']+=[tlo]
923 for path
in toplevel[
'paths']:
924 path_html += div(htmlPathRecursive(path),
'path')
925 for sequence
in toplevel[
'sequences']:
926 sequence_html += htmlPathRecursive(sequence)
927 for module
in toplevel[
'modules']:
928 module_html += htmlModule(module)
929 file_html = div(
elem(
'span',data._filename,
'right'),
'file')
930 path_html += sequence_html
931 path_html += module_html
932 head_html =
elem(
'head',
elem(
'title',data._filename))
933 footer_html = div(
'gordon.ball',
'footer')
937 style_html =
elem(
'style',
939 .title{font-weight:bold}
941 .header{position:fixed;top:0px;left:0px;width:100%;background:#33cc00;font-weight:bold;font-size:120%}
942 .footer{position:fixed;bottom:0px;left:0px;width:100%;background:#33cc00;text-align:right}
943 .canvas{padding:40px 10px 40px 10px}
944 .file{position:relative;background:#bbb;width:100%;padding-left:5px}
945 .right{position:absolute;right:5px}
946 .sequence{border:1px solid #aaa}
947 .sequence:hover{border 1px solid #00ffff}
948 .sequence_label{background:lightskyblue;padding-left:5px}
949 .sequence_label:hover{background:#fff}
950 .sequence_label_hidden{background:grey;padding-left:5px}
951 .sequence_area{padding:5px 0px 5px 5px}
952 .edproducer{border:1px solid red;background-image:url('edproducer.png');background-position:center left;background-repeat:no-repeat;padding:0px 0px 0px 40px}
953 .edfilter{border:1px solid green;background-image:url('edfilter.png');background-position:center left;background-repeat:no-repeat;padding:0px 0px 0px 40px}
954 .edanalyzer{border:1px solid blue;background-image:url('edanalyzer.png');background-position:center left;background-repeat:no-repeat;padding:0px 0px 0px 40px}
955 .outputmodule{border:1px solid green;background-image:url('outputmodule.png');background-position:center left;background-repeat:no-repeat;padding:0px 0px 0px 40px}
957 .module_label:hover{background:#ccc;position:relative}
958 .module_area{display:none;padding:5px 0px 15px 15px;background:beige}
959 .pset{border-spacing:10px 1px;border:1px solid black}
961 .pset-list{list-style-type:none;margin:0px;padding:2px 2px 2px 2px;border:1px solid grey}
962 .pset-list-item{border-top:1px solid lightgrey;border-bottom:1px solid lightgrey}
963 .param-name{font-weight:bold}
964 .param-class{color:grey}
965 .param-value-int{font-family:courier;color:blue}
966 .param-value-double{font-family:courier;color:purple}
967 .param-value-string{font-family:courier;color:brown}
968 .param-value-bool{font-family:courier;color:#f0f}
969 .param-value-inputtag{font-family:courier;color:red}
970 .param-value-other{font-family:courier}
972 .hidden{display:none}
976 script_html =
elem(
'script',
978 function toggleModuleVisible(id) {
979 var elem = document.getElementById(id);
980 if (elem.style.display=='block') {
981 elem.style.display='none';
983 elem.style.display='block';
987 function toggleSequenceVisible(id) {
988 var area_elem = document.getElementById('seq_'+id);
989 var hidden_elem = document.getElementById('seq_hidden_'+id);
990 var label_elem = document.getElementById('seq_label_'+id);
991 if (area_elem.style.display=='none') {
992 area_elem.style.display='block';
993 hidden_elem.style.display='none';
994 label_elem.className = 'sequence_label';
996 area_elem.style.display='none';
997 hidden_elem.style.display='block';
998 label_elem.className = 'sequence_label_hidden';
1002 function doFilter() {
1003 var text = document.getElementById('input-filter').value;
1004 var regex = new RegExp(text);
1005 for (var i=0;i<document.all.length;i++) {
1006 if (document.all(i).id.substr(0,7)=="module_") {
1007 var elem = document.all(i);
1008 var elem_name = elem.id.substr(7);
1009 if (regex.test(elem_name)) {
1010 elem.style.display='block';
1012 elem.style.display='none';
1018 type=
'text/javascript')
1020 body_html =
elem(
'body',script_html+header_html+footer_html+div(file_html+path_html,
'canvas'))
1022 return elem(
'html',head_html+style_html+body_html)