Пример #1
0
def test_SelectNode_deSelectNode():
    from mglutil.gui.BasicWidgets.Tk.TreeWidget.tree import TreeView
    tv = TreeView()
    #Add some nodes
    tv.addNode('protein_1')
    node = tv.addNode('residue_11', parent='protein_1')
    tv.addNode('AminoAcid', parent='protein_1|residue_11')
    tv.addNode('A', parent='protein_1|residue_11|AminoAcid')
    tv.addNode('H', parent='protein_1|residue_11|AminoAcid')
    tv.addNode('protein_2')

    selection = tv.GetSelected()
    if selection:
        print "Now", selection.name, "is selected"
    else:
        print "Nothing is selected"

    # Now select a node
    tv.Select("protein_1|residue_11|AminoAcid|A")

    selection = tv.GetSelected()
    if selection:
        print "***", selection.name, "is selected ***"
    else:
        print "Nothing is selected"

    tv.destroy()
Пример #2
0
def test_NoHistory():
    """ Test the crateion of a TreeView with no history Pane """

    tv = TreeView(nohistory=True)
    # paint canvas red so we see it disappear when distroyed
    tv.canvas.configure(bg='red')

    tv.addNode('protein_1')
    tv.addNode('residue_11', parent='protein_1')
    tv.addNode('AminoAcid', parent='protein_1|residue_11')
    tv.addNode('A', parent='protein_1|residue_11|AminoAcid')
    tv.addNode('H', parent='protein_1|residue_11|AminoAcid')
    tv.addNode('protein_2')

    tv.Select("protein_1|residue_11|AminoAcid|A")

    selection = tv.GetSelected()
    if selection:
        print "Adding", selection.name, "to the history list"
    else:
        print "Nothing is selected"

    # add the current selected node to the list
    tv.AddToHistoryList()

    #tv.topFrame.master.update()
    pause(0.2)
    tv.destroy()
Пример #3
0
def test_Add_to_History():
    from mglutil.gui.BasicWidgets.Tk.TreeWidget.tree import TreeView
    tv = TreeView()
    tv.addNode('protein_1')
    tv.addNode('residue_11', parent='protein_1')
    tv.addNode('AminoAcid', parent='protein_1|residue_11')
    tv.addNode('A', parent='protein_1|residue_11|AminoAcid')
    tv.addNode('H', parent='protein_1|residue_11|AminoAcid')
    tv.addNode('protein_2')

    tv.Select("protein_1|residue_11|AminoAcid|A")

    selection = tv.GetSelected()
    if selection:
        print "Adding", selection.name, "to the history list"
    else:
        print "Nothing is selected"

    # add the current selected node to the list
    tv.AddToHistoryList()

    tv.destroy()