NovaBryan/EVE_Dump
Log | Files | 📦 下载最新源码 (.zip) | Refs | README

help.py (7372B)


      1 #Embedded file name: C:\BuildAgent\work\20d73f1b24eed06e\eve\release\V24.01\eve\client\script\ui\shared\neocom\help.py
      2 import blue
      3 import carbonui.const as uiconst
      4 import eve.client.script.ui.shared.pointerTool.pointerToolConst as pConst
      5 import localization
      6 import utillib
      7 from carbonui.control.button import Button
      8 from carbonui.control.window import Window
      9 from carbonui.primitives.container import Container
     10 from carbonui.primitives.containerAutoSize import ContainerAutoSize
     11 from eve.client.script.ui.control.eveLabel import CaptionLabel, EveLabelMedium
     12 from eve.client.script.ui.control.themeColored import LineThemeColored, SpriteThemeColored
     13 from eveservices.xmppchat import GetChatService
     14 from globalConfig.getFunctions import ShouldShowBugreportButton
     15 from player_messaging.client.ui_message import prompt_player_fsd_dialog
     16 HELP_WINDOW_WIDTH = 300
     17 ENTRY_WIDTH = 287
     18 MIN_ENTRY_HEIGHT = 36
     19 ENTRY_TEXT_WIDTH = 222
     20 ENTRY_PADDING_TOP = 4
     21 
     22 class HelpWindow(Window):
     23     __notifyevents__ = ['ProcessSessionChange']
     24     default_width = HELP_WINDOW_WIDTH
     25     default_fixedWidth = 400
     26     default_height = 400
     27     default_windowID = 'help'
     28     default_captionLabelPath = 'UI/Help/EveHelp'
     29     default_descriptionLabelPath = 'Tooltips/Neocom/Help_description'
     30     default_iconNum = 'res:/ui/Texture/WindowIcons/help.png'
     31 
     32     def ApplyAttributes(self, attributes):
     33         Window.ApplyAttributes(self, attributes)
     34         self.MouseDown = self.OnWndMouseDown
     35         self.mainCont = ContainerAutoSize(name='mainCont', parent=self.sr.main, align=uiconst.TOTOP, callback=self._OnMainContAutoSized)
     36         self.ConstructContent()
     37 
     38     def ConstructTopParent(self):
     39         self.topParent = Container(name='topParent', parent=self.mainCont, align=uiconst.TOTOP, height=64, clipChildren=True)
     40         SpriteThemeColored(name='mainicon', parent=self.topParent, state=uiconst.UI_DISABLED, pos=(0, -3, 64, 64), texturePath=self.iconNum, colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
     41         CaptionLabel(text=localization.GetByLabel('UI/Help/EveHelp'), parent=self.topParent, align=uiconst.CENTERLEFT, left=70)
     42 
     43     def ProcessSessionChange(self, isremote, session, change):
     44         if session.charid is None:
     45             self.Close()
     46 
     47     def CreateBugReport(self, *args):
     48         buttons = [utillib.KeyVal(label=localization.GetByLabel('UI/Help/ReportBug'), id='BugReport')]
     49         petitionerSvc = sm.RemoteSvc('petitioner')
     50         if petitionerSvc.IsZendeskSwapEnabled():
     51             buttons.append(utillib.KeyVal(label=localization.GetByLabel('UI/Help/HelpCenter'), id='Help'))
     52         else:
     53             buttons.append(utillib.KeyVal(label=localization.GetByLabel('UI/Common/Cancel'), id=uiconst.ID_CANCEL))
     54         ret = prompt_player_fsd_dialog('BugReportOpenConfirmation', {}, buttons, default='BugReport')
     55         if ret == 'BugReport':
     56             self.Close()
     57             blue.pyos.synchro.SleepWallclock(10)
     58             sm.GetService('bugReporting').StartCreateBugReport()
     59         elif ret == 'Help':
     60             self.OpenHelpCenter()
     61 
     62     def _LoadSupportHelpChannel(self, parent):
     63         EveLabelMedium(name='joinChannelHint', text=localization.GetByLabel('UI/Help/JoinChannelHint'), parent=parent, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, padTop=8)
     64         helpbtnparent = ContainerAutoSize(name='helpbtnparent', parent=parent, align=uiconst.TOTOP, padTop=8)
     65         Button(name='helpChannelButton', parent=helpbtnparent, label=localization.GetByLabel('UI/Help/JoinChannel'), func=self.JoinHelpChannel, btn_default=0, align=uiconst.TOPRIGHT)
     66 
     67     def _LoadSupportPetitions(self, parent):
     68         petpar = ContainerAutoSize(name='petitionpar', parent=parent, align=uiconst.TOTOP, padTop=8)
     69         petbtnparent = ContainerAutoSize(name='petbtnparent', parent=parent, align=uiconst.TOTOP, padTop=8)
     70         petitioner = sm.RemoteSvc('petitioner')
     71         if petitioner.IsZendeskSwapEnabled():
     72             EveLabelMedium(name='helpCenterDescriptionLabel', text=localization.GetByLabel('UI/Help/HelpCenterDescription'), parent=petpar, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, padTop=8)
     73             if petitioner.HasOpenTickets():
     74                 EveLabelMedium(name='openOldPetitionsLinkLabel', text=localization.GetByLabel('UI/Help/OpenOldPetitions'), parent=petpar, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, padTop=8)
     75             Button(name='openHelpCenterButton', parent=petbtnparent, label=localization.GetByLabel('UI/Help/OpenHelpCenterFinal'), func=self.OpenHelpCenter, btn_default=0, align=uiconst.TOPRIGHT, uniqueUiName=pConst.UNIQUE_NAME_HELP_CENTER_BTN)
     76         else:
     77             EveLabelMedium(name='openPetitionsLabelOld', text=localization.GetByLabel('UI/Help/OpenPetitions'), parent=petpar, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, padTop=8)
     78             Button(name='filePetitionButton', parent=petbtnparent, label=localization.GetByLabel('UI/Help/FilePetition'), func=self.FilePetition, btn_default=0, align=uiconst.TOPRIGHT)
     79             if petitioner.IsZendeskEnabled() and session.languageID.lower() == 'en':
     80                 Button(name='openHelpCenterButton', parent=petbtnparent, label=localization.GetByLabel('UI/Help/OpenHelpCenter'), func=self.OpenHelpCenter, btn_default=0, align=uiconst.TOPRIGHT, uniqueUiName=pConst.UNIQUE_NAME_HELP_CENTER_BTN, top=Button.default_height + 4)
     81 
     82     def _LoadSupportBugReport(self, parent):
     83         EveLabelMedium(name='reportBugLabel', text=localization.GetByLabel('UI/Help/ReportBugFull'), parent=parent, align=uiconst.TOTOP, state=uiconst.UI_NORMAL, padTop=8)
     84         bugreportbtnparent = ContainerAutoSize(name='bugreportbtnparent', parent=parent, align=uiconst.TOTOP, padTop=8)
     85         Button(name='reportBugButton', parent=bugreportbtnparent, label=localization.GetByLabel('UI/Help/ReportBug'), func=self.CreateBugReport, align=uiconst.TOPRIGHT)
     86 
     87     def ConstructContent(self):
     88         self._LoadSupportHelpChannel(self.mainCont)
     89         LineThemeColored(name='line1', parent=self.mainCont, align=uiconst.TOTOP, padTop=8)
     90         self._LoadSupportPetitions(self.mainCont)
     91         if ShouldShowBugreportButton(sm.GetService('machoNet')):
     92             LineThemeColored(name='line3', parent=self.mainCont, align=uiconst.TOTOP, padTop=8)
     93             self._LoadSupportBugReport(self.mainCont)
     94 
     95     def _OnMainContAutoSized(self):
     96         _, height = self.GetWindowSizeForContentSize(height=self.mainCont.height)
     97         self.SetFixedHeight(height)
     98 
     99     def OpenHelpCenter(self, *args):
    100         import webbrowser
    101         if prompt_player_fsd_dialog('HelpCenterOpenWarning', {}, uiconst.OKCANCEL) == uiconst.ID_OK:
    102             petitioner = sm.RemoteSvc('petitioner')
    103             webbrowser.open_new(petitioner.GetZendeskJwtLink())
    104 
    105     def FilePetition(self, *args):
    106         sm.GetService('petition').NewPetition()
    107 
    108     def JoinHelpChannel(self, *etc):
    109         normal_help_channel = GetChatService().XmppChatMgr.GetHelpChannel()
    110         if normal_help_channel:
    111             wnd = GetChatService().GetGroupChatWindow(normal_help_channel)
    112             if wnd and not wnd.destroyed:
    113                 wnd.Maximize()
    114                 return
    115         GetChatService().JoinHelpChannels()
    116 
    117     def OnWndMouseDown(self, *args):
    118         sm.GetService('neocom').BlinkOff('help')
    119 
    120     def _OnClose(self, *args):
    121         if getattr(self, 'sr', None) and self.sr.Get('form', None):
    122             self.sr.form.Close()