예제 #1
0
    def Expand(self):
        if not self.submenuview:
            for each in self.parent.children:
                if each != self and getattr(each, 'submenuview', None):
                    each.Collapse()

            if self.submenu[0] == 'isDynamic':
                menu = CreateMenuView(CreateMenuFromList(apply(self.submenu[1], self.submenu[2])), self.parent)
            else:
                menu = CreateMenuView(CreateMenuFromList(self.submenu), self.parent)
            if not menu:
                return
            w = uicore.desktop.width
            h = uicore.desktop.height
            aL, aT, aW, aH = self.GetAbsolute()
            menu.top = max(0, min(h - menu.height, aT))
            if aL + aW + menu.width <= w:
                menu.left = aL + aW - 3
            else:
                aL, aT, aW, aH = self.GetAbsolute()
                menu.left = aL - menu.width + 5
            uicore.layer.menu.children.insert(0, menu)
            if not self or self.destroyed:
                uiutil.Flush(uicore.layer.menu)
                return
            self.submenuview = menu
예제 #2
0
파일: calendar.py 프로젝트: R4M80MrX/eve-1
 def SetStatus(self, cont, iconPath=None):
     uiutil.Flush(cont)
     if iconPath:
         uicls.Icon(icon=iconPath,
                    parent=cont,
                    align=uiconst.CENTER,
                    pos=(0, 0, 16, 16))
예제 #3
0
    def UpdatePageInfo(self):
        needDots = len(self._pageStops)
        if needDots > 1:
            portionStep = 1.0 / (needDots - 1)
        else:
            portionStep = 0.0
        isHorizontal = bool(self._direction == uiconst.HORIZONTAL)
        step = 7
        centerOffset = step * (needDots - 1) / 2
        if needDots != len(self.sr.pagesParent.children):
            uiutil.Flush(self.sr.pagesParent)
            portion = 0.0
            offset = 0
            for each in self._pageStops:
                dot = uicls.Icon(parent=self.sr.pagesParent,
                                 icon='ui_3_8_1',
                                 align=uiconst.CENTER)
                dot.OnClick = (self.ClickPageDot, dot)
                dot.portion = portion
                dot.pageStop = each
                portion += portionStep
                if isHorizontal:
                    dot.left = offset - centerOffset
                else:
                    dot.top = offset - centerOffset
                offset += 7

        self.UpdatePageStatus()
예제 #4
0
파일: dragdrop.py 프로젝트: R4M80MrX/eve-1
    def _DoDrag(self, dragContainer):
        if dragContainer.destroyed:
            return
        dragData = dragContainer.dragData
        mouseOffset = self.PrepareDrag(dragContainer, self)
        if self.destroyed:
            return
        uicore.dragObject = dragContainer
        sm.ScatterEvent('OnExternalDragInitiated', self, dragData)
        try:
            dragContainer.InitiateDrag(mouseOffset)
        finally:
            sm.ScatterEvent('OnExternalDragEnded')
            uicore.dragObject = None

        dropLocation = uicore.uilib.mouseOver
        if self._dragEnabled:
            self._dragEnabled = False
            self._dragging = False
            uiutil.Flush(uicore.layer.dragging)
            dropLocation = uicore.uilib.mouseOver
            if dropLocation.isDropLocation and self.VerifyDrag(dropLocation, dragData) and dropLocation.VerifyDrop(self, dragData):
                uthread.new(dropLocation.OnDropData, self, dragData)
            else:
                self.OnDragCanceled(self, dragData)
        self.OnEndDrag(self, dropLocation, dragData)
예제 #5
0
 def Load(self, node):
     self.sr.leftmargin.width = node.Get('leftmargin', 0)
     self.sr.rightmargin.width = node.Get('rightmargin', 0)
     uiutil.Flush(self.sr.line)
     uicls.Fill(parent=self.sr.line,
                color=uiutil.ParseHTMLColor(node.attrs.color or '#88ffffff',
                                            1))
     align = uiconst.RELATIVE
     if node.attrs.width:
         if unicode(node.attrs.width).endswith('%'):
             node.attrs.width = self.sr.node.scroll.GetContentWidth() * int(
                 node.attrs.width[:-1]) / 100
         self.sr.line.width = int(node.attrs.width)
         if node.attrs.align and node.attrs.align.lower() in ('left',
                                                              'right'):
             if node.attrs.align.lower() == 'right':
                 align = uiconst.TORIGHT
             else:
                 align = uiconst.TOLEFT
         elif node.attrs.align is None:
             align = uiconst.RELATIVE
         else:
             align = uiconst.CENTER
     else:
         self.sr.line.left = self.sr.line.width = 0
         align = uiconst.TOALL
     self.sr.line.SetAlign(align)
