Пример #1
0
 def Prepare_(self, *args):
     self.sr.day = uicls.Container(name='dayNumberCont',
                                   parent=self,
                                   align=uiconst.TOALL,
                                   pos=(1, 1, 1, 1))
     self.sr.dayNumberCont = uicls.Container(name='dayNumberCont',
                                             parent=self.sr.day,
                                             align=uiconst.TOTOP,
                                             pos=(0, 0, 0, 12),
                                             state=uiconst.UI_NORMAL)
     self.sr.moreCont = uicls.Container(name='moreCont',
                                        parent=self.sr.day,
                                        align=uiconst.TOBOTTOM,
                                        pos=(0, 0, 0, 10),
                                        state=uiconst.UI_HIDDEN,
                                        padding=(0, 0, 0, 0))
     self.AddMoreContFill()
     self.AddFill()
     self.AddFrame()
     self.sr.emptyDay = uicls.Container(name='emptyDay',
                                        parent=self.sr.day,
                                        align=uiconst.TOALL,
                                        pos=(0, 0, 0, 0),
                                        clipChildren=1)
     self.sr.emptyDay.state = uiconst.UI_NORMAL
     self.sr.dayNumberCont.OnDblClick = self.OnDblClickDay
     self.sr.dayNumberCont.OnMouseDown = self.OnMouseClickDay
     self.sr.dayNumberCont.GetMenu = self.GetMenu
     self.sr.emptyDay.OnDblClick = self.OnDblClickDay
     self.sr.emptyDay.OnMouseDown = self.OnMouseClickDay
     self.sr.emptyDay.GetMenu = self.GetMenu
     uiutil.SetOrder(self.sr.fill, -1)
     uiutil.SetOrder(self.sr.todayFill, -1)
Пример #2
0
 def OnMouseUp(self, button):
     if not uicore.cmd.IsUIHidden():
         uicore.layer.main.state = uiconst.UI_PICKCHILDREN
     if not (uicore.uilib.leftbtn or uicore.uilib.rightbtn):
         self._isPicked = False
     if button == 1:
         if uicore.uilib.leftbtn and (self.sr.movingProbe
                                      or self.sr.rangeProbe):
             scannerWnd = form.Scanner.GetIfOpen()
             if scannerWnd:
                 scannerWnd.CancelProbeMoveOrScaling()
                 if self.sr.movingProbe:
                     self.sr.movingProbe.ShowIntersection()
                 self.sr.movingProbe = None
                 self.sr.rangeProbe = None
                 scannerWnd.lastScaleUpdate = None
                 scannerWnd.lastMoveUpdate = None
         uthread.new(self.TryToHilight)
         uiutil.SetOrder(self, -1)
         return
     uiutil.SetOrder(self, -1)
     scannerWnd = form.Scanner.GetIfOpen()
     if scannerWnd and self.sr.rangeProbe:
         uthread.new(scannerWnd.RegisterProbeRange, self.sr.rangeProbe)
     if scannerWnd and self.sr.movingProbe:
         uthread.new(scannerWnd.RegisterProbeMove, self.sr.movingProbe)
     self.sr.rangeProbe = None
     if self.sr.movingProbe:
         self.sr.movingProbe.ShowIntersection()
     self.sr.movingProbe = None
     if scannerWnd:
         scannerWnd.HideDistanceRings()
     uthread.new(self.TryToHilight)
     sm.GetService('systemmap').SortBubbles()
     sm.GetService('ui').ForceCursorUpdate()
 def OnMouseDown(self, button):
     systemmap = sm.GetService('systemmap')
     self._isPicked = True
     uiutil.SetOrder(self, 0)
     systemmap.CollapseBubbles()
     systemmap.SortBubbles()
     scannerWnd = Scanner.GetIfOpen()
     picktype, pickobject = self.GetPick()
     if uicore.uilib.leftbtn and pickobject:
         if pickobject.name[:6] == 'cursor':
             cursorName, side, probeID = pickobject.name.split('_')
             if probeID:
                 sm.GetService('scanSvc').StartMoveMode()
                 probe = scannerWnd.GetControl(probeID)
                 if probe:
                     cursorAxis = cursorName[6:]
                     x = uicore.ScaleDpi(uicore.uilib.x)
                     y = uicore.ScaleDpi(uicore.uilib.y)
                     self.PickAxis(x, y, probe, cursorAxis.lower())
                     if scannerWnd:
                         scannerWnd.HighlightProbeIntersections()
                     return
     if scannerWnd and button == 0:
         pickedProbeControl = self.TryPickSphereBorder()
         if pickedProbeControl:
             self.sr.rangeProbe = pickedProbeControl
             pickedProbeControl.ShowScanRanges()
             uicore.uilib.SetCursor(uiconst.UICURSOR_DRAGGABLE)
             scannerWnd.StartScaleMode(self.GetDotInCameraAlignedPlaneFromProbe(pickedProbeControl))
         else:
             uicore.uilib.SetCursor(uiconst.UICURSOR_SELECTDOWN)
