Exemplo n.º 1
0
    def cmdAdd(self):
        #create a new contact based on the contact's name
        self.tempContact = contact.contact(self.entryName.get())
        #build a temp address
        self.tempAddress = address.address(self.entryAddressLast.get(),self.entryAddressDelivery.get(),self.entryAddressSecond.get())
        #add the address to the contact object
        self.tempContact.addAddress(self.tempAddress)
        #add the email address to the contact object
        self.tempContact.addEmail(self.entryEmail.get())
        #get and add the phone number to the contact object
        self.tempContact.addPhoneNumber(self.entryPhone.get())
        #add the contact to the address book
        self.logic.addContact(self.tempContact)
        #update the listbox
        self.cmdUpdateListbox(self.logic.contacts)

        self.unSavedChanges = 1
Exemplo n.º 2
0
    def __init__(self, master, addressBookLogic):

        self.unSavedChanges = 0
        self.unUpdated = 0

        self.svName = tk.StringVar()
        self.svLast = tk.StringVar()
        self.svDelivery = tk.StringVar()
        self.svSecond = tk.StringVar()
        self.svEmail = tk.StringVar()
        self.svPhone = tk.StringVar()

        self.svName.trace("w", self.entryChanged)
        self.svLast.trace("w", self.entryChanged)
        self.svDelivery.trace("w", self.entryChanged)
        self.svSecond.trace("w", self.entryChanged)
        self.svEmail.trace("w", self.entryChanged)
        self.svPhone.trace("w", self.entryChanged)


        testContact1 = contact.contact("John Doe")
        testLast1 = "Alameda CA 9"
        testDelivery1 = "1401 SW Main St."
        testSecond1 = "Apt 4"
        testAddr1 = address.address(testLast1, testDelivery1, testSecond1)
        testEmail1 = "*****@*****.**"
        testEmail2 = "*****@*****.**"
        testPhoneNumber1 = "542-345-6745"
        testContact1.addAddress(testAddr1)
        testContact1.addEmail(testEmail1)
        testContact1.addEmail(testEmail2)
        testContact1.addPhoneNumber(testPhoneNumber1)

        testContact2 = contact.contact("Mary Sue")
        testLast2 = "Venice CA 1"
        testDelivery2 = "56 Trent St."
        testSecond2 = ""
        testAddr2 = address.address(testLast2, testDelivery2, testSecond2)
        testEmail2_1 = "*****@*****.**"
        testEmail2_2 = "*****@*****.**"
        testPhoneNumber2 = "542-524-5820"
        testContact2.addAddress(testAddr2)
        testContact2.addEmail(testEmail2_1)
        testContact2.addEmail(testEmail2_2)
        testContact2.addPhoneNumber(testPhoneNumber2)

        testContact3 = contact.contact("Eddy Adams")
        testLast3 = "Oakland CA 0"
        testDelivery3 = "345 Alder St."
        testSecond3 = ""
        testAddr3 = address.address(testLast3, testDelivery3, testSecond3)
        testEmail3_1 = "*****@*****.**"
        testEmail3_2 = "*****@*****.**"
        testPhoneNumber3 = "233-595-9090"
        testContact3.addAddress(testAddr3)
        testContact3.addEmail(testEmail3_1)
        testContact3.addEmail(testEmail3_2)
        testContact3.addPhoneNumber(testPhoneNumber3)

        #addressBookLogic.addContact(testContact1)
        #addressBookLogic.addContact(testContact2)
        #addressBookLogic.addContact(testContact3)

        self.master = master

        self.frame = tk.Frame(self.master)
        self.frame.grid(row=0,column=0)
        self.contactFrame = tk.Frame(self.frame)
        self.EntryFrame = tk.Frame(self.frame)
        self.buttonFrame = tk.Frame(self.frame)

        self.entryChanged = 0

        self.logic = addressBookLogic #run
        #self.logic = addressbook.addressbook #code

        self.initUI()
        self.buttonFrame.pack(side=tk.BOTTOM, pady=5)
        self.contactFrame.pack(side=tk.LEFT)
        self.EntryFrame.pack(side=tk.LEFT, padx=5)
        self.cmdUpdateListbox(self.logic.contacts)
        self.contactPairs