예제 #6
0
 def LoadTagIconInContainer(self, tag, cont, left = 2, top = 4, *args):
     uiutil.Flush(cont)
     if tag == const.calendarTagCorp:
         AddAndSetFlagIcon(parentCont=cont, flag=state.flagSameCorp, top=top, left=left)
     elif tag == const.calendarTagAlliance:
         AddAndSetFlagIcon(parentCont=cont, flag=state.flagSameAlliance, top=top, left=left)
     elif tag == const.calendarTagCCP:
         self.LoadCCPIcon(cont, top, left)
     elif tag == const.calendarTagAutomated:
         self.LoadAutomatedIcon(cont, top, left)
예제 #7
0
 def Load(self, node):
     uiutil.Flush(self.sr.links)
     self.leftM = 0
     self.sr.hiliteLinks = []
     self.RenderLine()
     self.LoadInlines()
     if not self or self.destroyed:
         return
     self.UpdateSelectionHilite()
     self.UpdateCursor()
예제 #8
0
 def LoadPortrait(self, orderIfMissing = True):
     attrs = self.attrs
     uiutil.Flush(self)
     sprite = uicontrols.Icon(parent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED, pos=(0, 0, 0, 0))
     self.sr.sprite = sprite
     size = int(max(attrs.size, 64))
     charID = int(attrs.src[9:])
     if sm.GetService('photo').GetPortrait(charID, size, sprite, orderIfMissing, callback=True):
         self.picloaded = 1
     else:
         sm.RegisterNotify(self)
예제 #9
0
 def LoadTagIconInContainer(self, tag, cont, left=2, top=4, *args):
     uiutil.Flush(cont)
     if tag == const.calendarTagCorp:
         uix.SetStateFlagForFlag(cont,
                                 state.flagSameCorp,
                                 top=top,
                                 left=left,
                                 showHint=True)
     elif tag == const.calendarTagAlliance:
         uix.SetStateFlagForFlag(cont,
                                 state.flagSameAlliance,
                                 top=top,
                                 left=left,
                                 showHint=True)
     elif tag == const.calendarTagCCP:
         self.LoadCCPIcon(cont, top, left)
     elif tag == const.calendarTagAutomated:
         self.LoadAutomatedIcon(cont, top, left)
예제 #10
0
    def Check(self, updatewnd=0, autoselecttab=1, checknone=0):
        if self is None or self.destroyed:
            return
        myWindows = self.GetWindows()
        if checknone and len(myWindows) == 0:
            self.Close()
            return
        self.SetMinWH()
        tabs = []
        label = ''
        for wnd in myWindows:
            if wnd is None or wnd.destroyed:
                continue
            tabData = uiutil.Bunch()
            tabData.label = wnd.GetCaption() or wnd.windowID or '-'
            tabData.panel = wnd
            tabData.code = self
            tabData.args = wnd
            tabs.append(tabData)
            wnd.HideHeader()
            wnd.HideBackground()
            wnd.state = uiconst.UI_PICKCHILDREN
            label = label + wnd.GetCaption() + '-'

        if len(tabs):
            if len(label):
                label = label[:-1]
            uiutil.Flush(self.sr.tabs)
            maintabs = self.GetTabGroupClass()(parent=self.sr.tabs,
                                               name='tabparent')
            maintabs.LoadTabs(tabs, autoselecttab)
            allTabs = maintabs.GetTabs()
            if allTabs:
                for i in xrange(len(allTabs)):
                    tab = allTabs[i]
                    wnd = myWindows[i]
                    tab.GetMenu = getattr(wnd, 'GetMenu', None)
                    tab.SetIcon(wnd.headerIconNo,
                                getattr(wnd.sr.headerIcon, 'hint', ''),
                                getattr(wnd.sr.headerIcon, 'GetMenu', None))
                    if wnd.isBlinking:
                        tab.Blink()

            self.SetCaption(label)