Пример #4
0
 def OnMouseEnter(self, *args):
     if self is None or self.destroyed or self.parent is None or self.parent.destroyed:
         return
     if not self.blockDisable and not uicore.cmd.IsUIHidden():
         uicore.layer.main.state = uiconst.UI_PICKCHILDREN
     if sm.IsServiceRunning('tactical'):
         uthread.pool('InflightNav::MouseEnter --> ResetTargetingRanges',
                      sm.GetService('tactical').ResetTargetingRanges)
     uiutil.SetOrder(self, -1)
Пример #5
0
    def __SetActive(self, wnd=None):
        while not self.IsTopLevelWindow(wnd):
            if wnd == uicore.desktop:
                break
            wnd = wnd.parent

        active = self.GetActive()
        if hasattr(active, 'OnSetInactive'):
            active.OnSetInactive()
        if self.IsWindowStack(wnd):
            wnd = wnd.GetActiveWindow()
        if not wnd or wnd.destroyed:
            wnd = uicore.desktop
        elif self.IsWindow(wnd):
            if wnd.sr.stack is not None:
                uiutil.SetOrder(wnd.sr.stack)
            elif wnd.parent and wnd.align == uiconst.TOPLEFT:
                uiutil.SetOrder(wnd, 0)
        if hasattr(wnd, 'SetActive'):
            wnd.SetActive()
Пример #6
0
 def OnMouseEnter(self, *args):
     if self.destroyed or self.parent is None or self.parent.destroyed:
         return
     if not uicore.cmd.IsUIHidden():
         uicore.layer.main.state = uiconst.UI_PICKCHILDREN
     if sm.IsServiceRunning('tactical'):
         uthread.new(sm.GetService('tactical').ClearModuleRange)
     if uicore.cmd.IsCombatCommandLoaded(
             'CmdApproachItem') and not self.positionalControl.IsActive():
         self.positionalControl.StartMoveCommand()
     uiutil.SetOrder(self, -1)
Пример #7
0
 def FadeButtonIn(self, btnPar, doAnimate = False, order = -1):
     if not btnPar.display or btnPar.fadingOut:
         btnPar.fadingOut = False
         uiutil.SetOrder(btnPar, order)
         btnPar.display = True
         if doAnimate:
             uicore.animations.FadeIn(btnPar)
             uicore.animations.MorphScalar(btnPar, 'width', startVal=0, endVal=40, duration=0.25)
         else:
             btnPar.opacity = 1.0
             btnPar.width = 40
     self._ResetButtonHint(btnPar)
