Revert "Some shticker book cleanup, add Speedchat Plus and True Friends to shticker book, but we really need a OptionsPage rewrite."

This reverts commit 0d5b0cbee9.
This commit is contained in:
John Cote 2015-05-17 00:56:44 -04:00
parent 449237e764
commit aba9368632
5 changed files with 114 additions and 92 deletions

View file

@ -43,6 +43,7 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
self.isLoaded = 1 self.isLoaded = 1
self.anyChanged = 0 self.anyChanged = 0
self.apiChanged = 0
if len(base.resDict[base.nativeRatio]) > 1: if len(base.resDict[base.nativeRatio]) > 1:
# We have resolutions that match our native ratio and fit it: # We have resolutions that match our native ratio and fit it:
@ -86,6 +87,8 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
self.introText = DirectLabel(parent=self, relief=None, scale=TTLocalizer.DSDintroText, text=TTLocalizer.DisplaySettingsIntro, text_wordwrap=TTLocalizer.DSDintroTextWordwrap, text_align=TextNode.ALeft, pos=(-0.725, 0, 0.3)) self.introText = DirectLabel(parent=self, relief=None, scale=TTLocalizer.DSDintroText, text=TTLocalizer.DisplaySettingsIntro, text_wordwrap=TTLocalizer.DSDintroTextWordwrap, text_align=TextNode.ALeft, pos=(-0.725, 0, 0.3))
self.introTextSimple = DirectLabel(parent=self, relief=None, scale=0.06, text=TTLocalizer.DisplaySettingsIntroSimple, text_wordwrap=25, text_align=TextNode.ALeft, pos=(-0.725, 0, 0.3)) self.introTextSimple = DirectLabel(parent=self, relief=None, scale=0.06, text=TTLocalizer.DisplaySettingsIntroSimple, text_wordwrap=25, text_align=TextNode.ALeft, pos=(-0.725, 0, 0.3))
self.apiLabel = DirectLabel(parent=self, relief=None, scale=0.06, text=TTLocalizer.DisplaySettingsApi, text_align=TextNode.ARight, pos=(-0.08, 0, 0))
self.apiMenu = DirectOptionMenu(parent=self, relief=DGG.RAISED, scale=0.06, items=['x'], pos=(0, 0, 0))
self.screenSizeLabel = DirectLabel(parent=self, relief=None, scale=0.06, text=TTLocalizer.DisplaySettingsResolution, text_align=TextNode.ARight, pos=(-0.08, 0, -0.1)) self.screenSizeLabel = DirectLabel(parent=self, relief=None, scale=0.06, text=TTLocalizer.DisplaySettingsResolution, text_align=TextNode.ARight, pos=(-0.08, 0, -0.1))
self.screenSizeLeftArrow = DirectButton(parent=self, relief=None, image=(gui.find('**/Horiz_Arrow_UP'), gui.find('**/Horiz_Arrow_DN'), gui.find('**/Horiz_Arrow_Rllvr'), gui.find('**/Horiz_Arrow_UP')), scale=(-1.0, 1.0, 1.0), pos=(0.04, 0, -0.085), command=self.__doScreenSizeLeft) self.screenSizeLeftArrow = DirectButton(parent=self, relief=None, image=(gui.find('**/Horiz_Arrow_UP'), gui.find('**/Horiz_Arrow_DN'), gui.find('**/Horiz_Arrow_Rllvr'), gui.find('**/Horiz_Arrow_UP')), scale=(-1.0, 1.0, 1.0), pos=(0.04, 0, -0.085), command=self.__doScreenSizeLeft)
self.screenSizeRightArrow = DirectButton(parent=self, relief=None, image=(gui.find('**/Horiz_Arrow_UP'), gui.find('**/Horiz_Arrow_DN'), gui.find('**/Horiz_Arrow_Rllvr'), gui.find('**/Horiz_Arrow_UP')), pos=(0.54, 0, -0.085), command=self.__doScreenSizeRight) self.screenSizeRightArrow = DirectButton(parent=self, relief=None, image=(gui.find('**/Horiz_Arrow_UP'), gui.find('**/Horiz_Arrow_DN'), gui.find('**/Horiz_Arrow_Rllvr'), gui.find('**/Horiz_Arrow_UP')), pos=(0.54, 0, -0.085), command=self.__doScreenSizeRight)
@ -102,7 +105,7 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
self.hide() self.hide()
def enter(self, changeDisplaySettings): def enter(self, changeDisplaySettings, changeDisplayAPI):
if self.isEntered == 1: if self.isEntered == 1:
return return
@ -127,12 +130,19 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
else: else:
self.displayMode = self.WindowedMode self.displayMode = self.WindowedMode
self.updateApiMenu(changeDisplaySettings, changeDisplayAPI)
self.updateWindowed() self.updateWindowed()
self.updateScreenSize() self.updateScreenSize()
if changeDisplaySettings: if changeDisplaySettings:
self.introText.show() self.introText.show()
self.introTextSimple.hide() self.introTextSimple.hide()
if changeDisplayAPI and len(self.apis) > 1:
self.apiLabel.show()
self.apiMenu.show()
else:
self.apiLabel.hide()
self.apiMenu.hide()
self.c1b.show() self.c1b.show()
self.windowedButton.show() self.windowedButton.show()
self.c2b.show() self.c2b.show()
@ -141,6 +151,8 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
else: else:
self.introText.hide() self.introText.hide()
self.introTextSimple.show() self.introTextSimple.show()
self.apiLabel.hide()
self.apiMenu.hide()
self.windowedButton.hide() self.windowedButton.hide()
self.fullscreenButton.hide() self.fullscreenButton.hide()
self.c1b.hide() self.c1b.hide()
@ -148,6 +160,7 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
self.c3b.hide() self.c3b.hide()
self.anyChanged = 0 self.anyChanged = 0
self.apiChanged = 0
self.show() self.show()
@ -164,7 +177,7 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
self.ignoreAll() self.ignoreAll()
self.hide() self.hide()
messenger.send(self.doneEvent, [self.anyChanged]) messenger.send(self.doneEvent, [self.anyChanged, self.apiChanged])
def cleanupDialogs(self): def cleanupDialogs(self):
if self.applyDialog is not None: if self.applyDialog is not None:
@ -180,6 +193,19 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
self.revertDialog.cleanup() self.revertDialog.cleanup()
self.revertDialog = None self.revertDialog = None
def updateApiMenu(self, changeDisplaySettings, changeDisplayAPI):
self.apis = []
self.apiPipes = []
if changeDisplayAPI:
base.makeAllPipes()
for pipe in base.pipeList:
if pipe.isValid():
self.apiPipes.append(pipe)
self.apis.append(pipe.getInterfaceName())
self.apiMenu['items'] = self.apis
self.apiMenu.set(base.pipe.getInterfaceName())
def updateWindowed(self): def updateWindowed(self):
if self.displayMode == self.FullscreenMode: if self.displayMode == self.FullscreenMode:
self.windowedButton['indicatorValue'] = 0 self.windowedButton['indicatorValue'] = 0
@ -249,13 +275,15 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
base.transitions.fadeScreen(0.5) base.transitions.fadeScreen(0.5)
if command != DGG.DIALOG_OK: if command != DGG.DIALOG_OK:
return return
self.origPipe = base.pipe
self.origProperties = base.win.getProperties() self.origProperties = base.win.getProperties()
pipe = self.apiPipes[self.apiMenu.selectedIndex]
properties = WindowProperties() properties = WindowProperties()
xSize, ySize = self.screenSizes[self.screenSizeIndex] xSize, ySize = self.screenSizes[self.screenSizeIndex]
properties.setSize(xSize, ySize) properties.setSize(xSize, ySize)
properties.setFullscreen(self.displayMode == self.FullscreenMode) properties.setFullscreen(self.displayMode == self.FullscreenMode)
fullscreen = self.displayMode == self.FullscreenMode fullscreen = self.displayMode == self.FullscreenMode
if not self.changeDisplayProperties(xSize, ySize, fullscreen): if not self.changeDisplayProperties(pipe, xSize, ySize, fullscreen):
self.__revertBack(1) self.__revertBack(1)
return return
self.clearBin() self.clearBin()
@ -265,11 +293,12 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
self.timeoutStart = None self.timeoutStart = None
taskMgr.add(self.__timeoutCountdown, self.TimeoutCountdownTask) taskMgr.add(self.__timeoutCountdown, self.TimeoutCountdownTask)
def changeDisplayProperties(self, width, height, fullscreen = False): def changeDisplayProperties(self, pipe, width, height, fullscreen = False):
result = False result = False
self.current_pipe = base.pipe
self.current_properties = WindowProperties(base.win.getProperties()) self.current_properties = WindowProperties(base.win.getProperties())
properties = self.current_properties properties = self.current_properties
if self.current_properties.getFullscreen() == fullscreen and self.current_properties.getXSize() == width and self.current_properties.getYSize() == height: if self.current_pipe == pipe and self.current_properties.getFullscreen() == fullscreen and self.current_properties.getXSize() == width and self.current_properties.getYSize() == height:
self.notify.info('DISPLAY NO CHANGE REQUIRED') self.notify.info('DISPLAY NO CHANGE REQUIRED')
state = True state = True
else: else:
@ -293,7 +322,7 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
properties.setFullscreen(fullscreen) properties.setFullscreen(fullscreen)
properties.setParentWindow(0) properties.setParentWindow(0)
original_sort = base.win.getSort() original_sort = base.win.getSort()
if self.resetDisplayProperties(properties): if self.resetDisplayProperties(pipe, properties):
properties = base.win.getProperties() properties = base.win.getProperties()
if properties.getFullscreen() == fullscreen and properties.getXSize() == width and properties.getYSize() == height: if properties.getFullscreen() == fullscreen and properties.getXSize() == width and properties.getYSize() == height:
self.notify.info('DISPLAY CHANGE VERIFIED') self.notify.info('DISPLAY CHANGE VERIFIED')
@ -333,7 +362,7 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
self.__revertBack(0) self.__revertBack(0)
def __revertBack(self, reason): def __revertBack(self, reason):
if not self.resetDisplayProperties(self.origProperties): if not self.resetDisplayProperties(self.origPipe, self.origProperties):
self.notify.warning("Couldn't restore original display settings!") self.notify.warning("Couldn't restore original display settings!")
base.panda3dRenderError() base.panda3dRenderError()
self.clearBin() self.clearBin()
@ -353,7 +382,7 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
def __cancel(self): def __cancel(self):
self.exit() self.exit()
def resetDisplayProperties(self, properties): def resetDisplayProperties(self, pipe, properties):
if base.win: if base.win:
currentProperties = base.win.getProperties() currentProperties = base.win.getProperties()
gsg = base.win.getGsg() gsg = base.win.getGsg()
@ -362,9 +391,13 @@ class DisplaySettingsDialog(DirectFrame, StateData.StateData):
gsg = None gsg = None
newProperties = WindowProperties(currentProperties) newProperties = WindowProperties(currentProperties)
newProperties.addProperties(properties) newProperties.addProperties(properties)
if base.pipe != pipe:
self.apiChanged = 1
gsg = None
if gsg == None or currentProperties.getFullscreen() != newProperties.getFullscreen() or currentProperties.getParentWindow() != newProperties.getParentWindow(): if gsg == None or currentProperties.getFullscreen() != newProperties.getFullscreen() or currentProperties.getParentWindow() != newProperties.getParentWindow():
self.notify.debug('window properties: %s' % properties) self.notify.debug('window properties: %s' % properties)
self.notify.debug('gsg: %s' % gsg) self.notify.debug('gsg: %s' % gsg)
base.pipe = pipe
if not base.openMainWindow(props=properties, gsg=gsg, keepCamera=True): if not base.openMainWindow(props=properties, gsg=gsg, keepCamera=True):
self.notify.warning('OPEN MAIN WINDOW FAILED') self.notify.warning('OPEN MAIN WINDOW FAILED')
return 0 return 0

