Example #1
0
    def __init__(self, username, master=None):
        Frame.__init__(self, master, bg="AntiqueWhite")

        self.username = username
        self.password = userInformation.searchUserInfo(self.username)[1]

        self.password_ori_var = StringVar()
        self.password_new_var = StringVar()
        self.password_sec_var = StringVar()

        self.createFrame()
Example #2
0
    def __init__(self, username, master=None):
        Frame.__init__(self, master, bg="AntiqueWhite")

        self.root = master
        self.username = username

        self.userInfo = userInformation.searchUserInfo(self.username)
        self.tasteVar = []
        self.tastes = [
            "Thailand", "Chinese", "Fast", "American", "Japanese", "Sea",
            "Italian", "Desert", "Korean", "Mexican", "Vietnam", "Peru",
            "African", "Vegetarian"
        ]

        self.lowerPrice = StringVar()
        self.upperPrice = StringVar()

        self.createNewFrame()
Example #3
0
    def __init__(self, cvs, username, master=None):
        Frame.__init__(self, master, bg="AntiqueWhite")
        self.cvs = cvs
        self.root = master
        self.username = username

        self.imageAddress = userInformation.getPhotoInfo(self.username)

        self.userInfo = userInformation.searchUserInfo(self.username)

        self.editMainPage = Toplevel()
        self.editMainPage.geometry('300x400')
        self.editMainPage.resizable(0, 0)
        self.editMainPage['bg'] = "AntiqueWhite"
        self.editMainPage.protocol("WM_DELETE_WINDOW", self.on_closing_setting)
        self.editMainPage.withdraw()

        self.createFrame()
Example #4
0
    def __init__(self, username, master=None):
        Frame.__init__(self, master, bg="AntiqueWhite")

        self.root = master
        self.username = username

        self.job_var = StringVar()

        self.new_username_var = StringVar()

        userInfo = userInformation.searchUserInfo(self.username)
        self.topic_ori = userInfo[4]

        self.topic_var = []
        self.listTopic = [
            "makeup", "anime", "sports", "music", "art", "movie", "cooking",
            "car", "programming", "game", "pets"
        ]

        self.createNewFrame()
Example #5
0
def selectRestaurant(userPreference, users):
    matchedPerson = []
    matchedTimeSpan = []

    for i in users:
        if i[0] != userPreference[0]:
            if restaurant.matchAgeAndGender(i, userPreference[1],
                                            userPreference[2]):
                if restaurant.matchTopicsAndJob(i, userPreference[5],
                                                userPreference[6]):
                    timeMatch = timeInfo.checkIfTimeMatch(
                        userPreference[0], i[0])
                    if timeMatch:
                        matchedPerson.append(i[0])
                        matchedTimeSpan.append([i[0], timeMatch])

    if len(matchedPerson) == 0:
        return []

    possiblePersons = []

    for i in matchedPerson:
        selected = restaurant.matchRestaurant(
            userInformation.searchUserInfo(i), userPreference[3],
            userPreference[4])
        if not len(selected) == 0:
            possiblePersons.append([i, selected])

    if len(possiblePersons) == 0:
        return []

    randNum = 0
    randNum2 = 0

    print(possiblePersons)

    if len(possiblePersons) == 1:
        timeSpan = []
        for i in matchedTimeSpan:
            if i[0] == possiblePersons[0][0]:
                timeSpan = i
        if len(possiblePersons[0][1]) == 1:
            result = appointmentInfo.writeAppointment([
                userPreference[0], timeSpan[0], timeSpan[1],
                possiblePersons[0][1][0][0]
            ])
            if not result:
                return [possiblePersons[0][0], possiblePersons[0][1][0]]
            else:
                return []
        else:
            randNum2 = random.randint(0, len(possiblePersons[0][1])) - 1
            result = appointmentInfo.writeAppointment([
                userPreference[0], timeSpan[0], timeSpan[1],
                possiblePersons[0][1][randNum2]
            ])
            if not result:
                return [possiblePersons[0][0], possiblePersons[0][1][randNum2]]
            else:
                return []
    else:
        randNum = random.randint(1, len(possiblePersons)) - 1
        timeSpan = []
        for i in matchedTimeSpan:
            if i[0] == possiblePersons[0][0]:
                timeSpan = i
        if len(possiblePersons[randNum][1]) == 1:
            result = appointmentInfo.writeAppointment([
                userPreference[0], timeSpan[0], timeSpan[1],
                possiblePersons[randNum][1][0]
            ])
            if not result:
                return [[possiblePersons[randNum][0]],
                        possiblePersons[randNum][1][0]]
            else:
                return []
        else:
            randNum2 = random.randint(1, len(possiblePersons[randNum][1])) - 1
            result = appointmentInfo.writeAppointment([
                userPreference[0], timeSpan[0], timeSpan[1],
                possiblePersons[randNum][randNum2][0]
            ])
            if not result:
                return [
                    possiblePersons[randNum][randNum2],
                    possiblePersons[randNum][1][randNum2]
                ]
            else:
                return []
Example #6
0
    def confirmCallBack(self):

        userInfo = userInformation.searchUserInfo(self.username)
        users = userInformation.readUserInfo()

        preferenceInfo = []
        preferenceInfo.append(self.username)
        preferenceInfo.append(self.genderPreference.get())
        preferenceInfo.append(
            [self.ageLowerBound.get(),
             self.ageUpperBound.get()])
        preferenceInfo.append(userInfo[6])
        preferenceInfo.append(userInfo[7])
        preferenceInfo.append(userInfo[4])
        preferenceInfo.append(userInfo[5])

        whichMonth = "0" + self.monthVar.get() if len(
            self.monthVar.get()) == 1 else self.monthVar.get()
        whichDay = "0" + self.dayVar.get() if len(
            self.dayVar.get()) == 1 else self.dayVar.get()
        dateResult = self.yearVar.get() + whichMonth + whichDay
        timeResult = []
        if self.mealVar.get() == 0:
            for i in range(0, len(self.lunchTimeSpan)):
                if self.lunchTimeSpan[i].get() == 1:
                    if not appointmentInfo.isExist(self.username, self.date):
                        timeResult.append(self.lunchTimes[i])
        else:
            for i in range(0, len(self.dinnerTimeSpan)):
                if self.dinnerTimeSpan[i].get() == 1:
                    if not appointmentInfo.isExist(self.username, self.date):
                        timeResult.append(self.dinnerTimes[i])

        whichMeal = "lunch" if self.mealVar.get() == 0 else "dinner"

        for i in timeResult:
            dateAndTimeResult = [self.username, [dateResult, whichMeal, i]]
            timeInfo.writeTimeInfo(dateAndTimeResult)

        result = selectRestaurant.selectRestaurant(preferenceInfo, users)

        if result:
            self.matchResult = result
            print(self.matchResult)
            callBack = tkinter.messagebox.askyesno(
                "We got a match for you!", "you got a match with " +
                self.matchResult[0] + " at " + self.matchResult[1][0])
            self.destroy()
            Frame_main = mainFrame(self.cvs, self.username, self.root)
            self.cvs.create_window(500,
                                   215,
                                   width=500,
                                   height=430,
                                   window=Frame_main)

        else:
            tkinter.messagebox.showinfo(
                "sorry!",
                "cannot find a match for you right now\nmaybe try again later!"
            )
            self.destroy()
            Frame_main = mainFrame(self.cvs, self.username, self.root)
            self.cvs.create_window(500,
                                   215,
                                   width=500,
                                   height=430,
                                   window=Frame_main)