Пример #8
0
    def ShowBubbleHint(self,
                       particleID,
                       solarsystemID,
                       mapColor=None,
                       extended=0):
        starmap = sm.GetService('starmap')
        if not extended:
            blue.pyos.synchro.SleepWallclock(25)
            if self.destroyed:
                return
            _particleID = starmap.PickParticle()
            if _particleID is None or _particleID != particleID:
                self.state = uiconst.UI_NORMAL
                return
        self.bubbleHint = (particleID, solarsystemID, mapColor, extended)
        eve.Message('click')
        mapData = sm.GetService('map').GetItem(solarsystemID)
        bubblehint = sm.GetService('systemmap').GetBubbleHint(
            solarsystemID, mapData=mapData, extended=extended)
        if self.destroyed:
            return
        hint = bubblehint or [mapData.itemName]
        data = starmap.GetStarData()
        if particleID in data:
            hint.append('<line>')
            hint.append(
                localization.GetByLabel('UI/Map/Navigation/hintStatistics'))
            hintFunc, hintArgs = data[particleID]
            particleData = hintFunc(*hintArgs)
            if type(particleData) == types.TupleType:
                for each in particleData:
                    hint += each

            else:
                hint.append(particleData)
        if hint:
            bubble = self.GetBubble()
            if extended:
                bubble.state = uiconst.UI_DISABLED
            else:
                bubble.state = uiconst.UI_HIDDEN
            bubble.ShowHint(hint, 0)
            uiutil.SetOrder(bubble.parent, 0)
            blue.pyos.synchro.Yield()
            if bubble.destroyed or self.destroyed:
                return
            bubble.state = uiconst.UI_NORMAL
            self.hoveringParticleID = particleID
        starmap.ShowCursorInterest(solarsystemID)
        self.state = uiconst.UI_NORMAL
Пример #9
0
 def ShowMsg(self, text):
     if self.message is None:
         self.Prepare_Text_()
         self.Prepare_Underlay_()
     if getattr(self, 'fakeText', None) is not None:
         self.fakeText.Close()
     self.message.text = '<%s>%s' % (self.currentTextAlignment, text)
     self.pureText = text
     self.SetSizeAndPosition()
     if not self.inDragMode:
         self.state = uiconst.UI_DISABLED
     uiutil.SetOrder(self, 0)
     if not self.inDragMode:
         self.timer = base.AutoTimer(5000, self.hide)
 def UpdateColumnSort(self, scroll, entries, columnID):
     if not entries:
         return
     startIdx = entries[0].idx
     endIdx = entries[-1].idx
     entries = listentry.SortColumnEntries(entries, columnID)
     scroll.sr.nodes = scroll.sr.nodes[:startIdx] + entries + scroll.sr.nodes[endIdx + 1:]
     idx = 0
     for entry in scroll.GetNodes()[startIdx:]:
         if entry.panel:
             uiutil.SetOrder(entry.panel, -1)
         entry.idx = startIdx + idx
         if entry.Get('needReload', 0) and entry.panel:
             entry.panel.LoadLite(entry)
         idx += 1
Пример #11
0
 def IndicateStackable(self, wnd = None):
     if wnd is None:
         if self.sr.snapIndicator:
             self.sr.snapIndicator.Close()
             self.sr.snapIndicator = None
         return
     if not wnd.IsStackable() or not self.IsStackable():
         return
     if self.sr.snapIndicator is None:
         self.sr.snapIndicator = uicls.Fill(parent=None, align=uiconst.TOTOP_NOPUSH, height=19)
     si = self.sr.snapIndicator
     si.state = uiconst.UI_DISABLED
     if si.parent != wnd:
         uiutil.Transplant(si, wnd, idx=0)
     else:
         uiutil.SetOrder(si, 0)
