GUI module
- class GUI.Application
Bases:
objectThe main application class for the project.- reload_state()
Populates the listbox with saved values.
- run_timer()
After this function is called for the first time, it will be called again every second until the application is closed. Delegates GUI updating to ‘update_stock_info’ and send an alert when the item restocks.
- save_setting()
Saves the updated setting. Checks email alert.
- scraper_data()
Obtains stock info from appropriate scrapers. Threads run this method.
- update_stock_info(entry, item_name, item_url, item_stock)
Updates the items in the GUI with the stock information.
- Parameters
entry – one of the items in the products list
item_name – name of the product
item_url – url of the product
item_stock – stock info of the product
- class GUI.GetItemURLDialogue
Bases:
objectThis is a popup for getting the name and url for a product. It is build off of the tkinter.simpledialog.Dialog class. Information can be retrieved by checking the name and url attributes after the popup has been closed.
- Parameters
parent – the parent object for the popup
title – the title of the new window
name – the default name of the item
url – the default url of the item
- apply()
This function controls what values are applied to the object after the popup closes.
- body(frame)
This function is called automatically by the object. It controls what objects should be contained in the popup frame.
- Parameters
frame –
- Returns
the modified frame
- class GUI.ItemAlertDialogue
Bases:
objectThis class defines the popup that is used to alert a user of a restock.
- Parameters
parent – the parent object for the popup
title – the title of the new window
name – the name of the item
url – the url of the item
- body(frame)
This function is called automatically by the object. It controls what objects should be contained in the popup frame.
- Parameters
frame –
- Returns
the modified frame
- buttonbox()
This function is called automatically by the object. It controls what buttons should be contained in the popup.
- followlink(event)
Opens the url displayed in the popup in a web browser.
- Parameters
event – The popup event
- class GUI.TrackedItemsListbox
Bases:
objectThis object is for holding and displaying the list of items that are being tracked by the program. It is built off of the ttk.Treeview class, and contains 3 columns (Name, URL, Stock Status).
- add_item(name, url)
Adds an item to the list to be tracked.
- Parameters
name – name of the item to be added
url – URL of the product page
- add_item_popup()
Adds a new item to the list. It launches a popup to gather the name and url for the item from the user.
- alert(name, url)
Alerts the user that a particular product is back in stock by launching a popup and, if the email setting is active, sending an email.
- Parameters
name – name of the item to be added
url – URL of the product page
- delete_item()
Deletes the currently selected item.
- edit_item()
Edits the currently selected item. To do this, it creates a popup to gather the new item information.
This function causes a menu with a list of commands to appear. It is intended to be used when the user right clicks on the item list.
- GUI.on_closing()
Save the setting when closing