def openXML(mainApp, filename=''): if askSaveChanges(mainApp): label_filename = mainApp.frames.menu.dic['label_filename'] if filename=='': filename = getFilename() if filename <> '': mainApp.frames.treeview.clean() mainApp.frames.buttons.clean() GL.filename = filename label_filename.config(text= GL.filename) root = xml_man.getXML(GL.filename) #root = xml_man.getXML('stylers.xml') if root == None: tkMessageBox.showerror('eXMLorer', 'El archivo %s no es un archivo XML valido' % GL.filename) label_filename.config(text= '') else: GL.dicTagsInTree = {} GL.appTreeView = tk_treeview.getTreeView(mainApp.frames.treeview, mainApp.frames.buttons, GL.dicTagsInTree) GL.dicTagsInTree[root.tag] = TIG.TagInTree('', root.tag, root, None, GL.appTreeView) mainApp.rootTIG = GL.dicTagsInTree[root.tag] addXMLToTree(root, root.tag, GL.dicTagsInTree, GL.appTreeView)
def refreshTreeview(mainApp): #clean treeview frame mainApp.frames.treeview.clean() #set globals GL.dicTagsInTree = {} GL.appTreeView = tk_treeview.getTreeView(mainApp.frames.treeview, mainApp.frames.buttons, GL.dicTagsInTree) #load xml dic and TIGs root = GL.XMLTree.getroot() GL.dicTagsInTree[root.tag] = TIG.TagInTree('', root.tag, root, None, GL.appTreeView) addXMLToTree(root, root.tag, GL.dicTagsInTree, GL.appTreeView) mainApp.update() selectAndFocus(GL.lastTreeViewFocus)