Beispiel #1
0
 def InitializeBrowsers(self):
     self.sr.briefingBrowser = uicls.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 = uicls.Edit(parent=self.sr.rightPaneTop, readonly=1, padding=(const.defaultPadding,
      const.defaultPadding,
      const.defaultPadding,
      const.defaultPadding))
     self.sr.objectiveBrowser.sr.window = self
Beispiel #2
0
 def _DrawEditBox(self, parent, text):
     textHeight = uix.GetTextHeight(text,
                                    width=self.width - 30,
                                    fontsize=fontConst.EVE_MEDIUM_FONTSIZE)
     edit = uicls.Edit(setvalue=text,
                       parent=parent,
                       align=uiconst.TOTOP,
                       height=textHeight + 18,
                       top=-6,
                       hideBackground=1,
                       readonly=True)
     edit.scrollEnabled = False
     return edit
Beispiel #3
0
 def Execute(self, text, title, buttons, icon, suppText, customicon = None, height = None, default = None):
     if title is None:
         title = localization.GetByLabel('/Carbon/UI/Common/Information')
     self.sr.topArea = self.Split(uiconst.SPLITTOP, 56, line=0)
     self.SetButtons(buttons, defaultBtn=default)
     if suppText:
         self.ShowSupp(suppText)
     if title:
         self.Prepare_Caption_()
         if self.sr.caption:
             self.sr.caption.text = title
             self.sr.topArea.height = max(56, self.sr.caption.textheight + 16)
     if text:
         self.edit = uicls.Edit(parent=self.sr.content, pos=(0, 0, 0, 0), align=uiconst.TOALL, readonly=True, setvalue=text)
