From b05d2741582777361cddb9256f456400951e1e1d Mon Sep 17 00:00:00 2001 From: Loudrob Date: Wed, 17 Jun 2015 11:24:52 -0400 Subject: [PATCH] Misc Fixes (prepare your asshole for daniels commits) --- toontown/shtiker/OptionsPage.py | 62 ++++++++++++++----------- toontown/toon/ToonAvatarPanel.py | 3 +- toontown/toonbase/ClientStart.py | 4 +- toontown/toonbase/TTLocalizerEnglish.py | 10 ++++ toontown/toonbase/ToonBase.py | 1 + toontown/town/TownBattle.py | 4 +- 6 files changed, 52 insertions(+), 32 deletions(-) diff --git a/toontown/shtiker/OptionsPage.py b/toontown/shtiker/OptionsPage.py index b63026a2..e8593daa 100755 --- a/toontown/shtiker/OptionsPage.py +++ b/toontown/shtiker/OptionsPage.py @@ -706,7 +706,6 @@ class ExtraOptionsTabPage(DirectFrame): def __init__(self, parent = aspect2d): self.parent = parent self.currentSizeIndex = None - self.dialog = None DirectFrame.__init__(self, parent=self.parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0)) @@ -714,16 +713,10 @@ class ExtraOptionsTabPage(DirectFrame): def destroy(self): self.parent = None - - if self.dialog: - self.dialog.destroy() - - del self.dialog DirectFrame.destroy(self) def load(self): guiButton = loader.loadModel('phase_3/models/gui/quit_button') - gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') titleHeight = 0.61 textStartHeight = 0.45 textRowHeight = 0.145 @@ -734,45 +727,56 @@ class ExtraOptionsTabPage(DirectFrame): button_textpos = (0, -0.02) options_text_scale = 0.052 disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0) - self.speed_chat_scale = 0.055 - self.cogLevel_toggleButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord), command=self.__doToggleCogLevelGui) - self.cogLevel_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight)) - self.bugReportButton = DirectButton(parent=self, relief=None, text=TTLocalizer.BugReportButton, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=button_image_scale, text_pos=(0, -0.01), text_fg=(0, 0, 0, 1), + button_image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')) + self.speed_chat_scale = 0.055 + self.speedchatPlus_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight)) + self.trueFriends_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight)) + self.cogInterface_label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight)) + self.speedchatPlus_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord), command=self.__doToggleSpeedchatPlus) + self.trueFriends_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight), command=self.__doToggleTrueFriends) + self.cogInterface_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=button_image_scale, text='', text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - 2 * textRowHeight), command=self.__doToggleCogInterface) + self.bugReportButton = DirectButton(parent=self, relief=None, text=TTLocalizer.BugReportButton, image=button_image, image_scale=button_image_scale, text_pos=(0, -0.01), text_fg=(0, 0, 0, 1), command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045)) - gui.removeNode() guiButton.removeNode() def enter(self): self.show() self.settingsChanged = 0 - self.__setCogLevelGuiButton() + self.__setSpeedchatPlusButton() + self.__setTrueFriendsButton() + self.__setCogInterfaceButton() def exit(self): self.ignore('confirmDone') + self.destroyReportNotice() self.hide() def unload(self): - self.cogLevel_label.destroy() - del self.cogLevel_label - self.cogLevel_toggleButton.destroy() - del self.cogLevel_toggleButton + self.speedchatPlus_label.destroy() + del self.speedchatPlus_label + self.trueFriends_label.destroy() + del self.trueFriends_label + self.cogInterface_label.destroy() + del self.cogInterface_label + self.cogInterface_toggleButton.destroy() + del self.cogInterface_toggleButton - def __doToggleCogLevelGui(self): + def __doToggleCogInterface(self): messenger.send('wakeup') - settings['cogLevel'] = not settings['cogLevel'] + settings['cogInterface'] = not settings['cogInterface'] self.settingsChanged = 1 - self.__setCogLevelGuiButton() + self.__setCogInterfaceButton() + def __setCogInterfaceButton(self): + self.cogInterface_label['text'] = TTLocalizer.CogInterfaceLabelOn if settings['cogInterface'] else TTLocalizer.CogInterfaceLabelOff + self.cogInterface_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['cogInterface'] else TTLocalizer.OptionsPageToggleOn + def __doToggleSpeedchatPlus(self): messenger.send('wakeup') settings['speedchatPlus'] = not settings['speedchatPlus'] Avatar.reconsiderAllUnderstandable() self.settingsChanged = 1 self.__setSpeedchatPlusButton() - - def __setCogLevelGuiButton(self): - self.cogLevel_label['text'] = TTLocalizer.CogLevelLabelOn if settings['cogLevel'] else TTLocalizer.CogLevelLabelOff - self.cogLevel_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['cogLevel'] else TTLocalizer.OptionsPageToggleOn def __setSpeedchatPlusButton(self): self.speedchatPlus_label['text'] = TTLocalizer.SpeedchatPlusLabelOn if settings['speedchatPlus'] else TTLocalizer.SpeedchatPlusLabelOff @@ -789,12 +793,18 @@ class ExtraOptionsTabPage(DirectFrame): self.trueFriends_label['text'] = TTLocalizer.TrueFriendsLabelOn if settings['trueFriends'] else TTLocalizer.TrueFriendsLabelOff self.trueFriends_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['trueFriends'] else TTLocalizer.OptionsPageToggleOn + def destroyReportNotice(self): + if hasattr(self, 'dialog'): + self.dialog.destroy() + del self.dialog + def showReportNotice(self): + self.destroyReportNotice() self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.BugReportNotice, command=self.confirmBugReport) self.dialog.show() def confirmBugReport(self, value): + self.destroyReportNotice() + if value > 0: webbrowser.open(ToontownGlobals.BugReportSite, new=2, autoraise=True) - - self.dialog.destroy() diff --git a/toontown/toon/ToonAvatarPanel.py b/toontown/toon/ToonAvatarPanel.py index 6efe74df..92e46c71 100755 --- a/toontown/toon/ToonAvatarPanel.py +++ b/toontown/toon/ToonAvatarPanel.py @@ -219,7 +219,6 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase): command=self.handleReport) if avatar.isAdmin(): - self.trueFriendsButton['state'] = DGG.DISABLED self.ignoreButton['state'] = DGG.DISABLED self.reportButton['state'] = DGG.DISABLED elif base.localAvatar.isIgnored(self.avId): @@ -594,4 +593,4 @@ class ToonAvatarPanel(AvatarPanelBase.AvatarPanelBase): def cleanupDialogAndWalk(self, state=None): self.cleanupDialog() - base.cr.playGame.getPlace().fsm.request('walk') \ No newline at end of file + base.cr.playGame.getPlace().fsm.request('walk') diff --git a/toontown/toonbase/ClientStart.py b/toontown/toonbase/ClientStart.py index 83db1dcc..c7c05f58 100755 --- a/toontown/toonbase/ClientStart.py +++ b/toontown/toonbase/ClientStart.py @@ -92,8 +92,8 @@ if 'toonChatSounds' not in settings: settings['toonChatSounds'] = True if 'language' not in settings: settings['language'] = 'English' -if 'cogLevel' not in settings: - settings['cogLevel'] = True +if 'cogInterface' not in settings: + settings['cogInterface'] = True if 'speedchatPlus' not in settings: settings['speedchatPlus'] = True if 'trueFriends' not in settings: diff --git a/toontown/toonbase/TTLocalizerEnglish.py b/toontown/toonbase/TTLocalizerEnglish.py index c09ccce5..8d7acd2a 100755 --- a/toontown/toonbase/TTLocalizerEnglish.py +++ b/toontown/toonbase/TTLocalizerEnglish.py @@ -8481,3 +8481,13 @@ def convertSecondsToDate(seconds): return '%d:%02d:%02d' % (h, m, s) ToonDefeatedMessage = '%s was defeated!' +BugReportButton = 'Report a Bug' +BugReportNotice = 'Attention!\n\nThis button will open a browser which will send you to a third party bug tracker website. This site requires an Ubuntu One account to login. It may ask you to create an account.\n\nAre you sure you want to continue?' +CodeRedemptionWarning = 'NOTICE: All codes can only be entered once!' +CogInterfaceLabelOn = 'The cog battle interface is on.' +CogInterfaceLabelOff = 'The cog battle interface is off.' +SpeedchatPlusLabelOn = 'Speedchat Plus is on.' +SpeedchatPlusLabelOff = 'Speedchat Plus is off.' +TrueFriendsLabelOn = 'True Friends is on.' +TrueFriendsLabelOff = 'True Friends is off.' + diff --git a/toontown/toonbase/ToonBase.py b/toontown/toonbase/ToonBase.py index a83c9d3b..9b6fb7db 100755 --- a/toontown/toonbase/ToonBase.py +++ b/toontown/toonbase/ToonBase.py @@ -145,6 +145,7 @@ class ToonBase(OTPBase.OTPBase): self.localAvatarStyle = None self.filters = CommonFilters(self.win, self.cam) + self.wantCogInterface = settings.get('cogInterface', True) def openMainWindow(self, *args, **kw): result = OTPBase.OTPBase.openMainWindow(self, *args, **kw) diff --git a/toontown/town/TownBattle.py b/toontown/town/TownBattle.py index d981f96d..481e73fa 100755 --- a/toontown/town/TownBattle.py +++ b/toontown/town/TownBattle.py @@ -368,7 +368,7 @@ class TownBattle(StateData.StateData): def exitOff(self): if self.isLoaded: self.__enterPanels(self.numToons, self.localNum) - if settings['cogLevel']: + if settings['cogInterface']: self.__enterCogPanels(self.numCogs) self.timer.show() self.track = -1 @@ -516,7 +516,7 @@ class TownBattle(StateData.StateData): for i in xrange(len(toons)): self.toonPanels[i].setLaffMeter(toons[i]) - if settings['cogLevel']: + if settings['cogInterface']: self.__enterCogPanels(self.numCogs) for i in xrange(len(cogs)): self.cogPanels[i].setSuit(cogs[i])