Clean up more options page, add strings to the localizer, add new strings to the more options page, add cogLevel settings properly.

This commit is contained in:
DenialMC 2015-04-04 13:14:39 +03:00
parent 73dbf43edb
commit b6cf9c8f22
6 changed files with 21 additions and 34 deletions

View file

@ -732,8 +732,8 @@ class MoreOptionsTabPage(DirectFrame):
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.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))
gui.removeNode()
guiButton.removeNode()
@ -747,36 +747,17 @@ class MoreOptionsTabPage(DirectFrame):
self.hide()
def unload(self):
self.CogLevel_Label.destroy()
del self.CogLevel_Label
self.CogLevel_toggleButton.destroy()
del self.CogLevel_toggleButton
self.cogLevel_label.destroy()
del self.cogLevel_label
self.cogLevel_toggleButton.destroy()
del self.cogLevel_toggleButton
def __doToggleCogLevelGui(self):
messenger.send('wakeup')
if base.wantCogLevelGui:
base.wantCogLevelGui = False
settings['want-Cog-Level-GUI'] = False
else:
base.wantCogLevelGui = True
settings['want-Cog-Level-GUI'] = True
settings['cogLevel'] = not settings['cogLevel']
self.settingsChanged = 1
self.__setCogLevelGuiButton()
def __setCogLevelGuiButton(self):
if base.wantCogLevelGui:
self.CogLevel_Label['text'] = 'Cog Level GUI In-Battle:'
self.CogLevel_toggleButton['text'] = 'On'
else:
self.CogLevel_Label['text'] = 'Cog Level GUI In-Battle:'
self.CogLevel_toggleButton['text'] = 'Off'
def __doToggleAntialiasing(self):
# To toggle anti-aliasing in the future.
pass
def __setAntialiasingGuiButton(self):
# More anti-aliasing stuff.
pass
self.cogLevel_label['text'] = TTLocalizer.CogLevelLabelOn if settings['cogLevel'] else TTLocalizer.CogLevelLabelOff
self.cogLevel_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['cogLevel'] else TTLocalizer.OptionsPageToggleOn

View file

@ -828,7 +828,7 @@ class Toon(Avatar.Avatar, ToonHead):
if headStyle > -1:
self.style.head = headStyle
if laughingMan > -1:
self.style.laughingMan = True if laughingMan else self.getWantLaughingMan()
self.style.laughingMan = True if laughingMan else self.getWantLaughingManHoliday()
self.generateToonHead(copy)
self.generateToonColor()
self.parentToonParts()
@ -1149,7 +1149,10 @@ class Toon(Avatar.Avatar, ToonHead):
return self.hat
def getWantLaughingMan(self):
return self.style.laughingMan or (base.cr.newsManager and base.cr.newsManager.isHolidayRunning(ToontownGlobals.LAUGHING_MAN))
return self.style.laughingMan or self.getWantLaughingManHoliday()
def getWantLaughingManHoliday(self):
return base.cr.newsManager and base.cr.newsManager.isHolidayRunning(ToontownGlobals.LAUGHING_MAN)
def setGlasses(self, glassesIdx, textureIdx, colorIdx, fromRTM = False):
self.glasses = (glassesIdx, textureIdx, colorIdx)

View file

@ -83,6 +83,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
loadPrcFileData('Settings: res', 'win-size %d %d' % tuple(settings.get('res', (800, 600))))
loadPrcFileData('Settings: fullscreen', 'fullscreen %s' % settings['fullscreen'])
loadPrcFileData('Settings: music', 'audio-music-active %s' % settings['music'])
@ -92,6 +94,7 @@ loadPrcFileData('Settings: sfxVol', 'audio-master-sfx-volume %s' % settings['sfx
loadPrcFileData('Settings: loadDisplay', 'load-display %s' % settings['loadDisplay'])
loadPrcFileData('Settings: toonChatSounds', 'toon-chat-sounds %s' % settings['toonChatSounds'])
loadPrcFileData('Settings: language', 'language %s' % settings['language'])
loadPrcFileData('Settings: cogLevel', 'cogLevel %s' % settings['cogLevel'])
import os

View file

@ -8984,6 +8984,8 @@ LanguageSelectorSameLanguage = "You're already using that language!"
PickTrackTitle = 'Pick your third track!'
PickTrackNotice = 'Choose a track!'
UnknownTrack = 'None'
CogLevelLabelOn = 'The cog level GUI is on.'
CogLevelLabelOff = 'The cog level GUI is off.'
HouseNames = ("Bungalow", "Tiki", "Teepee", "Castle", "Cupcake", "Cabin")
CatalogPurchaseHouseType = "When you buy a new house type, the current one is replaced by it. To recover the old type, you'll need to buy it back. Continue?"

View file

@ -235,8 +235,6 @@ class ToonBase(OTPBase.OTPBase):
self.filters = CommonFilters(self.win, self.cam)
self.wantCogLevelGui = settings.get('want-Cog-Level-GUI', True)
def openMainWindow(self, *args, **kw):
result = OTPBase.OTPBase.openMainWindow(self, *args, **kw)
self.setCursorAndIcon()

View file

@ -368,7 +368,7 @@ class TownBattle(StateData.StateData):
def exitOff(self):
if self.isLoaded:
self.__enterPanels(self.numToons, self.localNum)
if base.wantCogLevelGui:
if settings['cogLevel']:
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 base.wantCogLevelGui:
if settings['cogLevel']:
self.__enterCogPanels(self.numCogs)
for i in xrange(len(cogs)):
self.cogPanels[i].setSuit(cogs[i])