Пример #12
0
    def ClickCol(self, idx, sender):
        """
        A logo layer color has been clicked; Open the logo layer color selection pop-up
        """
        if not self.sr.Get('colors', None):
            self.sr.colors = uiprimitives.Container(name='colors_container',
                                                    parent=self.sr.main,
                                                    align=uiconst.CENTERTOP,
                                                    height=128,
                                                    width=150,
                                                    idx=0)
            colorscroll = uicontrols.Scroll(
                parent=self.sr.colors,
                padding=(const.defaultPadding, const.defaultPadding,
                         const.defaultPadding, const.defaultPadding))
            self.AddCloseButton(self.sr.colors)
            self.sr.underlay = uicontrols.WindowUnderlay(parent=self.sr.colors)
            x = 0
            scrolllist = []
            icons = []
            graphicIDs = const.graphicCorpLogoLibColors.keys()
            graphicIDs.sort()
            for graphicID in graphicIDs:
                color, blendMode = self.GetLogoLibColor(graphicID)
                icons.append((None, color, graphicID, self.PickCol))
                x += 1
                if x == 4:
                    scrolllist.append(listentry.Get('Icons', {'icons': icons}))
                    icons = []
                    x = 0

            if len(icons):
                scrolllist.append(listentry.Get('Icons', {'icons': icons[:]}))
            self.sr.colors.state = uiconst.UI_NORMAL
            colorscroll.Load(fixedEntryHeight=32, contentList=scrolllist)
        self.layerNumSelected = idx
        self.sr.colors.top = self.corpLogo.top + self.corpLogo.height
        if self.sr.Get('shapes', None):
            self.sr.shapes.state = uiconst.UI_HIDDEN
        self.sr.colors.state = uiconst.UI_NORMAL
        uiutil.SetOrder(self.sr.colors, 0)
Пример #13
0
 def IndicateStackable(self, wnd=None):
     if wnd is None:
         if self.sr.snapIndicator:
             self.sr.snapIndicator.Close()
             self.sr.snapIndicator = None
         return
     if not wnd.IsStackable() or not self.IsStackable():
         return
     if self.sr.snapIndicator is None:
         self.sr.snapIndicator = FillUnderlay(
             parent=None,
             colorType=uiconst.COLORTYPE_UIHILIGHTGLOW,
             align=uiconst.TOTOP_NOPUSH,
             height=20,
             padding=(2, 2, 2, 0))
     si = self.sr.snapIndicator
     si.state = uiconst.UI_DISABLED
     if si.parent != wnd:
         uiutil.Transplant(si, wnd, idx=0)
     else:
         uiutil.SetOrder(si, 0)
Пример #14
0
    def _ShowSubhint(self, passedArgs, entry):
        if not getattr(entry.sr, 'hilite', None):
            entry.sr.hilite = uiprimitives.Fill(parent=entry)
        self.ClearSubs()
        uiutil.SetOrder(self.parent, 0)
        for each in self.content.children:
            if each != entry and getattr(each, 'sr', None) and getattr(
                    each.sr, 'hilite', None):
                each.sr.hilite.state = uiconst.UI_HIDDEN

        entry.sr.hilite.state = uiconst.UI_DISABLED
        if len(passedArgs) == 2:
            funcName, args = passedArgs
            func = getattr(self, funcName, None)
            if not func:
                log.LogError('Unsupported dynamic function in bubblehint',
                             funcName)
                return
            hint = func(*args)
        else:
            hint, = passedArgs
        bubble = BubbleHint(parent=self.parent,
                            align=uiconst.TOPLEFT,
                            width=0,
                            height=0,
                            idx=0,
                            state=uiconst.UI_NORMAL)
        bubble.ShowHint(hint, None, 100)
        if not self or self.destroyed:
            return
        self.sr.sub = bubble
        if self.parent:
            pl, pt, pw, ph = self.parent.GetAbsolute()
            ll, lt, lw, lh = entry.GetAbsolute()
            bubble.left = ll - pl + lw - 6
            bubble.top = lt - pt - 2
