mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-25 12:42:41 -06:00
34 lines
1.1 KiB
Python
34 lines
1.1 KiB
Python
|
from toontown.catalog.CatalogItemPage import CatalogItemPage
|
||
|
|
||
|
|
||
|
class CatalogItemListGUI:
|
||
|
def __init__(self, catalogGui):
|
||
|
self.catalogGui = catalogGui
|
||
|
self.items = {}
|
||
|
self.pages = []
|
||
|
|
||
|
def getPages(self):
|
||
|
return self.pages
|
||
|
|
||
|
def addItem(self, item, category):
|
||
|
if category not in self.items:
|
||
|
self.items[category] = []
|
||
|
if not item in self.items[category]:
|
||
|
self.items[category].append(item)
|
||
|
|
||
|
def generatePages(self):
|
||
|
for category in self.items.keys():
|
||
|
pageNum = 1
|
||
|
currPage = CatalogItemPage(self.catalogGui, category, pageNum)
|
||
|
for (x, item) in enumerate(self.items[category]):
|
||
|
if x % 12 == 0 and x != 0:
|
||
|
self.pages.append(currPage)
|
||
|
pageNum += 1
|
||
|
currPage = CatalogItemPage(self.catalogGui, category, pageNum)
|
||
|
currPage.addCatalogItem(item)
|
||
|
if not currPage in self.pages:
|
||
|
self.pages.append(currPage)
|
||
|
for page in self.pages:
|
||
|
page.generatePage()
|
||
|
return self.pages
|