Beispiel #1
0
    def initUI(self):
        #portable
        p = Panedwindow(self.parent, orient=HORIZONTAL)
        leftFrame = LabelFrame(p)
        rightFrame = LabelFrame(p)
        p.add(leftFrame, weight=60)
        p.add(rightFrame, weight=40)
        p.pack(fill=BOTH, expand=1)
        p.pack_propagate(0)
        leftFrame.pack_propagate(0)
        rightFrame.pack_propagate(0)

        self.saveFrame = saveFrame = Frame(leftFrame)
        self.treeFrame = treeFrame = Frame(leftFrame)
        self.xScrollFrame = xScrollFrame = Frame(leftFrame)
        self.totalFrame = totalFrame = Frame(leftFrame)
        saveFrame.pack(expand=0, fill=X, side=TOP)
        totalFrame.pack(expand=0, fill=X, side=BOTTOM)
        xScrollFrame.pack(expand=0, fill=X, side=BOTTOM)
        treeFrame.pack(expand=1, fill=BOTH, side=TOP)

        self.saveDeleteFrame = Frame(rightFrame)
        self.fieldsFrame = VerticalScrolledFrame(rightFrame)
        self.saveDeleteFrame.pack(expand=0, fill=X, side=BOTTOM)
        self.fieldsFrame.pack(expand=1, fill=BOTH, side=TOP)

        self.generateNewButton()
Beispiel #2
0
    def initUI(self):
        self.printFrame = Frame(self)
        self.printFrame.pack(fill=X, expand=0, side=TOP)
        self.printButton = Button(self.printFrame,
                                  text="Export to docx",
                                  command=self.exportCallback)
        self.printButton.pack(fill=NONE, expand=0, side=LEFT)
        self.mainFrame = VerticalScrolledFrame(self)
        self.mainFrame.pack(fill=BOTH, expand=1, side=TOP)
        self.headerField = Text(self.mainFrame.interior,
                                bd=0,
                                width=0,
                                state='disabled',
                                height=3)
        self.headerField.tag_configure("center", justify="center")
        self.boldFont = f = Font(self.headerField,
                                 self.headerField.cget('font'))
        f.configure(weight='bold')
        self.headerField.configure(font=f)
        self.headerField.pack(fill=X, expand=0, side=TOP)

        self.cashFlowsText = TextTable(
            self.mainFrame.interior,
            aligns=['left', 'left', 'right', 'right', 'right', 'right'],
            weights=[4, 4, 1, 1, 1, 1],
            width=500)
        self.cashFlowsText.pack(expand=1, fill=BOTH, side=TOP)

        self.oalText = Text(self.mainFrame.interior,
                            bd=0,
                            width=0,
                            state='disabled',
                            height=0)
        self.oalText.tag_configure("bold", font=f)
        self.oalText.pack(fill=X, expand=0, side=TOP)

        self.noteChunk = NoteChunk(self.mainFrame.interior, self.app)
        self.noteChunk.pack(fill=BOTH, expand=1, side=TOP)
        self.noteBlocks = self.noteChunk.noteBlocks
