12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- #!/usr/bin/env python
- #
- # Program to view the inventory,
- #
- import os
- import sys
- import Tkinter as tk
- import config
- import admin
- class Inventory(object):
- '''
- Window to check out the inventory.
- '''
- def availability(self):
- '''
- Queries the database to see if there are any items still available
- '''
- product = self.menuvalue.get()
- stock = admin.view_availability(product)
- self.counter.config(text="Quantidade em estoque: %s" % stock)
- def __init__(self):
- self.window = tk.Tk()
- self.window.title("Gestor de inventario")
- self.inventory_frame = tk.Frame(self.window)
- self.counter = tk.Label(text="Selecione um item para checar")
- # Stuff for Dropdown menu:
- self.menuvalue = tk.StringVar(self.window)
- self.menuvalue.set("Clique para escolher")
- self.inventoryframe = tk.Frame(self.inventory_frame)
- self.dropdown = apply(tk.OptionMenu, (self.inventoryframe,
- self.menuvalue) + config.products)
- self.checker = tk.Button(self.inventory_frame, text="Checar disponibilidade",
- command=self.availability)
- # Pack everything:
- self.inventoryframe.pack(side="left", expand=1)
- self.dropdown.pack(expand=1)
- self.checker.pack(side="right")
- self.counter.pack(expand=1)
- self.inventory_frame.pack(expand=1)
- def main(self):
- self.window.mainloop()
- if __name__ == "__main__":
- app = Inventory()
- app.main()
|