コード例 #1
0
 def InitializeBrowsers(self):
     self.sr.briefingBrowser = uicontrols.Edit(
         parent=self.sr.leftPane,
         padding=(const.defaultPadding, const.defaultPadding,
                  const.defaultPadding, const.defaultPadding),
         readonly=1)
     self.sr.briefingBrowser.sr.window = self
     self.sr.objectiveBrowser = uicontrols.Edit(
         parent=self.sr.rightPaneTop,
         readonly=1,
         padding=(const.defaultPadding, const.defaultPadding,
                  const.defaultPadding, const.defaultPadding))
     self.sr.objectiveBrowser.sr.window = self
コード例 #2
0
 def ApplyAttributes(self, attributes):
     uicontrols.Window.ApplyAttributes(self, attributes)
     self.scope = 'all'
     self.sr.browser = uicontrols.Edit(parent=self.sr.main, padding=const.defaultPadding, readonly=1)
     self.sr.browser.HideBackground(True)
     self.sr.browser.AllowResizeUpdates(0)
     self.sr.browser.sr.window = self
     m = uicls.UtilMenu(menuAlign=uiconst.TOPRIGHT, parent=self.sr.topParent, align=uiconst.TOPRIGHT, left=const.defaultPadding, top=18, GetUtilMenu=self.SettingMenu, texturePath='res:/UI/Texture/Icons/73_16_50.png')
     self.nextFunc = attributes.nextFunc
     self.backFunc = attributes.backFunc
     self.onStartScalingWidth = None
     self.onStartScalingHeight = None
     self.constrainScreen = True
     if self.sr.stack is not None:
         self.sr.stack.RemoveWnd(self, 0, 0)
     if sm.GetService('tutorial').IsTutorialWindowUnkillable():
         self.MakeUnKillable()
         repairSysSkill = sm.GetService('skills').HasSkill(const.typeRepairSystems)
         shieldOpsSkill = sm.GetService('skills').HasSkill(const.typeShieldOperations)
         if repairSysSkill or shieldOpsSkill:
             self.MakeKillable()
     Sprite(parent=self.sr.topParent, name='mainicon', pos=(0, 2, 64, 64), texturePath='res:/UI/Texture/Icons/74_64_13.png')
     self.HideHeader()
     self.MakeUnstackable()
     self.SetMinSize([350, 220])
     self.imgpar = uiprimitives.Container(name='imgpar', parent=self.sr.main, align=uiconst.TOLEFT, width=64, idx=4, state=uiconst.UI_HIDDEN, clipChildren=1)
     imgparclipper = uiprimitives.Container(name='imgparclipper', parent=self.imgpar, align=uiconst.TOALL, left=5, top=5, width=5, height=5, clipChildren=1)
     self.img = uiprimitives.Sprite(parent=imgparclipper, align=uiconst.RELATIVE, left=1, top=1)
     self.bottomCont = uiprimitives.Container(name='bottom', parent=self.sr.maincontainer, align=uiconst.TOBOTTOM, height=32, idx=0)
     self.backBtn = Button(parent=self.bottomCont, label=localization.GetByLabel('UI/Commands/Back'), name='tutorialBackBtn', func=self.backFunc, align=uiconst.TOLEFT, padding=(8, 0, 0, 6))
     self.nextBtn = Button(parent=self.bottomCont, label=localization.GetByLabel('UI/Commands/Next'), name='tutorialNextBtn', func=self.nextFunc, align=uiconst.TORIGHT, padding=(0, 0, 8, 6), btn_default=1)
     self.Confirm = self.nextFunc
     self.sr.text = uicontrols.EveLabelMedium(text='', parent=self.bottomCont, state=uiconst.UI_DISABLED, align=uiconst.CENTER)
     top = self.tTop = uiprimitives.Container(name='tTop', parent=self.sr.topParent, align=uiconst.TOALL, padding=(64, 0, 24, 0), idx=0)
     self.captionText = uicontrols.EveLabelLarge(text='', parent=top, align=uiconst.TOTOP, top=10, state=uiconst.UI_DISABLED)
     self.captionText.OnSizeChanged = self.CheckTopHeight
     self.subcaption = uicontrols.Label(text='', parent=top, align=uiconst.TOTOP, state=uiconst.UI_DISABLED, fontsize=18, color=TutorialColor.HINT_FRAME)
     self.sr.browser.AllowResizeUpdates(1)
     self.SetParent(uicore.layer.abovemain)
     uicore.animations.SpSwoopBlink(self.blinkFill, rotation=math.pi - 0.5, duration=3.0, loops=TutorialConstants.NUM_BLINKS)
     uicore.animations.SpSwoopBlink(self.blinkBorder, rotation=math.pi - 0.5, duration=3.0, loops=TutorialConstants.NUM_BLINKS)
