oldschool-toontown/toontown/fishing/FishBrowser.py

60 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 pandac.PandaModules import *
from toontown.toonbase import TTLocalizer
from . import GenusPanel
from . import FishGlobals
2019-11-02 17:27:54 -05:00
class FishBrowser(DirectScrolledList):
notify = DirectNotifyGlobal.directNotify.newCategory('FishBrowser')
def __init__(self, parent = aspect2d, **kw):
2019-11-17 15:57:18 -06:00
self._parent = parent
2019-11-02 17:27:54 -05:00
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
2019-11-17 15:57:18 -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, FishGlobals.getGenera())), None),
2019-11-02 17:27:54 -05:00
('scrollSpeed', 4, None),
('itemMakeFunction', GenusPanel.GenusPanel, None),
('itemMakeExtraArgs', None, None))
gui.removeNode()
self.defineoptions(kw, optiondefs)
DirectScrolledList.__init__(self, parent)
self.initialiseoptions(FishBrowser)
return None
def destroy(self):
DirectScrolledList.destroy(self)
2019-11-17 15:57:18 -06:00
self._parent = None
2019-11-02 17:27:54 -05:00
return
def update(self):
pass
def show(self):
2019-11-17 15:57:18 -06:00
if not self._parent.isHidden():
2019-11-02 17:27:54 -05:00
self['items'][self.index].show()
DirectScrolledList.show(self)
def hide(self):
self['items'][self.index].hide()
DirectScrolledList.hide(self)