Пример #15
0
    def Initialize(self, wnd, panelName=None):
        while eve.session.mutating:
            blue.pyos.BeNice()

        wnd.ShowLoad()
        uix.Flush(wnd.sr.main)
        self.toparea = uicls.Container(parent=wnd.sr.main,
                                       name='corptop',
                                       pos=(0, 0, 0, 54),
                                       align=uiconst.TOTOP,
                                       state=uiconst.UI_NORMAL)
        uicls.Icon(parent=self.toparea,
                   name='simplepic',
                   pos=(4, 0, 64, 64),
                   icon='ui_7_64_5')
        self.panelHome = None
        self.members = None
        self.recruitment = None
        self.wars = None
        self.standings = None
        self.votes = None
        self.sanctionable = None
        self.accounts = None
        self.auditing = None
        self.membertracking = None
        self.findmember = None
        self.titles = None
        self.alliances = None
        tabpanels = []
        homeHint = localization.GetByLabel(
            'UI/Corporations/BaseCorporationUI/AboutThisCorp')
        warsHint = localization.GetByLabel(
            'UI/Corporations/BaseCorporationUI/CorpWarsHint')
        standingsHint = localization.GetByLabel(
            'UI/Corporations/BaseCorporationUI/CorpStandingsHint')
        votesHint = localization.GetByLabel(
            'UI/Corporations/BaseCorporationUI/CorpVotesHint')
        sanctionableActionsHint = localization.GetByLabel(
            'UI/Corporations/BaseCorporationUI/CorpSanctionableActionsHint')
        accountsHint = localization.GetByLabel(
            'UI/Corporations/BaseCorporationUI/CorpAccountsHint')
        alliancesHint = localization.GetByLabel(
            'UI/Corporations/BaseCorporationUI/AlliancesHint')
        self.panelHome = form.CorpUIHome(name='corp_home',
                                         parent=wnd.sr.main,
                                         state=uiconst.UI_PICKCHILDREN)
        tabpanels.append([
            localization.GetByLabel('UI/Corporations/BaseCorporationUI/Home'),
            self.panelHome, self, 'home', None, homeHint
        ])
        self.panels['home'] = [self.panelHome]
        self.recruitment = form.CorpRecruitment(name='recruitmentpar',
                                                pos=(0, 0, 0, 0))
        wnd.sr.main.children.append(self.recruitment)
        tabpanels.append([
            uiutil.FixedTabName(
                'UI/Corporations/BaseCorporationUI/Recruitment'),
            self.recruitment, self, 'recruitment', None, None
        ])
        self.panels['recruitment'] = [self.recruitment]
        membersTabEntries = []
        self.panels['members'] = []
        if not util.IsNPC(eve.session.corpid):
            self.membertracking = form.CorpMemberTracking(
                name='membertrackingpar', pos=(0, 0, 0, 0))
            wnd.sr.main.children.append(self.membertracking)
            membersTabEntries.append([
                localization.GetByLabel(
                    'UI/Corporations/BaseCorporationUI/MemberList'),
                self.membertracking, self.membertracking, 'main'
            ])
            self.panels['members'].append(self.membertracking)
            grantableRoles, grantableRolesAtHQ, grantableRolesAtBase, grantableRolesAtOther = self.corp.GetMyGrantableRoles(
            )
            if session.corprole & const.corpRolePersonnelManager | grantableRoles:
                self.findmember = form.CorpFindMembersInRole(
                    name='findmember',
                    parent=wnd.sr.main,
                    left=const.defaultPadding,
                    width=const.defaultPadding)
                membersTabEntries.append([
                    localization.GetByLabel(
                        'UI/Corporations/BaseCorporationUI/FindMemberInRole'),
                    self.findmember, self.findmember, 'findmember'
                ])
                self.panels['members'].append(self.findmember)
                self.members = form.CorpMembers(name='members',
                                                pos=(0, 0, 0, 0))
                wnd.sr.main.children.append(self.members)
                membersTabEntries.append([
                    localization.GetByLabel(
                        'UI/Corporations/BaseCorporationUI/RoleManagement'),
                    self.members, self.members, 'roles'
                ])
                self.panels['members'].append(self.members)
            if const.corpRoleDirector & eve.session.corprole == const.corpRoleDirector:
                self.titles = form.CorpTitles(name='titles', pos=(0, 0, 0, 0))
                wnd.sr.main.children.append(self.titles)
                membersTabEntries.append([
                    localization.GetByLabel(
                        'UI/Corporations/BaseCorporationUI/TitleManagement'),
                    self.titles, self.titles, 'titles'
                ])
                self.panels['members'].append(self.titles)
        if eve.session.corprole & const.corpRoleAuditor == const.corpRoleAuditor:
            self.auditing = form.CorpAuditing(name='auditingpar',
                                              pos=(0, 0, 0, 0))
            wnd.sr.main.children.append(self.auditing)
            membersTabEntries.append([
                localization.GetByLabel(
                    'UI/Corporations/BaseCorporationUI/Auditing'),
                self.auditing, self.auditing, 'main'
            ])
            self.panels['members'].append(self.auditing)
        self.decorations = form.CorpDecorations(name='decorations',
                                                pos=(0, 0, 0, 0))
        wnd.sr.main.children.append(self.decorations)
        membersTabEntries.append([
            localization.GetByLabel(
                'UI/Corporations/BaseCorporationUI/Decorations'),
            self.decorations, self.decorations, 'decorations'
        ])
        self.panels['members'].append(self.decorations)
        wnd.sr.membersTabs = uicls.TabGroup(name='tabparent',
                                            parent=wnd.sr.main,
                                            idx=0)
        wnd.sr.membersTabs.Startup(membersTabEntries,
                                   'corpmembersstab',
                                   autoselecttab=0)
        tabpanels.append([
            localization.GetByLabel(
                'UI/Corporations/BaseCorporationUI/Members'), None, self,
            'members', wnd.sr.membersTabs
        ])
        if not util.IsNPC(session.corpid):
            self.standings = form.CorpStandings(name='standingspar',
                                                pos=(0, 0, 0, 0))
            wnd.sr.main.children.append(self.standings)
            tabpanels.append([
                localization.GetByLabel(
                    'UI/Corporations/BaseCorporationUI/Standings'),
                self.standings, self, 'standings', None, standingsHint
            ])
            self.panels['standings'] = [self.standings]
        politicsTabEntries = []
        self.panels['politics'] = []
        if self.corp.CanViewVotes(eve.session.corpid):
            self.votes = form.CorpVotes(name='votespar', pos=(0, 0, 0, 0))
            wnd.sr.main.children.append(self.votes)
            politicsTabEntries.append([
                localization.GetByLabel(
                    'UI/Corporations/BaseCorporationUI/Votes'), self.votes,
                self.votes, 'votes', None, votesHint
            ])
            self.panels['politics'].append(self.votes)
            self.sanctionable = form.CorpSanctionableActions(
                name='sanctionablepar', pos=(0, 0, 0, 0))
            wnd.sr.main.children.append(self.sanctionable)
            politicsTabEntries.append([
                localization.GetByLabel(
                    'UI/Corporations/BaseCorporationUI/SanctionableActions'),
                self.sanctionable, self.sanctionable, 'sanctionable', None,
                sanctionableActionsHint
            ])
            self.panels['politics'].append(self.sanctionable)
        self.wars = form.CorpWars(name='warspar', pos=(0, 0, 0, 0))
        wnd.sr.main.children.append(self.wars)
        tabpanels.append([
            localization.GetByLabel('UI/Corporations/BaseCorporationUI/Wars'),
            self.wars, self, 'wars', None, warsHint
        ])
        self.panels['wars'] = [self.wars]
        if len(self.panels['politics']):
            wnd.sr.politicsTabs = uicls.TabGroup(name='tabparent',
                                                 parent=wnd.sr.main,
                                                 idx=0)
            wnd.sr.politicsTabs.Startup(politicsTabEntries,
                                        'corppoliticsstab',
                                        autoselecttab=0)
            tabpanels.append([
                localization.GetByLabel(
                    'UI/Corporations/BaseCorporationUI/Politics'), None, self,
                'politics', wnd.sr.politicsTabs
            ])
        if const.corpRoleAccountant & eve.session.corprole != 0 or self.corp.UserIsCEO(
        ):
            self.accounts = form.CorpAccounts(name='accountspar',
                                              pos=(0, 0, 0, 0))
            wnd.sr.main.children.append(self.accounts)
            tabpanels.append([
                localization.GetByLabel(
                    'UI/Corporations/BaseCorporationUI/Assets'), self.accounts,
                self, 'accounts', None, accountsHint
            ])
            self.panels['accounts'] = [self.accounts]
        self.alliances = form.Alliances(name='alliances', pos=(0, 0, 0, 0))
        wnd.sr.main.children.append(self.alliances)
        tabpanels.append([
            localization.GetByLabel(
                'UI/Corporations/BaseCorporationUI/Alliances'), self.alliances,
            self, 'alliances', None, alliancesHint
        ])
        self.panels['alliances'] = [self.alliances]
        wnd.sr.maintabs = uicls.TabGroup(name='tabparent', parent=wnd.sr.main)
        wnd.sr.maintabs.Startup(tabpanels,
                                'corporationpanel',
                                UIIDPrefix='corporationTab',
                                autoselecttab=False)
        if panelName:
            wnd.sr.maintabs.ShowPanelByName(panelName)
        else:
            wnd.sr.maintabs.AutoSelect()
        if wnd is None or wnd.destroyed:
            self.Reset(1, 0, 0)
            return
        uiutil.SetOrder(wnd.sr.maintabs, 0)
        wnd.HideLoad()
        wnd.state = uiconst.UI_NORMAL
        uthread.new(sm.StartService('wallet').AskSetWalletDivision)