예제 #11
0
    def ChangeControlAppearance(self, wnd, control = None):
        haveLiteFunction = [ w for w in (control or wnd).Find('trinity.Tr2Sprite2dContainer') if hasattr(w, 'LiteMode') ]
        haveLiteFunction += [ w for w in (control or wnd).Find('trinity.Tr2Sprite2dFrame') if hasattr(w, 'LiteMode') ]
        for obj in haveLiteFunction:
            obj.LiteMode(wnd.IsPinned())

        wnds = [ w for w in (control or wnd).Find('trinity.Tr2Sprite2dContainer') if w.name == '_underlay' and w not in haveLiteFunction ]
        wnd = getattr(wnd.sr, 'stack', None) or wnd
        for w in wnds:
            uiutil.Flush(w)
            if wnd.IsPinned():
                uicls.Frame(parent=w, color=(1.0, 1.0, 1.0, 0.2), padding=(-1, -1, -1, -1))
                uicls.Fill(parent=w, color=(0.0, 0.0, 0.0, 0.3))
            else:
                uicls.BumpedUnderlay(parent=w)

        frames = [ w for w in (control or wnd).Find('trinity.Tr2Sprite2dFrame') if w.name == '__underlay' and w not in haveLiteFunction ]
        for f in frames:
            self.CheckFrames(f, wnd)
예제 #12
0
 def OnEsc(self, stopLoading=True):
     if len(uicore.layer.menu.children):
         uiutil.Flush(uicore.layer.menu)
         return True
     modalResult = uicore.registry.GetModalResult(uiconst.ID_CANCEL,
                                                  'btn_cancel')
     if modalResult is not None:
         uicore.registry.GetModalWindow().SetModalResult(modalResult)
         return True
     if stopLoading and uicore.layer.loading.state == uiconst.UI_NORMAL:
         uthread.new(sm.GetService('loading').HideAllLoad)
         return True
     sys = uicore.layer.systemmenu
     if sys:
         if sys.isopen:
             uthread.new(sys.CloseMenu)
         else:
             uthread.new(sys.OpenView)
         return True
예제 #13
0
파일: image.py 프로젝트: R4M80MrX/eve-1
 def Load(self, attrs, *args):
     uiutil.Flush(self)
     self.hint = attrs.alt or ''
     self.attrs = copy.copy(attrs)
     self.width = attrs.width
     self.height = attrs.height
     self.left = getattr(attrs, 'pictureLeft', 0)
     self.top = getattr(attrs, 'pictureTop', 0)
     if getattr(self.attrs, 'loadlater', 0):
         uthread.new(self.LoadImage)
     attrs.size = int(getattr(attrs, 'size', 128))
     self.LoadAttrs(self.attrs)
     if getattr(attrs, 'bgcolor', None):
         uicls.Fill(parent=self, color=attrs.bgcolor)
     if not getattr(self.attrs, 'a', None):
         self.cursor = uiconst.UICURSOR_DEFAULT
     else:
         self.cursor = uiconst.UICURSOR_SELECT
     self.state = uiconst.UI_NORMAL
     self.loaded = 1
