def ReportaTipo(type, nombre='vocabulario.doc', noClaves=False): rootElement = QueryTesNode.filter_by(name=type) Vorden = getVOrden(type) try: rootElement = rootElement[0] salida=codecs.open(nombre,'w','utf-8') header = HTMLHeader() encClave,encID= 'Clave','ID' if noClaves: encClave,encID = '','' salida.write(header) expr = "<tr><td colspan=5><p class=titulo>Tesauro:%s - %s</p></td></tr>"%(rootElement.name, rootElement.descripcion) salida.write(expr) expr = "<tr border=0><td><b>%s</b></td><td width=%s><b>%s</b></td><td><b>%s</b></td><td><b>%s</b></td><td><b>%s</b></td></tr>\n"%('Nivel','70%',u'T\xe9rmino',encClave,encID,'Notas de alcance') salida.write(expr) DesarrollaTipo(rootElement, 0, salida, noClaves=noClaves, VOrden=Vorden) salida.close() except: print "no existe ", sys.exc_info()
def getTaxonomyTree(prnt, type, title, Pattern=None, ctrl=None, id=None, poli=None, VOrden=None, deep=None, help=u'', search=False): #if type in status.dlg.keys() and not search and type not in status.dlgExcepciones: if type in status.dlg[search].keys() and type not in status.dlgExcepciones: dlg = status.dlg[search][type] dlg.staticTextNotas.Clear() if dlg.help != help: LlenaAyuda(dlg, help) dlg.help = help else: dlg = DialogTaxTree(prnt) dlg.search = search dlg.staticTextNotas.Clear() dlg.help = help dlg.poli=poli VOrden = getVOrden(type) query = QueryTesNode.filter_by(name=type) cuenta = None try: cuenta = query.count() except: MError(None, u"Ocurri\xf3 un problema de acceso a la red. Se recomienda cerrar el programa y volver a ejecutarlo") if cuenta: rootElement = QueryTesNode.filter_by(name=type)[0] if deep: maxDeep = deep else: maxDeep = 999 LlenaTree(dlg.treeCtrl1, None, rootElement, NamePattern=Pattern, poli=poli, VOrden=VOrden, maxDeep=maxDeep) dlg.Title=title selecciones = dlg.treeCtrl1.GetSelections() dlg.checkBoxInvertir.Show(search) LlenaAyuda(dlg, help) else: # if query.count(): MError(prnt, type +u": Vocabulario inv\xe1lido") dlg.Destroy() return None if not search and not (type in status.dlgExcepciones): status.dlg[search][type]=dlg dlg.treeCtrl1.CollapseAll() root = dlg.treeCtrl1.GetRootItem() dlg.treeCtrl1.Expand(root) dlg.tipoActual = None dlg.tiposActuales = [] dlg.ShowModal() if ctrl: ctrl.SetLabel( dlg.tipoActual.descripcion) tipo = dlg.tipoActual tipos = dlg.tiposActuales invertir = dlg.checkBoxInvertir.GetValue() #dlg.Destroy() if search: return tipos, invertir, dlg.cancelar else: return tipo