コード例 #3
0
    def Layout(self,
               reloading=0,
               pushBtnArgs=None,
               setUsername=None,
               setPassword=None):
        if not reloading:
            self.sceneLoadedEvent = locks.Event('loginScene')
            uthread.new(self.LoadScene)
        self.eulaInited = 0
        self.Flush()
        borderHeight = uicore.desktop.height / 6
        par = uiprimitives.Container(name='underlayContainer',
                                     parent=self,
                                     align=uiconst.TOTOP,
                                     height=borderHeight)
        self.sr.underlay2 = uicontrols.WindowUnderlay(parent=par)
        self.sr.underlay2.padding = (-16, -16, -16, 0)
        bottomPar = uiprimitives.Container(name='underlayContainer_Bottom',
                                           parent=self,
                                           align=uiconst.TOBOTTOM,
                                           height=borderHeight + 6)
        bottomUnderlay = uicontrols.WindowUnderlay(parent=bottomPar)
        bottomUnderlay.padding = (-16, 6, -16, -16)
        if trinity.app.fullscreen:
            closex = uicontrols.Icon(
                icon='ui_73_16_49',
                parent=self,
                pos=(0, 1, 0, 0),
                align=uiconst.TOPRIGHT,
                idx=0,
                state=uiconst.UI_NORMAL,
                hint=localization.GetByLabel('UI/Login/QuitGame'))
            closex.OnClick = self.ClickExit
            closex.sr.hintAbRight = uicore.desktop.width - 16
            closex.sr.hintAbTop = 16
        self.mainBrowserParent = uiprimitives.Container(
            name='mainBrowserParent',
            parent=self,
            align=uiconst.CENTER,
            state=uiconst.UI_HIDDEN,
            width=800,
            height=440,
            idx=0)
        self.mainBrowser = uicontrols.Edit(parent=self.mainBrowserParent,
                                           padding=(8, 18, 8, 8),
                                           readonly=1)
        mainclosex = uicontrols.Icon(icon='ui_38_16_220',
                                     parent=self.mainBrowserParent,
                                     pos=(2, 1, 0, 0),
                                     align=uiconst.TOPRIGHT,
                                     idx=0,
                                     state=uiconst.UI_NORMAL)
        mainclosex.OnClick = self.CloseMenu
        wndUnderlay = uicontrols.WindowUnderlay(parent=self.mainBrowserParent)
        self.eulaParent = uiprimitives.Container(name='eulaParent',
                                                 parent=self,
                                                 align=uiconst.CENTER,
                                                 state=uiconst.UI_HIDDEN,
                                                 width=800,
                                                 height=440,
                                                 idx=0)
        eulaCont = uiprimitives.Container(name='eulaCont',
                                          parent=self.eulaParent,
                                          align=uiconst.TOALL,
                                          padding=(0, 18, 0, 0))
        browser = uicontrols.Edit(parent=eulaCont,
                                  padding=(6, 6, 6, 6),
                                  readonly=1)
        browser.sr.scrollcontrols.state = uiconst.UI_NORMAL
        browser.viewing = 'eula_ccp'
        self.eulaBrowser = browser
        self.sr.eulaUnderlay = uicontrols.WindowUnderlay(
            parent=self.eulaParent)
        self.maintabs = uicontrols.TabGroup(
            name='maintabs',
            parent=eulaCont,
            idx=0,
            tabs=[[
                localization.GetByLabel('UI/Login/EULA/EveEULAHeader'),
                browser, self, 'eula_ccp'
            ],
                  [
                      localization.GetByLabel(
                          'UI/Login/EULA/ThirdPartyEULAHeader'), browser, self,
                      'eula_others'
                  ]],
            groupID='eula',
            autoselecttab=0)
        self.eulaclosex = uicontrols.Icon(icon='ui_38_16_220',
                                          parent=self.eulaParent,
                                          pos=(2, 1, 0, 0),
                                          align=uiconst.TOPRIGHT,
                                          idx=0,
                                          state=uiconst.UI_NORMAL)
        self.eulaclosex.OnClick = self.CloseMenu
        bottomArea = uiprimitives.Container(name='bottomArea',
                                            parent=bottomPar,
                                            idx=0,
                                            pos=(0, 0, 0, 0))
        bottomSub = uiprimitives.Container(name='bottomSub',
                                           parent=bottomArea,
                                           align=uiconst.CENTER,
                                           idx=0,
                                           height=bottomPar.height,
                                           width=800)
        knownUserNames = settings.public.ui.Get('usernames', [])
        editswidth = 120
        if borderHeight <= 100:
            editstop = 30
        else:
            editstop = 40
        editsleft = (bottomSub.width - editswidth) / 2
        edit = uicontrols.SinglelineEdit(name='username',
                                         parent=bottomSub,
                                         pos=(editsleft, editstop, editswidth,
                                              0),
                                         maxLength=64)
        edit.SetHistoryVisibility(0)
        t1 = uicontrols.EveLabelSmall(
            text=localization.GetByLabel('UI/Login/Username'),
            parent=edit,
            top=3,
            state=uiconst.UI_DISABLED,
            color=(1.0, 1.0, 1.0, 0.75))
        if knownUserNames:
            ops = [(name, name) for name in knownUserNames]
            edit.LoadCombo('usernamecombo',
                           ops,
                           self.OnComboChange,
                           comboIsTabStop=0)
        edit.SetValue(setUsername or settings.public.ui.Get('username', ''))
        edit.OnReturn = self.Confirm
        self.usernameEditCtrl = edit
        edit = uicontrols.SinglelineEdit(name='password',
                                         parent=bottomSub,
                                         pos=(editsleft,
                                              edit.top + edit.height + 6,
                                              editswidth, 0),
                                         maxLength=64)
        t2 = uicontrols.EveLabelSmall(
            text=localization.GetByLabel('UI/Login/Password'),
            parent=edit,
            top=3,
            state=uiconst.UI_DISABLED,
            color=(1.0, 1.0, 1.0, 0.75))
        edit.SetPasswordChar(u'\u2022')
        edit.SetValue(setPassword or '')
        edit.OnReturn = self.Confirm
        self.passwordEditCtrl = edit
        if sm.GetService('gameui').UsingSingleSignOn():
            self.usernameEditCtrl.state = self.passwordEditCtrl.state = uiconst.UI_HIDDEN
            editswidth = 0
        tw = max(t1.textwidth, t2.textwidth)
        t1.left = t2.left = -tw - 6
        connectBtn = uicontrols.Button(
            parent=bottomSub,
            label=localization.GetByLabel('UI/Login/Connect'),
            func=self.Connect,
            pos=(editsleft, edit.top + edit.height + 4, 0, 0),
            fixedwidth=120,
            btn_default=1)
        statusContainer = uiprimitives.Container(parent=bottomSub,
                                                 left=editsleft + editswidth +
                                                 6,
                                                 top=editstop)
        self.serverNameTextControl = uicontrols.EveLabelSmall(
            text=localization.GetByLabel('UI/Login/CheckingStatus'),
            parent=statusContainer,
            align=uiconst.TOTOP,
            state=uiconst.UI_DISABLED)
        self.serverStatusTextControl = uicontrols.EveLabelSmall(
            parent=statusContainer,
            align=uiconst.TOTOP,
            state=uiconst.UI_DISABLED)
        self.serverPlayerCountTextControl = uicontrols.EveLabelSmall(
            parent=statusContainer,
            align=uiconst.TOTOP,
            state=uiconst.UI_DISABLED)
        self.serverVersionTextControl = uicontrols.EveLabelSmall(
            parent=statusContainer,
            align=uiconst.TOTOP,
            state=uiconst.UI_DISABLED)
        self.motdParent = uiprimitives.Container(name='motdParent',
                                                 parent=self,
                                                 align=uiconst.CENTERBOTTOM,
                                                 top=borderHeight + 16,
                                                 width=400,
                                                 height=64,
                                                 state=uiconst.UI_HIDDEN)
        motdLabel = uicontrols.EveLabelMedium(parent=self.motdParent,
                                              align=uiconst.CENTER,
                                              width=360,
                                              state=uiconst.UI_NORMAL)
        self.motdLabel = motdLabel
        uicontrols.BumpedUnderlay(parent=self.motdParent, name='background')
        versionstr = localization.GetByLabel('UI/Login/Version',
                                             versionNumber=GetVersion())
        uicontrols.EveLabelSmall(text=versionstr,
                                 parent=self,
                                 left=6,
                                 top=6,
                                 idx=0,
                                 state=uiconst.UI_NORMAL)
        self.pushButtons = uicls.ToggleButtonGroup(
            parent=bottomPar,
            align=uiconst.CENTERTOP,
            idx=0,
            top=12,
            width=120,
            callback=self.OnButtonSelected)
        for btnID, label, panel in (
            ('settings', localization.GetByLabel('UI/Login/Settings'), None),
            ('eula', localization.GetByLabel('UI/Login/EULA/EULAHeader'),
             self.eulaParent)):
            self.pushButtons.AddButton(btnID, label, panel)

        if boot.region == 'optic':
            self.eulaCRC = zlib.adler32(str(boot.version))
        else:
            self.eulaCRC = zlib.adler32(buffer(self.GetEulaCCP()))
        eulaAgreed = True
        if not eulaAgreed:
            self.GetEulaConfirmation()
        else:
            if pushBtnArgs:
                self.pushButtons.SelectByID(pushBtnArgs)
            uthread.new(self.LoadMotd, bool(pushBtnArgs))
            if trinity.app.IsActive():
                if settings.public.ui.Get('username', ''):
                    uicore.registry.SetFocus(self.passwordEditCtrl)
                else:
                    uicore.registry.SetFocus(self.usernameEditCtrl)
        if boot.region != 'optic':
            esrbNoticeHeight = 70
            esrbNoticeWidth = 200
            allowedSizes = [1.0, 0.9, 0.8]
            desktopWidth = uicore.desktop.width
            useHeight = int(esrbNoticeHeight * 0.7)
            useWidth = int(esrbNoticeWidth * 0.7)
            for multiplier in allowedSizes:
                tempWidth = esrbNoticeWidth * multiplier
                if tempWidth <= desktopWidth * 0.11:
                    useWidth = int(tempWidth)
                    useHeight = int(esrbNoticeHeight * multiplier)
                    break

            cont = uiprimitives.Container(name='esrbParent',
                                          parent=bottomArea,
                                          align=uiconst.TOPLEFT,
                                          top=editstop,
                                          width=useWidth,
                                          height=useHeight,
                                          state=uiconst.UI_NORMAL,
                                          idx=0,
                                          left=20)
            sprite = uiprimitives.Sprite(
                name='ESRB',
                parent=cont,
                align=uiconst.TOALL,
                state=uiconst.UI_DISABLED,
                color=(1.0, 1.0, 1.0, 1.0),
                lockAspect=1,
                texturePath='res:/UI/Texture/ESRBnotice.dds')
            sprite.rectWidth = esrbNoticeWidth
            sprite.rectHeight = esrbNoticeHeight
            uthread.new(uix.FadeCont, cont, 0, after=6000, fadeTime=500.0)