예제 #14
0
 def OnUilibEvent(self, item, msgID, args):
     if msgID == uiconst.UI_MOUSEDOWN:
         if not uiutil.IsUnder(item, self.layer.menu):
             uiutil.Flush(self.layer.menu)
         self.registry.SetFocus(item)
 def Load(self, node):
     agent = node.agent
     agentID = agent.agentID
     career = node.career
     agentStation = node.agentStation
     agentStationID = agentStation.stationID
     agentSystemID = agentStation.solarSystemID
     agentConstellationID = sm.GetService(
         'map').GetConstellationForSolarSystem(agentSystemID)
     agentRegionID = sm.GetService('map').GetRegionForSolarSystem(
         agentSystemID)
     agentNameText = cfg.eveowners.Get(agentID).name
     self.sr.agentContainer.Flush()
     agentSprite = uiprimitives.Sprite(name='AgentSprite',
                                       parent=self.sr.agentContainer,
                                       align=uiconst.RELATIVE,
                                       width=128,
                                       height=128,
                                       state=uiconst.UI_NORMAL,
                                       top=6)
     agentTextContainer = uiprimitives.Container(
         name='TextContainer',
         parent=self.sr.agentContainer,
         align=uiconst.TOPLEFT,
         width=190,
         height=77,
         left=140)
     uicontrols.EveLabelLarge(text=agentNameText,
                              parent=agentTextContainer,
                              state=uiconst.UI_DISABLED,
                              align=uiconst.TOTOP,
                              padTop=const.defaultPadding)
     self.photoSvc.GetPortrait(agentID, 128, agentSprite)
     menuContainer = agentSprite
     menuContainer.GetMenu = lambda *args: self.GetAgentMenu(
         agent, agentStation)
     menuContainer.id = agentID
     menuContainer.OnClick = self.TalkToAgent
     menuContainer.cursor = uiconst.UICURSOR_SELECT
     agentButton = uicontrols.Button(
         parent=self.sr.agentContainer,
         align=uiconst.BOTTOMRIGHT,
         label=localization.GetByLabel('UI/Generic/Unknown'),
         fixedwidth=196,
         left=const.defaultPadding,
         top=const.defaultPadding)
     agentButton.func = self.SetDestination
     agentButton.args = (agentStationID, )
     agentButton.SetLabel(
         localization.GetByLabel('UI/Commands/SetDestination'))
     agentButton.state = uiconst.UI_NORMAL
     if session.stationid is None and agentSystemID == session.solarsystemid:
         hint = menuContainer.hint = localization.GetByLabel(
             'UI/Tutorial/AgentInSameSystem')
         agentButton.func = self.DockAtStation
         agentButton.args = (agentStationID, )
         agentButton.SetLabel(
             localization.GetByLabel('UI/Tutorial/WarpToAgentStation'))
     elif session.stationid == agentStationID:
         hint = menuContainer.hint = localization.GetByLabel(
             'UI/Tutorial/AgentInSameStation')
         agentButton.func = self.TalkToAgent
         agentButton.args = (agentID, )
         agentButton.SetLabel(
             localization.GetByLabel('UI/Commands/StartConversation'))
     elif session.stationid is not None:
         hint = menuContainer.hint = localization.GetByLabel(
             'UI/Tutorial/YouNeedToExitTheStation')
     else:
         hint = localization.GetByLabel(
             'UI/Tutorial/ThisStationIsInADifferentSolarSystem',
             setDestination=localization.GetByLabel(
                 'UI/Commands/SetDestination'))
         if session.constellationid == agentConstellationID:
             menuContainer.hint = localization.GetByLabel(
                 'UI/Tutorial/AgentInSameConstellation')
         elif session.regionid == agentRegionID:
             menuContainer.hint = localization.GetByLabel(
                 'UI/Tutorial/AgentInSameRegion')
         else:
             menuContainer.hint = localization.GetByLabel(
                 'UI/Tutorial/AgentNotInSameRegion')
     linktext = "<url=showinfo:%d//%d alt='%s'>%s</url>" % (
         agentStation.stationTypeID, agentStationID, hint,
         agentStation.stationName)
     linkObject = uicontrols.EveLabelMedium(text=linktext,
                                            parent=agentTextContainer,
                                            state=uiconst.UI_NORMAL,
                                            align=uiconst.TOTOP,
                                            padTop=const.defaultPadding,
                                            padLeft=const.defaultPadding,
                                            padRight=const.defaultPadding)
     uiutil.Flush(self.sr.careerContainer)
     careerText = localization.GetByLabel('UI/Generic/Unknown')
     careerDesc = localization.GetByLabel('UI/Generic/Unknown')
     if career == const.agentDivisionBusiness:
         careerText = localization.GetByLabel('UI/Tutorial/Business')
         careerDesc = localization.GetByLabel('UI/Tutorial/BusinessDesc')
     elif career == const.agentDivisionExploration:
         careerText = localization.GetByLabel('UI/Tutorial/Exploration')
         careerDesc = localization.GetByLabel('UI/Tutorial/ExplorationDesc')
     elif career == const.agentDivisionIndustry:
         careerText = localization.GetByLabel('UI/Tutorial/Industry')
         careerDesc = localization.GetByLabel('UI/Tutorial/IndustryDesc')
     elif career == const.agentDivisionMilitary:
         careerText = localization.GetByLabel('UI/Tutorial/Military')
         careerDesc = localization.GetByLabel('UI/Tutorial/MilitaryDesc')
     elif career == const.agentDivisionAdvMilitary:
         careerText = localization.GetByLabel('UI/Tutorial/AdvMilitary')
         careerDesc = localization.GetByLabel('UI/Tutorial/AdvMilitaryDesc')
     uicontrols.EveCaptionMedium(text=careerText,
                                 parent=self.sr.careerContainer,
                                 state=uiconst.UI_DISABLED,
                                 align=uiconst.TOTOP)
     uicontrols.EveLabelMedium(text=careerDesc,
                               parent=self.sr.careerContainer,
                               state=uiconst.UI_DISABLED,
                               align=uiconst.TOTOP)