Пример #16
0
 def OnMouseUp(self, *args):
     if self.dragging:
         self.left = max(-self.width + 24, min(self.parent.absoluteRight - self.parent.absoluteLeft - 24, self.left))
         self.top = max(-self.height + 24, min(self.parent.absoluteBottom - self.parent.absoluteTop - 24, self.top))
         uiutil.SetOrder(self, -1)
     self.dragging = 0
Пример #17
0
    def Select(self, silently=0):
        if self.destroyed:
            return
        self.selecting = 1
        self.Blink(0)
        if self is None or self.destroyed:
            self.selecting = 0
            self.sr.tabgroup.state = uiconst.UI_PICKCHILDREN
            return
        if len(self.sr.tabgroup.sr.linkedrows):
            for tabgroup in self.sr.tabgroup.sr.linkedrows:
                if self in tabgroup.sr.mytabs:
                    continue
                uiutil.SetOrder(tabgroup, 0)

        for each in self.sr.tabgroup.sr.tabs:
            if each.IsSelected():
                if hasattr(self.sr.code, 'UnloadTabPanel'):
                    self.sr.code.UnloadTabPanel(each.sr.args, each.sr.panel,
                                                each.sr.tabgroup)
            if each == self:
                continue
            notify = True
            if each.sr.panel and each.sr.panel is self.sr.panel or each.sr.panelparent and each.sr.panelparent is self.sr.panelparent:
                notify = False
            each.Deselect(notify)

        self._selected = True
        self.ShowSelected_()
        if self.sr.panelparent:
            self.sr.panelparent.state = uiconst.UI_PICKCHILDREN
            if hasattr(self.sr.panelparent, 'OnTabSelect'):
                self.sr.panelparent.OnTabSelect()
        if self.sr.panel:
            self.sr.panel.state = uiconst.UI_PICKCHILDREN
            if hasattr(self.sr.panel, 'OnTabSelect'):
                self.sr.panel.OnTabSelect()
        if self.sr.tabgroup.callback:
            self.sr.tabgroup.callback(self.sr.tabgroup.GetSelectedIdx())
        err = None
        if self.sr.LoadTabCallback:
            try:
                self.sr.LoadTabCallback(self.sr.args, self.sr.panel,
                                        self.sr.tabgroup)
            finally:
                self.selecting = 0

        elif hasattr(self.sr.code, 'LoadTabPanel'):
            try:
                self.sr.code.LoadTabPanel(self.sr.args, self.sr.panel,
                                          self.sr.tabgroup)
            finally:
                self.selecting = 0

        elif getattr(self.sr.code, 'Load', None):
            try:
                self.sr.code.Load(self.sr.args)
            except (StandardError, ) as err:
                log.LogException(toMsgWindow=0)
                sys.exc_clear()
                if self.destroyed:
                    return
                wnd = uiutil.GetWindowAbove(self)
                if wnd and not wnd.destroyed:
                    wnd.HideLoad()

        if not silently:
            par = self.sr.panelparent or self.sr.panel
            wnd = uiutil.GetWindowAbove(self)
            if par and wnd and wnd == uicore.registry.GetActive():
                uthread.new(uicore.registry.SetFocus, par)
        if self.destroyed:
            return
        if self.sr.tabgroup._settingsID:
            settings.user.tabgroups.Set(self.sr.tabgroup._settingsID,
                                        self.sr.tabgroup.sr.tabs.index(self))
        if self and not self.destroyed:
            self.sr.tabgroup.UpdateSizes()
            self.selecting = 0
        if err and isinstance(err, UserError):
            raise err
