fix some estate crashes

This commit is contained in:
Open Toontown 2022-01-17 15:10:03 -05:00
parent 949fc5e50e
commit c9495aa06d
5 changed files with 17 additions and 14 deletions

View file

@ -10,9 +10,9 @@ class FlowerBrowser(DirectScrolledList):
notify = DirectNotifyGlobal.directNotify.newCategory('FlowerBrowser') notify = DirectNotifyGlobal.directNotify.newCategory('FlowerBrowser')
def __init__(self, parent = aspect2d, **kw): def __init__(self, parent = aspect2d, **kw):
self.parent = parent self._parent = parent
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
optiondefs = (('parent', self.parent, None), optiondefs = (('parent', self._parent, None),
('relief', None, None), ('relief', None, None),
('incButton_image', (gui.find('**/FndsLst_ScrollUp'), ('incButton_image', (gui.find('**/FndsLst_ScrollUp'),
gui.find('**/FndsLst_ScrollDN'), gui.find('**/FndsLst_ScrollDN'),
@ -43,7 +43,7 @@ class FlowerBrowser(DirectScrolledList):
def destroy(self): def destroy(self):
DirectScrolledList.destroy(self) DirectScrolledList.destroy(self)
self.parent = None self._parent = None
return return
def update(self): def update(self):

View file

@ -27,7 +27,7 @@ class FlowerPanel(DirectFrame):
self.initialiseoptions(FlowerPanel) self.initialiseoptions(FlowerPanel)
self.doneEvent = doneEvent self.doneEvent = doneEvent
self.flower = flower self.flower = flower
self.parent = parent self._parent = parent
self.photo = None self.photo = None
return return
@ -37,7 +37,7 @@ class FlowerPanel(DirectFrame):
self.photo = None self.photo = None
self.flower = None self.flower = None
DirectFrame.destroy(self) DirectFrame.destroy(self)
self.parent = None self._parent = None
return return
def load(self): def load(self):

View file

@ -10,10 +10,10 @@ class FlowerPicker(DirectScrolledList):
def __init__(self, parent = aspect2d, **kw): def __init__(self, parent = aspect2d, **kw):
self.flowerList = [] self.flowerList = []
self.parent = parent self._parent = parent
self.shown = 0 self.shown = 0
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
optiondefs = (('parent', self.parent, None), optiondefs = (('parent', self._parent, None),
('relief', None, None), ('relief', None, None),
('incButton_image', (gui.find('**/FndsLst_ScrollUp'), ('incButton_image', (gui.find('**/FndsLst_ScrollUp'),
gui.find('**/FndsLst_ScrollDN'), gui.find('**/FndsLst_ScrollDN'),
@ -63,7 +63,7 @@ class FlowerPicker(DirectScrolledList):
def destroy(self): def destroy(self):
DirectScrolledList.destroy(self) DirectScrolledList.destroy(self)
self.parent = None self._parent = None
self.flowerList = [] self.flowerList = []
self.flowerPanel = None self.flowerPanel = None
return return

View file

@ -28,7 +28,7 @@ class DirectRegion(NodePath):
pass pass
def hide(self): def hide(self):
NodePath.NodePath.hide(self) NodePath.hide(self)
def load(self): def load(self):
if not hasattr(self, 'cRender'): if not hasattr(self, 'cRender'):
@ -127,9 +127,12 @@ class SpecialsPhoto(NodePath):
rotate = pitch.attachNewNode('rotate') rotate = pitch.attachNewNode('rotate')
scale = rotate.attachNewNode('scale') scale = rotate.attachNewNode('scale')
actor.reparentTo(scale) actor.reparentTo(scale)
if actor.getTightBounds():
bMin, bMax = actor.getTightBounds() bMin, bMax = actor.getTightBounds()
center = (bMin + bMax) / 2.0 center = (bMin + bMax) / 2.0
actor.setPos(-center[0], -center[1], -center[2]) actor.setPos(-center[0], -center[1], -center[2])
else:
actor.setPos(0, 0, 0)
pitch.setY(2.5) pitch.setY(2.5)
return frame return frame
@ -193,7 +196,7 @@ class SpecialsPhoto(NodePath):
self.background.reparentTo(self.specialsFrame) self.background.reparentTo(self.specialsFrame)
def hide(self): def hide(self):
NodePath.NodePath.hide(self) NodePath.hide(self)
if hasattr(self, 'specialsDisplayRegion'): if hasattr(self, 'specialsDisplayRegion'):
self.specialsDisplayRegion.unload() self.specialsDisplayRegion.unload()
if hasattr(self, 'background'): if hasattr(self, 'background'):

View file

@ -1449,7 +1449,7 @@ class ObjectManager(NodePath, DirectObject):
buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui') buttons = loader.loadModel('phase_3/models/gui/dialog_box_buttons_gui')
okButtonImage = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr')) okButtonImage = (buttons.find('**/ChtBx_OKBtn_UP'), buttons.find('**/ChtBx_OKBtn_DN'), buttons.find('**/ChtBx_OKBtn_Rllvr'))
cancelButtonImage = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr')) cancelButtonImage = (buttons.find('**/CloseBtn_UP'), buttons.find('**/CloseBtn_DN'), buttons.find('**/CloseBtn_Rllvr'))
self.verifyFrame = DirectFrame(pos=(-0.4, 0.1, 0.3), scale=0.75, relief=None, image=DGG.getDefaultDialogGeom(), image_color=ToontownGlobals.GlobalDialogColor, image_scale=(1.2, 1, 1.3), text='', text_wordwrap=19, text_scale=0.06, text_pos=(0, 0.5), textMayChange=1, sortOrder=NO_FADE_SORT_INDEX) self.verifyFrame = DirectFrame(pos=(-0.4, 0.1, 0.3), scale=0.75, relief=None, image=DGG.getDefaultDialogGeom(), image_color=ToontownGlobals.GlobalDialogColor, image_scale=(1.2, 1, 1.3), text='', text_wordwrap=19, text_scale=0.06, text_pos=(0, 0.5), textMayChange=1, sortOrder=DGG.NO_FADE_SORT_INDEX)
self.okButton = DirectButton(parent=self.verifyFrame, image=okButtonImage, relief=None, text=OTPLocalizer.DialogOK, text_scale=0.05, text_pos=(0.0, -0.1), textMayChange=0, pos=(-0.22, 0.0, -0.5)) self.okButton = DirectButton(parent=self.verifyFrame, image=okButtonImage, relief=None, text=OTPLocalizer.DialogOK, text_scale=0.05, text_pos=(0.0, -0.1), textMayChange=0, pos=(-0.22, 0.0, -0.5))
self.cancelButton = DirectButton(parent=self.verifyFrame, image=cancelButtonImage, relief=None, text=OTPLocalizer.DialogCancel, text_scale=0.05, text_pos=(0.0, -0.1), textMayChange=0, pos=(0.22, 0.0, -0.5)) self.cancelButton = DirectButton(parent=self.verifyFrame, image=cancelButtonImage, relief=None, text=OTPLocalizer.DialogCancel, text_scale=0.05, text_pos=(0.0, -0.1), textMayChange=0, pos=(0.22, 0.0, -0.5))
self.deleteItemText = DirectLabel(parent=self.verifyFrame, relief=None, text='', text_wordwrap=16, pos=(0.0, 0.0, -0.4), scale=0.09) self.deleteItemText = DirectLabel(parent=self.verifyFrame, relief=None, text='', text_wordwrap=16, pos=(0.0, 0.0, -0.4), scale=0.09)