From c9495aa06d404146f97e82b322b77457850fc12a Mon Sep 17 00:00:00 2001 From: Open Toontown <57279094+opentoontown@users.noreply.github.com> Date: Mon, 17 Jan 2022 15:10:03 -0500 Subject: [PATCH] fix some estate crashes --- toontown/estate/FlowerBrowser.py | 6 +++--- toontown/estate/FlowerPanel.py | 4 ++-- toontown/estate/FlowerPicker.py | 6 +++--- toontown/estate/SpecialsPhoto.py | 13 ++++++++----- toontown/estate/houseDesign.py | 2 +- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/toontown/estate/FlowerBrowser.py b/toontown/estate/FlowerBrowser.py index d594a85..edaf213 100644 --- a/toontown/estate/FlowerBrowser.py +++ b/toontown/estate/FlowerBrowser.py @@ -10,9 +10,9 @@ class FlowerBrowser(DirectScrolledList): notify = DirectNotifyGlobal.directNotify.newCategory('FlowerBrowser') def __init__(self, parent = aspect2d, **kw): - self.parent = parent + self._parent = parent gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') - optiondefs = (('parent', self.parent, None), + optiondefs = (('parent', self._parent, None), ('relief', None, None), ('incButton_image', (gui.find('**/FndsLst_ScrollUp'), gui.find('**/FndsLst_ScrollDN'), @@ -43,7 +43,7 @@ class FlowerBrowser(DirectScrolledList): def destroy(self): DirectScrolledList.destroy(self) - self.parent = None + self._parent = None return def update(self): diff --git a/toontown/estate/FlowerPanel.py b/toontown/estate/FlowerPanel.py index ab52810..30e978f 100644 --- a/toontown/estate/FlowerPanel.py +++ b/toontown/estate/FlowerPanel.py @@ -27,7 +27,7 @@ class FlowerPanel(DirectFrame): self.initialiseoptions(FlowerPanel) self.doneEvent = doneEvent self.flower = flower - self.parent = parent + self._parent = parent self.photo = None return @@ -37,7 +37,7 @@ class FlowerPanel(DirectFrame): self.photo = None self.flower = None DirectFrame.destroy(self) - self.parent = None + self._parent = None return def load(self): diff --git a/toontown/estate/FlowerPicker.py b/toontown/estate/FlowerPicker.py index dddb2b9..999433b 100644 --- a/toontown/estate/FlowerPicker.py +++ b/toontown/estate/FlowerPicker.py @@ -10,10 +10,10 @@ class FlowerPicker(DirectScrolledList): def __init__(self, parent = aspect2d, **kw): self.flowerList = [] - self.parent = parent + self._parent = parent self.shown = 0 gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') - optiondefs = (('parent', self.parent, None), + optiondefs = (('parent', self._parent, None), ('relief', None, None), ('incButton_image', (gui.find('**/FndsLst_ScrollUp'), gui.find('**/FndsLst_ScrollDN'), @@ -63,7 +63,7 @@ class FlowerPicker(DirectScrolledList): def destroy(self): DirectScrolledList.destroy(self) - self.parent = None + self._parent = None self.flowerList = [] self.flowerPanel = None return diff --git a/toontown/estate/SpecialsPhoto.py b/toontown/estate/SpecialsPhoto.py index 1180a03..01fd7a8 100644 --- a/toontown/estate/SpecialsPhoto.py +++ b/toontown/estate/SpecialsPhoto.py @@ -28,7 +28,7 @@ class DirectRegion(NodePath): pass def hide(self): - NodePath.NodePath.hide(self) + NodePath.hide(self) def load(self): if not hasattr(self, 'cRender'): @@ -127,9 +127,12 @@ class SpecialsPhoto(NodePath): rotate = pitch.attachNewNode('rotate') scale = rotate.attachNewNode('scale') actor.reparentTo(scale) - bMin, bMax = actor.getTightBounds() - center = (bMin + bMax) / 2.0 - actor.setPos(-center[0], -center[1], -center[2]) + if actor.getTightBounds(): + bMin, bMax = actor.getTightBounds() + center = (bMin + bMax) / 2.0 + actor.setPos(-center[0], -center[1], -center[2]) + else: + actor.setPos(0, 0, 0) pitch.setY(2.5) return frame @@ -193,7 +196,7 @@ class SpecialsPhoto(NodePath): self.background.reparentTo(self.specialsFrame) def hide(self): - NodePath.NodePath.hide(self) + NodePath.hide(self) if hasattr(self, 'specialsDisplayRegion'): self.specialsDisplayRegion.unload() if hasattr(self, 'background'): diff --git a/toontown/estate/houseDesign.py b/toontown/estate/houseDesign.py index e8c5e08..f20801b 100644 --- a/toontown/estate/houseDesign.py +++ b/toontown/estate/houseDesign.py @@ -1449,7 +1449,7 @@ class ObjectManager(NodePath, DirectObject): 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')) 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.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)