surveyClaimWnd.py (2345B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\login\charSelection\surveyClaimWnd.py 2 from carbonui.control.button import Button 3 from carbonui.control.window import Window 4 from carbonui.primitives.container import Container 5 from carbonui import uiconst 6 from eve.client.script.ui.control.eveLabel import Label, EveLabelMedium 7 from localization import GetByLabel, GetByMessageID 8 from surveys import GetSurveyByID 9 10 class ClaimSurveyRewardsWnd(Window): 11 default_width = 400 12 default_height = 200 13 default_windowID = 'claimSurveyRewardsWnd' 14 15 def ApplyAttributes(self, attributes): 16 attributes.useDefaultPos = True 17 super(ClaimSurveyRewardsWnd, self).ApplyAttributes(attributes) 18 self.MakeUnResizeable() 19 self.sr.headerParent.display = False 20 self.HideHeaderButtons() 21 surveyIDS = attributes.surveyIDs 22 text = self.GetSurveyText(surveyIDS) 23 cont = Container(name='innerCont', parent=self.sr.main, align=uiconst.TOALL, padding=(25, 25, 25, 0)) 24 headerLabel = Label(parent=cont, fontsize=18, text='<center>%s</center>' % GetByLabel('UI/Surveys/SurveyRewards'), align=uiconst.TOTOP, uppercase=True, padBottom=13) 25 textLabel = EveLabelMedium(parent=cont, text=text, align=uiconst.TOTOP, padBottom=13) 26 claimBtn = Button(parent=self.sr.main, align=uiconst.CENTERBOTTOM, label=GetByLabel('UI/LoginRewards/ClaimButtonText'), func=self.OnClaimBtnClicked, top=20) 27 contentHeight = self.sr.headerParent.height + cont.padTop + headerLabel.height + headerLabel.padBottom + textLabel.height + textLabel.padBottom + claimBtn.height + claimBtn.top 28 self.height = max(self.height, contentHeight) 29 30 def GetSurveyText(self, surveyIDs): 31 text = GetByLabel('UI/Surveys/ClaimMessages/GenericClaimSurveyRewards') 32 if len(surveyIDs) > 1: 33 return text 34 surveyID = surveyIDs.pop() 35 survey = GetSurveyByID(surveyID) 36 if survey and survey.GetClaimLabelID(): 37 return GetByMessageID(survey.GetClaimLabelID()) 38 return text 39 40 def CloseByUser(self, *args): 41 self.SetModalResult(uiconst.ID_CLOSE) 42 super(ClaimSurveyRewardsWnd, self).CloseByUser(*args) 43 44 def OnClaimBtnClicked(self, *args, **kwargs): 45 self.SetModalResult(uiconst.ID_YES)