Exemplo n.º 1
0
def createTable(model):
    t = Toplevel()
    app = App(t)
    master = app.main
    table = TableCanvas(master, model, rowheaderwidth=50)
    table.createTableFrame()
    return table
def createTable(model):
    t=Toplevel()
    app = App(t)
    master = app.main
    table = TableCanvas(master, model,rowheaderwidth=50)
    table.createTableFrame()
    return table
Exemplo n.º 3
0
def test5():
    """frame placement"""
    import Pmw
    t = Toplevel()
    app = App(t)
    master = app.main
    w = Pmw.Group(master, tag_text='Show/Hide')
    w.pack(fill=BOTH)
    f = Frame(master)
    f.pack(fill=BOTH)
    table = TableCanvas(w)
    table.createTableFrame()
    return
Exemplo n.º 4
0
def test5():
    """frame placement"""
    import Pmw

    t = Toplevel()
    app = App(t)
    master = app.main
    w = Pmw.Group(master, tag_text="Show/Hide")
    w.pack(fill=BOTH)
    f = Frame(master)
    f.pack(fill=BOTH)
    table = TableCanvas(w)
    table.createTableFrame()
    return
Exemplo n.º 5
0
def test1(root):
    """Setup a table and populate it with data"""
    app = App(root)
    master = app.main
    model = TableModel()
    data = createData(40)
    # import after model created
    # print data
    model.importDict(data)
    table = TableCanvas(
        master,
        model,
        cellwidth=60,
        cellbackgr="#e3f698",
        thefont=("Arial", 12),
        rowheight=18,
        rowheaderwidth=30,
        rowselectedcolor="yellow",
        editable=True,
    )
    table.createTableFrame()
    # table.sortTable(columnName='label')
    # remove cols
    model.deleteColumns([0])
    model.deleteRows(range(0, 2))
    # table.redrawTable()
    # add rows and cols
    table.addRow(1, label="aaazzz")
    table.addRow(label="bbb")
    table.addRow(**{"label": "www"})
    table.addColumn("col6")
    model.data[1]["col6"] = "TEST"
    # table.redrawTable()
    # change col labels
    model.columnlabels["col6"] = "new label"
    # set and get selections
    table.setSelectedRow(2)
    table.setSelectedCol(1)
    table.setSelectedCells(1, 80, 2, 4)
    # print table.getSelectionValues()
    # table.plotSelected(graphtype='XY')
    # save data
    # table.addRows(50000)
    model.save("test.table")
    # load new data
    table.load("test.table")
    # root.after(2000, root.quit)
    return
def test2():
    """Multuple tables in one window"""
    t=Toplevel()
    app = App(t)
    master = app.main
    c=0; r=1
    for i in range(12):
        model = TableModel()
        data = createData(50)
        model.importDict(data)
        fr = Frame(master)
        if c%3==0: c=0; r+=1
        fr.grid(row=r,column=c,sticky='nws')
        table = TableCanvas(fr, model, width=250,height=150,rowheaderwidth=0)
        table.createTableFrame()
        c+=1
    return
Exemplo n.º 7
0
def test1(root):
    """Setup a table and populate it with data"""
    app = App(root)
    master = app.main
    model = TableModel()
    data = createData(40)
    #import after model created
    #print data
    model.importDict(data)
    table = TableCanvas(master,
                        model,
                        cellwidth=60,
                        cellbackgr='#e3f698',
                        thefont=('Arial', 12),
                        rowheight=18,
                        rowheaderwidth=30,
                        rowselectedcolor='yellow',
                        editable=True)
    table.createTableFrame()
    #table.sortTable(columnName='label')
    #remove cols
    model.deleteColumns([0])
    model.deleteRows(range(0, 2))
    #table.redrawTable()
    #add rows and cols
    table.addRow(1, label='aaazzz')
    table.addRow(label='bbb')
    table.addRow(**{'label': 'www'})
    table.addColumn('col6')
    model.data[1]['col6'] = 'TEST'
    #table.redrawTable()
    #change col labels
    model.columnlabels['col6'] = 'new label'
    #set and get selections
    table.setSelectedRow(2)
    table.setSelectedCol(1)
    table.setSelectedCells(1, 80, 2, 4)
    #print table.getSelectionValues()
    #table.plotSelected(graphtype='XY')
    #save data
    #table.addRows(50000)
    model.save('test.table')
    #load new data
    table.load('test.table')
    #root.after(2000, root.quit)
    return