コード例 #4
0
ファイル: svc_console.py プロジェクト: connoryang/1v1dec
    def Show(self):
        self.wnd = wnd = uicontrols.Window.GetIfOpen(windowID=SERVICENAME)
        if wnd:
            self.wnd.Maximize()
            return
        self.wnd = wnd = uicontrols.Window.Open(windowID=SERVICENAME)
        wnd._OnClose = self.Hide
        wnd.SetWndIcon(None)
        wnd.SetTopparentHeight(0)
        wnd.SetCaption('Console')
        wnd.SetMinSize([352, 200])
        main = uiprimitives.Container(
            name='con',
            parent=uiutil.GetChild(wnd, 'main'),
            pos=(const.defaultPadding, const.defaultPadding,
                 const.defaultPadding, const.defaultPadding))
        o = wnd.sr.o = uiprimitives.Container(name='output',
                                              parent=main,
                                              align=uiconst.TOBOTTOM)
        o.height = max(32, settings.user.ui.Get('consoleoutputheight', 48))
        c = uiprimitives.Container(name='control',
                                   parent=main,
                                   align=uiconst.TOBOTTOM,
                                   height=24)
        i = uiprimitives.Container(name='input',
                                   parent=main,
                                   align=uiconst.TOALL,
                                   pos=(0, 0, 0, 0))
        divider = Divider(name='divider',
                          align=uiconst.TOBOTTOM,
                          idx=1,
                          height=const.defaultPadding,
                          parent=c,
                          state=uiconst.UI_NORMAL)
        divider.Startup(o, 'height', 'y', 32, 128)
        input = wnd.sr.input = uicls.EditPlainText(
            setvalue=self.consolecontents, parent=i)
        input.autoScrollToBottom = 1
        buttons = [['Copy All', self.DoCopy, None, 81],
                   ['Paste', self.DoPaste, None, 81],
                   ['Clear', self.DoClear, None, 81],
                   ['<color=0xff40ff40>Execute', self.DoExecute, None, 81]]
        controls = uicontrols.ButtonGroup(btns=buttons, line=0)
        controls.align = uiconst.TORIGHT
        controls.width = 64 * len(buttons)
        controls.height = 16
        c.children.append(controls)

        def checker(cb):
            checked = cb.GetValue()
            settings.user.ui.Set('consolestealth', checked)
            if checked:
                wnd.sr.stealth.hint = 'Stealth: ON<br>Console exceptions are not logged.<br>Click to disable stealth.'
            else:
                wnd.sr.stealth.hint = 'Stealth: OFF<br>Console exceptions are logged.<br>Click to enable stealth.'
            cb.state = uiconst.UI_HIDDEN
            cb.state = uiconst.UI_NORMAL

        wnd.sr.stealth = uicontrols.Checkbox(text='Stealth',
                                             parent=c,
                                             configName='consolestealth',
                                             retval=0,
                                             checked=settings.user.ui.Get(
                                                 'consolestealth', 0),
                                             callback=checker)
        checker(wnd.sr.stealth)
        output = wnd.sr.output = uicontrols.Edit(
            setvalue=self.outputcontents_default, parent=o, readonly=1)
        output.autoScrollToBottom = 1
        uicore.registry.SetFocus(input)