Ejemplo n.º 1
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
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
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
Ejemplo n.º 4
0
def create_stuff(i, week):
    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
Ejemplo n.º 5
0
 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
Ejemplo n.º 6
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()
Ejemplo n.º 7
0
from sample_widgets import label1, label2, label3, label4, button1, button2, button3, exit_button
from constants import WIN, HIN, VT, HL, VC, VB, HAS, HC, WEX
from containernode import GFrame_Row, GFrame_Column, HBox, VBox
from tablenode import GTable
from sample_table import SampleTable
from build import build_gui
import tkinter as TK

tb = SampleTable()
con1 = VBox('Box1', [tb])
con2 = GFrame_Row('Row4', [exit_button],
                  height=40,
                  parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])
con3 = HBox('Box2', [con1, con2])

root = TK.Tk()

g = con3
build_gui(root, g)
exit_button.set_command(root.destroy)

root.mainloop()
Ejemplo n.º 8
0
from containernode import GFrame_Row, GFrame_Column, HBox, VBox
from build import build_gui
import tkinter as TK

from sample_widgets import label1, label2, label3, label4, button1, button2, button3, exit_button

def tick():
    print (root.geometry())
    root.after(500, tick) # Constantly loop through this code

def resize_test():
    # See what happens when the app width is changed and build called again
    con8.width += 40
    build_gui(root, con8)

con1 = GFrame_Row('Row1', [label1, label2], height = 40, parms=[WIN, HIN, HL, VC,[5,5,5], [0,0]])
con1.configure(background='lightblue')
con2 = GFrame_Row('Row2', [label3, label4], height=40, parms=[WIN, HAS, HL, VC,[5,5,5], [0,0]])
con2.configure(background='lightgrey')
#con3 = GFrame_Column('Column1', [con1, con2], parms=[WIN, HIN, HL, VC,[0,0,0], [0,0]])

con3 = HBox('Con3', [con1,con2])
con3.configure(background='grey')

con4 = GFrame_Column('Column2', [button1, button2, button3], width=150, parms=[WIN, HIN, HC, VC,[0,0], [5,5,5]])
con4.configure(background='grey')
#con5 = GFrame_Row('Row3', [con3, con4], parms=[WIN, HIN, HL, VC,[0,0,0], [0,0]])
con5 = VBox('Con5',[con3, con4])
con5.configure(background='lightgreen')

con6 = GFrame_Row('Row4',[exit_button], height=40, parms=[WIN, HIN, HC, VC,[0,0,0], [0,0]])
Ejemplo n.º 9
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()
Ejemplo n.º 10
0
from sample_widgets import label1, label2, label3, label4, button1, button2, button3, exit_button


def tick():
    print(root.geometry())
    root.after(500, tick)  # Constantly loop through this code


def resize_test():
    # See what happens when the app width is changed and build called again
    con8.width += 40
    build_gui(root, con8)


con1 = GFrame_Row('Row1', [label1, label2],
                  height=40,
                  parms=[WIN, HIN, HL, VC, [5, 5, 5], [0, 0]])
con1.configure(background='lightblue')
con2 = GFrame_Row('Row2', [label3, label4],
                  height=40,
                  parms=[WIN, HAS, HL, VC, [5, 5, 5], [0, 0]])
con2.configure(background='lightgrey')
#con3 = GFrame_Column('Column1', [con1, con2], parms=[WIN, HIN, HL, VC,[0,0,0], [0,0]])

con3 = HBox('Con3', [con1, con2])
con3.configure(background='grey')

con4 = GFrame_Column('Column2', [button1, button2, button3],
                     width=150,
                     parms=[WIN, HIN, HC, VC, [0, 0], [5, 5, 5]])
con4.configure(background='grey')
Ejemplo n.º 11
0
from constants import WIN, HIN, VT, HL, VC, VB, HAS, HC, WEX
from containernode import GFrame_Row, GFrame_Column, HBox, VBox
from build import build_gui
import tkinter as TK

con1 = GFrame_Row('Row1', [],
                  width=100,
                  height=40,
                  parms=[WIN, HIN, HL, VC, [], []])
con2 = GFrame_Row('Row2', [],
                  width=150,
                  height=30,
                  parms=[WIN, HAS, HL, VC, [], []])
#con3 = GFrame_Column('Column1', [con1, con2], parms=[WIN, HIN, HL, VC,[0,0,0], [0,0]])
con3 = HBox('Box1', [con1, con2])
#con3 = VBox('Box1', [con1, con2])
#con3 = HBox('Box1', [con1, con2], width=200, height = 100)
#con3 = VBox('Box1', [con1, con2], width=200, height = 100)

root = TK.Tk()

g = con3
build_gui(root, g)
con1.widget.config(bg="red")
con2.widget.config(bg="blue")
con3.widget.config(bg="green")

root.mainloop()
Ejemplo n.º 12
0
mongo = MongoClient('localhost', 27017)
db = mongo.Production
jobs = db.Jobs
job_recs = jobs.find({"company": 'MTC', "customer": 'CRC'})
x = list(job_recs)
x = sorted(x, key=lambda y: y['received'], reverse=True)
#print (x)
print('-')
print(x[0])

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

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

tb = crc_table(x)
con1 = VBox('Box1', [tb])
con2 = GFrame_Row('Row4', [exit_button],
                  height=40,
                  parms=[WIN, HIN, HC, VC, [0, 0, 0], [0, 0]])
con3 = HBox('Box2', [header, con1, con2])

root = TK.Tk()

g = con3
build_gui(root, g)
exit_button.set_command(root.destroy)
title.widget.configure(foreground="black",