Beispiel #3
0
    def initUI(self):
        self.parent.title("Test UI")
        menubar = Menu(self.parent)
        self.parent.config(menu=menubar)
        self.parent.geometry("700x500")

        #menu
        usersMenu = Menu(menubar)
        usersMenu.add_command(label="Create User")
        preferencesMenu = Menu(menubar)
        preferencesMenu.add_command(label="Settings")
        menubar.add_cascade(label="User", menu=usersMenu)
        menubar.add_cascade(label="Preferences", menu=preferencesMenu)
        menubar.add_command(label="About", command=self.clickAbout)

        #notebook
        n = Notebook(self.parent)
        f1 = Frame(n)
        f2 = Frame(n)
        n.add(f1, text='One')
        n.add(f2, text='Two')
        n.pack(fill=BOTH, expand=1)
        n.pack_propagate(0)

        #panedwindow
        p = Panedwindow(f1, orient=HORIZONTAL)
        lf1 = LabelFrame(p, text="Pane1")
        lf2 = VerticalScrolledFrame(p)
        p.add(lf1, weight=60)
        p.add(lf2, weight=40)
        p.pack(fill=BOTH, expand=1)
        p.pack_propagate(0)
        lf1.pack_propagate(0)
        lf2.pack_propagate(0)

        #listbox
        listFrame = Frame(lf1)
        scrollBar = Scrollbar(listFrame, orient=VERTICAL)
        listBox = Listbox(listFrame, yscrollcommand=scrollBar.set)
        scrollBar.config(command=listBox.yview)
        scrollBar.pack(side=RIGHT, fill=Y)
        listBox.pack(side=LEFT, fill=BOTH, expand=1)
        listFrame.pack(fill=BOTH, expand=1)
        for i in range(0, 500):
            listBox.insert(END, i)

        #add some datafield boxes
        for i in range(0, 7):
            dfb = TextFieldBox(lf2.interior,
                               label=str(i),
                               toolTip="Tooltip " + str(i))
            print dfb.text
            dfb.text = str(i)
            dfb.pack(expand=1, fill=X)

        self.autocomplete = AutocompleteBox(lf2.interior, label="autocomplete")
        self.autocomplete.initComboBox("payors")
        self.autocomplete.text = "autocomplete"
        self.autocomplete.pack(expand=1, fill=X)

        self.calendarBox = calendarBox = CalendarBox(lf2.interior,
                                                     label="Calendar",
                                                     toolTip="Sample calendar")
        calendarBox.pack(expand=1, fill=X)

        options = ["option1", "two", "tres"]
        self.dropdown = AutocompleteBox(lf2.interior, label="Dropdown")
        self.dropdown.initDropDown()
        self.dropdown.pack(expand=1, fill=X)
        # self.dropdown = DropDownBox(lf2.interior, label="dropdown1", toolTip="dropdown!", options=options)
        # self.dropdown.pack(expand=1, fill=None)

        button = Button(lf1, text='Press', command=self.clickPress)
        button.pack(pady=20, padx=20)
