예제 #1
0
파일: channels.py 프로젝트: R4M80MrX/eve-1
 def GetHeight(self, *args):
     node, width = args
     btnHeight1 = uix.GetTextHeight(localization.GetByLabel('UI/Chat/ChannelWindow/Unsubscribe'), maxLines=1, fontsize=fontConst.EVE_SMALL_FONTSIZE, hspace=1, uppercase=1)
     btnHeight2 = uix.GetTextHeight(localization.GetByLabel('UI/Chat/ChannelWindow/Subscribe'), maxLines=1, fontsize=fontConst.EVE_SMALL_FONTSIZE, hspace=1, uppercase=1)
     if btnHeight1 > btnHeight2:
         node.height = btnHeight1
     else:
         node.height = btnHeight2
     return node.height + 11
예제 #2
0
 def GetHeight(self, *args):
     node, width = args
     labelheight = uix.GetTextHeight(node.label,
                                     fontsize=fontConst.EVE_SMALL_FONTSIZE,
                                     maxLines=1,
                                     uppercase=1)
     textheight = uix.GetTextHeight(node.text,
                                    fontsize=fontConst.EVE_MEDIUM_FONTSIZE,
                                    maxLines=1)
     size = node.Get('iconsize', 32)
     node.height = max(labelheight + textheight, size) + 2
     return node.height
예제 #3
0
    def ApplyAttributes(self, attributes):
        uiprimitives.Container.ApplyAttributes(self, attributes)
        color = attributes.Get('color', util.Color.WHITE)
        backgroundColor = attributes.Get('backgroundColor', None)
        self.value = attributes.Get('value', 0.0)
        self.uiEffects = uicls.UIEffects()
        self.busy = False
        self.queuedSetValue = None
        self.gaugeCont = uiprimitives.Container(parent=self, name='gaugeCont', pos=(0,
         0,
         self.width,
         self.height), align=uiconst.TOPLEFT)
        uicontrols.Frame(parent=self.gaugeCont, color=(1.0, 1.0, 1.0, 0.2))
        self.gauge = uiprimitives.Fill(parent=self.gaugeCont, name='gauge', align=uiconst.TOLEFT, width=0, color=color)
        if backgroundColor is None:
            backgroundColor = util.Color(*color).SetAlpha(0.2).GetRGBA()
        uiprimitives.Fill(parent=self.gaugeCont, name='background', color=backgroundColor)
        testString = ''.join(self.HEXDIGITS)
        fontSize = 1
        textHeight = uix.GetTextHeight(testString, fontsize=fontSize)
        while textHeight < self.height:
            fontSize += 1
            textHeight = uix.GetTextHeight(testString, fontsize=fontSize)
        else:
            fontSize -= 1
            textHeight = uix.GetTextHeight(testString, fontsize=fontSize)

        self.textCont = uiprimitives.Container(parent=self, name='textCont', pos=(0,
         0,
         self.width,
         textHeight), align=uiconst.CENTER, clipChildren=True, idx=0)
        self.text = uicontrols.Label(parent=self.textCont, name='hackText', align=uiconst.TOALL, fontsize=fontSize, text='')
        hackText = random.choice(self.HEXDIGITS)
        while uix.GetTextWidth(hackText[1:], fontsize=fontSize) < self.width:
            hackText += random.choice(self.HEXDIGITS)

        self.text.text = hackText
        self.SetValueInstantly(self.value)
        self.hackStrings = ['Hacking Gibson...',
         'Cracking Codes...',
         'Inserting Rootkit...',
         'Defeating ICE...',
         'Circumventing Firewall...',
         'Polymorphing Virii...',
         'Erasing Logs...',
         'Reticulating Splines...',
         'Twisting Mersenne...',
         'Curving Ellipses...',
         'Analyzing Ciphers...',
         'Factoring Primes...']
        self.hackText = uicontrols.EveHeaderMedium(text='', parent=self, align=uiconst.CENTERBOTTOM, height=20, state=uiconst.UI_HIDDEN, top=-24)
        self.active = True
        uthread.new(self._CycleText)
