示例#1
0
def create_footer(root):
    # Close application
    b = GButton('Quit', width=100, height=30, text='Quit')
    b.set_command(root.destroy)
    ft = GFrame_Row('RowFooter', [b],
                    height=40,
                    parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])
    return ft
    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()
示例#3
0
def main(alljobs, stagelist):
    #print (x)
    print ('-')
    print (alljobs[0])
    stage = stagelist[0]
    #stage = 'ced'
    print ('-'*70)
    weeks = current_delivery(alljobs, stage)

    #for week in weeks:
    #    print (week['title'])
    #    for job in week['jobs']:
    #        print (job['jobname'])

 
    title = GLabel('Title', width=300, height=20, text='Latest CRC Jobs')

    header = GFrame_Row('Header', [title], height = 40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]])
    footer = GFrame_Row('Footer',[exit_button], height=40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]])

    stagelabel = GLabel('Title', width=100, height=20, text=stage)
    stagerow = GFrame_Row('StageRow',[stagelabel], height=40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]])

    # Create stage selection button
    cedbutton = GButton('GetCED', width=100, height=30, text='CED')
    initialbutton = GButton('GetInitial', width=100, height=30, text='Initial')
    secondpagesbutton = GButton('SecondPages', width=100, height=30, text='Second Pages')
    finalpagesbutton = GButton('FinalPages', width=100, height=30, text='Final Pages')
    sbutton = GFrame_Row('SButtonRow',[cedbutton, initialbutton, secondpagesbutton, finalpagesbutton], height=40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]])

    widgets = [header, sbutton, stagerow]
   # Create table
    for i, week in enumerate(weeks):
        tb = create_stuff(i, week)
        widgets.append(tb)
    widgets.append(footer) 
    con3 = HBox('MainBox', widgets)

    root = TK.Tk()

    g = con3
    build_gui(root, g)
    status = ['quit']
    exit_button.set_command(root.destroy)
    cedbutton.set_command(lambda: clicked(root, status, 'ced') )
    initialbutton.set_command(lambda: clicked(root, status, 'initial') )
    secondpagesbutton.set_command(lambda: clicked(root, status, '2ndpages') )
    finalpagesbutton.set_command(lambda: clicked(root, status, 'finalpages') )
    title.widget.configure(foreground="black", font='arial 14 bold', background='white')
    stagelabel.widget.configure(foreground="black", font='arial 12 bold', background='white')
    root.mainloop()
    # Now which button was pressed?
    return status
示例#4
0
# Create the widgets for the sample
from widgetnode import GLabel, GButton

label1 = GLabel('Label1', width=100, height=20)
label2 = GLabel('Label2', width=100, height=20)
label3 = GLabel('Label3', width=100, height=20)
label4 = GLabel('Label4', width=100, height=30)

button1 = GButton('Button1', width=100, height=30)
button2 = GButton('Button2', width=100, height=30)
button3 = GButton('Button3', width=100, height=30)
exit_button = GButton('ExitButton', text='Quit', width=100, height=30)
示例#5
0
import tkinter as TK

from widgetnode import GLabel, GButton
from containernode import GFrame_Row, GFrame_Column, HBox, VBox
from constants import WIN, HIN, VT, HL, VC, VB, HAS, HC, WEX
from build import build_gui


root = TK.Tk()

t = GLabel('Title', width=300, height=20, text = 'AMCAT')

header = GFrame_Row('Header', [t], parms=[WIN, HIN, HC, VC,[10,10], [15,15]])

b1 = GButton('Save', width=100, height=30, text='Save')
b1.set_command(root.destroy)
b2 = GButton('Cancel', width=100, height=30, text='Cancel')

footer = GFrame_Row('RowFooter',[b1, b2], height=40, parms=[WIN, HIN, HC, VC,[10,5,10], [0,0]])

main_container = HBox('main', [header,footer])

build_gui(root, main_container)

root.mainloop()
def create_footer(root):
    # Close application
    b = GButton("Quit", width=100, height=30, text="Quit")
    b.set_command(root.destroy)
    ft = GFrame_Row("RowFooter", [b], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])
    return ft
