Example #1
0
def OnLoad():
    global CharSoundWindow, VoiceList

    CharSoundWindow = GemRB.LoadWindow(19, "GUICG")
    CharGenCommon.PositionCharGenWin(CharSoundWindow)

    VoiceList = CharSoundWindow.GetControl(45)
    Voices = VoiceList.ListResources(CHR_SOUNDS)
    GUICommon.AddDefaultVoiceSet(VoiceList, Voices)
    # preselect the default entry to avoid an infinite loop if Play is pressed immediately
    VoiceList.SetVarAssoc("Selected", 0)

    PlayButton = CharSoundWindow.GetControl(47)
    PlayButton.SetState(IE_GUI_BUTTON_ENABLED)
    PlayButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, PlayPress)
    PlayButton.SetText(17318)

    TextArea = CharSoundWindow.GetControl(50)
    TextArea.SetText(11315)

    BackButton = CharSoundWindow.GetControl(10)
    BackButton.SetText(15416)
    BackButton.MakeEscape()
    DoneButton = CharSoundWindow.GetControl(0)
    DoneButton.SetText(11973)
    DoneButton.MakeDefault()

    VoiceList.SetEvent(IE_GUI_TEXTAREA_ON_SELECT, ChangeVoice)
    DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, NextPress)
    BackButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, BackPress)
    CharSoundWindow.Focus()
    return
Example #2
0
def OnLoad():
	global CharSoundWindow, VoiceList
	
	CharSoundWindow=GemRB.LoadWindow(19, "GUICG")

	VoiceList = CharSoundWindow.GetControl (45)
	Voices = VoiceList.ListResources (CHR_SOUNDS)
	GUICommon.AddDefaultVoiceSet (VoiceList, Voices)
	# preselect the default entry to avoid an infinite loop if Play is pressed immediately
	VoiceList.SetVarAssoc ("Selected", 0)

	PlayButton = CharSoundWindow.GetControl (47)
	PlayButton.SetState (IE_GUI_BUTTON_ENABLED)
	PlayButton.OnPress (PlayPress)
	PlayButton.SetText (17318)

	TextArea = CharSoundWindow.GetControl (50)
	TextArea.SetText (11315)

	BackButton = CharSoundWindow.GetControl(10)
	BackButton.SetText(15416)
	DoneButton = CharSoundWindow.GetControl(0)
	DoneButton.SetText(11973)
	DoneButton.MakeDefault()

	VoiceList.OnSelect (ChangeVoice)
	DoneButton.OnPress (NextPress)
	BackButton.OnPress (lambda: CharGenCommon.back(CharSoundWindow))
	CharSoundWindow.ShowModal(MODAL_SHADOW_NONE)
	return
Example #3
0
def OpenSoundWindow():
    global VoiceList, OldVoiceSet

    pc = GemRB.GameGetSelectedPCSingle()
    OldVoiceSet = GemRB.GetPlayerSound(pc)
    SubCustomizeWindow = GemRB.LoadWindow(20)
    SubCustomizeWindow.AddAlias("SUB_WIN", 0)

    VoiceList = SubCustomizeWindow.GetControl(5)
    Voices = VoiceList.ListResources(CHR_SOUNDS)

    # add "default" voice
    # bg1: mainm and mainf
    # bg2: last item in the list: female4/male005
    # iwds: n/a
    DefaultAdded = GUICommon.AddDefaultVoiceSet(VoiceList, Voices)

    # find the index of the current voice and preselect it
    if OldVoiceSet in Voices:
        VoiceList.SetVarAssoc("Selected",
                              Voices.index(OldVoiceSet) + int(DefaultAdded))
    else:  # "default"
        VoiceList.SetVarAssoc("Selected", 0)

    PlayButton = SubCustomizeWindow.GetControl(7)
    PlayButton.SetText(17318)

    TextArea = SubCustomizeWindow.GetControl(8)
    TextArea.SetText(11315)

    DoneButton = SubCustomizeWindow.GetControl(10)
    DoneButton.SetText(11973)
    DoneButton.MakeDefault()

    CancelButton = SubCustomizeWindow.GetControl(11)
    CancelButton.SetText(13727)
    CancelButton.MakeEscape()

    PlayButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, PlaySoundPressed)
    DoneButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, DoneSoundWindow)
    CancelButton.SetEvent(IE_GUI_BUTTON_ON_PRESS, CloseSoundWindow)

    SubCustomizeWindow.ShowModal(MODAL_SHADOW_GRAY)
    return