oldschool-toontown/toontown/estate/FlowerBrowser.py

59 lines
2.2 KiB
Python
Raw Normal View History

2019-11-02 17:27:54 -05:00
from toontown.toonbase import ToontownGlobals
from direct.directnotify import DirectNotifyGlobal
from direct.gui.DirectGui import *
from panda3d.core import *
2019-11-02 17:27:54 -05:00
from toontown.toonbase import TTLocalizer
from . import FlowerSpeciesPanel
from . import GardenGlobals
2019-11-02 17:27:54 -05:00
class FlowerBrowser(DirectScrolledList):
notify = DirectNotifyGlobal.directNotify.newCategory('FlowerBrowser')
def __init__(self, parent = aspect2d, **kw):
2022-01-17 14:10:03 -06:00
self._parent = parent
2019-11-02 17:27:54 -05:00
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
2022-01-17 14:10:03 -06:00
optiondefs = (('parent', self._parent, None),
2019-11-02 17:27:54 -05:00
('relief', None, None),
('incButton_image', (gui.find('**/FndsLst_ScrollUp'),
gui.find('**/FndsLst_ScrollDN'),
gui.find('**/FndsLst_ScrollUp_Rllvr'),
gui.find('**/FndsLst_ScrollUp')), None),
('incButton_relief', None, None),
('incButton_scale', (1.3, 1.3, -1.3), None),
('incButton_pos', (0, 0, -0.525), None),
('incButton_image3_color', Vec4(0.8, 0.8, 0.8, 0.5), None),
('decButton_image', (gui.find('**/FndsLst_ScrollUp'),
gui.find('**/FndsLst_ScrollDN'),
gui.find('**/FndsLst_ScrollUp_Rllvr'),
gui.find('**/FndsLst_ScrollUp')), None),
('decButton_relief', None, None),
('decButton_scale', (1.3, 1.3, 1.3), None),
('decButton_pos', (0, 0, 0.525), None),
('decButton_image3_color', Vec4(0.8, 0.8, 0.8, 0.5), None),
('numItemsVisible', 1, None),
('items', list(map(str, GardenGlobals.getFlowerSpecies())), None),
2019-11-02 17:27:54 -05:00
('scrollSpeed', 4, None),
('itemMakeFunction', FlowerSpeciesPanel.FlowerSpeciesPanel, None),
('itemMakeExtraArgs', base.localAvatar.flowerCollection, None))
gui.removeNode()
self.defineoptions(kw, optiondefs)
DirectScrolledList.__init__(self, parent)
self.initialiseoptions(FlowerBrowser)
return None
def destroy(self):
DirectScrolledList.destroy(self)
2022-01-17 14:10:03 -06:00
self._parent = None
2019-11-02 17:27:54 -05:00
return
def update(self):
pass
def show(self):
self['items'][self.index].show()
DirectScrolledList.show(self)
def hide(self):
self['items'][self.index].hide()
DirectScrolledList.hide(self)