class Main:
    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()

    def create_stage(self, stage):
        status = self.children.get(stage, None)
        if status:
            parentName = status.widget.winfo_parent()
            # print (parentName)
            parent = status.widget._nametowidget(parentName)
            parent.destroy()
            self.children[stage] = None
        else:
            self.children[stage] = self.create_stage_window(stage)
            self.children[stage].root.protocol("WM_DELETE_WINDOW", lambda: self.create_stage(stage))
            # self.children[stage].root.overrideredirect(1) # Removes window border and all the buttons on the top right
            # self.children[stage].root.lift()

    def create_stage_window(self, stage):
        stagelabel = GLabel(stage + "StageTitle", width=100, height=20, text=stage)
        stagerow = GFrame_Row(stage + "StageRow", [stagelabel], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])
        stagerow.configure(background="black")
        # Create table
        widgets = [stagerow]
        weeks = current_delivery(self.job_recs, stage)
        for i, week in enumerate(weeks):
            tb = create_stage_table(i, week)
            widgets.append(tb)
        stage_window = HBox(stage + "MainBox", widgets)
        # Position Topwindow right of buttons
        x, y = self.ced_button.get_absolute_x_y()
        x += self.ced_button.width + 10
        build_gui(None, stage_window, xpos=x)
        # stagerow.widget.configure(background='black')
        return stage_window
示例#8
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()
示例#9
0
class Main():
    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()

    def create_stage(self, stage):
        status = self.children.get(stage, None)
        if status:
            parentName = status.widget.winfo_parent()
            #print (parentName)
            parent = status.widget._nametowidget(parentName)
            parent.destroy()
            self.children[stage] = None
        else:
            self.children[stage] = self.create_stage_window(stage)
            self.children[stage].root.protocol(
                "WM_DELETE_WINDOW", lambda: self.create_stage(stage))
            #self.children[stage].root.overrideredirect(1) # Removes window border and all the buttons on the top right
            #self.children[stage].root.lift()

    def create_stage_window(self, stage):
        stagelabel = GLabel(stage + 'StageTitle',
                            width=100,
                            height=20,
                            text=stage)
        stagerow = GFrame_Row(stage + 'StageRow', [stagelabel],
                              height=40,
                              parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])
        stagerow.configure(background='black')
        # Create table
        widgets = [stagerow]
        weeks = current_delivery(self.job_recs, stage)
        for i, week in enumerate(weeks):
            tb = create_stage_table(i, week)
            widgets.append(tb)
        stage_window = HBox(stage + 'MainBox', widgets)
        # Position Topwindow right of buttons
        x, y = self.ced_button.get_absolute_x_y()
        x += self.ced_button.width + 10
        build_gui(None, stage_window, xpos=x)
        #stagerow.widget.configure(background='black')
        return stage_window
def main(alljobs, stagelist):
    # print (x)
    print("-")
    print(alljobs[0])
    stage = stagelist[0]
    # stage = 'ced'
    print("-" * 70)
    weeks = current_delivery(alljobs, stage)

    # for week in weeks:
    #    print (week['title'])
    #    for job in week['jobs']:
    #        print (job['jobname'])

    title = GLabel("Title", width=300, height=20, text="Latest CRC Jobs")

    header = GFrame_Row("Header", [title], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])
    footer = GFrame_Row("Footer", [exit_button], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])

    stagelabel = GLabel("Title", width=100, height=20, text=stage)
    stagerow = GFrame_Row("StageRow", [stagelabel], height=40, parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])

    # Create stage selection button
    cedbutton = GButton("GetCED", width=100, height=30, text="CED")
    initialbutton = GButton("GetInitial", width=100, height=30, text="Initial")
    secondpagesbutton = GButton("SecondPages", width=100, height=30, text="Second Pages")
    finalpagesbutton = GButton("FinalPages", width=100, height=30, text="Final Pages")
    sbutton = GFrame_Row(
        "SButtonRow",
        [cedbutton, initialbutton, secondpagesbutton, finalpagesbutton],
        height=40,
        parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]],
    )

    widgets = [header, sbutton, stagerow]
    # Create table
    for i, week in enumerate(weeks):
        tb = create_stuff(i, week)
        widgets.append(tb)
    widgets.append(footer)
    con3 = HBox("MainBox", widgets)

    root = TK.Tk()

    g = con3
    build_gui(root, g)
    status = ["quit"]
    exit_button.set_command(root.destroy)
    cedbutton.set_command(lambda: clicked(root, status, "ced"))
    initialbutton.set_command(lambda: clicked(root, status, "initial"))
    secondpagesbutton.set_command(lambda: clicked(root, status, "2ndpages"))
    finalpagesbutton.set_command(lambda: clicked(root, status, "finalpages"))
    title.widget.configure(foreground="black", font="arial 14 bold", background="white")
    stagelabel.widget.configure(foreground="black", font="arial 12 bold", background="white")
    root.mainloop()
    # Now which button was pressed?
    return status