Exemplo n.º 1
0
    def __init__(self):
        # Initialise database
        self.children = {}
        alljobs = get_crc_all_jobs()
        self.job_recs = alljobs
        self.root = TK.Tk()

        title = GLabel('Title', width=300, height=20, text='AMCAT')
        header = GFrame_Row('Header', [title],
                            height=40,
                            parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])
        tb = crc_newjobstable(self.job_recs)
        newjobs = HBox('Box1', [tb])
        # Add buttons on the left
        duedatetitle = GLabel('DueDateTitle',
                              width=100,
                              height=30,
                              text='Due Dates')
        self.ced_button = GButton('CED', width=100, height=30, text='CED')
        self.ced_button.set_command(lambda: self.create_stage('ced'))
        b2 = GButton('Initial', width=100, height=30, text='Initial')
        b2.set_command(lambda: self.create_stage('initial'))
        b3 = GButton('2ndPages', width=100, height=30, text='2nd Pages')
        b3.set_command(lambda: self.create_stage('2ndpages'))
        b4 = GButton('FinalPages', width=100, height=30, text='Final Pages')
        b4.set_command(lambda: self.create_stage('finalpages'))
        duedatebuttons = GFrame_Column(
            'DueDateButtons', [duedatetitle, self.ced_button, b2, b3, b4],
            width=140,
            parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0, 0]])

        centerbox = VBox('CenterBox', [duedatebuttons, newjobs])

        footer = create_footer(self.root)
        widgets = [header, centerbox, footer]
        self.mainbox = HBox('MainBox', widgets)
        build_gui(self.root, self.mainbox)
        title.widget.configure(foreground="black",
                               font='arial 14 bold',
                               background='white')
        duedatetitle.widget.configure(foreground="black",
                                      font='arial 12 bold',
                                      background='white')
        self.root.mainloop()
Exemplo n.º 2
0
    def __init__(self):
        # Initialise database
        self.children = {}
        alljobs = get_crc_all_jobs()
        self.job_recs = alljobs
        self.root = TK.Tk()

        title = GLabel("Title", width=300, height=20, text="AMCAT")
        header = GFrame_Row("Header", [title], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])
        tb = crc_newjobstable(self.job_recs)
        newjobs = HBox("Box1", [tb])
        # Add buttons on the left
        duedatetitle = GLabel("DueDateTitle", width=100, height=30, text="Due Dates")
        self.ced_button = GButton("CED", width=100, height=30, text="CED")
        self.ced_button.set_command(lambda: self.create_stage("ced"))
        b2 = GButton("Initial", width=100, height=30, text="Initial")
        b2.set_command(lambda: self.create_stage("initial"))
        b3 = GButton("2ndPages", width=100, height=30, text="2nd Pages")
        b3.set_command(lambda: self.create_stage("2ndpages"))
        b4 = GButton("FinalPages", width=100, height=30, text="Final Pages")
        b4.set_command(lambda: self.create_stage("finalpages"))
        duedatebuttons = GFrame_Column(
            "DueDateButtons",
            [duedatetitle, self.ced_button, b2, b3, b4],
            width=140,
            parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0, 0]],
        )

        centerbox = VBox("CenterBox", [duedatebuttons, newjobs])

        footer = create_footer(self.root)
        widgets = [header, centerbox, footer]
        self.mainbox = HBox("MainBox", widgets)
        build_gui(self.root, self.mainbox)
        title.widget.configure(foreground="black", font="arial 14 bold", background="white")
        duedatetitle.widget.configure(foreground="black", font="arial 12 bold", background="white")
        self.root.mainloop()
Exemplo n.º 3
0
    weektitle = GLabel('WeekTitle' + str(i), width=300, height=20)
    weektitle.set_text(week['title'])
    if week['jobs']:
        wrow = GFrame_Row('WRow'+str(i), [weektitle], height = 40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]])
        tb = crc_table(week['jobs'])
        b = VBox('Box1'+str(i), [tb])
        return HBox('Box2'+str(i), [weektitle, b])
    else:
        return weektitle

def crc_table(jobdata): # Data is list of dictionaries
    columns = [create_column('Name',width = 300, labelalign=LABEL_LEFT), create_column('Due'), create_column('Actual'), create_column('Comment',width = 500, labelalign=LABEL_LEFT) ]
    data = []
    for r in jobdata:
        row = [r['jobname'], r['duedate'], r['delivered'], r['comment']]
        data.append(row)
    t = GTable('table1',columns, data, view_rows=min(20, len(jobdata)))
    #t.data_clicked = data_clicked
    return t

if __name__ == '__main__':
    alljobs = get_crc_all_jobs()
    alljobs = sorted(alljobs, key = lambda y: y['received'], reverse=True)
    status = ['initial']
    while True:
        status = main(alljobs, status)
        print (status)
        if status[0] == 'quit':
            break

        return HBox("Box2" + str(i), [weektitle, b])
    else:
        return weektitle


def crc_table(jobdata):  # Data is list of dictionaries
    columns = [
        create_column("Name", width=300, labelalign=LABEL_LEFT),
        create_column("Due"),
        create_column("Actual"),
        create_column("Comment", width=500, labelalign=LABEL_LEFT),
    ]
    data = []
    for r in jobdata:
        row = [r["jobname"], r["duedate"], r["delivered"], r["comment"]]
        data.append(row)
    t = GTable("table1", columns, data, view_rows=min(20, len(jobdata)))
    # t.data_clicked = data_clicked
    return t


if __name__ == "__main__":
    alljobs = get_crc_all_jobs()
    alljobs = sorted(alljobs, key=lambda y: y["received"], reverse=True)
    status = ["initial"]
    while True:
        status = main(alljobs, status)
        print(status)
        if status[0] == "quit":
            break