Beispiel #4
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 = uicls.Container(name='underlayContainer', parent=self, align=uiconst.TOTOP, height=borderHeight)
        self.sr.underlay2 = uicls.WindowUnderlay(parent=par)
        self.sr.underlay2.padding = (-16, -16, -16, 0)
        bottomPar = uicls.Container(name='underlayContainer_Bottom', parent=self, align=uiconst.TOBOTTOM, height=borderHeight + 6)
        bottomUnderlay = uicls.WindowUnderlay(parent=bottomPar)
        bottomUnderlay.padding = (-16, 6, -16, -16)
        self.fadeCont = uicls.Container(name='fadeCont', parent=self, align=uiconst.TOPLEFT, state=uiconst.UI_DISABLED, width=uicore.desktop.width, height=uicore.desktop.height, idx=-1)
        if trinity.app.fullscreen:
            closex = uicls.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 = uicls.Container(name='mainBrowserParent', parent=self, align=uiconst.CENTER, state=uiconst.UI_HIDDEN, width=800, height=440, idx=0)
        self.mainBrowser = uicls.Edit(parent=self.mainBrowserParent, padding=(8, 18, 8, 8), readonly=1)
        mainclosex = uicls.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 = uicls.WindowUnderlay(parent=self.mainBrowserParent)
        self.eulaParent = uicls.Container(name='eulaParent', parent=self, align=uiconst.CENTER, state=uiconst.UI_HIDDEN, width=800, height=440, idx=0)
        eulaCont = uicls.Container(name='eulaCont', parent=self.eulaParent, align=uiconst.TOALL, padding=(0, 18, 0, 0))
        browser = uicls.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 = uicls.WindowUnderlay(parent=self.eulaParent)
        self.maintabs = uicls.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 = uicls.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 = uicls.Container(name='bottomArea', parent=bottomPar, idx=0, pos=(0, 0, 0, 0))
        bottomSub = uicls.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 = uicls.SinglelineEdit(name='username', parent=bottomSub, pos=(editsleft,
         editstop,
         editswidth,
         0), maxLength=64)
        edit.SetHistoryVisibility(0)
        t1 = uicls.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 = uicls.SinglelineEdit(name='password', parent=bottomSub, pos=(editsleft,
         edit.top + edit.height + 6,
         editswidth,
         0), maxLength=64)
        t2 = uicls.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 = uicls.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 = uicls.Container(parent=bottomSub, left=editsleft + editswidth + 6, top=editstop)
        self.serverNameTextControl = uicls.EveLabelSmall(text=localization.GetByLabel('UI/Login/CheckingStatus'), parent=statusContainer, align=uiconst.TOTOP, state=uiconst.UI_DISABLED)
        self.serverStatusTextControl = uicls.EveLabelSmall(parent=statusContainer, align=uiconst.TOTOP, state=uiconst.UI_DISABLED)
        self.serverPlayerCountTextControl = uicls.EveLabelSmall(parent=statusContainer, align=uiconst.TOTOP, state=uiconst.UI_DISABLED)
        self.serverVersionTextControl = uicls.EveLabelSmall(parent=statusContainer, align=uiconst.TOTOP, state=uiconst.UI_DISABLED)
        self.motdParent = uicls.Container(name='motdParent', parent=self, align=uiconst.CENTERBOTTOM, top=borderHeight + 16, width=400, height=64, state=uiconst.UI_HIDDEN)
        motdLabel = uicls.EveLabelMedium(parent=self.motdParent, align=uiconst.CENTER, width=360, state=uiconst.UI_NORMAL)
        self.motdLabel = motdLabel
        uicls.BumpedUnderlay(parent=self.motdParent, name='background')
        versionstr = localization.GetByLabel('UI/Login/Version', versionNumber=GetVersion())
        vers = uicls.EveLabelSmall(text=versionstr, parent=self, left=6, top=6, idx=0, state=uiconst.UI_NORMAL)
        tabs = [[localization.GetByLabel('UI/Login/Settings'),
          None,
          self,
          None,
          ('settings',)], [localization.GetByLabel('UI/Login/EULA/EULAHeader'),
          self.eulaParent,
          self,
          None,
          ('eula',)]]
        self.pushButtons = uicls.PushButtonGroup(parent=bottomPar, align=uiconst.CENTERTOP, idx=0, top=-4)
        self.pushButtons.Startup(tabs)
        self.pushButtons.OnNoneSelected = self.OnPushButtonNoneSelected
        if boot.region == 'optic':
            self.eulaCRC = zlib.adler32(str(boot.version))
        else:
            self.eulaCRC = zlib.adler32(buffer(self.GetEulaCCP()))
        eulaAgreed = bool(settings.public.generic.Get('eulaCRC', None) == self.eulaCRC)
        if not eulaAgreed:
            self.GetEulaConfirmation()
        else:
            if pushBtnArgs:
                self.pushButtons.SelectPanelByArgs(pushBtnArgs)
            uthread.pool('Login::Fetching ads', self.CheckAds, bool(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 = uicls.Container(name='esrbParent', parent=bottomArea, align=uiconst.TOPLEFT, top=editstop, width=useWidth, height=useHeight, state=uiconst.UI_NORMAL, idx=0, left=20)
            sprite = uicls.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)
Beispiel #5
0
 def ApplyAttributes(self, attributes):
     uicls.Window.ApplyAttributes(self, attributes)
     trustUrl = attributes.trustUrl
     inputUrl = attributes.inputUrl
     self.SetCaption(localization.GetByLabel('UI/Browser/AskTrustedSites'))
     self.SetMinSize((400, 300))
     main = self.GetMainArea()
     self.ignoreAlwaysBtnPar = uicls.Container(name='ignoreAlwaysBtnPar',
                                               parent=main,
                                               align=uiconst.TOBOTTOM,
                                               height=22,
                                               top=2)
     self.ignoreBtnPar = uicls.Container(name='ignoreBtnPar',
                                         parent=main,
                                         align=uiconst.TOBOTTOM,
                                         height=22,
                                         top=2)
     self.trustBtn = uicls.Button(
         parent=self.ignoreBtnPar,
         label=localization.GetByLabel('UI/Browser/TrustPrompt/TrustSite'),
         align=uiconst.TOLEFT,
         pos=(4, 0, 0, 0),
         func=self.TrustSite)
     self.trustBtn.hint = localization.GetByLabel(
         'UI/Browser/TrustPrompt/TrustButtonHint')
     self.ignoreBtn = uicls.Button(
         parent=self.ignoreBtnPar,
         label=localization.GetByLabel('UI/Browser/TrustPrompt/IgnoreOnce'),
         align=uiconst.TORIGHT,
         pos=(4, 0, 0, 0),
         func=self.IgnoreThisRequest)
     self.ignoreBtn.hint = localization.GetByLabel(
         'UI/Browser/TrustPrompt/IgnoreOnceHint')
     self.ignoreAlwaysBtn = uicls.Button(
         parent=self.ignoreAlwaysBtnPar,
         label=localization.GetByLabel(
             'UI/Browser/TrustPrompt/IgnoreAlways'),
         align=uiconst.TORIGHT,
         pos=(4, 0, 0, 0),
         func=self.AlwaysIgnoreRequests)
     self.ignoreAlwaysBtn.hint = localization.GetByLabel(
         'UI/Browser/TrustPrompt/IgnoreAlwaysHint')
     self.sourcePar = uicls.Container(name='sourcePar',
                                      parent=main,
                                      align=uiconst.TOBOTTOM,
                                      height=32)
     self.sourceTxtPar = uicls.Container(name='sourceTxtPar',
                                         parent=self.sourcePar,
                                         align=uiconst.TOTOP,
                                         height=14)
     self.sourceUrlPar = uicls.Container(name='sourceUrlPar',
                                         parent=self.sourcePar,
                                         align=uiconst.TOTOP,
                                         height=16)
     self.sourceTxt = uicls.Label(
         text=localization.GetByLabel('UI/Browser/TrustPrompt/RequestFrom'),
         parent=self.sourceTxtPar,
         state=uiconst.UI_DISABLED,
         color=(0.5, 0.5, 0.5, 0.7),
         align=uiconst.TOALL,
         padLeft=8)
     self.sourceUrl = uicls.Label(text=inputUrl,
                                  parent=self.sourceUrlPar,
                                  state=uiconst.UI_NORMAL,
                                  color=(0.5, 0.5, 0.5, 0.7),
                                  align=uiconst.TOALL,
                                  padLeft=8)
     self.sourceUrl.hint = inputUrl
     uicls.Line(parent=self.sourcePar,
                align=uiconst.TOTOP,
                color=(0.4, 0.4, 0.4, 0.9))
     self.promptPar = uicls.Container(name='promptPar',
                                      parent=main,
                                      align=uiconst.TOALL,
                                      pos=(8, 2, 8, 2))
     trustDescription = localization.GetByLabel(
         'UI/Browser/TrustPrompt/TrustDescription', trustUrl=trustUrl)
     self.promptTxt = uicls.Edit(setvalue=trustDescription,
                                 parent=self.promptPar,
                                 readonly=1,
                                 align=uiconst.TOALL)
     self.trustUrl = trustUrl
     self.inputUrl = inputUrl
Beispiel #6
0
 def Create_textarea(self, attrs):
     wnd = uicls.Edit(name='textarea', align=uiconst.RELATIVE)
     wnd.width = getattr(attrs, 'width', None) or 8 * int(attrs.cols) or 350
     wnd.height = getattr(attrs, 'height',
                          None) or 18 * int(attrs.rows) or 45
     return wnd