View file

@ -259,6 +259,7 @@ class OptionsTabPage(DirectFrame):
DisplaySettingsTaskName = 'save-display-settings' DisplaySettingsTaskName = 'save-display-settings'
DisplaySettingsDelay = 60 DisplaySettingsDelay = 60
ChangeDisplaySettings = base.config.GetBool('change-display-settings', 1) ChangeDisplaySettings = base.config.GetBool('change-display-settings', 1)
ChangeDisplayAPI = base.config.GetBool('change-display-api', 0)
def __init__(self, parent = aspect2d): def __init__(self, parent = aspect2d):
self.parent = parent self.parent = parent
@ -278,6 +279,8 @@ class OptionsTabPage(DirectFrame):
self.displaySettingsChanged = 0 self.displaySettingsChanged = 0
self.displaySettingsSize = (None, None) self.displaySettingsSize = (None, None)
self.displaySettingsFullscreen = None self.displaySettingsFullscreen = None
self.displaySettingsApi = None
self.displaySettingsApiChanged = 0
guiButton = loader.loadModel('phase_3/models/gui/quit_button') guiButton = loader.loadModel('phase_3/models/gui/quit_button')
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui') gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
titleHeight = 0.61 titleHeight = 0.61
@ -290,8 +293,6 @@ class OptionsTabPage(DirectFrame):
button_textpos = (0, -0.02) button_textpos = (0, -0.02)
options_text_scale = 0.052 options_text_scale = 0.052
disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0) disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)
button_image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR'))
arrow_image = (gui.find('**/Horiz_Arrow_UP'), gui.find('**/Horiz_Arrow_DN'), gui.find('**/Horiz_Arrow_Rllvr'), gui.find('**/Horiz_Arrow_UP'))
self.speed_chat_scale = 0.055 self.speed_chat_scale = 0.055
self.Music_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, pos=(leftMargin, 0, textStartHeight)) self.Music_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, pos=(leftMargin, 0, textStartHeight))
self.SoundFX_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.SoundFX_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=16, pos=(leftMargin, 0, textStartHeight - textRowHeight))
@ -301,20 +302,29 @@ class OptionsTabPage(DirectFrame):
self.SpeedChatStyle_Label = DirectLabel(parent=self, relief=None, text=TTLocalizer.OptionsPageSpeedChatStyleLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=10, pos=(leftMargin, 0, textStartHeight - 6 * textRowHeight)) self.SpeedChatStyle_Label = DirectLabel(parent=self, relief=None, text=TTLocalizer.OptionsPageSpeedChatStyleLabel, text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=10, pos=(leftMargin, 0, textStartHeight - 6 * textRowHeight))
self.ToonChatSounds_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=15, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight + 0.025)) self.ToonChatSounds_Label = DirectLabel(parent=self, relief=None, text='', text_align=TextNode.ALeft, text_scale=options_text_scale, text_wordwrap=15, pos=(leftMargin, 0, textStartHeight - 2 * textRowHeight + 0.025))
self.ToonChatSounds_Label.setScale(0.9) self.ToonChatSounds_Label.setScale(0.9)
self.Music_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.__doToggleMusic) self.Music_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.__doToggleMusic)
self.SoundFX_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.__doToggleSfx) self.SoundFX_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 - textRowHeight), command=self.__doToggleSfx)
self.Friends_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 * 3), command=self.__doToggleAcceptFriends) self.Friends_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 - textRowHeight * 3), command=self.__doToggleAcceptFriends)
self.Whispers_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 * 4), command=self.__doToggleAcceptWhispers) self.Whispers_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 - textRowHeight * 4), command=self.__doToggleAcceptWhispers)
self.DisplaySettingsButton = DirectButton(parent=self, relief=None, image=button_image, image3_color=Vec4(0.5, 0.5, 0.5, 0.5), image_scale=button_image_scale, text=TTLocalizer.OptionsPageChange, text3_fg=(0.5, 0.5, 0.5, 0.75), text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight * 5), command=self.__doDisplaySettings) self.DisplaySettingsButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image3_color=Vec4(0.5, 0.5, 0.5, 0.5), image_scale=button_image_scale, text=TTLocalizer.OptionsPageChange, text3_fg=(0.5, 0.5, 0.5, 0.75), text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight * 5), command=self.__doDisplaySettings)
self.speedChatStyleLeftArrow = DirectButton(parent=self, relief=None, image=arrow_image, image3_color=Vec4(1, 1, 1, 0.5), scale=(-1.0, 1.0, 1.0), pos=(0.25, 0, buttonbase_ycoord - textRowHeight * 6), command=self.__doSpeedChatStyleLeft) self.speedChatStyleLeftArrow = DirectButton(parent=self, relief=None, image=(gui.find('**/Horiz_Arrow_UP'),
self.speedChatStyleRightArrow = DirectButton(parent=self, relief=None, image=arrow_image, image3_color=Vec4(1, 1, 1, 0.5), pos=(0.65, 0, buttonbase_ycoord - textRowHeight * 6), command=self.__doSpeedChatStyleRight) gui.find('**/Horiz_Arrow_DN'),
self.ToonChatSounds_toggleButton = DirectButton(parent=self, relief=None, image=button_image, image3_color=Vec4(0.5, 0.5, 0.5, 0.5), image_scale=button_image_scale, text='', text3_fg=(0.5, 0.5, 0.5, 0.75), text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight * 2 + 0.025), command=self.__doToggleToonChatSounds) gui.find('**/Horiz_Arrow_Rllvr'),
gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), scale=(-1.0, 1.0, 1.0), pos=(0.25, 0, buttonbase_ycoord - textRowHeight * 6), command=self.__doSpeedChatStyleLeft)
self.speedChatStyleRightArrow = DirectButton(parent=self, relief=None, image=(gui.find('**/Horiz_Arrow_UP'),
gui.find('**/Horiz_Arrow_DN'),
gui.find('**/Horiz_Arrow_Rllvr'),
gui.find('**/Horiz_Arrow_UP')), image3_color=Vec4(1, 1, 1, 0.5), pos=(0.65, 0, buttonbase_ycoord - textRowHeight * 6), command=self.__doSpeedChatStyleRight)
self.ToonChatSounds_toggleButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'),
guiButton.find('**/QuitBtn_DN'),
guiButton.find('**/QuitBtn_RLVR'),
guiButton.find('**/QuitBtn_UP')), image3_color=Vec4(0.5, 0.5, 0.5, 0.5), image_scale=button_image_scale, text='', text3_fg=(0.5, 0.5, 0.5, 0.75), text_scale=options_text_scale, text_pos=button_textpos, pos=(buttonbase_xcoord, 0.0, buttonbase_ycoord - textRowHeight * 2 + 0.025), command=self.__doToggleToonChatSounds)
self.ToonChatSounds_toggleButton.setScale(0.8) self.ToonChatSounds_toggleButton.setScale(0.8)
self.speedChatStyleText = SpeedChat.SpeedChat(name='OptionsPageStyleText', structure=[2000], backgroundModelName='phase_3/models/gui/ChatPanel', guiModelName='phase_3.5/models/gui/speedChatGui') self.speedChatStyleText = SpeedChat.SpeedChat(name='OptionsPageStyleText', structure=[2000], backgroundModelName='phase_3/models/gui/ChatPanel', guiModelName='phase_3.5/models/gui/speedChatGui')
self.speedChatStyleText.setScale(self.speed_chat_scale) self.speedChatStyleText.setScale(self.speed_chat_scale)
self.speedChatStyleText.setPos(0.37, 0, buttonbase_ycoord - textRowHeight * 6 + 0.03) self.speedChatStyleText.setPos(0.37, 0, buttonbase_ycoord - textRowHeight * 6 + 0.03)
self.speedChatStyleText.reparentTo(self, DGG.FOREGROUND_SORT_INDEX) self.speedChatStyleText.reparentTo(self, DGG.FOREGROUND_SORT_INDEX)
self.exitButton = DirectButton(parent=self, relief=None, image=button_image, image_scale=1.15, text=TTLocalizer.OptionsPageExitToontown, text_scale=options_text_scale, text_pos=button_textpos, textMayChange=0, pos=(0.45, 0, -0.6), command=self.__handleExitShowWithConfirm) self.exitButton = DirectButton(parent=self, relief=None, image=(guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')), image_scale=1.15, text=TTLocalizer.OptionsPageExitToontown, text_scale=options_text_scale, text_pos=button_textpos, textMayChange=0, pos=(0.45, 0, -0.6), command=self.__handleExitShowWithConfirm)
guiButton.removeNode() guiButton.removeNode()
gui.removeNode() gui.removeNode()
@ -486,15 +496,17 @@ class OptionsTabPage(DirectFrame):
self.displaySettings = DisplaySettingsDialog.DisplaySettingsDialog() self.displaySettings = DisplaySettingsDialog.DisplaySettingsDialog()
self.displaySettings.load() self.displaySettings.load()
self.accept(self.displaySettings.doneEvent, self.__doneDisplaySettings) self.accept(self.displaySettings.doneEvent, self.__doneDisplaySettings)
self.displaySettings.enter(self.ChangeDisplaySettings) self.displaySettings.enter(self.ChangeDisplaySettings, self.ChangeDisplayAPI)
def __doneDisplaySettings(self, anyChanged): def __doneDisplaySettings(self, anyChanged, apiChanged):
if anyChanged: if anyChanged:
self.__setDisplaySettings() self.__setDisplaySettings()
properties = base.win.getProperties() properties = base.win.getProperties()
self.displaySettingsChanged = 1 self.displaySettingsChanged = 1
self.displaySettingsSize = (properties.getXSize(), properties.getYSize()) self.displaySettingsSize = (properties.getXSize(), properties.getYSize())
self.displaySettingsFullscreen = properties.getFullscreen() self.displaySettingsFullscreen = properties.getFullscreen()
self.displaySettingsApi = base.pipe.getInterfaceName()
self.displaySettingsApiChanged = apiChanged
def __setDisplaySettings(self): def __setDisplaySettings(self):
properties = base.win.getProperties() properties = base.win.getProperties()
@ -502,7 +514,16 @@ class OptionsTabPage(DirectFrame):
screensize = '%s x %s' % (properties.getXSize(), properties.getYSize()) screensize = '%s x %s' % (properties.getXSize(), properties.getYSize())
else: else:
screensize = TTLocalizer.OptionsPageDisplayWindowed screensize = TTLocalizer.OptionsPageDisplayWindowed
self.DisplaySettings_Label['text'] = TTLocalizer.OptionsPageDisplaySettings % screensize api = base.pipe.getInterfaceName()
settings = {'screensize': screensize,
'api': api}
if self.ChangeDisplayAPI:
OptionsPage.notify.debug('change display settings...')
text = TTLocalizer.OptionsPageDisplaySettings % settings
else:
OptionsPage.notify.debug('no change display settings...')
text = TTLocalizer.OptionsPageDisplaySettingsNoApi % settings
self.DisplaySettings_Label['text'] = text
def __doSpeedChatStyleLeft(self): def __doSpeedChatStyleLeft(self):
if self.speedChatStyleIndex > 0: if self.speedChatStyleIndex > 0:
@ -573,7 +594,7 @@ class CodesTabPage(DirectFrame):
return return
def load(self): def load(self):
self.notice = DirectLabel(parent=self, relief=None, text=TTLocalizer.CodeRedemptionWarning, text_scale=0.06, pos=(0.0, 0, 0.53), text_fg=Vec4(1.0, 0, 0, 1)) self.notice = DirectLabel(parent=self, relief=None, text='NOTICE: All codes can only be entered once!', text_scale=0.06, pos=(0.0, 0, 0.53), text_fg=Vec4(1.0, 0, 0, 1))
cdrGui = loader.loadModel('phase_3.5/models/gui/tt_m_gui_sbk_codeRedemptionGui') cdrGui = loader.loadModel('phase_3.5/models/gui/tt_m_gui_sbk_codeRedemptionGui')
instructionGui = cdrGui.find('**/tt_t_gui_sbk_cdrPresent') instructionGui = cdrGui.find('**/tt_t_gui_sbk_cdrPresent')
flippyGui = cdrGui.find('**/tt_t_gui_sbk_cdrFlippy') flippyGui = cdrGui.find('**/tt_t_gui_sbk_cdrFlippy')
@ -692,6 +713,7 @@ class ExtraOptionsTabPage(DirectFrame):
def __init__(self, parent = aspect2d): def __init__(self, parent = aspect2d):
self.parent = parent self.parent = parent
self.currentSizeIndex = None 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)) DirectFrame.__init__(self, parent=self.parent, relief=None, pos=(0.0, 0.0, 0.0), scale=(1.0, 1.0, 1.0))
@ -699,10 +721,16 @@ class ExtraOptionsTabPage(DirectFrame):
def destroy(self): def destroy(self):
self.parent = None self.parent = None
if self.dialog:
self.dialog.destroy()
del self.dialog
DirectFrame.destroy(self) DirectFrame.destroy(self)
def load(self): def load(self):
guiButton = loader.loadModel('phase_3/models/gui/quit_button') guiButton = loader.loadModel('phase_3/models/gui/quit_button')
gui = loader.loadModel('phase_3.5/models/gui/friendslist_gui')
titleHeight = 0.61 titleHeight = 0.61
textStartHeight = 0.45 textStartHeight = 0.45
textRowHeight = 0.145 textRowHeight = 0.145
@ -713,82 +741,45 @@ class ExtraOptionsTabPage(DirectFrame):
button_textpos = (0, -0.02) button_textpos = (0, -0.02)
options_text_scale = 0.052 options_text_scale = 0.052
disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0) disabled_arrow_color = Vec4(0.6, 0.6, 0.6, 1.0)
button_image = (guiButton.find('**/QuitBtn_UP'), guiButton.find('**/QuitBtn_DN'), guiButton.find('**/QuitBtn_RLVR')) self.speed_chat_scale = 0.055
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.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.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.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.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),
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)) command=self.showReportNotice, pos=(0.0, 0.0, -0.6), text_scale=(0.045))
gui.removeNode()
guiButton.removeNode() guiButton.removeNode()
def enter(self): def enter(self):
self.show() self.show()
self.settingsChanged = 0 self.settingsChanged = 0
self.__setSpeedchatPlusButton() self.__setCogLevelGuiButton()
self.__setTrueFriendsButton()
self.__setCogInterfaceButton()
def exit(self): def exit(self):
self.ignore('confirmDone') self.ignore('confirmDone')
self.destroyReportNotice()
self.hide() self.hide()
def unload(self): def unload(self):
self.speedchatPlus_label.destroy() self.cogLevel_label.destroy()
del self.speedchatPlus_label del self.cogLevel_label
self.trueFriends_label.destroy() self.cogLevel_toggleButton.destroy()
del self.trueFriends_label del self.cogLevel_toggleButton
self.cogInterface_label.destroy()
del self.cogInterface_label
self.cogInterface_toggleButton.destroy()
del self.cogInterface_toggleButton
def __doToggleCogInterface(self): def __doToggleCogLevelGui(self):
messenger.send('wakeup') messenger.send('wakeup')
settings['cogInterface'] = not settings['cogInterface'] settings['cogLevel'] = not settings['cogLevel']
self.settingsChanged = 1 self.settingsChanged = 1
self.__setCogInterfaceButton() self.__setCogLevelGuiButton()
def __setCogInterfaceButton(self): def __setCogLevelGuiButton(self):
self.cogInterface_label['text'] = TTLocalizer.CogInterfaceLabelOn if settings['cogInterface'] else TTLocalizer.CogInterfaceLabelOff self.cogLevel_label['text'] = TTLocalizer.CogLevelLabelOn if settings['cogLevel'] else TTLocalizer.CogLevelLabelOff
self.cogInterface_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['cogInterface'] else TTLocalizer.OptionsPageToggleOn self.cogLevel_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['cogLevel'] else TTLocalizer.OptionsPageToggleOn
def __doToggleSpeedchatPlus(self):
messenger.send('wakeup')
settings['speedchatPlus'] = not settings['speedchatPlus']
self.settingsChanged = 1
self.__setSpeedchatPlusButton()
def __setSpeedchatPlusButton(self):
self.speedchatPlus_label['text'] = TTLocalizer.SpeedchatPlusLabelOn if settings['speedchatPlus'] else TTLocalizer.SpeedchatPlusLabelOff
self.speedchatPlus_toggleButton['text'] = TTLocalizer.OptionsPageToggleOff if settings['speedchatPlus'] else TTLocalizer.OptionsPageToggleOn
def __doToggleTrueFriends(self):
messenger.send('wakeup')
settings['trueFriends'] = not settings['trueFriends']
self.settingsChanged = 1
self.__setTrueFriendsButton()
def __setTrueFriendsButton(self):
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): def showReportNotice(self):
self.destroyReportNotice()
self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.BugReportNotice, command=self.confirmBugReport) self.dialog = TTDialog.TTDialog(style=TTDialog.YesNo, text=TTLocalizer.BugReportNotice, command=self.confirmBugReport)
self.dialog.show() self.dialog.show()
def confirmBugReport(self, value): def confirmBugReport(self, value):
self.destroyReportNotice()
if value > 0: if value > 0:
webbrowser.open(ToontownGlobals.BugReportSite, new=2, autoraise=True) webbrowser.open(ToontownGlobals.BugReportSite, new=2, autoraise=True)
self.dialog.destroy()

