Beispiel #1
0
    def __init__(self, parent, logic):
        Frame.__init__(self, parent)
        from Pages.main import MainPage
        from Pages.searchEngine import Result
        from Logic.mSettings import Settings
        from Logic.tLogic import ToolLogic
        from Logic.rLogic import LeaseLogic
        
        self.logic = logic
        self.tool = ToolLogic()
        self.lease = LeaseLogic()
        self.logic = logic
        
        Button(self, text='Logout', command=lambda: logic.show_frame(MainPage)).pack()
        Label(self, text='Return Tool', font=Settings.lFont).pack(padx=10, pady=10)
        
        Button(self, text='Go back!', command=lambda: self.logic.show_frame(Result)).pack(padx=10, pady=10)
        Label(self, text='Payment List:', font=Settings.lFont).pack(padx=10, pady=10)
        
        self.frame = Frame(self, relief=RAISED, borderwidth=1)
        self.frame.pack(fill=BOTH, expand=True)
        
        Label(self, text='Additional Info:', font=Settings.lFont).pack(padx=10, pady=10)
        self.addInfo = Label(self, text='Additional Info:', font=Settings.lFont)
        self.addInfo.pack(padx=10, pady=10)
        
        Label(self, text='Photos:', font=Settings.lFont).pack()
        Button(self, text='Browse', command=self.addToolPhoto).pack()
        
        Label(self, text='Price', font=Settings.lFont).pack(padx=10, pady=10)
        self.price = Label(self, text='Price', font=Settings.lFont)
        self.price.pack(padx=10, pady=10)

        Button(self, text='Confirm', command=self.makeLease).pack()
Beispiel #2
0
    def __init__(self, parent, logic):
        self.logic = logic
        self.tool = ToolLogic()
        self.lease = LeaseLogic()
        
        Frame.__init__(self, parent)

        Button(self, text="Logout", command=lambda: self.logic.show_frame(MainPage)).pack()
        Button(self, text="Back", command=lambda: self.logic.show_frame(Search)).pack(pady=10, padx=10)

        self.topic = Label(self, text="Your balance is: £" + str(Settings.mAvail),font=Settings.lFont)
        self.topic.pack(pady=10, padx=10)

        Label(self, text="Leased:", font=Settings.lFont).pack(pady=10, padx=10)

        scrollBar = Scrollbar(self)
        scrollBar.pack(side=RIGHT, fill=Y)
        self.record = Listbox(self, yscrollcommand=scrollBar.set)
        tools = self.tool.getListAll(1514206410.671336)
        for index, itemTool in enumerate(tools):
            self.record.insert(END, itemTool["name"] + str(index))
        self.record.pack(fill=BOTH)
        scrollBar.config(command=self.record.yview())

        Label(self, text="Rented:", font=Settings.lFont).pack(pady=10, padx=10)

        scrollBar = Scrollbar(self)
        scrollBar.pack(side=RIGHT, fill=Y)
        self.rRecord = Listbox(self, yscrollcommand=scrollBar.set)
        for line in range(100):
            self.rRecord.insert(END, "Tool number" + str(line))
        self.rRecord.pack(fill=BOTH)
        scrollBar.config(command=self.rRecord.yview())
Beispiel #3
0
    def __init__(self, parent, logic):
        self.logic = logic
        self.tool = ToolLogic()
        
        Frame.__init__(self, parent)
        
        self.logic = logic

        Button(self, text="Logout", command=lambda: logic.show_frame(MainPage)).pack()
        Button(self, text="Back", command=lambda: logic.show_frame(Result)).pack(pady=10, padx=10)

        Label(self, text="Tool Details: ", font=Settings.lFont).pack(pady=10, padx=10)

        Label(self, text="Name:", font=Settings.sFont).pack()
        self.name = Label(self, text="Name:", font=Settings.sFont)
        self.name.pack()

        Label(self, text="Description:", font=Settings.sFont).pack()
        self.dscp = Label(self, text="Name:", font=Settings.sFont)
        self.dscp.pack()

        Label(self, text="Photos:", font=Settings.sFont).pack()
        self.frame = Frame(self, relief=RAISED, borderwidth=1)
        self.frame.pack(fill=BOTH, expand=True)

        Label(self, text="Price:", font=Settings.sFont).pack()
        self.price = Label(self, text="Name:", font=Settings.sFont)
        self.price.pack()