Beispiel #4
0
    def initUI(self):
        p = Panedwindow(self.parent, orient=HORIZONTAL)
        leftFrame = LabelFrame(p)
        rightFrame = LabelFrame(p)
        p.add(leftFrame, weight=60)
        p.add(rightFrame, weight=40)
        p.pack(fill=BOTH, expand=1)
        p.pack_propagate(0)
        leftFrame.pack_propagate(0)
        rightFrame.pack_propagate(0)

        #leftFrame elements
        leftFrameUpperest = Frame(leftFrame)
        leftFrameUpper = Frame(leftFrame)
        leftFrameLower = Frame(leftFrame)
        leftFrameLower.pack(expand=0, fill=X, side=BOTTOM)
        leftFrameUpperest.pack(expand=0, fill=X, side=TOP)
        leftFrameUpper.pack(expand=1, fill=BOTH, side=BOTTOM)

        newButton = Button(leftFrameUpperest,
                           text="New",
                           command=self.newEntry,
                           style="NEWButton.TButton")
        newButton.pack(fill=None, expand=0, side=LEFT)
        self.tree = tree = Treeview(leftFrameUpper, selectmode="browse")
        tree.bind("<<TreeviewSelect>>", self.getSelection)
        yscroll = Scrollbar(leftFrameUpper,
                            orient="vertical",
                            command=tree.yview)
        xscroll = Scrollbar(leftFrameLower,
                            orient="horizontal",
                            command=tree.xview)
        colList = [
            "Timestamp", "Date of Transaction", "Category", "Nature", "Amount",
            "Payor's Name", "Acknowledgement Receipt #", "Notes", "Remarks"
        ]
        tree['columns'] = colList
        for col in colList:
            tree.heading(col,text=col,command=lambda _col=col: \
             treeview_sort_column(tree,_col,False))
            tree.column(col, anchor=W, width=60)
        tree.column('#0', width=3, anchor=W)
        if "Amount" in colList:
            tree.column("Amount", anchor=E)
        tree.configure(yscroll=yscroll.set, xscroll=xscroll.set)
        yscroll.pack(side=RIGHT, fill=Y)
        xscroll.pack(side=TOP, fill=X)
        tree.pack(side=LEFT, fill=BOTH, expand=1)
        tree.tag_configure("deleted", foreground="red")
        tree.tag_configure("edited", foreground="orange")

        #bottombar
        leftLowestFrame = Frame(leftFrameLower)
        leftLowestFrame.pack(fill=X, expand=0)

        self.totalLabel = totalLabel = Label(leftLowestFrame,
                                             text="Total Cash Receipts: ",
                                             relief=SUNKEN,
                                             width=50)
        totalLabel.pack(fill=None, expand=0, side=RIGHT)

        #populateTree
        #testing. Remove later for actual data
        self.fieldList = [
            'timestamp', 'dateOfTransaction', 'category', 'nature', 'amount',
            'payor', 'receiptNumber', 'notes', 'remarks'
        ]
        self.populateTree()

        #rightFrame
        upperRight = VerticalScrolledFrame(rightFrame)
        lowerRight = Frame(rightFrame)
        lowerRight.pack(fill=X, expand=0, side=BOTTOM)
        upperRight.pack(fill=BOTH, expand=1, side=TOP)

        saveButton = Button(lowerRight,
                            text="Save",
                            command=self.save,
                            style="SAVEButton.TButton")
        saveButton.pack(side=LEFT, fill=X, expand=1)
        deleteButton = Button(lowerRight, text="Delete", command=self.delete)
        deleteButton.pack(side=LEFT, fill=X, expand=1)

        #fields
        self.fields = {}
        self.fields['timestamp'] = timestamp = TextFieldBox(
            upperRight.interior, label="Timestamp", readonly=True, height=1)

        self.fields['dateOfTransaction'] = dot = CalendarBox(
            upperRight.interior, label="Date of Transaction")
        dot.pack(side=TOP, fill=X, expand=1)
        #options for removal, get from DB
        options = [
            "Council Mandated Funds", "General Sponsorship Inflows",
            "Income Generating Projects", "Other Inflows", "Excess"
        ]
        self.fields['category'] = category = AutocompleteBox(
            upperRight.interior,
            label="Category",
            toolTip=
            "[Council Mandated Funds]: All fees, commissions and revenues that the council body is authorized to collect among students and all businesses within the college\n[General Sponsorhip Inflows]: Cash inflows acquired gratuitously from business organizations, studentry/alumni body and other entities\n[Income Generating Projects]: Cash inflows from all council events to raise revenues and generate additional funds supplementary to its operations\n[Other Inflows]: Cash inflows other than council mandated funds, general sponsoships and income generating projects"
        )
        category.initDropDown(options)

        self.fields['nature'] = nature = AutocompleteBox(upperRight.interior,
                                                         label="Nature",
                                                         toolTip=None)
        nature.initComboBox(self.app.listOptions("Nature"))

        self.fields['amount'] = TextFieldBox(upperRight.interior,
                                             label="Amount",
                                             readonly=False,
                                             height=1,
                                             textType="number")

        self.fields['payor'] = AutocompleteBox(
            upperRight.interior,
            label="Payor's Name",
            toolTip="Name of the individual who actually gave the cash.")
        self.fields['payor'].initComboBox(self.app.listOptions("CR_Payor"))

        self.fields['receiptNumber'] = TextFieldBox(
            upperRight.interior,
            label="Acknowledgement Receipt #",
            readonly=False)

        self.fields['notes'] = TextFieldBox(
            upperRight.interior,
            label="Notes",
            toolTip="Any additional notes about the transaction.")

        self.fields['remarks'] = TextFieldBox(upperRight.interior,
                                              label="Remarks",
                                              readonly=True)

        for i in self.fields:
            self.fields[i].bind("<Return>", self.save)
            self.fields[i].pack(side=TOP, fill=X, expand=1)