예제 #4
0
def calculate_challenge_height(challenge, text_width):
    text_width = text_width - 2 * TOP_CONTAINER_PAD_LEFT - TOP_CONTAINER_PAD_RIGHT
    title_text_height = uix.GetTextHeight(strng=challenge.name,
                                          width=text_width,
                                          font=EVE_LARGE_FONTSIZE)
    title_text_height = max(TITLE_CONTAINER_HEIGHT,
                            title_text_height + TOP_CONTAINER_PAD_TOP)
    description_text_height = uix.GetTextHeight(
        strng=challenge.message_text,
        width=text_width,
        font=DESCRIPTION_FONTSIZE) + DESCRIPTION_CONTAINER_PAD_TOP
    description_text_height += DESCRIPTION_CONTAINER_PAD_TOP
    top_height = max(
        TOP_CONTAINER_MINIMUM_HEIGHT, title_text_height +
        description_text_height + DESCRIPTION_CONTAINER_PAD_TOP)
    progress_height = CHALLENGE_PROGRESS_HEIGHT + CHALLENGE_PROGRESS_PAD_TOP + CHALLENGE_PROGRESS_PAD_BOTTOM
    total_challenge_height = max(CHALLENGE_MINIMUM_HEIGHT, top_height +
                                 progress_height) + CHALLENGE_HEIGHT_PADDING
    return (total_challenge_height, title_text_height, description_text_height)
예제 #5
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
예제 #6
0
 def InitBroadcastBottom(self):
     self.sr.broadcastBottom = uiprimitives.Container(name='broadcastBottom', parent=self.sr.main, align=uiconst.TOBOTTOM, height=BROADCAST_HEIGHT, state=uiconst.UI_HIDDEN)
     broadcastHeaderParent = uiprimitives.Container(name='lastbroadcastheader', parent=self.sr.main, align=uiconst.TOBOTTOM, state=uiconst.UI_NORMAL, height=24)
     broadcastHeaderParent.padBottom = 3
     expanderCont = uiprimitives.Container(name='expanderCont', parent=broadcastHeaderParent, align=uiconst.TORIGHT, state=uiconst.UI_NORMAL, width=18)
     expanderCont.OnClick = self.ToggleBroadcasts
     broadcastHeaderParent.height = uix.GetTextHeight('Xg')
     self.sr.broadcastHeaderParent = broadcastHeaderParent
     expander = uiprimitives.Sprite(parent=expanderCont, pos=(5, 0, 11, 11), name='expandericon', state=uiconst.UI_DISABLED, texturePath='res:/UI/Texture/Shared/expanderUp.png', align=uiconst.TOPRIGHT)
     self.sr.broadcastExpanderIcon = expander
     uix.Flush(self.sr.broadcastBottom)
     self.sr.lastBroadcastCont = uiprimitives.Container(name='lastBroadcastCont', parent=broadcastHeaderParent, align=uiconst.TOALL, pos=(0, 0, 0, 0), state=uiconst.UI_NORMAL)
     uicontrols.EveLabelMedium(text=localization.GetByLabel('UI/Fleet/FleetBroadcast/NoBroadcasts'), parent=self.sr.lastBroadcastCont, left=6, top=1, width=500, state=uiconst.UI_NORMAL)
     self.sr.lastVoiceEventCont = uiprimitives.Container(name='lastVoiceEventCont', parent=self.sr.broadcastBottom, align=uiconst.TOTOP_PROP, top=0, left=0, height=1.0, width=1.0, state=uiconst.UI_PICKCHILDREN)
     uicontrols.EveLabelMedium(text=localization.GetByLabel('UI/Fleet/FleetBroadcast/NoVoiceBroadcasts'), parent=self.sr.lastVoiceEventCont, left=6, top=0, width=500)
     self.sr.actionsCont = uiprimitives.Container(name='actionsCont', parent=self.sr.broadcastBottom, align=uiconst.TOBOTTOM, height=26, state=uiconst.UI_NORMAL)
     self.sr.toggleCont = uiprimitives.Container(name='toggleCont', parent=self.sr.actionsCont, align=uiconst.TOBOTTOM, height=26, state=uiconst.UI_PICKCHILDREN)
     self.sr.line = uiprimitives.Container(name='lineparent', align=uiconst.TOTOP, parent=self.sr.actionsCont, idx=0, height=1)
     uiprimitives.Line(parent=self.sr.line, align=uiconst.TOALL)
     self.InitActions()