Beispiel #4
0
    def __init__(self, parent, logic):
        from Pages.main import MainPage
        from Pages.searchEngine import Result

        from Logic.tLogic import ToolLogic

        self.logic = logic
        self.tool = ToolLogic()

        Frame.__init__(self, parent)
        self.logic = logic

        Button(self, text='Logout',
               command=lambda: logic.show_frame(MainPage)).pack()
        Button(self, text='Go back!',
               command=lambda: logic.show_frame(Result)).pack(padx=10, pady=10)

        Label(self, text='Tool Details', font=Settings.lFont).pack(padx=10,
                                                                   pady=10)
        Label(self, text='Name:', font=Settings.sFont).pack()
        self.name = Label(self, text='Name:', font=Settings.sFont)
        self.name.pack()

        Label(self, text='Description:', font=Settings.sFont).pack()
        self.dscp = Label(self, text='Name:', font=Settings.sFont)
        self.dscp.pack()

        Label(self, text='Photos:', font=Settings.sFont).pack()
        self.frame = Frame(self, relief=RAISED, borderwidth=1)
        self.frame.pack(fill=BOTH, expand=True)

        Label(self, text='Price:', font=Settings.sFont).pack()
        self.price = Label(self, text='Name:', font=Settings.sFont)
        self.price.pack()
        Button(self, text='Rent', command=self.rental).pack(padx=10, pady=10)
Beispiel #5
0
    def __init__(self, parent, logic):
        Frame.__init__(self, parent)

        from Pages.main import MainPage
        from Pages.searchEngine import Result
        from Logic.tLogic import ToolLogic

        self.logic = logic
        self.tool = ToolLogic()

        Frame.__init__(self, parent)

        self.logic = logic

        Button(self, text='Logout',
               command=lambda: logic.show_frame(MainPage)).pack()
        Button(self,
               text='Go Back!',
               command=lambda: self.logic.show_frame(PaymentsPage)).pack(
                   padx=10, pady=10)

        Label(self, text='Return Tool', font=Settings.lFont).pack(padx=10,
                                                                  pady=10)
        self.pName = Label(self, text='Payment: ', font=Settings.lFont)
        Label(self, text='Payments List: ', font=Settings.lFont).pack(padx=10,
                                                                      pady=10)
        Label(self, text='Additional Info: ',
              font=Settings.lFont).pack(padx=10, pady=10)
        Label(self, text='Price: ', font=Settings.lFont).pack(padx=10, pady=10)
        self.price = Label(self, text='Price: ', font=Settings.lFont)

        self.addInf = Label(self,
                            text='Additional Info: ',
                            font=Settings.lFont)
        self.addInf.pack(padx=10, pady=10)
        self.photos = Label(self, text='Photos: ', font=Settings.lFont)

        self.frame = Frame(self, relief=RAISED, borderwidth=1)
        self.photosFrame = Frame(self, relief=RAISED, borderwidth=1)

        self.price.pack(padx=10, pady=10)
        self.pName.pack(padx=10, pady=10)
        self.photosFrame.pack(fill=BOTH, expand=True)
        self.frame.pack(fill=BOTH, expand=True)
        self.photos.pack()
Beispiel #6
0
class UserToolPage(Frame):
    def __init__(self, parent, logic):
        self.logic = logic
        self.tool = ToolLogic()
        
        Frame.__init__(self, parent)
        
        self.logic = logic

        Button(self, text="Logout", command=lambda: logic.show_frame(MainPage)).pack()
        Button(self, text="Back", command=lambda: logic.show_frame(Result)).pack(pady=10, padx=10)

        Label(self, text="Tool Details: ", font=Settings.lFont).pack(pady=10, padx=10)

        Label(self, text="Name:", font=Settings.sFont).pack()
        self.name = Label(self, text="Name:", font=Settings.sFont)
        self.name.pack()

        Label(self, text="Description:", font=Settings.sFont).pack()
        self.dscp = Label(self, text="Name:", font=Settings.sFont)
        self.dscp.pack()

        Label(self, text="Photos:", font=Settings.sFont).pack()
        self.frame = Frame(self, relief=RAISED, borderwidth=1)
        self.frame.pack(fill=BOTH, expand=True)

        Label(self, text="Price:", font=Settings.sFont).pack()
        self.price = Label(self, text="Name:", font=Settings.sFont)
        self.price.pack()

    def run(self):
        tools = self.tool.searchName(self.logic.sTool)
        tool = tools[0]
        self.name["text"] = tool["name"]
        self.price["text"] = tool["price"]
        self.dscp["text"] = tool["dscp"]

        for photo in tool["photos"]:
            avFile = ImageTk.PhotoImage(Image.open(photo).resize((100, 50), Image.ANTIALIAS))
            avatar = Label(self.frame, image=avFile)
            avatar.image = avFile
            avatar.config(image=avFile)
            avatar.pack()
