reportWindow.py (6641B)
1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\zhReport\reportWindow.py 2 from carbon.common.script.util.format import FmtDate 3 from carbonui import uiconst 4 from carbonui.control.combo import Combo 5 from carbonui.primitives.container import Container 6 from carbonui.primitives.fill import Fill 7 from eve.client.script.ui.control import eveIcon, eveLabel 8 from carbonui.control.button import Button 9 from eve.client.script.ui.control.eveEditPlainText import EditPlainText 10 from eve.client.script.ui.control.eveLabel import EveLabelMedium, EveCaptionSmall 11 from carbonui.control.window import Window 12 from eve.client.script.ui.control.themeColored import SpriteThemeColored 13 from localization import GetByLabel 14 from player_messaging.client.ui_message import prompt_player_fsd_dialog 15 TYPE_INAPPROPRIATE_LANGUAGE = 1 16 TYPE_OFFENSIVE_MAIL = 2 17 TYPE_MACRO_USE = 3 18 TYPE_QUESTIONABLE_TRANSACTION = 4 19 TYPE_INAPPROPRIATE_CHARACTER_NAME = 5 20 TYPE_EXPLOIT_ABUSE = 6 21 TYPE_GAMBLING = 7 22 TYPE_OTHER = 8 23 INVALID_CHARACTER_ID = -1 24 INAPPROPRIATE_COMBO_OPTIONS = ((GetByLabel('UI/Kiring/Report/OffensiveMail'), TYPE_OFFENSIVE_MAIL, GetByLabel('UI/Kiring/Report/OffensiveMailHint')), 25 (GetByLabel('UI/Kiring/Report/InappropriateLanguage'), TYPE_INAPPROPRIATE_LANGUAGE, GetByLabel('UI/Kiring/Report/InappropriateLanguageHint')), 26 (GetByLabel('UI/Kiring/Report/MacroUse'), TYPE_MACRO_USE, GetByLabel('UI/Kiring/Report/MacroUseHint')), 27 (GetByLabel('UI/Kiring/Report/QuestionableTransaction'), TYPE_QUESTIONABLE_TRANSACTION, GetByLabel('UI/Kiring/Report/QuestionableTransactionHint')), 28 (GetByLabel('UI/Kiring/Report/InappropriateCharacterName'), TYPE_INAPPROPRIATE_CHARACTER_NAME, GetByLabel('UI/Kiring/Report/InappropriateCharacterNameHint')), 29 (GetByLabel('UI/Kiring/Report/ExploitAbuse'), TYPE_EXPLOIT_ABUSE, GetByLabel('UI/Kiring/Report/ExploitAbuseHint')), 30 (GetByLabel('UI/Kiring/Report/Gambling'), TYPE_GAMBLING, GetByLabel('UI/Kiring/Report/GamblingHint')), 31 (GetByLabel('UI/Kiring/Report/Other'), TYPE_OTHER, GetByLabel('UI/Kiring/Report/OtherHint'))) 32 33 class ReportWindow(Window): 34 __guid__ = 'form.ReportWindow' 35 default_windowID = 'form.reportWnd' 36 default_captionLabelPath = 'UI/Kiring/Report/WndReportCaption' 37 default_descriptionLabelPath = 'UI/Kiring/Report/WndReportDescription' 38 default_iconNum = 'res:/ui/Texture/WindowIcons/log.png' 39 40 def ApplyAttributes(self, attributes): 41 Window.ApplyAttributes(self, attributes) 42 self.reportedCharID = INVALID_CHARACTER_ID 43 self.SetMinSize([340, 460]) 44 self.MakeUnResizeable() 45 self.topParent = Container(name='topParent', parent=self.GetMainArea(), align=uiconst.TOTOP, height=60, clipChildren=True) 46 SpriteThemeColored(name='mainicon', parent=self.topParent, state=uiconst.UI_DISABLED, pos=(0, -3, 64, 64), texturePath=self.iconNum, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW) 47 self.label = eveLabel.WndCaptionLabel(parent=self.topParent, text=GetByLabel(self.default_captionLabelPath)) 48 self._ConstructLayout() 49 50 def _ConstructLayout(self): 51 bottomCont = Container(name='bottomCont', parent=self.sr.main, align=uiconst.TOBOTTOM, height=20, padding=(0, 0, 0, 4)) 52 infoCont = Container(name='reportedInfoCont', parent=self.sr.main, align=uiconst.TOTOP, height=160, padding=(4, -8, 4, 4)) 53 Fill(name='backGround', parent=infoCont, color=(0.5, 0.5, 0.5, 0.1), align=uiconst.TOALL, padding=(4, 11, 4, 10)) 54 self.reportedImgCont = Container(name='imgCont', parent=infoCont, align=uiconst.TOLEFT, width=128, padding=(10, 17, 0, 0), pos=(0, 0, 64, 0)) 55 reportedNameCont = Container(name='nameCont', parent=infoCont, align=uiconst.TOLEFT, width=200, padding=(75, 0, 0, 0)) 56 self.reportedCharacter = EveCaptionSmall(parent=reportedNameCont, left=0, top=0, align=uiconst.CENTERLEFT, width=180, state=uiconst.UI_DISABLED, idx=0) 57 midCont = Container(name='inappropriateInfoCont', parent=self.sr.main, align=uiconst.TOALL) 58 EveLabelMedium(text=GetByLabel('UI/Kiring/Report/InappropriateType'), parent=midCont, align=uiconst.TOPLEFT, padLeft=8) 59 self.inappropriateType = Combo(name='inappropriateType', parent=midCont, options=self._GetComboOptions(), select=TYPE_OFFENSIVE_MAIL, width=200, pos=(131, 0, 0, 0), callback=self._OnComboOptionChange) 60 self.inappropriateType.Confirm() 61 additionalCont = Container(parent=midCont, align=uiconst.TOALL, padTop=25) 62 EveLabelMedium(text=GetByLabel('UI/Kiring/Report/AdditionalInformation'), parent=additionalCont, align=uiconst.TOPLEFT, padLeft=8) 63 self.additionalInfo = EditPlainText(name='information', parent=additionalCont, align=uiconst.TOALL, padding=(8, 24, 8, 4)) 64 Button(name='submit', parent=bottomCont, align=uiconst.CENTER, label=GetByLabel('UI/Kiring/Report/ButtonSubmit'), fixedwidth=64, func=self._Submit) 65 66 def _GetComboOptions(self): 67 return INAPPROPRIATE_COMBO_OPTIONS 68 69 def _OnComboOptionChange(self, combo, key, value): 70 if value == TYPE_INAPPROPRIATE_LANGUAGE: 71 focus_window = sm.GetService('focus').GetFocusChannel() 72 channelName = sm.GetService('XmppChat').GetDetailedDisplayName(focus_window.GetChannelId()) 73 messageCount = 0 74 messageText = '%s\n' % channelName 75 for sender, text, timestamp, colorkey in focus_window.messages: 76 if sender == self.reportedCharID: 77 messageCount += 1 78 messageText += '[%s] %s> %s\n' % (FmtDate(timestamp), cfg.eveowners.Get(sender).name, text) 79 80 if messageCount > 0: 81 self.additionalInfo.SetValue(messageText) 82 else: 83 self.additionalInfo.SetValue('') 84 else: 85 self.additionalInfo.SetValue('') 86 87 def _Submit(self, *args): 88 if self.reportedCharID != INVALID_CHARACTER_ID: 89 sm.GetService('reportClientSvc').SubmitReportInformation(self.reportedCharID, self.inappropriateType.GetValue(), self.additionalInfo.GetValue()) 90 self.CloseByUser() 91 prompt_player_fsd_dialog('CustomInfo', {'info': GetByLabel('UI/Messages/ReportSuccessfullyBody')}) 92 93 def SetReportedCharacter(self, characterId): 94 characterName = cfg.eveowners.Get(characterId).name 95 if characterName: 96 self.reportedCharID = characterId 97 self.reportedCharacter.SetText(characterName) 98 eveIcon.GetOwnerLogo(self.reportedImgCont, self.reportedCharID, size=128, noServerCall=True) 99 else: 100 raise RuntimeError('Invalid character id: %d' % characterId)