예제 #7
0
 def GetHeight(_self, *args):
     node, width = args
     node.height = uix.GetTextHeight(node.label, maxLines=1) + 4
     return node.height
예제 #8
0
 def GetDynamicHeight(node, width):
     if '<br>' in node.label:
         node.height = max(37, uix.GetTextHeight(node.label, linespace=11))
     else:
         node.height = 37
     return node.height
예제 #9
0
 def ApplyAttributes(self, attributes):
     uicontrols.Window.ApplyAttributes(self, attributes)
     self.ShowLoad()
     self.SetCaption(self.caption)
     self.DefineButtons(
         uiconst.OK,
         okLabel=localization.GetByLabel('UI/Generic/Submit'),
         okFunc=self.Submit)
     self.SetMinSize([320, 410], 1)
     self.SetWndIcon()
     self.SetTopparentHeight(0)
     self.MakeUnResizeable()
     self.pickingTicker = 0
     self.layerNumSelected = None
     self.sr.prefs = [None, None, None, None, None, None]
     self.sr.priorlogo = (None, None, None, None, None, None)
     self.sr.priordesc = self.description
     self.sr.priorurl = self.url
     self.sr.priortaxRate = self.taxRate
     par = uiprimitives.Container(name='logoControl',
                                  parent=self.sr.main,
                                  align=uiconst.TOTOP,
                                  height=100,
                                  width=310,
                                  padding=(5, 5, 5, 0))
     self.sr.logocontrol = uiprimitives.Container(name='controlpanel',
                                                  parent=par,
                                                  height=100,
                                                  width=160,
                                                  align=uiconst.CENTER)
     self.sr.inputcontrol = uiprimitives.Container(name='controlpanel',
                                                   parent=self.sr.main,
                                                   align=uiconst.TOALL,
                                                   pos=(0, 0, 0, 0),
                                                   padding=(5, 5, 5, 0))
     top = uix.GetTextHeight(
         localization.GetByLabel('UI/Corporations/CorpDetails/CorpName'))
     if boot.region == 'optic':
         defaultCorpName = localization.GetByLabel(
             'UI/Corporations/CorpDetails/DefaultCorpName')
     else:
         defaultCorpName = localization.GetByLabel(
             'UI/Corporations/CorpDetails/DefaultCorpName',
             localization.const.LOCALE_SHORT_ENGLISH)
     self.sr.corpNameEdit_container = uiprimitives.Container(
         name='corpNameEdit_container',
         parent=self.sr.inputcontrol,
         align=uiconst.TOTOP,
         height=56)
     self.sr.corpNameEdit = uicontrols.SinglelineEdit(
         name='nameEdit',
         parent=self.sr.corpNameEdit_container,
         setvalue=defaultCorpName,
         align=uiconst.TOTOP,
         maxLength=100,
         label=localization.GetByLabel(
             'UI/Corporations/CorpDetails/CorpName'),
         top=top)
     self.sr.corpNameEdit_container.height = self.sr.corpNameEdit.height + top + const.defaultPadding
     top = uix.GetTextHeight(
         localization.GetByLabel('UI/Corporations/CorpDetails/Ticker'))
     self.sr.corpTickerEdit_container = uiprimitives.Container(
         name='corpTickerEdit_container',
         parent=self.sr.inputcontrol,
         align=uiconst.TOTOP,
         height=56)
     btn = uicontrols.Button(parent=self.sr.corpTickerEdit_container,
                             label=localization.GetByLabel(
                                 'UI/Corporations/CorpDetails/Ticker'),
                             align=uiconst.BOTTOMRIGHT,
                             func=self.GetPickTicker,
                             idx=0)
     self.sr.corpTickerEdit = uicontrols.SinglelineEdit(
         name='corpTickerEdit',
         parent=self.sr.corpTickerEdit_container,
         setvalue='',
         align=uiconst.TOPLEFT,
         maxLength=5,
         label=localization.GetByLabel(
             'UI/Corporations/CorpDetails/Ticker'),
         top=top,
         width=min(300 - btn.width, 240))
     self.sr.corpTickerEdit_container.height = self.sr.corpTickerEdit.height + top + const.defaultPadding
     top = uix.GetTextHeight(
         localization.GetByLabel('UI/Corporations/CorpDetails/MemberLimit'))
     self.sr.memberLimit_container = uiprimitives.Container(
         name='memberLimit_container',
         parent=self.sr.inputcontrol,
         align=uiconst.TOTOP,
         height=24)
     btn = uicontrols.Button(
         parent=self.sr.memberLimit_container,
         label=localization.GetByLabel(
             'UI/Corporations/CorpDetails/UpdateWithMySkills'),
         align=uiconst.BOTTOMRIGHT,
         func=self.UpdateWithSkills,
         idx=0)
     uicontrols.EveLabelSmall(text=localization.GetByLabel(
         'UI/Corporations/CorpDetails/MemberLimit'),
                              parent=self.sr.memberLimit_container,
                              left=0,
                              top=0,
                              state=uiconst.UI_NORMAL)
     self.sr.memberLimit = uicontrols.EveLabelMedium(
         text='123',
         parent=self.sr.memberLimit_container,
         left=2,
         top=top,
         state=uiconst.UI_DISABLED,
         idx=0)
     self.sr.memberLimit_container.height = self.sr.memberLimit.height + top + const.defaultPadding
     top = uix.GetTextHeight(
         localization.GetByLabel('UI/Corporations/CorpDetails/TaxRate'))
     self.sr.taxRateEdit_container = uiprimitives.Container(
         name='taxRateEdit_container',
         parent=self.sr.inputcontrol,
         align=uiconst.TOTOP,
         height=24)
     self.sr.taxRateEdit = uicontrols.SinglelineEdit(
         name='taxRateEdit',
         parent=self.sr.taxRateEdit_container,
         floats=(0.0, 100.0, 1),
         setvalue=self.taxRate,
         align=uiconst.TOPLEFT,
         label=localization.GetByLabel(
             'UI/Corporations/CorpDetails/TaxRate'),
         top=top)
     self.sr.taxRateEdit_container.height = self.sr.taxRateEdit.height + top + const.defaultPadding
     top = uix.GetTextHeight('http://')
     self.sr.urlEdit_container = uiprimitives.Container(
         name='urlEdit_container',
         parent=self.sr.inputcontrol,
         align=uiconst.TOTOP)
     self.sr.urlEdit = uicontrols.SinglelineEdit(
         name='urlEdit',
         parent=self.sr.urlEdit_container,
         setvalue=self.url,
         maxLength=2048,
         align=uiconst.TOTOP,
         label=localization.GetByLabel(
             'UI/Corporations/CorpDetails/HomePage'),
         top=top)
     self.sr.urlEdit_container.height = self.sr.urlEdit.height + top + const.defaultPadding + 20
     top = uix.GetTextHeight(
         localization.GetByLabel('UI/Corporations/CorpDetails/Description'))
     self.sr.descEdit_container = uiprimitives.Container(
         name='descEdit_container',
         parent=self.sr.inputcontrol,
         align=uiconst.TOALL,
         pos=(0, 0, 0, 0))
     uicontrols.EveLabelSmall(text=localization.GetByLabel(
         'UI/Corporations/CorpDetails/Description'),
                              parent=self.sr.descEdit_container,
                              top=-16)
     self.sr.descEdit = uicls.EditPlainText(
         setvalue=self.description,
         parent=self.sr.descEdit_container,
         maxLength=4000)
     self.logopicker = uicls.CorpLogoPickerContainer(
         parent=self.sr.logocontrol,
         pos=(100, 0, 57, 90),
         align=uiconst.TOPLEFT)
예제 #10
0
 def GetHeight(self, *args):
     node, _ = args
     node.height = uix.GetTextHeight(node.label, maxLines=1) + 6
     return node.height
예제 #11
0
파일: drone.py 프로젝트: connoryang/1v1dec
 def GetHeight(self, *args):
     node, width = args
     node.height = uix.GetTextHeight('Xg', maxLines=1) + 4
     return node.height