Beispiel #7
0
    def __init__(self, parent, logic):
        Frame.__init__(self, parent)

        from Pages.main import MainPage
        from Logic.tLogic import ToolLogic

        self.logic = logic
        self.lease = LeaseLogic()
        self.tool = ToolLogic()

        Frame.__init__(self, parent)

        self.logic = logic

        Button(self, text='Logout', command=lambda: logic.show_frame(MainPage)).pack()
        Button(self, text='Go back', command=lambda: self.logic.show_frame(Result)).pack(padx=10, pady=10)

        Label(self, text='Check Availability', font=Settings.lFont).pack(padx=10, pady=10)

        Label(self, text='Start Date', font=Settings.lFont).pack(padx=10, pady=10)
        self.dStart = Calendar(self, firstweekday=calendar.SUNDAY)
        self.dStart.pack()

        Label(self, text='End Date', font=Settings.lFont).pack(padx=10, pady=10)
        self.dEnd = Calendar(self, firstweekday=calendar.SUNDAY)
        self.dEnd.pack()

        Button(self, text='Check Availability', command=self.isAvail).pack()

        self.errors = Label(self, text='', font=Settings.sFont)
        self.errors.pack()
        self.rent = Button(self, text='Lease',
                           state=DISABLED, command=self.rent)
        self.rent.pack()
        
        if 'win' not in sys.platform:
            style = ttk.Style()
            style.theme_use('alt')
Beispiel #8
0
    def __init__(self, parent, logic):
        Frame.__init__(self, parent)

        from Pages.main import MainPage
        from Pages.searchEngine import Result
        from Logic.tLogic import ToolLogic

        self.logic = logic
        self.tool = ToolLogic()
        self.payments = PaymentsLogic()

        Button(self, text='Logout',
               command=lambda: logic.show_frame(MainPage)).pack()
        Button(self,
               text='Go back!',
               command=lambda: self.logic.show_frame(Result)).pack(padx=10,
                                                                   pady=10)

        scrollBar = Scrollbar(self)
        scrollBar.pack(side=RIGHT, fill=Y)
        self.paymBox = Listbox(self, yscrollcommand=scrollBar.set)
        for line in range(100):
            self.paymBox.insert(END, 'Payment number' + str(line))
        scrollBar.config(command=self.paymBox.yview())
        Label(self, text='Payments of my rentings:',
              font=Settings.lFont).pack(padx=10, pady=10)

        scrollBar = Scrollbar(self)

        self.paymeBox = Listbox(self, yscrollcommand=scrollBar.set)
        for line in range(100):
            self.paymeBox.insert(END, 'Payment number' + str(line))
        scrollBar.config(command=self.paymeBox.yview())
        scrollBar.pack(side=RIGHT, fill=Y)

        self.paymeBox.pack(fill=BOTH)
        self.paymBox.pack(fill=BOTH)