예제 #16
0
 def LinkDown(self, link, *args):
     for each in self.sr.hiliteLinks:
         uiutil.Flush(each)
예제 #17
0
def KillAllMenus():
    uiutil.Flush(uicore.layer.menu)
예제 #18
0
 def LinkExit(self, link, *args):
     browser = uiutil.GetBrowser(self)
     if browser and browser.sr.window and hasattr(browser.sr.window, 'ShowHint'):
         browser.sr.window.ShowHint('')
     for each in self.sr.hiliteLinks:
         uiutil.Flush(each)
예제 #19
0
파일: calendar.py 프로젝트: R4M80MrX/eve-1
 def SetTag(self, tagIcon):
     uiutil.Flush(self.sr.tagCont)
     self.sr.tagCont.children.append(tagIcon)
예제 #20
0
    def Startup_select(self, wnd, attrs):
        if getattr(attrs, 'size', None) is not None or getattr(
                attrs, 'height', 0):
            wnd.Startup([(k, v, s) for k, v, s in attrs.options])
            if not hasattr(attrs, 'multiple'):
                wnd.multiSelect = 0
            for each in wnd.children:
                if each.name in ('_underlay', ):
                    each.Close()
                if each.name == 'activeframe':
                    uiutil.Flush(each)
                    uicls.Frame(parent=each,
                                color=self.browser.attrStack[-1]['color'],
                                padding=(-1, -1, -1, -1))

            uicls.Line(parent=wnd,
                       align=uiconst.TOTOP,
                       color=getattr(attrs, 'fontcolor', None),
                       weight=1)
            uicls.Line(parent=wnd,
                       align=uiconst.TOBOTTOM,
                       color=getattr(attrs, 'fontcolor', None),
                       weight=1)
            uicls.Line(parent=wnd,
                       align=uiconst.TOLEFT,
                       color=getattr(attrs, 'fontcolor', None),
                       weight=1)
            uicls.Line(parent=wnd,
                       align=uiconst.TORIGHT,
                       color=getattr(attrs, 'fontcolor', None),
                       weight=1)
            uicls.Container(name='push',
                            parent=wnd,
                            align=uiconst.TOTOP,
                            pos=(0, 0, 0, attrs.vspace),
                            idx=0)
            uicls.Container(name='push',
                            parent=wnd,
                            align=uiconst.TOBOTTOM,
                            pos=(0, 0, 0, attrs.vspace),
                            idx=0)
        else:
            default = None
            for key, value, selected in attrs.options:
                if selected:
                    default = key
                    break

            if getattr(attrs, 'width', None) is not None:
                wnd.Startup([(k, v) for k, v, s in attrs.options],
                            default=default)
            else:
                wnd.Startup([(k, v) for k, v, s in attrs.options],
                            default=default,
                            adjustWidth=1)
            clipper = uiutil.GetChild(wnd, 'clipper')
            clipper.clipChildren = 1
            for each in wnd.children:
                if each.name == 'selected':
                    wnd.sr.activeframe = uicls.Frame(parent=each,
                                                     color=getattr(
                                                         attrs, 'fontcolor',
                                                         None),
                                                     padding=(-1, -1, -1, -1))
                    wnd.sr.activeframe.state = uiconst.UI_HIDDEN
                    uicls.Frame(parent=each,
                                color=getattr(attrs, 'fontcolor', None))
                    uicls.Container(name='push',
                                    parent=each,
                                    align=uiconst.TOTOP,
                                    pos=(0, 0, 0, attrs.vspace),
                                    idx=0)
                    uicls.Container(name='push',
                                    parent=each,
                                    align=uiconst.TOBOTTOM,
                                    pos=(0, 0, 0, attrs.vspace),
                                    idx=0)
                    for child in each.children:
                        if child.name in ('_underlay', ):
                            child.Close()

                    break