Exemplo n.º 8
0
def test2():
    """Multuple tables in one window"""
    t = Toplevel()
    app = App(t)
    master = app.main
    c = 0
    r = 1
    for i in range(12):
        model = TableModel()
        data = createData(50)
        model.importDict(data)
        fr = Frame(master)
        if c % 3 == 0:
            c = 0
            r += 1
        fr.grid(row=r, column=c, sticky='nws')
        table = TableCanvas(fr, model, width=250, height=150, rowheaderwidth=0)
        table.createTableFrame()
        c += 1
    return
def test1(root):
    """Setup a table and populate it with data"""
    app = App(root)
    master = app.main
    model = TableModel()
    data = createData(40)
    #import after model created
    #print data
    model.importDict(data)
    table = TableCanvas(master, model,
                        cellwidth=60, cellbackgr='#e3f698',
                        thefont=('Arial',12),rowheight=18, rowheaderwidth=30,
                        rowselectedcolor='yellow', editable=True)
    table.createTableFrame()
    #table.sortTable(columnName='label')
    #remove cols
    model.deleteColumns([0])
    model.deleteRows(range(0,2))
    #table.redrawTable()
    #add rows and cols
    table.addRow(1,label='aaazzz')
    table.addRow(label='bbb')
    table.addRow(**{'label':'www'})
    table.addColumn('col6')
    model.data[1]['col6']='TEST'
    #table.redrawTable()
    #change col labels
    model.columnlabels['col6'] = 'new label'
    #set and get selections
    table.setSelectedRow(2)
    table.setSelectedCol(1)
    table.setSelectedCells(1,80,2,4)
    #print table.getSelectionValues()
    #table.plotSelected(graphtype='XY')
    #save data
    #table.addRows(50000)
    model.save('test.table')
    #load new data
    table.load('test.table')
    #root.after(2000, root.quit)
    return
Exemplo n.º 10
0
class App:

    def __init__(self, master):

        tframe = Frame(master)
        tframe.pack(fill=BOTH)
        
        d = {1: {'date': 1189774539.345525, 'message': 'Commiting project ', 'author': 'damien'},
             2: {'date': 1189776100.545814, 'message': 'tommytest1', 'author': 'tc'},
             3: {'date': 1189776148.873471, 'message': 'test', 'author': 'elisa'},
             4: {'date': 1189776217.082571, 'message': "barbara's wt and mutant", 'author': 'btconnolly'},
             5: {'date': 1189776969.9782951, 'message': 'Adding a column', 'author': 'nielsen'},
             6: {'date': 1189777126.719934, 'message': 'fergal_test', 'author': 'fomeara'},
             7: {'date': 1189777948.4796059, 'message': 'TEST', 'author': 'elisa'},
             8: {'date': 1189778073.3868899, 'message': 'Adding 7TLN and deleting damen wt', 'author': 'nielsen'},
             9: {'date': 1189778472.5035281, 'message': 'Adding exp. data', 'author': 'nielsen'},
             10: {'date': 1189778553.6663699, 'message': 'Adding NMR tirtaion curve', 'author': 'nielsen'},
             11: {'date': 1189778701.032536, 'message': 'blaah', 'author': 'nielsen'}}

        self.tmodel = TableModel()
        self.tmodel.importDict(d,None,columns = ['date','message','author'])
        self.table = TableCanvas(tframe, self.tmodel,upperColumnHeaders=None)
        self.table.createTableFrame()
        return