Beispiel #9
0
class FinishLease(Frame):
    leasedItem = ''
    leaseSum = 0
    fee = 0
    insurance = 5
    totalPrice = 0
    items = []
    oId = 0
    
    def __init__(self, parent, logic):
        Frame.__init__(self, parent)
        from Pages.main import MainPage
        from Pages.searchEngine import Result
        from Logic.mSettings import Settings
        from Logic.tLogic import ToolLogic
        from Logic.rLogic import LeaseLogic
        
        self.logic = logic
        self.tool = ToolLogic()
        self.lease = LeaseLogic()
        self.logic = logic
        
        Button(self, text='Logout', command=lambda: logic.show_frame(MainPage)).pack()
        Label(self, text='Return Tool', font=Settings.lFont).pack(padx=10, pady=10)
        
        Button(self, text='Go back!', command=lambda: self.logic.show_frame(Result)).pack(padx=10, pady=10)
        Label(self, text='Payment List:', font=Settings.lFont).pack(padx=10, pady=10)
        
        self.frame = Frame(self, relief=RAISED, borderwidth=1)
        self.frame.pack(fill=BOTH, expand=True)
        
        Label(self, text='Additional Info:', font=Settings.lFont).pack(padx=10, pady=10)
        self.addInfo = Label(self, text='Additional Info:', font=Settings.lFont)
        self.addInfo.pack(padx=10, pady=10)
        
        Label(self, text='Photos:', font=Settings.lFont).pack()
        Button(self, text='Browse', command=self.addToolPhoto).pack()
        
        Label(self, text='Price', font=Settings.lFont).pack(padx=10, pady=10)
        self.price = Label(self, text='Price', font=Settings.lFont)
        self.price.pack(padx=10, pady=10)

        Button(self, text='Confirm', command=self.makeLease).pack()

    def makeLease(self):
        self.lease.endLease(self.logic.lId, self.totalPrice, self.logic.session.uId)
        self.payments.addPayment(self.logic.session.uId, self.items, self.totalPrice)
        self.logic.show_frame(PaymentPage)

    def addToolPhoto(self):
        from Logic.fLogic import FileLogic
        file = FileLogic()
        self.photos = file.addPhoto()
        print(self.photos)

    def run(self):
        from Logic.pLogic import PaymentsLogic
        self.payments = PaymentsLogic()
        self.leaseItem = self.lease.getLeases(self.logic.selectrental)
        tool = self.tool.searchId(self.leasedItem['tId'])
        self.oId = tool['uId']
        fee = int(tool['price'])
        now = time.time()
        if (self.leasedItem['dEnd'] < now):
            self.addInfo.config(
                text='Your payment is multiplied 2 times, because you should finish renting before end date')
            fee = int(fee) * 2
        Label(self.frame, text=tool['name']).pack(padx=10, pady=10)
        days = datetime.datetime.utcfromtimestamp(now) - datetime.datetime.utcfromtimestamp(
            self.leasedItem['dStart'])
        itemPrice = fee * int(days.days)
        self.itemlist = [tool['name'] + ' Price:' + str(itemPrice), 'Insurance Price:' + str(self.insurance)]

        Label(self.frame, text='Price: ' + str(itemPrice),
              font=Settings.lFont).pack(padx=10, pady=10)
        Label(self.frame, text='Insurance: ').pack(padx=10, pady=10)
        Label(self.frame, text='Price: ' + str(self.insurance),
              font=Settings.lFont).pack(padx=10, pady=10)
        price = int(itemPrice) + self.insurance

        self.price.config(
            text='Total:' + str(price))
        self.totalPrice = price
Beispiel #10
0
 def addTool(self):
     from Pages.succeded import Success
     tool = ToolLogic()
     tool.addTool(
         self.logic.session.uId, self.name.get(), self.pDay.get(), self.type.get(), self.photos, self.cond.get(), self.dscp.get())
     self.logic.show_frame(Success)