Пример #18
0
 def ClickParent(self, *args):
     for each in uicore.layer.main.children:
         if getattr(each, 'isDockWnd',
                    0) == 1 and each.state == uiconst.UI_NORMAL:
             uiutil.SetOrder(each, -1)
Пример #19
0
    def ShowMsg(self, *args):
        if self.showingMessage:
            return
        while 1:
            if not self or self.destroyed:
                return
            try:
                if len(self.messageList) == 0:
                    self.messageCounter.append(0)
                    continue
                self.messageCounter.append(1)
                now = blue.os.GetWallclockTime()
                validTime = now - self.expiryTime
                text = ''
                numMessagesDiscarded = 0
                while len(self.messageList) > 0:
                    nextMessage = self.messageList.pop(0)
                    timeStamp, text = nextMessage
                    if timeStamp < validTime:
                        numMessagesDiscarded += 1
                        continue
                    break

                if numMessagesDiscarded:
                    sm.GetService('logger').LogWarn('Discarded ',
                                                    numMessagesDiscarded,
                                                    ' messages')
                if not text:
                    continue
                if len(self.allLabels) < 1:
                    self.Prepare_Text_()
                fakeText = self.GetFakeText()
                if fakeText:
                    fakeText.Close()
                label, otherVisibleLabels = self.FindFreeLabel()
                label.display = True
                label.text = text
                label.top = 0
                label.msgIndex = -1
                self.SetSizeAndPosition()
                otherVisibleLabels.sort(lambda x, y: cmp(x.top, y.top))
                if sum(self.messageCounter) > 8:
                    duration = 0.166
                    secondPoint = 0.05
                else:
                    secondPoint = 0.2
                    duration = 0.4
                for i, ovl in enumerate(otherVisibleLabels):
                    uicore.animations.MorphScalar(ovl,
                                                  'top',
                                                  startVal=ovl.top,
                                                  endVal=(i + 1) * 20,
                                                  duration=duration)
                    ovl.msgIndex = i
                    if i == 4:
                        uicore.animations.FadeOut(
                            ovl, duration=self.messageSleepTimeInMs)

                curvePoints = ([0, 0], [secondPoint, 1.0], [1, 0])
                uicore.animations.MorphScalar(label,
                                              'opacity',
                                              duration=self.fadeOutTime,
                                              curveType=curvePoints)
                uiutil.SetOrder(self, 0)
            except Exception as e:
                sm.GetService('logger').LogWarn(
                    'failed at displaying message, e = ', e)
            finally:
                blue.pyos.synchro.SleepWallclock(self.messageSleepTime)