|
From: <sjo...@us...> - 2011-11-29 09:07:36
|
Revision: 3515
http://civ4mods.svn.sourceforge.net/civ4mods/?rev=3515&view=rev
Author: sjodster
Date: 2011-11-29 09:07:25 +0000 (Tue, 29 Nov 2011)
Log Message:
-----------
Brought over stock BTS copies of the following Python files:
* CvAppInterface.py
* CvOptionsScreenCallbackInterface.py
* CvOptionsScreen.py
Added Paths:
-----------
realism/bts/trunk/mod/Assets/Python/EntryPoints/CvAppInterface.py
realism/bts/trunk/mod/Assets/Python/EntryPoints/CvOptionsScreenCallbackInterface.py
realism/bts/trunk/mod/Assets/Python/Screens/CvOptionsScreen.py
Added: realism/bts/trunk/mod/Assets/Python/EntryPoints/CvAppInterface.py
===================================================================
--- realism/bts/trunk/mod/Assets/Python/EntryPoints/CvAppInterface.py (rev 0)
+++ realism/bts/trunk/mod/Assets/Python/EntryPoints/CvAppInterface.py 2011-11-29 09:07:25 UTC (rev 3515)
@@ -0,0 +1,187 @@
+# Sid Meier's Civilization 4
+# Copyright Firaxis Games 2005
+#
+# CvAppInterface.py
+#
+# These functions are App Entry Points from C++
+# WARNING: These function names should not be changed
+# WARNING: These functions can not be placed into a class
+#
+# No other modules should import this
+#
+# DONT ADD ANY MORE IMPORTS HERE - Moose
+import sys
+import os
+import CvUtil
+#
+
+from CvPythonExtensions import *
+
+# globals
+gc = CyGlobalContext()
+
+# don't make this an event - Moose
+def init():
+ # for PythonExtensions Help File
+ PythonHelp = 0 # doesn't work on systems which haven't installed Python
+
+ # dump Civ python module directory
+ if PythonHelp:
+ import CvPythonExtensions
+ helpFile=file("CvPythonExtensions.hlp.txt", "w")
+ sys.stdout=helpFile
+ import pydoc
+ pydoc.help(CvPythonExtensions)
+ helpFile.close()
+
+ sys.stderr=CvUtil.RedirectError()
+ sys.excepthook = CvUtil.myExceptHook
+ sys.stdout=CvUtil.RedirectDebug()
+
+def onSave():
+ 'Here is your chance to save data. This function should return a string'
+ import CvWBDesc
+ import pickle
+ import CvEventInterface
+ # if the tutorial is active, it will save out the Shown Messages list
+ saveDataStr = pickle.dumps( CvEventInterface.onEvent( ('OnSave',0,0,0,0,0 ) ) )
+ return saveDataStr
+
+def onLoad(argsList):
+ 'Called when a file is loaded'
+ import pickle
+ import CvEventInterface
+ loadDataStr=argsList[0]
+ if len(loadDataStr):
+ CvEventInterface.onEvent( ('OnLoad',pickle.loads(loadDataStr),0,0,0,0,0 ) )
+
+def preGameStart():
+ import CvScreensInterface
+
+ if not CyGame().isPitbossHost():
+ NiTextOut("Initializing font icons")
+ # Load dynamic font icons into the icon map
+ CvUtil.initDynamicFontIcons()
+
+ if not CyGame().isPitbossHost():
+ # Preload the tech chooser..., only do this release builds, in debug build we may not be raising the tech chooser
+ if (not gc.isDebugBuild()):
+ NiTextOut("Preloading tech chooser")
+ CvScreensInterface.showTechChooser()
+ CvScreensInterface.techChooser.hideScreen()
+
+ NiTextOut("Loading main interface...")
+ CvScreensInterface.showMainInterface()
+
+def onPbemSend(argsList):
+ import sys, smtplib, MimeWriter, base64, StringIO
+
+ szToAddr = argsList[0]
+ szFromAddr = argsList[1]
+ szSubject = argsList[2]
+ szPath = argsList[3]
+ szFilename = argsList[4]
+ szHost = argsList[5]
+ szUser = argsList[6]
+ szPassword = argsList[7]
+
+ print 'sending e-mail'
+ print 'To:', szToAddr
+ print 'From:', szFromAddr
+ print 'Subject:', szSubject
+ print 'Path:', szPath
+ print 'File:', szFilename
+ print 'Server:', szHost
+ print 'User:', szUser
+
+ if len(szFromAddr) == 0 or len(szHost) == 0:
+ print 'host or address empty'
+ return 1
+
+ message = StringIO.StringIO()
+ writer = MimeWriter.MimeWriter(message)
+
+ writer.addheader('To', szToAddr)
+ writer.addheader('From', szFromAddr)
+ writer.addheader('Subject', szSubject)
+ writer.addheader('MIME-Version', '1.0')
+ writer.startmultipartbody('mixed')
+
+ part = writer.nextpart()
+ body = part.startbody('text/plain')
+ body.write('CIV4 PBEM save attached')
+
+ part = writer.nextpart()
+ part.addheader('Content-Transfer-Encoding', 'base64')
+ szStartBody = "application/CivBeyondSwordSave; name=%s" % szFilename
+ body = part.startbody(szStartBody)
+ base64.encode(open(szPath+szFilename, 'rb'), body)
+
+ # finish off
+ writer.lastpart()
+
+ # send the mail
+ try:
+ smtp = smtplib.SMTP(szHost)
+ # trying to get TLS to work...
+ #smtp.set_debuglevel(1)
+ #smtp.ehlo()
+ #smtp.starttls()
+ #smtp.ehlo()
+ if len(szUser) > 0:
+ smtp.login(szUser, szPassword)
+ smtp.sendmail(szFromAddr, szToAddr, message.getvalue())
+ smtp.quit()
+ except smtplib.SMTPAuthenticationError, e:
+ CyInterface().addImmediateMessage("Authentication Error: The server didn't accept the username/password combination provided.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code, e.smtp_error), "")
+ return 1
+ except smtplib.SMTPHeloError, e:
+ CyInterface().addImmediateMessage("The server refused our HELO reply.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code, e.smtp_error), "")
+ return 1
+ except smtplib.SMTPConnectError, e:
+ CyInterface().addImmediateMessage("Error establishing connection.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code, e.smtp_error), "")
+ return 1
+ except smtplib.SMTPDataError, e:
+ CyInterface().addImmediateMessage("The SMTP server didn't accept the data.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code, e.smtp_error), "")
+ return 1
+ except smtplib.SMTPRecipientsRefused, e:
+ CyInterface().addImmediateMessage("All recipient addresses refused.", "")
+ return 1
+ except smtplib.SMTPSenderRefused, e:
+ CyInterface().addImmediateMessage("Sender address refused.", "")
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code, e.smtp_error), "")
+ return 1
+ except smtplib.SMTPResponseException, e:
+ CyInterface().addImmediateMessage("Error %d: %s" % (e.smtp_code, e.smtp_error), "")
+ return 1
+ except smtplib.SMTPServerDisconnected:
+ CyInterface().addImmediateMessage("Not connected to any SMTP server", "")
+ return 1
+ except:
+ return 1
+ return 0
+
+#####################################33
+## INTERNAL USE ONLY
+#####################################33
+def normalizePath(argsList):
+ CvUtil.pyPrint("PathName in = %s" %(argsList[0],))
+ pathOut=os.path.normpath(argsList[0])
+ CvUtil.pyPrint("PathName out = %s" %(pathOut,))
+ return pathOut
+
+def getConsoleMacro(argsList):
+ 'return a string macro that is used by the in-game python console, fxnKey goes from 1 to 10'
+ fxnKey = argsList[0]
+ if (fxnKey==1): return "player = gc.getPlayer(0)"
+ if (fxnKey==2): return "import CvCameraControls"
+ if (fxnKey==3): return "CvCameraControls.g_CameraControls.resetCameraControls()"
+ if (fxnKey==4): return "CvCameraControls.g_CameraControls.doRotateCamera(360, 45.0)"
+ if (fxnKey==5): return "CvCameraControls.g_CameraControls.doZoomCamera(0.2, 0.5)"
+ if (fxnKey==6): return "CvCameraControls.g_CameraControls.doZoomCamera(0.5, 0.15)"
+ if (fxnKey==7): return "CvCameraControls.g_CameraControls.doPitchCamera(0.5, 0.5)"
+ return ""
\ No newline at end of file
Added: realism/bts/trunk/mod/Assets/Python/EntryPoints/CvOptionsScreenCallbackInterface.py
===================================================================
--- realism/bts/trunk/mod/Assets/Python/EntryPoints/CvOptionsScreenCallbackInterface.py (rev 0)
+++ realism/bts/trunk/mod/Assets/Python/EntryPoints/CvOptionsScreenCallbackInterface.py 2011-11-29 09:07:25 UTC (rev 3515)
@@ -0,0 +1,489 @@
+from CvPythonExtensions import *
+import CvScreensInterface
+import Popup as PyPopup
+import CvUtil
+import string
+
+localText = CyTranslator()
+UserProfile = CyUserProfile()
+
+#"""
+#OPTIONS SCREEN CALLBACK INTERFACE - Any time something is changed in the Options Screen the result is determined here
+#"""
+
+def saveProfile():
+ if (UserProfile.getProfileName() != ""):
+ UserProfile.writeToFile(UserProfile.getProfileName())
+
+def getOptionsScreen():
+ return CvScreensInterface.optionsScreen
+
+def getTabControl():
+ return getOptionsScreen().getTabControl()
+
+def refresh():
+ getOptionsScreen().refreshScreen()
+
+def restartPopup(bForceShowing = false):
+
+ if (CyInterface().isInMainMenu() == false or bForceShowing == true):
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+ popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_NEED_TO_RESTART", ()))
+ popup.launch()
+
+def isNumber(s):
+
+ for l in s:
+ if l not in string.digits:
+ return False
+
+ return True
+
+def DummyCallback( argsList ):
+ "This is the callback function for controls which shouldn't do anything when modified (editboxes, mainly)"
+ return
+
+######################################## GAME OPTIONS ########################################
+
+def handleGameOptionsClicked ( argsList ):
+ "Handles checkbox clicked input"
+ bValue, szName = argsList
+
+ iGameOption = int(szName[szName.find("_")+1:])
+ CyMessageControl().sendPlayerOption(iGameOption, bValue)
+ return 1
+
+def handleLanguagesDropdownBoxInput ( argsList ):
+ "Handles Languages Dropdown Box input"
+ iValue, szName = argsList
+
+ CyGame().setCurrentLanguage(iValue)
+
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+ popup.setBodyString(localText.getText("TXT_KEY_FEAT_ACCOMPLISHED_OK", ()))
+ popup.launch()
+
+ return 1
+
+def handleGameReset ( argsList ):
+ "Resets these options"
+ szName = argsList
+
+ UserProfile.resetOptions(TabGroupTypes.TABGROUP_GAME)
+ refresh()
+ saveProfile()
+
+ return 1
+
+######################################## GRAPHIC OPTIONS ########################################
+
+def handleGraphicOptionsClicked ( argsList ):
+ "Handles checkbox clicked input"
+ bValue, szName = argsList
+ iGraphicOption = int(szName[szName.find("_")+1:])
+
+ UserProfile.setGraphicOption(iGraphicOption, bValue)
+
+ if (iGraphicOption == GraphicOptionTypes.GRAPHICOPTION_SINGLE_UNIT_GRAPHICS or
+ iGraphicOption == GraphicOptionTypes.GRAPHICOPTION_FULLSCREEN):
+ restartPopup(true)
+
+ if (iGraphicOption == GraphicOptionTypes.GRAPHICOPTION_HIRES_TERRAIN):
+ restartPopup(false)
+
+ return 1
+
+def handleGraphicsLevelDropdownBoxInput ( argsList ):
+ "Handles Graphics Level Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setGraphicsLevel(iValue)
+ refresh()
+
+ restartPopup(true)
+ return 1
+
+def handleRenderQualityDropdownBoxInput ( argsList ):
+ "Handles Render Quality Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setRenderQualityLevel(iValue)
+
+ return 1
+
+def handleGlobeViewDropdownBoxInput ( argsList ):
+ "Handles Globe View Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setGlobeViewRenderLevel(iValue)
+
+ return 1
+
+def handleMovieDropdownBoxInput ( argsList ):
+ "Handles Movie Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setMovieQualityLevel(iValue)
+
+ return 1
+
+def handleMainMenuDropdownBoxInput ( argsList ):
+ "Handles Main Menu Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setMainMenu(iValue)
+ refresh()
+ saveProfile()
+
+ return 1
+
+def handleResolutionDropdownInput ( argsList ):
+ "Handles Resolution Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setResolution(iValue)
+
+ return 1
+
+def handleAntiAliasingDropdownInput ( argsList ):
+ "Handles Anti-Aliasing Dropdown Box input"
+ iValue, szName = argsList
+
+ UserProfile.setAntiAliasing(iValue)
+ return 1
+
+def handleGraphicsReset ( argsList ):
+ "Resets these options"
+ szName = argsList
+
+ UserProfile.resetOptions(TabGroupTypes.TABGROUP_GRAPHICS)
+ refresh()
+ restartPopup()
+ saveProfile()
+
+ return 1
+
+######################################## AUDIO OPTIONS ########################################
+
+def handleVolumeSlidersInput ( argsList ):
+ "Handles Volume slider input"
+ iValue, szName = argsList
+ iVolumeType = int(szName[szName.find("_")+1:])
+
+ iMax = UserProfile.getVolumeStops()
+
+ if (iVolumeType == 0): # Master Volume
+ UserProfile.setMasterVolume(iMax - iValue)
+ elif (iVolumeType == 1): # Music Volume
+ UserProfile.setMusicVolume(iMax - iValue)
+ elif (iVolumeType == 2): # Sound Effects Volume
+ UserProfile.setSoundEffectsVolume(iMax - iValue)
+ elif (iVolumeType == 3): # Speech Volume
+ UserProfile.setSpeechVolume(iMax - iValue)
+ elif (iVolumeType == 4): # Ambience Volume
+ UserProfile.setAmbienceVolume(iMax - iValue)
+ elif (iVolumeType == 5): # Interface Volume
+ UserProfile.setInterfaceVolume(iMax - iValue)
+
+ return 1
+
+def handleVolumeCheckboxesInput ( argsList ):
+ "Handles checkbox clicked input"
+ bValue, szName = argsList
+ iVolumeType = int(szName[szName.find("_")+1:])
+
+ if (iVolumeType == 0): # Master Volume
+ UserProfile.setMasterNoSound(bValue)
+ elif (iVolumeType == 1): # Music Volume
+ UserProfile.setMusicNoSound(bValue)
+ elif (iVolumeType == 2): # Sound Effects Volume
+ UserProfile.setSoundEffectsNoSound(bValue)
+ elif (iVolumeType == 3): # Speech Volume
+ UserProfile.setSpeechNoSound(bValue)
+ elif (iVolumeType == 4): # Ambience Volume
+ UserProfile.setAmbienceNoSound(bValue)
+ elif (iVolumeType == 5): # Interface Volume
+ UserProfile.setInterfaceNoSound(bValue)
+
+ return 1
+
+def handleCustomMusicPathCheckboxInput ( argsList ):
+ "Handles Custom Music Path text changed input"
+ bValue, szName = argsList
+
+ if (bValue):
+ UserProfile.setMusicPath(CvUtil.convertToStr(getOptionsScreen().getMusicPath()))
+ else:
+ UserProfile.setMusicPath("")
+
+ return 1
+
+def handleCustomMusicPathButtonInput ( argsList ):
+ "Handles Custom Music Path Browse Button clicked input"
+ szName = argsList
+
+ UserProfile.musicPathDialogBox()
+ return 1
+
+def handleSpeakerConfigDropdownInput ( argsList ):
+ "Handles Speaker Config Dropdown Box input"
+ iValue, szName = argsList
+ szSpeakerConfigName = UserProfile.getSpeakerConfigFromList(iValue)
+
+ UserProfile.setSpeakerConfig(szSpeakerConfigName)
+ restartPopup(true)
+
+ return 1
+
+def handleVoiceCheckboxInput ( argsList ):
+ "Handles voice checkbox clicked input"
+ bValue, szName = argsList
+ UserProfile.setUseVoice(bValue)
+ return 1
+
+def handleCaptureDeviceDropdownInput ( argsList ):
+ "Handles Capture Device Config Dropdown Box input"
+ iValue, szName = argsList
+ UserProfile.setCaptureDevice(iValue)
+ return 1
+
+def handleCaptureVolumeSliderInput ( argsList ):
+ "Handles Capture Volume slider input"
+ iValue, szName = argsList
+ iMax = UserProfile.getMaxPlaybackVolume()
+
+ UserProfile.setCaptureVolume(iValue)
+ return 1
+
+def handlePlaybackDeviceDropdownInput ( argsList ):
+ "Handles Playback Device Dropdown Box input"
+ iValue, szName = argsList
+ UserProfile.setPlaybackDevice(iValue)
+ return 1
+
+def handlePlaybackVolumeSliderInput ( argsList ):
+ "Handles Playback Volume slider input"
+ iValue, szName = argsList
+ iMax = UserProfile.getMaxPlaybackVolume()
+
+# UserProfile.setPlaybackVolume(iMax - iValue)
+ UserProfile.setPlaybackVolume(iValue)
+ return 1
+
+def handleAudioReset ( argsList ):
+ "Resets these options"
+ szName = argsList
+
+ UserProfile.resetOptions(TabGroupTypes.TABGROUP_AUDIO)
+ refresh()
+ restartPopup(true)
+ saveProfile()
+
+ return 1
+
+######################################## NETWORK OPTIONS ########################################
+
+def handleBroadbandSelected ( argsList ):
+ "Handles bandwidth selection"
+ bSelected, szName = argsList
+ if (bSelected):
+ CyGame().setModem(false)
+ return 1
+
+def handleModemSelected ( argsList ):
+ "Handles bandwidth selection"
+ bSelected, szName = argsList
+ if (bSelected):
+ CyGame().setModem(true)
+ return 1
+
+######################################## CLOCK OPTIONS ########################################
+
+def handleClockOnCheckboxInput ( argsList ):
+ "Handles Clock On/Off checkbox clicked input"
+ bValue, szName = argsList
+
+ UserProfile.setClockOn(bValue)
+ return 1
+
+def handle24HourClockCheckboxInput ( argsList ):
+ "Handles 24 Hour Clock On/Off checkbox clicked input"
+ bValue, szName = argsList
+
+ UserProfile.set24Hours(bValue)
+ return 1
+
+def handleAlarmOnCheckboxInput ( argsList ):
+ "Handles Alarm On/Off checkbox clicked input"
+ bValue, szName = argsList
+
+ iHour = getOptionsScreen().getAlarmHour()
+ iMin = getOptionsScreen().getAlarmMin()
+
+ if (isNumber(iHour) and iHour != "" and isNumber(iMin) and iMin != "" ):
+
+ iHour = int(iHour)
+ iMin = int(iMin)
+
+ if (iHour > 0 or iMin > 0):
+ toggleAlarm(bValue, iHour, iMin)
+
+ return 1
+
+def handleOtherReset ( argsList ):
+ "Resets these options"
+ szName = argsList
+
+ UserProfile.resetOptions(TabGroupTypes.TABGROUP_CLOCK)
+ refresh()
+ saveProfile()
+
+ return 1
+
+######################################## PROFILES ########################################
+
+def handleProfilesDropdownInput ( argsList ):
+ "Handles Profiles tab dropdown box input"
+
+ iValue, szName = argsList
+ saveProfile()
+
+ # Load other file
+ szFilename = UserProfile.getProfileFileName(iValue)
+ szProfile = szFilename[szFilename.find("PROFILES\\")+9:-4]
+
+ bSuccess = loadProfile(szProfile)
+ return bSuccess
+
+def handleNewProfileButtonInput ( argsList ):
+ "Handles New Profile Button clicked input"
+ szName = argsList
+
+ szNewProfileName = getOptionsScreen().getProfileEditCtrlText()
+ szNarrow = szNewProfileName.encode("latin_1")
+ UserProfile.setProfileName(szNarrow)
+ UserProfile.writeToFile(szNarrow)
+
+ # Recalculate file info when new file is saved out
+ UserProfile.loadProfileFileNames()
+
+ saveProfile()
+
+ refresh()
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+ popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_SAVED_PROFILE", (szNewProfileName, )))
+ popup.launch()
+
+ return 1
+
+def handleDeleteProfileButtonInput ( argsList ):
+ "Handles Delete Profile Button clicked input"
+ szName = argsList
+
+ szProfileName =CvUtil.convertToStr(getOptionsScreen().getProfileEditCtrlText())
+
+ if (UserProfile.deleteProfileFile(szProfileName)): # Note that this function automatically checks to see if the string passed is a valid file to be deleted (it must have the proper file extension though)
+
+ # Recalculate list of stuff
+ UserProfile.loadProfileFileNames()
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+ popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_DELETED_PROFILE", (szProfileName, )))
+ popup.launch()
+
+ bSuccess = true
+
+ if (szProfileName == UserProfile.getProfileName()):
+
+ UserProfile.setProfileName("")
+
+ # Load other file
+ szFilename = UserProfile.getProfileFileName(0)
+ szProfile = szFilename[szFilename.find("PROFILES\\")+9:-4]
+
+ bSuccess = loadProfile(szProfile)
+
+ refresh()
+
+ return bSuccess
+
+ return 0
+
+def loadProfile(szProfile):
+
+ bReadSuccessful = UserProfile.readFromFile(szProfile)
+
+ if (bReadSuccessful):
+ UserProfile.recalculateAudioSettings()
+
+ getOptionsScreen().setProfileEditCtrlText(szProfile)
+
+ ########### Now we have to update everything we loaded since nothing is done except the serialization on load ###########
+
+ # Game Options
+ for iOptionLoop in range(PlayerOptionTypes.NUM_PLAYEROPTION_TYPES):
+ bValue = UserProfile.getPlayerOption(iOptionLoop)
+ CyMessageControl().sendPlayerOption(iOptionLoop, bValue)
+
+ # Graphics Options
+ for iOptionLoop in range(GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES):
+ bValue = UserProfile.getGraphicOption(iOptionLoop)
+ UserProfile.setGraphicOption(iOptionLoop, bValue)
+
+ # Beware! These guys aren't safe to change:
+ UserProfile.setAntiAliasing(UserProfile.getAntiAliasing())
+ UserProfile.setResolution(UserProfile.getResolution())
+
+ # Audio Options
+ UserProfile.setSpeakerConfig(UserProfile.getSpeakerConfig())
+ UserProfile.setMusicPath(UserProfile.getMusicPath())
+ UserProfile.setUseVoice(UserProfile.useVoice())
+ UserProfile.setCaptureDevice(UserProfile.getCaptureDeviceIndex())
+ UserProfile.setPlaybackDevice(UserProfile.getPlaybackDeviceIndex())
+ UserProfile.setCaptureVolume(UserProfile.getCaptureVolume())
+ UserProfile.setPlaybackVolume(UserProfile.getPlaybackVolume())
+
+ # Clock Options
+ UserProfile.setClockOn(UserProfile.isClockOn())
+
+ #################
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+ popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_LOADED_PROFILE", (szProfile, )))
+ popup.launch()
+
+ # Refresh options screen with updated values
+ refresh()
+
+ return 1
+
+ # Load failed
+ else:
+
+ # create popup
+ popup = PyPopup.PyPopup()
+ popup.setHeaderString("")
+ popup.setBodyString(localText.getText("TXT_KEY_OPTIONS_LOAD_PROFILE_FAIL", ()))
+ popup.launch()
+
+ return 0
+
+def handleExitButtonInput ( argsList ):
+ "Exits the screen"
+ szName = argsList
+
+ saveProfile()
+ getTabControl().destroy()
+
+ return 1
Added: realism/bts/trunk/mod/Assets/Python/Screens/CvOptionsScreen.py
===================================================================
--- realism/bts/trunk/mod/Assets/Python/Screens/CvOptionsScreen.py (rev 0)
+++ realism/bts/trunk/mod/Assets/Python/Screens/CvOptionsScreen.py 2011-11-29 09:07:25 UTC (rev 3515)
@@ -0,0 +1,948 @@
+## Sid Meier's Civilization 4
+## Copyright Firaxis Games 2005
+
+# For Input see CvOptionsScreenCallbackInterface in Python\EntryPoints\
+
+import CvUtil
+from CvPythonExtensions import *
+
+# globals
+gc = CyGlobalContext()
+UserProfile = CyUserProfile()
+localText = CyTranslator()
+
+class CvOptionsScreen:
+ "Options Screen"
+
+ def __init__(self):
+
+ self.iScreenHeight = 50
+
+ self.iGameOptionsTabID = 0
+ self.iGraphicOptionsTabID = 1
+ self.iAudioOptionsTabID = 2
+ self.iOtherOptionsTabID = 3
+
+ self.callbackIFace = "CvOptionsScreenCallbackInterface"
+
+ def getTabControl(self):
+ return self.pTabControl
+
+ def getGameOptionsTabName(self):
+ return self.szGameOptionsTabName
+ def getGraphicOptionsTabName(self):
+ return self.szGraphicsOptionsTabName
+ def getAudioOptionsTabName(self):
+ return self.szAudioOptionsTabName
+ def getOtherOptionsTabName(self):
+ return self.szOtherOptionsTabName
+
+ # Used by Callback Interface to set path via checkbox
+ def getMusicPath(self):
+ return self.getTabControl().getText("CustomMusicEditBox")
+ def getCustomMusicCheckboxName(self):
+ return self.szCustomMusicCheckboxName
+
+ # Used by Callback Interface to set Alarm time via checkbox
+ def getAlarmHour(self):
+ return self.getTabControl().getText("AlarmHourEditBox")
+ def getAlarmMin(self):
+ return self.getTabControl().getText("AlarmMinEditBox")
+
+ # Used by Callback Interface to get user defined profile names from editbox
+ def setProfileEditCtrlText(self, szProfileName):
+ szWideProfName = CvUtil.convertToUnicode(szProfileName)
+ self.getTabControl().setText("ProfileNameEditBox", szWideProfName)
+ def getProfileEditCtrlText(self):
+ return self.getTabControl().getText("ProfileNameEditBox")
+
+ # Called from C++ after a custom music path is selected via FileDialogBox
+ def updateMusicPath (self, szMusicPath):
+
+ self.getTabControl().setText("CustomMusicEditBox", szMusicPath)
+ self.getTabControl().setValue(self.getCustomMusicCheckboxName(), true)
+
+#########################################################################################
+################################## SCREEN CONSTRUCTION ##################################
+#########################################################################################
+
+ def initText(self):
+
+ self.szTabControlName = localText.getText("TXT_KEY_OPTIONS_TITLE", ())
+
+ self.szGameOptionsTabName = localText.getText("TXT_KEY_OPTIONS_GAME", ())
+ self.szGraphicsOptionsTabName = localText.getText("TXT_KEY_OPTIONS_GRAPHICS", ())
+ self.szAudioOptionsTabName = localText.getText("TXT_KEY_OPTIONS_AUDIO", ())
+ self.szOtherOptionsTabName = localText.getText("TXT_KEY_OPTIONS_SCREEN_OTHER", ())
+
+ def refreshScreen (self):
+
+ #################### Game Options ####################
+
+ szTab = self.getGameOptionsTabName()
+ for iOptionLoop in range(PlayerOptionTypes.NUM_PLAYEROPTION_TYPES):
+ szWidgetName = "GameOptionCheckBox_" + str(iOptionLoop)
+ bOptionOn = UserProfile.getPlayerOption(iOptionLoop)
+ self.pTabControl.setValue(szWidgetName, bOptionOn)
+
+ # Languages Dropdown
+ self.getTabControl().setValue("LanguagesDropdownBox", CyGame().getCurrentLanguage())
+
+ #################### GRAPHICS ####################
+
+ szTab = self.getGraphicOptionsTabName()
+
+ # Graphics Dropdowns
+
+ self.getTabControl().setValue(self.szResolutionComboBoxName, UserProfile.getResolution() )
+ self.getTabControl().setValue("AntiAliasingDropdownBox", UserProfile.getAntiAliasing() )
+ self.getTabControl().setValue("GraphicsLevelDropdownBox", UserProfile.getGraphicsLevel() )
+ self.getTabControl().setValue("RenderQualityDropdownBox", UserProfile.getRenderQualityLevel() )
+ self.getTabControl().setValue("GlobeViewDropdownBox", UserProfile.getGlobeViewRenderLevel() )
+ self.getTabControl().setValue("MovieDropdownBox", UserProfile.getMovieQualityLevel() )
+ self.getTabControl().setValue("MainMenuDropdownBox", UserProfile.getMainMenu() )
+
+ # Graphic Option Checkboxes
+ for iOptionLoop in range(GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES):
+ szWidgetName = "GraphicOptionCheckbox_" + str(iOptionLoop)
+ bOptionOn = UserProfile.getGraphicOption(iOptionLoop)
+ self.pTabControl.setValue(szWidgetName, bOptionOn)
+
+ #################### AUDIO ####################
+
+ szTab = self.getAudioOptionsTabName()
+
+ iMax = UserProfile.getVolumeStops()
+
+ # Volume Sliders and No Sound Checkboxes
+ for iWidgetNum in range(6):
+ if (iWidgetNum == 0): # Master Volume
+ iInitialVal = iMax-UserProfile.getMasterVolume()-1
+ bNoSoundTrue = UserProfile.isMasterNoSound()
+ elif (iWidgetNum == 1): # Music Volume
+ iInitialVal = iMax-UserProfile.getMusicVolume()-1
+ bNoSoundTrue = UserProfile.isMusicNoSound()
+ elif (iWidgetNum == 2): # Sound Effects Volume
+ iInitialVal = iMax-UserProfile.getSoundEffectsVolume()-1
+ bNoSoundTrue = UserProfile.isSoundEffectsNoSound()
+ elif (iWidgetNum == 3): # Speech Volume
+ iInitialVal = iMax-UserProfile.getSpeechVolume()-1
+ bNoSoundTrue = UserProfile.isSpeechNoSound()
+ elif (iWidgetNum == 4): # Ambience Volume
+ iInitialVal = iMax-UserProfile.getAmbienceVolume()-1
+ bNoSoundTrue = UserProfile.isAmbienceNoSound()
+ elif (iWidgetNum == 5): # Interface Volume
+ iInitialVal = iMax-UserProfile.getInterfaceVolume()-1
+ bNoSoundTrue = UserProfile.isInterfaceNoSound()
+
+ # Volume Slider
+ szWidgetName = "VolumeSlider_" + str(iWidgetNum)
+ self.getTabControl().setValue(szWidgetName, iInitialVal)
+
+ # Volume Checkbox
+ szWidgetName = "VolumeNoSoundCheckbox_" + str(iWidgetNum)
+ self.pTabControl.setValue(szWidgetName, bNoSoundTrue)
+
+ # Voice Capture Dropdown
+ self.getTabControl().setValue("CaptureDeviceDropdownBox", UserProfile.getCaptureDeviceIndex() )
+ # Voice Capture Slider
+# self.getTabControl().setValue("CaptureVolumeSlider", UserProfile.getMaxCaptureVolume() - UserProfile.getCaptureVolume())
+ self.getTabControl().setValue("CaptureVolumeSlider", UserProfile.getCaptureVolume())
+
+ # Voice Playback Dropdown
+ self.getTabControl().setValue("PlaybackDeviceDropdownBox", UserProfile.getPlaybackDeviceIndex() )
+ # Voice Playback Slider
+# self.getTabControl().setValue("PlaybackVolumeSlider", UserProfile.getMaxPlaybackVolume() - UserProfile.getPlaybackVolume())
+ self.getTabControl().setValue("PlaybackVolumeSlider", UserProfile.getPlaybackVolume())
+
+ # Voice Chatting Checkbox
+ self.getTabControl().setValue("VoiceChatCheckbox", UserProfile.useVoice())
+
+ # Speaker config
+ iInitialSelection = 0
+ for iSpeakerConfigLoop in range(16):
+ szActiveConfig = UserProfile.getSpeakerConfigFromList(iSpeakerConfigLoop)
+ if (UserProfile.getSpeakerConfig() == szActiveConfig):
+ iInitialSelection = iSpeakerConfigLoop
+
+ # Speaker Config Dropdown
+ self.getTabControl().setValue("SpeakerConfigDropdownBox", iInitialSelection )
+
+ # Custom Music Path Checkbox
+ bUseCustomMusicPath = false
+ if (UserProfile.getMusicPath() != ""):
+ bUseCustomMusicPath = true
+ self.getTabControl().setValue(self.getCustomMusicCheckboxName(), bUseCustomMusicPath)
+
+ # Custom Music Path Editbox
+ szEditBoxDesc = ""
+ if (UserProfile.getMusicPath() != ""):
+ szEditBoxDesc = CvUtil.convertToUnicode(UserProfile.getMusicPath())
+ self.getTabControl().setText("CustomMusicEditBox", szEditBoxDesc)
+
+ #################### CLOCK ####################
+
+ szTab = self.getOtherOptionsTabName()
+
+ # Clock On Checkbox
+ self.getTabControl().setValue("ClockOnCheckbox", UserProfile.isClockOn())
+
+ # 24 Hour Clock Checkbox
+ self.getTabControl().setValue("24HourClockCheckbox", UserProfile.is24Hours())
+
+ # Alarm On Checkbox
+ self.getTabControl().setValue("AlarmOnCheckbox", isAlarmOn())
+
+ # Alarm Hours
+ self.getTabControl().setText("AlarmHourEditBox", str(getAlarmHourLeft()))
+ self.getTabControl().setText("AlarmMinEditBox", str(getAlarmMinLeft()))
+
+ #################### PROFILE ####################
+
+ # Profile Name Editbox
+ self.getTabControl().setText("ProfileNameEditBox", CvUtil.convertToUnicode(UserProfile.getProfileName()))
+
+ aszDropdownElements = ()
+ for iProfileLoop in range(UserProfile.getNumProfileFiles()):
+ szProfileFileName = UserProfile.getProfileFileName(iProfileLoop)
+ # Cut off file path and extension
+ szProfile = szProfileFileName[szProfileFileName.find("PROFILES\\")+9:-4]
+ aszDropdownElements = aszDropdownElements + (szProfile,)
+ if (UserProfile.getProfileName() == szProfile):
+ iInitialSelection = iProfileLoop
+
+ self.getTabControl().changeDropdownContents("ProfilesDropdownBox", aszDropdownElements)
+
+ # Profile List Dropdown
+ self.getTabControl().setValue("ProfilesDropdownBox", iInitialSelection)
+
+ #################### PROFILE ####################
+
+ # Broadband Radio Button
+ self.getTabControl().setValue("BroadbandSelection", not gc.getGame().isModem())
+
+ # Modem Checkbox
+ self.getTabControl().setValue("ModemSelection", gc.getGame().isModem())
+
+ def interfaceScreen (self):
+ "Initial creation of the screen"
+ self.initText()
+
+ self.pTabControl = CyGTabCtrl(self.szTabControlName, false, false)
+ self.pTabControl.setModal(1)
+ self.pTabControl.setSize(800,600)
+ self.pTabControl.setControlsExpanding(false)
+ self.pTabControl.setColumnLength(self.iScreenHeight)
+
+ # Set Tabs
+ self.pTabControl.attachTabItem("GameForm", self.szGameOptionsTabName)
+ self.pTabControl.attachTabItem("GraphicsForm", self.szGraphicsOptionsTabName)
+ self.pTabControl.attachTabItem("AudioForm", self.szAudioOptionsTabName)
+ self.pTabControl.attachTabItem("OtherForm", self.szOtherOptionsTabName)
+
+ self.drawGameOptionsTab()
+ self.drawGraphicOptionsTab()
+ self.drawAudioOptionsTab()
+ self.drawOtherTab()
+
+
+ def drawGameOptionsTab(self):
+
+ tab = self.pTabControl
+
+ tab.attachVBox("GameForm", "GameVBox")
+
+ # Add Game Options
+
+ tab.attachPanel("GameVBox", "GamePanelCenter")
+ tab.setStyle("GamePanelCenter", "Panel_Tan15_Style")
+ tab.setLayoutFlag("GamePanelCenter", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("GamePanelCenter", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachScrollPanel("GamePanelCenter", "GamePanel")
+ tab.setLayoutFlag("GamePanel", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("GamePanel", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachHBox("GamePanel", "GameHBox")
+ tab.setLayoutFlag("GameHBox", "LAYOUT_SIZE_HEXPANDING")
+
+ tab.attachVBox("GameHBox", "GameVBox1")
+ tab.setLayoutFlag("GameVBox1", "LAYOUT_SIZE_HEXPANDING")
+ #tab.attachVSeparator("GameHBox", "GameHBoxSeparator")
+ tab.attachVBox("GameHBox", "GameVBox2")
+ tab.setLayoutFlag("GameVBox2", "LAYOUT_SIZE_HEXPANDING")
+
+ i = 0
+ for iOptionLoop in range(PlayerOptionTypes.NUM_PLAYEROPTION_TYPES):
+
+ bContinue = true
+
+ if (iOptionLoop == PlayerOptionTypes.PLAYEROPTION_MODDER_1):
+ if (gc.getDefineINT("USE_MODDERS_PLAYEROPTION_1") == 0):
+ bContinue = false
+ elif (iOptionLoop == PlayerOptionTypes.PLAYEROPTION_MODDER_2):
+ if (gc.getDefineINT("USE_MODDERS_PLAYEROPTION_2") == 0):
+ bContinue = false
+ elif (iOptionLoop == PlayerOptionTypes.PLAYEROPTION_MODDER_3):
+ if (gc.getDefineINT("USE_MODDERS_PLAYEROPTION_3") == 0):
+ bContinue = false
+
+ if (bContinue):
+
+ szOptionDesc = gc.getPlayerOptionsInfoByIndex(iOptionLoop).getDescription()
+ szHelp = gc.getPlayerOptionsInfoByIndex(iOptionLoop).getHelp()
+ szCallbackFunction = "handleGameOptionsClicked"
+ szWidgetName = "GameOptionCheckBox_" + str(iOptionLoop)
+ bOptionOn = UserProfile.getPlayerOption(iOptionLoop)#gc.getPlayer(gc.getGame().getActivePlayer()).isOption(iOptionLoop)
+ if ((i+1) <= (PlayerOptionTypes.NUM_PLAYEROPTION_TYPES+1)/2):
+ vbox = "GameVBox1"
+ else:
+ vbox = "GameVBox2"
+ tab.attachCheckBox(vbox, szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName, bOptionOn)
+ tab.setToolTip(szWidgetName, szHelp)
+ i += 1
+
+
+ tab.attachSpacer("GamePanelCenter")
+
+ tab.attachHBox("GamePanelCenter", "LangHBox")
+
+ # Languages Dropdown
+ tab.attachLabel("LangHBox", "LangLabel", localText.getText("TXT_KEY_OPTIONS_SCREEN_LANGUAGE", ())) # Label
+ szDropdownDesc = "LanguagesDropdownBox"
+
+ tab.attachSpacer("LangHBox")
+
+ aszDropdownElements = ()
+ for i in range(CvGameText().getNumLanguages()):
+ szKey = "TXT_KEY_LANGUAGE_%d" % i
+ aszDropdownElements = aszDropdownElements + (localText.getText(szKey, ()),)
+
+ szCallbackFunction = "handleLanguagesDropdownBoxInput"
+ szWidgetName = "LanguagesDropdownBox"
+ iInitialSelection = CyGame().getCurrentLanguage()
+ tab.attachDropDown("LangHBox", szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+ tab.setLayoutFlag(szWidgetName, "LAYOUT_LEFT")
+
+ ########## Lower Panel
+
+ tab.attachHSeparator("GameVBox", "GameExitSeparator")
+
+ tab.attachHBox("GameVBox", "LowerHBox")
+ tab.setLayoutFlag("LowerHBox", "LAYOUT_HCENTER")
+
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_RESET", ())
+ szCallbackFunction = "handleGameReset"
+ szWidgetName = "GameOptionsResetButton"
+ tab.attachButton("LowerHBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+
+ szOptionDesc = localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ())
+ szCallbackFunction = "handleExitButtonInput"
+ szWidgetName = "GameOptionsExitButton"
+ tab.attachButton("LowerHBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+
+ def drawGraphicOptionsTab(self):
+
+ tab = self.pTabControl
+
+ tab.attachVBox("GraphicsForm", "GraphicsVBox")
+
+ tab.attachScrollPanel("GraphicsVBox", "GraphicsPanel")
+ tab.setLayoutFlag("GraphicsPanel", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("GraphicsPanel", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachHBox("GraphicsPanel", "GraphicsPanelHBox")
+ tab.setLayoutFlag("GraphicsPanelHBox", "LAYOUT_SIZE_HPREFERREDEXPANDING")
+ tab.setLayoutFlag("GraphicsPanelHBox", "LAYOUT_SIZE_VPREFERREDEXPANDING")
+
+
+ ####### RESOLUTION
+
+ tab.attachVBox("GraphicsPanelHBox", "ResVBox")
+ tab.setLayoutFlag("ResVBox", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("ResVBox", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachPanel("ResVBox", "ResPanel")
+ tab.setStyle("ResPanel", "Panel_Tan15_Style")
+ tab.setLayoutFlag("ResPanel", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("ResPanel", "LAYOUT_SIZE_VEXPANDING")
+
+ hbox = "ResPanelHBox"
+ tab.attachHBox("ResPanel", hbox)
+ tab.setLayoutFlag(hbox, "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag(hbox, "LAYOUT_SIZE_VEXPANDING")
+
+
+ vbox = "ResPanelVBox"
+ tab.attachVBox(hbox, vbox)
+ tab.setLayoutFlag(vbox, "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag(vbox, "LAYOUT_SIZE_VEXPANDING")
+
+ # Screen Image
+ tab.attachPanel(vbox, "ResScreenPanel")
+ tab.setLayoutFlag("ResScreenPanel", "LAYOUT_SIZE_HEXPANDING")
+ tab.setStyle("ResScreenPanel", "Panel_Black25_Style")
+
+ tab.attachHBox(vbox, "ResHBox")
+
+ vbox1 = "ResVBox1"
+ vbox2 = "ResVBox2"
+ tab.attachVBox("ResHBox", vbox1)
+ tab.attachVBox("ResHBox", vbox2)
+
+ # Screen Resolution Dropdown
+ tab.attachLabel(vbox1, "ResLabel", localText.getText("TXT_KEY_OPTIONS_SCREEN_RES", ())) # Label
+ tab.setControlFlag("ResLabel", "CF_LABEL_DEFAULTSIZE")
+ szDropdownDesc = "ResolutionDropdownBox"
+ aszDropdownElements = ()
+ for iResLoop in range(UserProfile.getResolutionMaxModes()):
+ aszDropdownElements = aszDropdownElements + (UserProfile.getResolutionString(iResLoop),)
+ szCallbackFunction = "handleResolutionDropdownInput"
+ szWidgetName = self.szResolutionComboBoxName = "ResolutionDropdownBox"
+ iInitialSelection = UserProfile.getResolution()
+ tab.attachDropDown(vbox2, szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+
+ # Anti-Aliasing Dropdown
+ tab.attachLabel(vbox1, "AALabel", localText.getText("TXT_KEY_OPTIONS_ANTIALIAS", ()))
+ tab.setControlFlag("AALabel", "CF_LABEL_DEFAULTSIZE")
+ szDropdownDesc = "AntiAliasingDropdownBox"
+ aszDropdownElements = ()
+ for iAALoop in range(UserProfile.getAntiAliasingMaxMultiSamples()+1):
+ if (iAALoop == 0):
+ aszDropdownElements = aszDropdownElements + (u"0",)
+ elif (iAALoop == 1):
+ aszDropdownElements = aszDropdownElements + (u"2",)
+ elif (iAALoop == 2):
+ aszDropdownElements = aszDropdownElements + (u"4",)
+ elif (iAALoop == 3):
+ aszDropdownElements = aszDropdownElements + (u"8",)
+ elif (iAALoop == 4):
+ aszDropdownElements = aszDropdownElements + (u"16",)
+
+ szCallbackFunction = "handleAntiAliasingDropdownInput"
+ szWidgetName = "AntiAliasingDropdownBox"
+ iInitialSelection = UserProfile.getAntiAliasing()
+ tab.attachDropDown(vbox2, szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+ tab.setLayoutFlag(szWidgetName, "LAYOUT_LEFT")
+
+ # Graphics Level
+ tab.attachLabel(vbox1, "GraphicsLevelLabel", localText.getText("TXT_KEY_OPTIONS_SCREEN_GRAPHICS_LEVEL", ())) # Label
+ tab.setControlFlag("GraphicsLevelLabel", "CF_LABEL_DEFAULTSIZE")
+ szDropdownDesc = "GraphicsLevelDropdownBox"
+ aszDropdownElements = (localText.getText("TXT_KEY_SEALEVEL_HIGH", ()), localText.getText("TXT_KEY_SEALEVEL_MEDIUM", ()), localText.getText("TXT_KEY_SEALEVEL_LOW", ()))
+ szCallbackFunction = "handleGraphicsLevelDropdownBoxInput"
+ szWidgetName = szDropdownDesc
+ iInitialSelection = UserProfile.getGraphicsLevel()
+ tab.attachDropDown(vbox2, szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+
+ # Render Quality level
+ tab.attachLabel(vbox1, "GraphicsQualityLabel", localText.getText("TXT_KEY_OPTIONS_SCREEN_RENDER_QUALITY_LEVEL", ())) # Label
+ tab.setControlFlag("GraphicsQualityLabel", "CF_LABEL_DEFAULTSIZE")
+ szDropdownDesc = "RenderQualityDropdownBox"
+ aszDropdownElements = (localText.getText("TXT_KEY_SEALEVEL_HIGH", ()), localText.getText("TXT_KEY_SEALEVEL_MEDIUM", ()), localText.getText("TXT_KEY_SEALEVEL_LOW", ()))
+ szCallbackFunction = "handleRenderQualityDropdownBoxInput"
+ szWidgetName = self.szRenderQualityDropdownBoxName = "RenderQualityDropdownBox"
+ iInitialSelection = UserProfile.getRenderQualityLevel()
+ tab.attachDropDown(vbox2, szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+
+ # Globe view rendering level
+ tab.attachLabel(vbox1, "GlobeViewLabel", localText.getText("TXT_KEY_OPTIONS_SCREEN_GLOBE", ())) # Label
+ tab.setControlFlag("GlobeViewLabel", "CF_LABEL_DEFAULTSIZE")
+
+ szDropdownDesc = "GlobeViewDropdownBox"
+ aszDropdownElements = (localText.getText("TXT_KEY_SEALEVEL_HIGH", ()), localText.getText("TXT_KEY_SEALEVEL_MEDIUM", ()), localText.getText("TXT_KEY_SEALEVEL_LOW", ()))
+ szCallbackFunction = "handleGlobeViewDropdownBoxInput"
+ szWidgetName = self.szGlobeViewDropdownBoxName = "GlobeViewDropdownBox"
+ iInitialSelection = UserProfile.getGlobeViewRenderLevel()
+ tab.attachDropDown(vbox2, szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+
+ # Movies
+ tab.attachLabel(vbox1, "MovieLabel", localText.getText("TXT_KEY_GRAPHICS_SETTINGS_MOVIE_QUALITY", ()))
+ tab.setControlFlag("MovieLabel", "CF_LABEL_DEFAULTSIZE")
+
+ szDropdownDesc = "MovieDropdownBox"
+ aszDropdownElements = (localText.getText("TXT_KEY_SEALEVEL_HIGH", ()), localText.getText("TXT_KEY_SEALEVEL_MEDIUM", ()), localText.getText("TXT_KEY_SEALEVEL_LOW", ()))
+ szCallbackFunction = "handleMovieDropdownBoxInput"
+ szWidgetName = self.szMovieDropdownBoxName = "MovieDropdownBox"
+ iInitialSelection = UserProfile.getMovieQualityLevel()
+ tab.attachDropDown(vbox2, szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+
+ # Main menu
+ tab.attachLabel(vbox1, "MainMenuLabel", localText.getText("TXT_KEY_OPENING_MENU", ())) # Label
+ tab.setControlFlag("MainMenuLabel", "CF_LABEL_DEFAULTSIZE")
+
+ szDropdownDesc = "MainMenuDropdownBox"
+ aszDropdownElements = ()
+ for iMainMenuLoop in range(gc.getNumMainMenus()):
+ aszDropdownElements = aszDropdownElements + (gc.getMainMenus(iMainMenuLoop).getDescription(),)
+ szCallbackFunction = "handleMainMenuDropdownBoxInput"
+ szWidgetName = self.szMainMenuDropdownBoxName = "DropdownBox"
+ iInitialSelection = UserProfile.getMainMenu()
+ tab.attachDropDown(vbox2, szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+
+ ####### GAME GRAPHICS
+
+ tab.attachVSeparator(hbox, "GfxSeparator")
+ tab.setLayoutFlag("GfxSeparator", "LAYOUT_LEFT")
+
+ vbox = "GfxPanelVBox"
+ tab.attachVBox(hbox, vbox)
+ tab.setLayoutFlag(vbox, "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag(vbox, "LAYOUT_SIZE_VEXPANDING")
+ tab.setLayoutFlag(vbox, "LAYOUT_SPACING_NONE")
+
+ # Checkboxes
+ for iOptionLoop in range(GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES):
+ szOptionDesc = gc.getGraphicOptionsInfoByIndex(iOptionLoop).getDescription()
+ szHelp = gc.getGraphicOptionsInfoByIndex(iOptionLoop).getHelp()
+ szCallbackFunction = "handleGraphicOptionsClicked"
+ szWidgetName = "GraphicOptionCheckbox_" + str(iOptionLoop)
+ bOptionOn = UserProfile.getGraphicOption(iOptionLoop)
+ tab.attachCheckBox(vbox, szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName, bOptionOn)
+ tab.setToolTip(szWidgetName, szHelp)
+
+ ########## EXIT
+
+ tab.attachHSeparator("GraphicsVBox", "GraphicsExitSeparator")
+
+ tab.attachHBox("GraphicsVBox", "LowerHBox")
+ tab.setLayoutFlag("LowerHBox", "LAYOUT_HCENTER")
+
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_RESET", ())
+ szCallbackFunction = "handleGraphicsReset"
+ szWidgetName = "GraphicOptionsResetButton"
+ tab.attachButton("LowerHBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+
+ szOptionDesc = localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ())
+ szCallbackFunction = "handleExitButtonInput"
+ szWidgetName = "GraphicOptionsExitButton"
+ tab.attachButton("LowerHBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+
+ def drawAudioOptionsTab(self):
+
+ tab = self.pTabControl
+
+ tab.attachVBox("AudioForm", "AudioVBox")
+
+ tab.attachScrollPanel("AudioVBox", "AudioPanel")
+ tab.setLayoutFlag("AudioPanel", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("AudioPanel", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachVBox("AudioPanel", "AudioPanelVBox")
+ tab.setLayoutFlag("AudioPanelHBox", "LAYOUT_SPACING_FORM")
+ tab.setLayoutFlag("AudioPanelHBox", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("AudioPanelHBox", "LAYOUT_SIZE_VEXPANDING")
+
+
+ ######################### Create the 6 volume slider/checkboxes #########################
+
+ tab.attachVBox("AudioPanelVBox", "VolumeVBox")
+ tab.setLayoutFlag("VolumeVBox", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("VolumeVBox", "LAYOUT_SIZE_VEXPANDING")
+
+ #tab.attachLabel("VolumeVBox", "VolumeLabel", "VOLUME")
+
+ tab.attachPanel("VolumeVBox", "VolumePanel")
+ tab.setStyle("VolumePanel", "Panel_Tan15_Style")
+ tab.setLayoutFlag("VolumePanel", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("VolumePanel", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachVBox("VolumePanel", "VolumePanelVBox")
+ tab.setLayoutFlag("VolumePanelVBox", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("VolumePanelVBox", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachScrollPanel("VolumePanelVBox", "VolumeScrollPanel")
+ tab.setLayoutFlag("VolumeScrollPanel", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("VolumeScrollPanel", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachHBox("VolumeScrollPanel", "VolumePanelHBox")
+ tab.setLayoutFlag("VolumePanelHBox", "LAYOUT_HEVENSTRETCH")
+ tab.setLayoutFlag("VolumePanelHBox", "LAYOUT_SIZE_VEXPANDING")
+
+ for iWidgetNum in range(6):
+
+ # SLIDER
+
+ if (iWidgetNum == 0): # Master Volume
+ szWidgetDesc = localText.getText("TXT_KEY_OPTIONS_MASTERVOLUME", ())
+ iInitialVal = 20-UserProfile.getMasterVolume()-1
+ bNoSoundTrue = UserProfile.isMasterNoSound()
+ elif (iWidgetNum == 1): # Music Volume
+ szWidgetDesc = localText.getText("TXT_KEY_OPTIONS_MUSICVOLUME", ())
+ iInitialVal = 20-UserProfile.getMusicVolume()-1
+ bNoSoundTrue = UserProfile.isMusicNoSound()
+ elif (iWidgetNum == 2): # Sound Effects Volume
+ szWidgetDesc = localText.getText("TXT_KEY_OPTIONS_EFFECTSVOLUME", ())
+ iInitialVal = 20-UserProfile.getSoundEffectsVolume()-1
+ bNoSoundTrue = UserProfile.isSoundEffectsNoSound()
+ elif (iWidgetNum == 3): # Speech Volume
+ szWidgetDesc = localText.getText("TXT_KEY_OPTIONS_SPEECHVOLUME", ())
+ iInitialVal = 20-UserProfile.getSpeechVolume()-1
+ bNoSoundTrue = UserProfile.isSpeechNoSound()
+ elif (iWidgetNum == 4): # Ambience Volume
+ szWidgetDesc = localText.getText("TXT_KEY_OPTIONS_AMBIENCEVOLUME", ())
+ iInitialVal = 20-UserProfile.getAmbienceVolume()-1
+ bNoSoundTrue = UserProfile.isAmbienceNoSound()
+ elif (iWidgetNum == 5): # Interface Volume
+ szWidgetDesc = localText.getText("TXT_KEY_OPTIONS_INTERFACEVOLUME", ())
+ iInitialVal = 20-UserProfile.getInterfaceVolume()-1
+ bNoSoundTrue = UserProfile.isInterfaceNoSound()
+
+ islider = str(iWidgetNum)
+
+ vbox = "VolumeSliderVBox"+islider
+ tab.attachVBox("VolumePanelHBox", vbox)
+
+ # Volume Slider
+ szSliderDesc = szWidgetDesc
+ szWidgetName = "VolumeSliderLabel"+islider
+ tab.attachLabel(vbox, szWidgetName, szSliderDesc)
+ tab.setLayoutFlag(szWidgetName, "LAYOUT_HCENTER")
+
+ szCallbackFunction = "handleVolumeSlidersInput"
+ szWidgetName = "VolumeSlider_" + str(iWidgetNum)
+ iMin = 0
+ iMax = UserProfile.getVolumeStops()
+ # iInitialVal set above
+ tab.attachVSlider(vbox, szWidgetName, self.callbackIFace, szCallbackFunction, szWidgetName, iMin, iMax, iInitialVal)
+ tab.setLayoutFlag(szWidgetName, "LAYOUT_SIZE_VEXPANDING")
+ tab.setControlFlag(szWidgetName, "CF_SLIDER_FILL_DOWN")
+
+ # CHECKBOX
+
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_NO_SOUND", ())
+ szCallbackFunction = "handleVolumeCheckboxesInput"
+ szWidgetName = "VolumeNoSoundCheckbox_" + str(iWidgetNum)
+ # bNoSoundTrue set above
+ tab.attachCheckBox(vbox, szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName, bNoSoundTrue)
+ tab.setLayoutFlag(szWidgetName, "LAYOUT_HCENTER")
+
+
+ tab.attachHSeparator("VolumePanelVBox", "SoundSeparator")
+
+ tab.attachHBox("VolumePanelVBox", "SoundPanelHBox")
+ tab.setLayoutFlag("SoundPanelHBox", "LAYOUT_SIZE_HPREFERREDEXPANDING")
+ tab.setLayoutFlag("SoundPanelHBox", "LAYOUT_SIZE_VPREFERRED")
+
+ ######################### Voice Config Section #########################
+
+ tab.attachVBox("SoundPanelHBox", "VoiceVBox")
+
+ # Checkbox
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_VOICE", ())
+ szCallbackFunction = "handleVoiceCheckboxInput"
+ self.szVoiceCheckboxName = "VoiceCheckbox"
+ szWidgetName = "VoiceChatCheckbox"
+ bUseVoice = UserProfile.useVoice()
+ tab.attachCheckBox("VoiceVBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName, bUseVoice)
+
+ # Capture Device Dropdown
+ tab.attachLabel("VoiceVBox", "VoiceCaptureLabel", localText.getText("TXT_KEY_OPTIONS_CAPTURE_DEVICE", ()))
+ szDropdownDesc = "CaptureDeviceDropdownBox"
+ aszDropdownElements = ()
+ for iCaptureDevice in range(UserProfile.getNumCaptureDevices()):
+ aszDropdownElements = aszDropdownElements + (UserProfile.getCaptureDeviceDesc(iCaptureDevice),)
+ szCallbackFunction = "handleCaptureDeviceDropdownInput"
+ szWidgetName = "CaptureDeviceDropdownBox"
+ iInitialSelection = UserProfile.getCaptureDeviceIndex()
+ tab.attachDropDown("VoiceVBox", szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+
+ # Capture Volume Slider
+ szSliderDesc = localText.getText("TXT_KEY_OPTIONS_CAPTUREVOLUME", ())
+ szCallbackFunction = "handleCaptureVolumeSliderInput"
+ szWidgetName = "CaptureVolumeSlider"
+ iMin = 0
+ iMax = UserProfile.getMaxCaptureVolume()
+# iInitialVal = iMax - UserProfile.getCaptureVolume()
+ iInitialVal = UserProfile.getCaptureVolume()
+ tab.attachHSlider("VoiceVBox", szWidgetName, self.callbackIFace, szCallbackFunction, szWidgetName, iMin, iMax, iInitialVal)
+ tab.setControlFlag(szWidgetName, "CF_SLIDER_FILL_UP")
+
+ # Playback Device Dropdown
+ tab.attachLabel("VoiceVBox", "VoicePlaybackLabel", localText.getText("TXT_KEY_OPTIONS_PLAYBACK_DEVICE", ())) # Label
+ szDropdownDesc = "PlaybackDeviceDropdownBox"
+ aszDropdownElements = ()
+ for iPlaybackDevice in range(UserProfile.getNumPlaybackDevices()):
+ aszDropdownElements = aszDropdownElements + (UserProfile.getPlaybackDeviceDesc(iPlaybackDevice),)
+ szCallbackFunction = "handlePlaybackDeviceDropdownInput"
+ szWidgetName = "PlaybackDeviceDropdownBox"
+ iInitialSelection = UserProfile.getPlaybackDeviceIndex()
+ tab.attachDropDown("VoiceVBox", szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+
+ # Playback Volume Slider
+ szSliderDesc = localText.getText("TXT_KEY_OPTIONS_PLAYBACKVOLUME", ())
+ szCallbackFunction = "handlePlaybackVolumeSliderInput"
+ szWidgetName = "PlaybackVolumeSlider"
+ iMin = 0
+ iMax = UserProfile.getMaxPlaybackVolume()
+# iInitialVal = iMax - UserProfile.getPlaybackVolume()
+ iInitialVal = UserProfile.getPlaybackVolume()
+ tab.attachHSlider("VoiceVBox", szWidgetName, self.callbackIFace, szCallbackFunction, szWidgetName, iMin, iMax, iInitialVal)
+ tab.setControlFlag(szWidgetName, "CF_SLIDER_FILL_UP")
+
+ ######################### Speaker Config Dropdown #########################
+
+ tab.attachVSeparator("SoundPanelHBox", "SoundVSeparator")
+
+ tab.attachVBox("SoundPanelHBox", "SoundConfigVBox")
+
+ tab.attachImage("SoundConfigVBox", "SoundBlasterLogo", CyArtFileMgr().getMiscArtInfo("SOUND_BLASTER_LOGO").getPath())
+
+ tab.attachLabel("SoundConfigVBox", "SpeakerConfigLabel", localText.getText("TXT_KEY_OPTIONS_SPEAKERS", ())) # Label
+ szDropdownDesc = "SpeakerConfigDropdownBox"
+ aszDropdownElements = ()
+ iInitialSelection = 0
+ for iSpeakerConfigLoop in range(15):
+ szActiveConfigKey = UserProfile.getSpeakerConfigFromList(iSpeakerConfigLoop)
+ szActiveConfig = localText.getText(szActiveConfigKey, ())
+ aszDropdownElements = aszDropdownElements + (szActiveConfig,)
+ if (UserProfile.getSpeakerConfig() == szActiveConfigKey):
+ iInitialSelection = iSpeakerConfigLoop
+
+ szCallbackFunction = "handleSpeakerConfigDropdownInput"
+ szWidgetName = "SpeakerConfigDropdownBox"
+ # iInitialSelection set above
+ tab.attachDropDown("SoundConfigVBox", szWidgetName, szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+ tab.setLayoutFlag(szWidgetName, "LAYOUT_SIZE_HFIXEDEXPANDING")
+ tab.setLayoutFlag(szWidgetName, "LAYOUT_LEFT")
+
+ ######################### Custom Audio Path #########################
+
+ tab.attachHSeparator("SoundConfigVBox", "SoundSeparator")
+
+ tab.attachHBox("SoundConfigVBox", "CustomPanelHBox")
+ tab.setLayoutFlag("CustomPanelHBox", "LAYOUT_SIZE_HPREFERREDEXPANDING")
+ tab.setLayoutFlag("CustomPanelHBox", "LAYOUT_SIZE_VPREFERRED")
+
+ # Checkbox
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_CUSTOM_MUSIC", ())
+ szCallbackFunction = "handleCustomMusicPathCheckboxInput"
+ self.szCustomMusicCheckboxName = "CustomMusicPathCheckbox"
+ szWidgetName = CvUtil.convertToStr(self.szCustomMusicCheckboxName)
+ bUseCustomMusicPath = false
+ if (UserProfile.getMusicPath() != ""):
+ bUseCustomMusicPath = true
+ tab.attachCheckBox("CustomPanelHBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName, bUseCustomMusicPath)
+
+ tab.attachHBox("CustomPanelHBox", "AudioPathHBox")
+ tab.setLayoutFlag("AudioPathHBox", "LAYOUT_SIZE_HFIXEDEXPANDING")
+
+ # Browse Button
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_BROWSE", ())
+ szCallbackFunction = "handleCustomMusicPathButtonInput"
+ szWidgetName = "CustomMusicPathButton"
+ tab.attachButton("AudioPathHBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+
+ # Edit Box
+ szEditBoxDesc = u""
+ if (UserProfile.getMusicPath() != ""):
+ szEditBoxDesc = CvUtil.convertToUnicode(UserProfile.getMusicPath())
+ szWidgetName = "CustomMusicEditBox"
+ szCallbackFunction = "DummyCallback"
+
+ tab.attachEdit("AudioPathHBox", szWidgetName, szEditBoxDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+
+ ########## EXIT
+
+ tab.attachHSeparator("AudioVBox", "AudioExitSeparator")
+
+ tab.attachHBox("AudioVBox", "LowerHBox")
+ tab.setLayoutFlag("LowerHBox", "LAYOUT_HCENTER")
+
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_RESET", ())
+ szCallbackFunction = "handleAudioReset"
+ szWidgetName = "AudioOptionsResetButton"
+ tab.attachButton("LowerHBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+
+ szOptionDesc = localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ())
+ szCallbackFunction = "handleExitButtonInput"
+ szWidgetName = "AudioOptionsExitButton"
+ tab.attachButton("LowerHBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+ tab.setLayoutFlag(szWidgetName, "LAYOUT_HCENTER")
+
+
+ def drawOtherTab(self):
+
+ tab = self.pTabControl
+
+ tab.attachVBox("OtherForm", "OtherVBox")
+
+ tab.attachScrollPanel("OtherVBox", "OtherPanel")
+ tab.setLayoutFlag("OtherPanel", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("OtherPanel", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachHBox("OtherPanel", "OtherPanelHBox")
+ tab.setLayoutFlag("OtherPanelHBox", "LAYOUT_SPACING_INNERFORM")
+ tab.setLayoutFlag("OtherPanelHBox", "LAYOUT_SIZE_HEXPANDING")
+
+
+ ########### CLOCK
+
+ tab.attachVBox("OtherPanelHBox", "ClockVBox")
+ tab.setLayoutFlag("ClockVBox", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("ClockVBox", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachLabel("ClockVBox", "ClockLabel", localText.getText("TXT_KEY_OPTIONS_CLOCK", ()).upper() )
+
+ tab.attachPanel("ClockVBox", "ClockPanel")
+ tab.setStyle("ClockPanel", "Panel_Tan15_Style")
+ tab.setLayoutFlag("ClockPanel", "LAYOUT_SIZE_HPREFERREDEXPANDING")
+ tab.setLayoutFlag("ClockPanel", "LAYOUT_SIZE_VPREFERREDEXPANDING")
+
+ tab.attachVBox("ClockPanel", "ClockPanelVBox")
+ tab.setLayoutFlag("ClockPanelVBox", "LAYOUT_SIZE_HPREFERREDEXPANDING")
+ tab.setLayoutFlag("ClockPanelVBox", "LAYOUT_SIZE_VPREFERREDEXPANDING")
+
+ # Clock On Checkbox
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_CLOCK_ON", ())
+ szCallbackFunction = "handleClockOnCheckboxInput"
+ szWidgetName = "ClockOnCheckbox"
+ bClockOn = UserProfile.isClockOn()
+ tab.attachCheckBox("ClockPanelVBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName, bClockOn)
+
+ # 24 Hour Clock Checkbox
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_24CLOCK", ())
+ szCallbackFunction = "handle24HourClockCheckboxInput"
+ szWidgetName = "24HourClockCheckbox"
+ b24HourClock = UserProfile.is24Hours()
+ tab.attachCheckBox("ClockPanelVBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName, b24HourClock)
+
+ # Edit Box Hours
+ tab.attachLabel("ClockPanelVBox", "HoursLabel", localText.getText("TXT_KEY_OPTIONS_HOURS", ())) # Label
+ szEditBoxDesc = str(getAlarmHourLeft())
+ szCallbackFunction = "DummyCallback"
+ szWidgetName = "AlarmHourEditBox"
+ tab.attachEdit("ClockPanelVBox", szWidgetName, szEditBoxDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+
+ # Edit Box Mins
+ tab.attachLabel("ClockPanelVBox", "MinsLabel", localText.getText("TXT_KEY_OPTIONS_MINS", ())) # Label
+ szEditBoxDesc = str(getAlarmMinLeft())
+ szCallbackFunction = "DummyCallback"
+ szWidgetName = "AlarmMinEditBox"
+ tab.attachEdit("ClockPanelVBox", szWidgetName, szEditBoxDesc, self.callbackIFace, szCallbackFunction, szWidgetName)
+
+ # Alarm On Checkbox
+ szOptionDesc = localText.getText("TXT_KEY_OPTIONS_ALARMON", ())
+ szCallbackFunction = "handleAlarmOnCheckboxInput"
+ szWidgetName = "AlarmOnCheckbox"
+ bAlarmOn = isAlarmOn()
+ tab.attachCheckBox("ClockPanelVBox", szWidgetName, szOptionDesc, self.callbackIFace, szCallbackFunction, szWidgetName, bAlarmOn)
+
+
+ ########### PROFILE
+
+ UserProfile.loadProfileFileNames()
+
+ tab.attachVBox("OtherPanelHBox", "ProfileVBox")
+ tab.setLayoutFlag("ProfileVBox", "LAYOUT_SIZE_HEXPANDING")
+ tab.setLayoutFlag("ProfileVBox", "LAYOUT_SIZE_VEXPANDING")
+
+ tab.attachLabel("ProfileVBox", "ProfileLabel", localText.getText("TXT_KEY_OPTIONS_SCREEN_PROFILES", ()).upper() )
+
+ tab.attachPanel("ProfileVBox", "ProfilePanel")
+ tab.setStyle("ProfilePanel", "Panel_Tan15_Style")
+ tab.setLayoutFlag("ProfilePanel", "LAYOUT_SIZE_HPREFERREDEXPANDING")
+ tab.setLayoutFlag("ProfilePanel", "LAYOUT_SIZE_VPREFERREDEXPANDING")
+
+ tab.attachVBox("ProfilePanel", "ProfilePanelVBox")
+ tab.setLayoutFlag("ProfilePanelVBox", "LAYOUT_SIZE_HPREFERREDEXPANDING")
+ tab.setLayoutFlag("ProfilePanelVBox", "LAYOUT_SIZE_VPREFERREDEXPANDING")
+
+
+ # Profiles Dropdown
+
+ tab.attachLabel("ProfilePanelVBox", "ProfileComboLabel", localText.getText("TXT_KEY_OPTIONS_SCREEN_PROFILES", ()))
+
+ szDropdownDesc = "ProfilesDropdownBox"
+ aszDropdownElements = ()
+ iInitialSelection = 0
+ for iProfileLoop in range(UserProfile.getNumProfileFiles()):
+ szProfileFileName = UserProfile.getProfileFileName(iProfileLoop)
+
+ # Cut off file path and extension
+ szProfile = szProfileFileName[szProfileFileName.find("PROFILES\\")+9:-4]
+
+ aszDropdownElements = aszDropdownElements + (szProfile,)
+
+ if (UserProfile.getProfileName() == szProfile):
+ iInitialSelection = iProfileLoop
+
+ szCallbackFunction = "handleProfilesDropdownInput"
+ szWidgetName = "ProfilesDropdownBox"
+ # iInitialSelection set above
+ tab.attachDropDown("ProfilePanelVBox",szWidgetName,szDropdownDesc, aszDropdownElements, self.callbackIFace, szCallbackFunction, szWidgetName, iInitialSelection)
+
+ # Edit Box ProfileName
+ tab.attachLabel("ProfilePanelVBox","ProfilesName",localText.getText("TXT_KEY_OPTIONS_SCREEN_PROFILE_NAME", ())) # Label
+
+
+ #szCallbackIFace = ""
+ szEditBoxDesc = User...
[truncated message content] |