Beispiel #11
0
class UserToolsPage(Frame):
    sTool = ''
    listTool = []
    listToolToLease = []
    
    def __init__(self, parent, logic):
        self.logic = logic
        self.tool = ToolLogic()
        self.lease = LeaseLogic()
        
        Frame.__init__(self, parent)

        Button(self, text="Logout", command=lambda: self.logic.show_frame(MainPage)).pack()
        Button(self, text="Back", command=lambda: self.logic.show_frame(Search)).pack(pady=10, padx=10)

        self.topic = Label(self, text="Your balance is: £" + str(Settings.mAvail),font=Settings.lFont)
        self.topic.pack(pady=10, padx=10)

        Label(self, text="Leased:", font=Settings.lFont).pack(pady=10, padx=10)

        scrollBar = Scrollbar(self)
        scrollBar.pack(side=RIGHT, fill=Y)
        self.record = Listbox(self, yscrollcommand=scrollBar.set)
        tools = self.tool.getListAll(1514206410.671336)
        for index, itemTool in enumerate(tools):
            self.record.insert(END, itemTool["name"] + str(index))
        self.record.pack(fill=BOTH)
        scrollBar.config(command=self.record.yview())

        Label(self, text="Rented:", font=Settings.lFont).pack(pady=10, padx=10)

        scrollBar = Scrollbar(self)
        scrollBar.pack(side=RIGHT, fill=Y)
        self.rRecord = Listbox(self, yscrollcommand=scrollBar.set)
        for line in range(100):
            self.rRecord.insert(END, "Tool number" + str(line))
        self.rRecord.pack(fill=BOTH)
        scrollBar.config(command=self.rRecord.yview())


    def run(self):
        self.sTool = ""
        if self.logic.session.session:
            tools = self.tool.getListAll(self.logic.session.uDetails["id"])
            self.record.delete(0, END)
            self.topic.config(text="Your balance is: £" + str(self.logic.session.uDetails["balance"]))
            for index, itemTool in enumerate(tools):
                self.record.insert(END, itemTool["name"])
                self.record.bind('<<ListboxSelect>>', self.select)
                self.listTool.append(itemTool)
            leases = self.lease.getLeasesUser(self.logic.session.uDetails["id"])
            self.rRecord.delete(0, END)
            for index, rental in enumerate(leases):
                itemTool = self.tool.searchId(rental["tId"])
                self.rRecord.insert(END, itemTool["name"])
                self.rRecord.bind('<<ListboxSelect>>', self.selectLease)
                self.rRecord.append(rental)

    def select(self, evt):
        q = evt.widget
        index = int(q.curselection()[0])
        value = q.get(index)
        self.logic.sTool = value
        self.logic.sTool = self.listTool[index]["id"]

        self.logic.show_frame(UserToolPage)

    def selectLease(self, evt):
        w = evt.widget
        index = int(w.curselection()[0])
        value = w.get(index)
        self.logic.selectLease = value
        self.logic.selectLease = self.listToolToLease[index]["id"]
        
        self.logic.show_frame(FinishLease)
Beispiel #12
0
class ToolPage(Frame):
    fee = 0

    def __init__(self, parent, logic):
        from Pages.main import MainPage
        from Pages.searchEngine import Result

        from Logic.tLogic import ToolLogic

        self.logic = logic
        self.tool = ToolLogic()

        Frame.__init__(self, parent)
        self.logic = logic

        Button(self, text='Logout',
               command=lambda: logic.show_frame(MainPage)).pack()
        Button(self, text='Go back!',
               command=lambda: logic.show_frame(Result)).pack(padx=10, pady=10)

        Label(self, text='Tool Details', font=Settings.lFont).pack(padx=10,
                                                                   pady=10)
        Label(self, text='Name:', font=Settings.sFont).pack()
        self.name = Label(self, text='Name:', font=Settings.sFont)
        self.name.pack()

        Label(self, text='Description:', font=Settings.sFont).pack()
        self.dscp = Label(self, text='Name:', font=Settings.sFont)
        self.dscp.pack()

        Label(self, text='Photos:', font=Settings.sFont).pack()
        self.frame = Frame(self, relief=RAISED, borderwidth=1)
        self.frame.pack(fill=BOTH, expand=True)

        Label(self, text='Price:', font=Settings.sFont).pack()
        self.price = Label(self, text='Name:', font=Settings.sFont)
        self.price.pack()
        Button(self, text='Rent', command=self.rental).pack(padx=10, pady=10)

    def run(self):
        tools = self.tool.searchName(self.logic.sTool)

        tool = tools[0]
        self.fee = tool['price']
        self.name['text'] = tool['name']
        self.price['text'] = tool['price']
        self.logic.sToolId = tool['id']
        self.dscp['text'] = tool['Description']

        for photo in tool['photos']:
            av_file = ImageTk.PhotoImage(
                Image.open(photo).resize((100, 50), Image.ANTIALIAS))
            avatar = Label(self.frame, image=av_file)
            avatar.image = av_file
            avatar.config(image=av_file)
            avatar.pack()

    def rental(self):
        self.logic.price = self.fee

        self.logic.show_frame(Lease)