View file

@ -13,8 +13,10 @@ from direct.extensions_native import VBase3_extensions
from direct.extensions_native import VBase4_extensions from direct.extensions_native import VBase4_extensions
from direct.extensions_native import NodePath_extensions from direct.extensions_native import NodePath_extensions
from panda3d.core import loadPrcFile from panda3d.core import loadPrcFile
if __debug__: if __debug__:
import wx, sys import wx, sys
from direct.stdpy import threading from direct.stdpy import threading
@ -73,8 +75,8 @@ if 'toonChatSounds' not in settings:
settings['toonChatSounds'] = True settings['toonChatSounds'] = True
if 'language' not in settings: if 'language' not in settings:
settings['language'] = 'English' settings['language'] = 'English'
if 'cogInterface' not in settings: if 'cogLevel' not in settings:
settings['cogInterface'] = True settings['cogLevel'] = True
if 'speedchatPlus' not in settings: if 'speedchatPlus' not in settings:
settings['speedchatPlus'] = True settings['speedchatPlus'] = True
if 'trueFriends' not in settings: if 'trueFriends' not in settings:

View file

@ -3797,11 +3797,13 @@ OptionsPageSelect = 'Select'
OptionsPageToggleOn = 'Turn On' OptionsPageToggleOn = 'Turn On'
OptionsPageToggleOff = 'Turn Off' OptionsPageToggleOff = 'Turn Off'
OptionsPageChange = 'Change' OptionsPageChange = 'Change'
OptionsPageDisplaySettings = 'Display: %s' OptionsPageDisplaySettings = 'Display: %(screensize)s, %(api)s'
OptionsPageDisplaySettingsNoApi = 'Display: %(screensize)s'
OptionsPageExitConfirm = 'Exit Toontown?' OptionsPageExitConfirm = 'Exit Toontown?'
DisplaySettingsTitle = 'Display Settings' DisplaySettingsTitle = 'Display Settings'
DisplaySettingsIntro = 'The following settings are used to configure the way Toontown is displayed on your computer. It is usually unnecessary to adjust these unless you are experiencing a problem.' DisplaySettingsIntro = 'The following settings are used to configure the way Toontown is displayed on your computer. It is usually unnecessary to adjust these unless you are experiencing a problem.'
DisplaySettingsIntroSimple = 'You may adjust the screen resolution to a higher value to improve the clarity of text and graphics in Toontown, but depending on your graphics card, some higher values may make the game run less smoothly or may not work at all.' DisplaySettingsIntroSimple = 'You may adjust the screen resolution to a higher value to improve the clarity of text and graphics in Toontown, but depending on your graphics card, some higher values may make the game run less smoothly or may not work at all.'
DisplaySettingsApi = 'Graphics API:'
DisplaySettingsResolution = 'Resolution:' DisplaySettingsResolution = 'Resolution:'
DisplaySettingsWindowed = 'In a window' DisplaySettingsWindowed = 'In a window'
DisplaySettingsFullscreen = 'Full screen' DisplaySettingsFullscreen = 'Full screen'
@ -8346,19 +8348,13 @@ LanguageSelectorConfirm = 'Are you sure you want to change your language to %s?
LanguageSelectorSameLanguage = "You're already using that language!" LanguageSelectorSameLanguage = "You're already using that language!"
PickTrackTitle = 'Pick your third track!' PickTrackTitle = 'Pick your third track!'
PickTrackNotice = 'Choose a track!' PickTrackNotice = 'Choose a track!'
CogInterfaceLabelOn = 'The cog battle interface is on.' CogLevelLabelOn = 'The cog level GUI is on.'
CogInterfaceLabelOff = 'The cog battle interface is off.' CogLevelLabelOff = 'The cog level GUI is off.'
SpeedchatPlusLabelOn = 'Speedchat Plus is on.'
SpeedchatPlusLabelOff = 'Speedchat Plus is off.'
TrueFriendsLabelOn = 'True Friends is on.'
TrueFriendsLabelOff = 'True Friends is off.'
HouseNames = ("Bungalow", "Tiki", "Teepee", "Castle", "Cupcake", "Cabin") 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?" 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?"
BugReportButton = 'Report a Bug' 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?' 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!'
# Buffs # Buffs
buffIdStrings = { buffIdStrings = {

View file

@ -368,7 +368,7 @@ class TownBattle(StateData.StateData):
def exitOff(self): def exitOff(self):
if self.isLoaded: if self.isLoaded:
self.__enterPanels(self.numToons, self.localNum) self.__enterPanels(self.numToons, self.localNum)
if settings['cogInterface']: if settings['cogLevel']:
self.__enterCogPanels(self.numCogs) self.__enterCogPanels(self.numCogs)
self.timer.show() self.timer.show()
self.track = -1 self.track = -1
@ -516,7 +516,7 @@ class TownBattle(StateData.StateData):
for i in xrange(len(toons)): for i in xrange(len(toons)):
self.toonPanels[i].setLaffMeter(toons[i]) self.toonPanels[i].setLaffMeter(toons[i])
if settings['cogInterface']: if settings['cogLevel']:
self.__enterCogPanels(self.numCogs) self.__enterCogPanels(self.numCogs)
for i in xrange(len(cogs)): for i in xrange(len(cogs)):
self.cogPanels[i].setSuit(cogs[i]) self.cogPanels[i].setSuit(cogs[i])