Ejemplo n.º 1
0
    def UpdateAll(self, updateActions=0):
        if not self or self.destroyed:
            return
        if eve.session.shipid in self.itemIDs:
            self.itemIDs.remove(eve.session.shipid)
        bp = sm.GetService('michelle').GetBallpark()
        if not self.ImVisible() or not bp or not self.itemIDs:
            self.sr.updateTimer = None
            self.FlushContent()
            return
        goForSlim = 1
        slimItems = []
        invItems = []
        fleetMember = None
        for itemID in self.itemIDs:
            blue.pyos.BeNice()
            if sm.GetService('fleet').IsMember(itemID):
                fleetMember = cfg.eveowners.Get(itemID)
                break
            slimItem = None
            if goForSlim:
                slimItem = uix.GetBallparkRecord(itemID)
                if slimItem:
                    slimItems.append(slimItem)
            if not slimItem:
                invItem = self.TryGetInvItem(itemID)
                if invItem:
                    invItems.append(invItem)
                    goForSlim = 0

        if not slimItems and not invItems and not fleetMember:
            self.itemIDs = []
            self.lastActionSerial = None
            self.lastActionDist = None
            self.FlushContent()
            return
        if not self or self.destroyed:
            return
        text = ''
        blue.pyos.BeNice()
        updateActions = updateActions or 0
        typeID = None
        groupID = None
        fleetSlim = None
        if fleetMember:
            multi = 1
            text = fleetMember.name
            typeID = fleetMember.typeID
            typeOb = cfg.invtypes.Get(typeID)
            groupID = typeOb.groupID
            categoryID = typeOb.categoryID
            fleetSlim = self.GetSlimItemForCharID(fleetMember.id)
            blue.pyos.BeNice()
        elif invItems:
            text = uix.GetItemName(invItems[0])
            typeID = invItems[0].typeID
            typeOb = cfg.invtypes.Get(typeID)
            groupID = typeOb.groupID
            categoryID = typeOb.categoryID
            multi = len(invItems)
            blue.pyos.BeNice()
        elif slimItems:
            text = uix.GetSlimItemName(slimItems[0])
            typeID = slimItems[0].typeID
            groupID = slimItems[0].groupID
            categoryID = slimItems[0].categoryID
            multi = len(slimItems)
            if multi == 1:
                slimItem = slimItems[0]
                itemID = slimItem.itemID
                ball = bp.GetBall(itemID)
                if not ball:
                    self.itemIDs = []
                    self.sr.updateTimer = None
                    self.FlushContent()
                    return
                dist = ball.surfaceDist
                if dist is not None:
                    md = None
                    myball = bp.GetBall(eve.session.shipid)
                    if myball:
                        md = myball.mode
                    text += '<br>' + localization.GetByLabel(
                        'UI/Inflight/ActiveItem/SelectedItemDistance',
                        distToItem=util.FmtDist(dist, maxdemicals=1))
                    if not self.lastActionDist or md != self.lastActionDist[
                            1] or self.CheckDistanceUpdate(
                                self.lastActionDist[0], dist):
                        self.lastActionDist = (dist, md)
                        updateActions = 1
                sec = slimItem.securityStatus
                if sec:
                    text += '<br>' + localization.GetByLabel(
                        'UI/Inflight/ActiveItem/SelectedItemSecurity',
                        secStatus=sec)
            blue.pyos.BeNice()
        corpID = None
        charID = None
        categoryID = None
        bountyItemID = None
        bountyTypeID = None
        bountySlim = None
        displayUtilMenu = False
        if multi > 1:
            text += '<br>' + localization.GetByLabel(
                'UI/Inflight/ActiveItem/MultipleItems', itemCount=multi)
            blue.pyos.BeNice()
        elif multi == 1:
            if slimItems:
                slim = slimItems[0]
                if slim.categoryID == const.categoryShip:
                    if util.IsCharacter(slim.charID):
                        charID = slim.charID
                        categoryID = slim.categoryID
                if slim.categoryID == const.categoryEntity:
                    bountyTypeID = slim.typeID
                elif slim.charID:
                    bountyItemID = slim.charID
                    bountySlim = slim
                killRightID, price = self.bountySvc.GetBestKillRight(
                    slim.charID)
                self.utilMenu.UpdateKillRightInfo(killRightID, price,
                                                  slim.charID, slim.itemID)
                stateSvc = sm.GetService('state')
                if killRightID is not None and not (
                        stateSvc.CheckSuspect(slim)
                        or stateSvc.CheckCriminal(slim)):
                    displayUtilMenu = True
            blue.pyos.BeNice()
        self.sr.utilMenuArea.display = displayUtilMenu
        self.utilMenu.display = displayUtilMenu
        if self.lastIcon != (typeID, itemID, charID):
            uthread.pool('ActiveItem::GetIcon', self.GetIcon, typeID, itemID,
                         charID, corpID, categoryID)
            self.lastIcon = (typeID, itemID, charID)
        else:
            self.sr.iconpar.state = uiconst.UI_PICKCHILDREN
            if categoryID == const.categoryShip and charID:
                self.sr.chariconpar.state = uiconst.UI_PICKCHILDREN
        bountyHint = None
        reducedBountyIndication = None
        if (bountyItemID, bountyTypeID) != self.lastBountyCheck:
            bounty, bountyHint, reducedBountyIndication = self.CheckBounty(
                bountyTypeID, bountySlim)
            blue.pyos.BeNice()
            if bounty:
                self.bounty = localization.GetByLabel('UI/Common/BountyAmount',
                                                      bountyAmount=util.FmtISK(
                                                          bounty, 0))
            else:
                self.bounty = None
            self.lastBountyCheck = (bountyItemID, bountyTypeID)
            self.lastBountyInfo = (bountyHint, reducedBountyIndication)
        else:
            bountyHint, reducedBountyIndication = self.lastBountyInfo
        if self.bounty:
            text += '<br>'
            text += self.bounty
        if reducedBountyIndication:
            text += reducedBountyIndication
        if updateActions:
            self.ReloadActions(slimItems, invItems, fleetMember, fleetSlim)
        else:
            self.CheckActions(1)
        self.SetText(text, bountyHint)
        self.ShowNoSelectedHint()
        blue.pyos.BeNice()
        self.laseUpdateWidth = self.absoluteRight - self.absoluteLeft
        if not self.sr.updateTimer and not invItems:
            self.sr.updateTimer = base.AutoTimer(500, self.UpdateAll)
 def OnMouseEnter(self, *args):
     uicore.animations.FadeIn(self.hilite, 0.05, duration=0.1)
     self.hiliteTimer = base.AutoTimer(1, self._CheckIfStillHilited)
Ejemplo n.º 3
0
    def Startup(self, slimItem):
        sm.RegisterNotify(self)
        obs = sm.GetService('target').IsObserving()
        self.ball = _weakref.ref(
            sm.GetService('michelle').GetBall(slimItem.itemID))
        self.slimItem = _weakref.ref(slimItem)
        self.id = slimItem.itemID
        self.itemID = slimItem.itemID
        self.updatedamage = slimItem.categoryID != const.categoryAsteroid and slimItem.groupID != const.groupHarvestableCloud and slimItem.groupID != const.groupOrbitalTarget
        self.iconSize = iconSize = 94
        barAndImageCont = uicls.Container(parent=self,
                                          name='barAndImageCont',
                                          align=uiconst.TOTOP,
                                          height=100,
                                          state=uiconst.UI_NORMAL)
        iconPar = uicls.Container(parent=barAndImageCont,
                                  name='iconPar',
                                  width=iconSize,
                                  height=iconSize,
                                  align=uiconst.CENTERTOP,
                                  state=uiconst.UI_DISABLED)
        barAndImageCont.OnMouseDown = self.OnTargetMouseDown
        barAndImageCont.OnMouseUp = self.OnTargetMouseUp
        barAndImageCont.OnClick = self.OnTargetClick
        barAndImageCont.GetMenu = self.GetTargetMenu
        barAndImageCont.OnMouseEnter = self.OnTargetMouseEnter
        barAndImageCont.OnMouseExit = self.OnTargetMouseExit
        self.barAndImageCont = barAndImageCont
        maskSize = 50
        iconPadding = (iconSize - maskSize) / 2
        icon = uicls.Icon(
            parent=iconPar,
            left=iconPadding,
            top=iconPadding,
            width=maskSize,
            height=maskSize,
            typeID=slimItem.typeID,
            textureSecondaryPath='res:/UI/Texture/classes/Target/shipMask.png',
            color=(1.0, 1.0, 1.0, 1.0),
            blendMode=1,
            spriteEffect=trinity.TR2_SFX_MODULATE,
            state=uiconst.UI_DISABLED,
            ignoreSize=True)
        if slimItem.groupID == const.groupOrbitalTarget:
            sm.GetService('photo').GetPortrait(slimItem.ownerID, 64, icon)
        if self.updatedamage:
            self.healthBar = uicls.TargetHealthBars(parent=iconPar,
                                                    itemID=self.itemID)
        self.sr.activeTarget = uicls.ActiveTargetOnBracket(parent=iconPar,
                                                           itemID=self.itemID)
        self.sr.iconPar = iconPar
        self.slimForFlag = slimItem
        self.SetStandingIcon()
        self.sr.hilite = uicls.Sprite(
            name='hiliteSprite',
            parent=iconPar,
            left=-5,
            top=-5,
            width=100,
            height=100,
            texturePath='res:/UI/Texture/classes/Target/targetUnderlay.png',
            color=(1.0, 1.0, 1.0, 0.05))
        circle = uicls.Sprite(
            name='circle',
            align=uiconst.CENTER,
            parent=iconPar,
            width=iconSize + 2,
            height=iconSize + 2,
            texturePath='res:/UI/Texture/classes/Target/outerCircle.png',
            color=(1.0, 1.0, 1.0, 0.5),
            state=uiconst.UI_DISABLED)
        self.circle = circle
        self.sr.activeTarget.RotateArrows()
        if not obs:
            labelClass = uicls.EveLabelSmall
        else:
            labelClass = uicls.EveLabelMedium
        labelContainer = uicls.ContainerAutoSize(parent=self,
                                                 name='labelContainer',
                                                 align=uiconst.TOTOP)
        self.sr.label = labelClass(text=' ',
                                   parent=labelContainer,
                                   align=uiconst.TOTOP,
                                   state=uiconst.UI_DISABLED,
                                   maxLines=1)
        self.sr.label2 = labelClass(text=' ',
                                    parent=labelContainer,
                                    align=uiconst.TOTOP,
                                    state=uiconst.UI_DISABLED,
                                    maxLines=1)
        self.sr.shipLabel = labelClass(text=' ',
                                       parent=labelContainer,
                                       align=uiconst.TOTOP,
                                       state=uiconst.UI_DISABLED,
                                       maxLines=1)
        self.sr.distanceLabel = labelClass(text=' ',
                                           parent=labelContainer,
                                           align=uiconst.TOTOP,
                                           state=uiconst.UI_DISABLED,
                                           maxLines=1)
        self.SetTargetLabel()
        self.sr.assignedPar = uicls.Container(name='assignedPar',
                                              align=uiconst.TOTOP,
                                              parent=self,
                                              height=32)
        self.sr.assigned = uicls.Container(name='assigned',
                                           align=uiconst.CENTERTOP,
                                           parent=self.sr.assignedPar,
                                           height=32)
        self.sr.updateTimer = base.AutoTimer(random.randint(750, 1000),
                                             self.UpdateData)
        self.UpdateData()
        selected = sm.GetService('state').GetExclState(state.selected)
        self.Select(selected == slimItem.itemID)
        hilited = sm.GetService('state').GetExclState(state.mouseOver)
        self.Hilite(hilited == slimItem.itemID)
        activeTargetID = sm.GetService('target').GetActiveTargetID()
        self.ActiveTarget(activeTargetID == slimItem.itemID)
        drones = sm.GetService('michelle').GetDrones()
        for key in drones:
            droneState = drones[key]
            if droneState.targetID == self.id:
                self.drones[droneState.droneID] = droneState.typeID

        self.UpdateDrones()
        for moduleInfo in sm.GetService(
                'godma').GetStateManager().GetActiveModulesOnTargetID(
                    slimItem.itemID):
            self.AddWeapon(moduleInfo)
Ejemplo n.º 4
0
 def TryRefreshHistory(self, currentString):
     self.refreshHistoryTimer = base.AutoTimer(
         200, self.TryRefreshHistory_Thread, currentString)
Ejemplo n.º 5
0
 def OnMouseDown(self, mouseBtn, *args):
     if mouseBtn != uiconst.MOUSELEFT:
         return
     self.sr.slideTimer = base.AutoTimer(33, self.UpdateSliderPortion)
Ejemplo n.º 6
0
    def Execute(self, banID, numBans, curBans, deadline, respondToNodeID,
                shipList):
        self.banID = banID
        self.deadline = deadline
        self.respondToNodeID = respondToNodeID
        self.resetButton = uicontrols.Button(
            label='Submit Ban' if numBans > 0 else 'Okay',
            parent=self.sr.main,
            align=uiconst.TOBOTTOM,
            func=self.Submit,
            state=uiconst.UI_NORMAL,
            padding=5)
        uicontrols.EveLabelLarge(text="Let's ban some ships!"
                                 if numBans > 0 else "Here's the bans:",
                                 parent=self.sr.main,
                                 align=uiconst.TOTOP,
                                 top=10,
                                 padding=5,
                                 color=(0.5, 0.5, 1, 1))
        uicontrols.Label(text='You have banned:',
                         parent=self.sr.main,
                         align=uiconst.TOTOP,
                         top=5,
                         padding=5)
        uicontrols.Label(text='<br>'.join(
            [evetypes.GetName(typeID) for typeID in curBans[0]]),
                         padding=5,
                         parent=self.sr.main,
                         align=uiconst.TOTOP)
        uicontrols.Label(text='They have banned:',
                         parent=self.sr.main,
                         align=uiconst.TOTOP,
                         top=5,
                         padding=5)
        uicontrols.Label(text='<br>'.join(
            [evetypes.GetName(typeID) for typeID in curBans[1]]),
                         padding=5,
                         parent=self.sr.main,
                         align=uiconst.TOTOP)
        ships = []
        for typeID in evetypes.GetTypeIDsByCategory(const.categoryShip):
            if typeID in [tup[1] for tup in shipList]:
                if evetypes.IsPublished(typeID):
                    name = evetypes.GetName(typeID)
                    if not name.startswith('[no messageID:'):
                        ships.append((name, typeID))

        banOptions = [('Pass', -1)] + sorted(ships)
        self.banChoices = []
        for banNum in xrange(numBans):
            self.banChoices.append(
                uicontrols.Combo(label='Ban: ',
                                 parent=self.sr.main,
                                 options=banOptions,
                                 top=20,
                                 padding=5,
                                 align=uiconst.TOTOP))

        if numBans > 0:
            banCont = uiprimitives.Container(name='banTimer',
                                             parent=self.sr.main,
                                             align=uiconst.TOTOP,
                                             height=50)
            self.countdownText = uicontrols.Label(parent=banCont,
                                                  align=uiconst.CENTER,
                                                  fontsize=36,
                                                  color=(1, 0, 0, 1))
            self.countdownTimer = base.AutoTimer(100, self.UpdateTimer)
        uicore.registry.SetFocus(self)
        self.MakeUnKillable()
Ejemplo n.º 7
0
 def StartTimer(self):
     self.gotoCount = 0
     self.updateTimer = base.AutoTimer(2000, self.Update)
Ejemplo n.º 8
0
 def OnMouseDown(self, *args):
     if self._propertyName in COMBOPROPERTIES:
         return
     if self._editType in (int, float):
         self._downPos = uicore.uilib.x
         self._updateValue = base.AutoTimer(10, self.ScrollValue)
Ejemplo n.º 9
0
 def ApplyAttributes(self, attributes):
     TargetInBar.ApplyAttributes(self, attributes)
     self.damageTimer = base.AutoTimer(random.randint(750, 1000),
                                       self.UpdateDamage)
Ejemplo n.º 10
0
    def __init__(self):
        self.std_file = None
        self.old_std = sys.stdout

        self.timer = base.AutoTimer(1000, self.flush)
Ejemplo n.º 11
0
 def OnSearchInputChange(self, *args):
     self.searchThread = base.AutoTimer(250, self.SearchTree)
Ejemplo n.º 12
0
 def StartPartitionDisplayTimer(self, boxsize=7):
     self.StopPartitionDisplayTimer()
     settings.user.ui.Set('partition_box_size', boxsize)
     self.partitionDisplayTimer = base.AutoTimer(
         50, self.UpdatePartitionDisplay)
Ejemplo n.º 13
0
    def Startup(self, slimItem):
        sm.RegisterNotify(self)
        self.ball = _weakref.ref(
            sm.GetService('michelle').GetBall(slimItem.itemID))
        self.slimItem = _weakref.ref(slimItem)
        self.id = slimItem.itemID
        self.itemID = slimItem.itemID
        self.updatedamage = slimItem.categoryID != const.categoryAsteroid and slimItem.groupID != const.groupHarvestableCloud
        iconPar = uiprimitives.Container(parent=self,
                                         width=64,
                                         height=64,
                                         align=uiconst.TOPLEFT,
                                         state=uiconst.UI_DISABLED)
        icon = uicontrols.Icon(parent=iconPar,
                               align=uiconst.TOALL,
                               typeID=slimItem.typeID,
                               size=64)
        self.sr.iconPar = iconPar
        self.slimForFlag = slimItem
        self.SetStandingIcon()
        self.sr.hilite = uiprimitives.Fill(parent=iconPar,
                                           color=(1.0, 1.0, 1.0, 0.125),
                                           state=uiconst.UI_HIDDEN)
        self.sr.activeTarget = xtriui.ActiveTarget(parent=iconPar)
        rot = uiutil.GetChild(self.sr.activeTarget, 'rotate')
        sm.GetService('ui').Rotate(rot, 2.0, timeFunc=blue.os.GetSimTime)
        sm.GetService('ui').BlinkSpriteA(rot.children[0],
                                         1.0,
                                         500.0,
                                         0,
                                         timeFunc=blue.os.GetSimTime)
        self.sr.diode = uiprimitives.Fill(parent=self,
                                          color=(0.0, 1.0, 0.0, 1.0),
                                          align=uiconst.TOLEFT,
                                          width=6,
                                          state=uiconst.UI_HIDDEN)
        self.sr.diode.state = uiconst.UI_HIDDEN
        labelClass = uicontrols.EveLabelSmall
        self.sr.label = labelClass(text=' ',
                                   parent=self,
                                   left=0,
                                   top=68,
                                   width=96,
                                   state=uiconst.UI_DISABLED)
        self.SetTargetLabel()
        self.sr.assigned = uiprimitives.Container(name='assigned',
                                                  align=uiconst.TOPLEFT,
                                                  parent=self,
                                                  width=32,
                                                  height=128,
                                                  left=64)
        self.sr.updateTimer = base.AutoTimer(random.randint(750, 1000),
                                             self.UpdateData)
        self.UpdateData()
        selected = sm.GetService('state').GetExclState(state.selected)
        self.Select(selected == slimItem.itemID)
        hilited = sm.GetService('state').GetExclState(state.mouseOver)
        self.Hilite(hilited == slimItem.itemID)
        activeTargetID = sm.GetService('target').GetActiveTargetID()
        self.ActiveTarget(activeTargetID == slimItem.itemID)
        drones = sm.GetService('michelle').GetDrones()
        for key in drones:
            droneState = drones[key]
            if droneState.targetID == self.id:
                self.drones[droneState.droneID] = droneState.typeID

        self.UpdateDrones()
Ejemplo n.º 14
0
    def Setup(self, moduleinfo):
        targetContainer = uicls.Container(name='targetCont',
                                          align=uiconst.TOPLEFT,
                                          parent=self,
                                          top=0,
                                          height=64,
                                          width=64)
        slot = DefenceModuleButton(parent=targetContainer, idx=0)
        self.sr.targetIcon = uiutil.GetChild(targetContainer, 'iconSprite')
        self.sr.targetContainer = targetContainer
        self.sr.targetContainer.state = uiconst.UI_DISABLED
        sourceContainer = uicls.Container(name='sourceCont',
                                          align=uiconst.TOPLEFT,
                                          parent=self,
                                          top=targetContainer.height + 22,
                                          height=64,
                                          width=64)
        slot = DefenceModuleButton(parent=sourceContainer, idx=0)
        self.sr.sourceIcon = uiutil.GetChild(sourceContainer, 'iconSprite')
        self.sr.sourceIcon.state = uiconst.UI_DISABLED
        self.sr.glow = uiutil.GetChild(sourceContainer, 'glow')
        self.sr.busy = uiutil.GetChild(sourceContainer, 'busy')
        self.sr.quantityParent = uiutil.GetChild(sourceContainer,
                                                 'quantityParent')
        self.sr.quantityParent.left = 8
        self.sr.quantityParent.width = 28
        idx = self.parent.children.index(self)
        fill = uicls.Fill(parent=self,
                          color=(1.0, 1.0, 1.0, 0.125),
                          state=uiconst.UI_HIDDEN,
                          idx=idx)
        self.sr.hilite = fill
        self.sr.sourceContainer = sourceContainer
        self.sr.sourceContainer.state = uiconst.UI_DISABLED
        chargeIcon = uicls.Icon(parent=sourceContainer,
                                align=uiconst.RELATIVE,
                                top=32,
                                left=6,
                                size=24,
                                idx=0,
                                state=uiconst.UI_HIDDEN,
                                ignoreSize=True)
        self.sr.chargeIcon = chargeIcon
        if not len(self.__cgattrs__):
            self.__cgattrs__.extend([
                a.attributeID for a in cfg.dgmattribs
                if cgre.match(a.attributeName) is not None
            ])
        self.sr.typeID = moduleinfo.typeID
        invType = cfg.invtypes.Get(moduleinfo.typeID)
        group = cfg.invtypes.Get(moduleinfo.typeID).Group()
        self.sr.moduleInfo = moduleinfo
        self.locationFlag = moduleinfo.flagID
        self.sr.sourceID = moduleinfo.itemID
        self.id = moduleinfo.itemID
        self.sr.glow.z = 0
        self.sr.qtylabel = uicls.Label(text='',
                                       parent=self.sr.quantityParent,
                                       width=30,
                                       state=uiconst.UI_DISABLED,
                                       idx=0,
                                       fontsize=9)
        self.sr.distancelabel = uicls.EveHeaderSmall(
            text='',
            parent=self.sr.targetContainer,
            left=12,
            top=-16,
            width=70,
            state=uiconst.UI_DISABLED,
            idx=0)
        if cfg.IsChargeCompatible(moduleinfo):
            self.invCookie = sm.GetService('inv').Register(self)
        self.SetCharge(None)
        for key in moduleinfo.effects.iterkeys():
            effect = moduleinfo.effects[key]
            if self.IsEffectActivatible(effect):
                self.def_effect = effect
                if effect.isActive:
                    self.SetActive()
            if effect.effectName == 'online':
                if effect.isActive:
                    self.ShowOnline()
                else:
                    self.ShowOffline()

        self.state = uiconst.UI_NORMAL
        currentTarget = self.GetCurrentTarget()
        if currentTarget is not None:
            uthread.pool('DefenceMobuleButton::OnTargetAdded::',
                         self.OnTargetAdded, currentTarget)
        self.sr.sourceUpdateTimer = base.AutoTimer(random.randint(750, 1000),
                                                   self.UpdateData, 'source')
        self.UpdateData('source')
        self.sr.targetUpdateTimer = base.AutoTimer(random.randint(750, 1000),
                                                   self.UpdateData, 'target')
        self.UpdateData('target')
        self.UpdateDistance()
        self.sr.distanceUpdateTimer = base.AutoTimer(
            random.randint(5000, 6000), self.UpdateDistance)
        self.EnableDrag()
        uthread.new(self.BlinkIcon)
Ejemplo n.º 15
0
 def OnResizeUpdate(self, *args):
     if self and not self.destroyed:
         self.sr.resizeTimer = base.AutoTimer(250, self.OnEndScale_)
Ejemplo n.º 16
0
 def _OnSizeChange_NoBlock(self, *args):
     self.sr.resizeTimer = base.AutoTimer(250, self.OnEndScale_)
Ejemplo n.º 17
0
 def OnPortraitEnter(self, portrait, *args):
     portrait.sr.button.state = uiconst.UI_NORMAL
     portrait.sr.mouseOverTimer = base.AutoTimer(
         33.0, self.CheckPortraitMouseOver, portrait)
Ejemplo n.º 18
0
    def RubberbandSelection_thread(self, *args):
        """
        Handles mouse movement event for the scroll
        to resize and display the multi-select container
        """
        while self.dragStart and uicore.uilib.leftbtn and trinity.app.IsActive():
            startX, startY = self.dragStart
            currentX, currentY = uicore.uilib.x - self.scroll.GetContentContainer().absoluteLeft, uicore.uilib.y - self.scroll.GetContentContainer().absoluteTop
            if startX > currentX:
                temp = currentX
                currentX = startX
                startX = temp
            if startY > currentY:
                temp = currentY
                currentY = startY
                startY = temp
            left = max(startX, 0)
            width = min(currentX, self.scroll.GetContentContainer().width) - max(startX, 0)
            top = max(startY, 0)
            height = min(currentY, self.scroll.GetContentContainer().height) - max(startY, 0)
            self.dragContainer.left = left
            self.dragContainer.top = top
            self.dragContainer.width = width
            self.dragContainer.height = height
            self.dragContainer.Show()
            if not self.scrollTimer:
                self.scrollTimer = base.AutoTimer(250, self.ScrollTimer)
            import listentry
            for each in self.scroll.GetContentContainer().children:
                if isinstance(each, listentry.VirtualContainerRow):
                    if each.top >= startY and each.top + each.height <= currentY or each.top + each.height >= startY and each.top <= currentY:
                        for icon in each.sr.icons:
                            if icon.left >= startX and icon.left + icon.width <= currentX or icon.left + icon.width >= startX and icon.left <= currentX:
                                if icon in self.previouslyHighlighted:
                                    if uicore.uilib.Key(uiconst.VK_SHIFT):
                                        icon.Select()
                                    elif uicore.uilib.Key(uiconst.VK_CONTROL):
                                        icon.Deselect()
                                else:
                                    icon.Select()
                            elif icon not in self.previouslyHighlighted:
                                icon.Deselect()
                            else:
                                icon.Select()

                    else:
                        for icon in each.sr.icons:
                            if icon not in self.previouslyHighlighted:
                                icon.Deselect()
                            else:
                                icon.Select()

                elif isinstance(each, listentry.InvItem):
                    if each.top >= startY and each.top + each.height <= currentY or each.top + each.height >= startY and each.top <= currentY:
                        each.Select()
                        if each in self.previouslyHighlighted:
                            if uicore.uilib.Key(uiconst.VK_SHIFT):
                                each.Select()
                            elif uicore.uilib.Key(uiconst.VK_CONTROL):
                                each.Deselect()
                        else:
                            each.Select()
                    elif each not in self.previouslyHighlighted:
                        each.Deselect()
                    else:
                        each.Select()

            blue.pyos.synchro.SleepSim(10)

        self.scrollTimer = None
        self.dragStart = None
        self.previouslyHighlighted = None
        self.scrollTimer = None
        self.dragContainer.Hide()
Ejemplo n.º 19
0
 def OnMouseDown(self, *args):
     if uicore.uilib.leftbtn:
         sm.StartService('audio').SendUIEvent(
             unicode('wise:/ui_icc_button_mouse_down_play'))
         self.UpdateMarkerPosition(jump=True)
         self.sr.updateTimer = base.AutoTimer(10, self.UpdateSlider)
Ejemplo n.º 20
0
 def OnMouseEnter(self, *args):
     self.headerButtons.Show()
     self.closeButtonTimer = base.AutoTimer(2000, self.headerButtons.Hide)
Ejemplo n.º 21
0
 def _OnResize(self, *args):
     if self.rendering:
         return
     if self.typerecord:
         self.sr.updateTimer = base.AutoTimer(500, self.UpdateSize)
Ejemplo n.º 22
0
 def _OnResize(self, *args):
     if self.tabs and self.tabs.GetSelectedArgs() in ('memory',
                                                      'performance',
                                                      'heap'):
         self.GetWnd().sr.updateTimer = base.AutoTimer(500, self.UpdateSize)
Ejemplo n.º 23
0
 def OnMouseEnter(self, *args):
     self.sr.softSlideTimer = base.AutoTimer(33, self.UpdateSoftSliderPortion)
Ejemplo n.º 24
0
 def OnMouseEnter(self, *args):
     uicore.animations.FadeTo(self.icon, startVal=self.icon.color.a, endVal=1.0, duration=0.125, loops=1)
     if self.hiliteTimer is None:
         self.hiliteTimer = base.AutoTimer(111, self.CheckIfMouseOver)
Ejemplo n.º 25
0
    def LoadNotesData(self):
        notes = sm.RemoteSvc('charMgr').GetOwnerNoteLabels()
        folders = []
        self.folderIDs = []
        badNotes = [ note for note in notes if note.label[0] not in ('I', 'B', 'N', 'S') ]
        bms = sm.GetService('bookmarkSvc').GetBookmarks()
        for entry in notes:
            if entry.label[0] in ('I', 'B', 'N') and entry.label[1] == ':':
                n = util.KeyVal()
                n.noteID = entry.noteID
                n.text = None
                if entry.label[0] == 'N':
                    n.label = entry.label[2:]
                    self.notes['N:' + str(entry.noteID)] = n
                elif entry.label[0] == 'B':
                    n.bookmarkID = entry.label[2:]
                    if int(n.bookmarkID) in bms:
                        self.bookmarknotes['B:' + str(n.bookmarkID)] = n
                    else:
                        badNotes.append(entry)
            if entry.label.startswith('S:'):
                label = entry.label[2:]
                if self.settings.has_key(label):
                    self.settings[label].append(entry.noteID)
                else:
                    self.settings[label] = [entry.noteID]

        parallelCalls = []
        for note in badNotes:
            parallelCalls.append((sm.RemoteSvc('charMgr').RemoveOwnerNote, (note.noteID,)))

        if len(parallelCalls):
            uthread.parallel(parallelCalls)
        folders = self.GetSetting('Folders')
        if folders is not None:
            for entry in folders.split('|'):
                tmp = entry.split('::')
                if len(tmp) != 4:
                    continue
                id, _type, parentID, label = tmp
                n = util.KeyVal()
                n.type = _type
                if parentID == 'None':
                    parentID = 0
                n.parent = int(parentID)
                n.data = label
                self.folders[int(id)] = n
                self.lastid = max(self.lastid, int(id))

        else:
            n = util.KeyVal()
            n.type = 'F'
            n.parent = 0
            n.data = localization.GetByLabel('UI/Notepad/Main')
            self.folders[1] = n
            self.lastid = 1
        self.starting = 0
        self.LoadNotes()
        self.sr.autosaveTimer = base.AutoTimer(60000, self.SaveNote)
        self.activeNode = None
        self.ShowNote(settings.char.notepad.Get('activeNote', None))
Ejemplo n.º 26
0
 def OnLSC(self, channelID, estimatedMemberCount, method, identityInfo,
           args):
     # logmodule.general.Log("AutoAlert Processing....method:%s chID:%s  id:%s"%(method,channelID,identityInfo),logmodule.LGNOTICE)
     AllianceID, CorpID, CfgLine, Role, CorpRole, WarFac = identityInfo
     Charname = None
     SolarsystemID = None
     # self.__timer=AutoTimer(5000,self.__SendMessage)
     if type(CfgLine) == types.IntType:
         CharID = CfgLine
     else:
         CharID = CfgLine[0]
         Charname = CfgLine[1]
     if method == "JoinChannel" and self.__alertchannel != 0:
         # logmodule.general.Log("Detected ID:%s(%s) entering" % (Charname, CharID), logmodule.LGNOTICE)
         # 判断是否为本地
         if type(channelID) == types.IntType:
             # logmodule.general.Log("Not Local CH", logmodule.LGNOTICE)
             return
         if channelID[0][0] != "solarsystemid2":
             # logmodule.general.Log("Not Local CH", logmodule.LGNOTICE)
             return
         SolarsystemID = channelID[0][1]
         if self.Ishostile(CharID):  # 判断声望
             # logmodule.general.Log("Sending Alert Message", logmodule.LGNOTICE)
             charInfo = cfg.eveowners.Get(CharID)
             charText = GetShowInfoLink(charInfo.typeID,
                                        charInfo.name,
                                        itemID=CharID)
             systemText = GetShowInfoLink(
                 const.typeSolarSystem,
                 cfg.evelocations.Get(SolarsystemID).name, SolarsystemID)
             msg = "%s %s" % (charText, systemText)
             if self.__isinstant:
                 sm.GetService('LSC').SendMessage(self.__alertchannel,
                                                  msg)  # 往服务器发送
                 sm.GetService('LSC').GetChannelWindow(
                     self.__alertchannel).Speak(msg,
                                                eve.session.charid,
                                                localEcho=True)  # 本地聊天框刷新
             else:
                 self.__AddMessage(charText, systemText)
             # logmodule.general.Log("Cached Alert Message", logmodule.LGNOTICE)
         else:
             pass
             # logmodule.general.Log("Safe", logmodule.LGNOTICE)
     elif method == "SendMessage":
         if CharID == session.charid:  # 发言的是自己才有效
             if args[0] == ".startalert":
                 if type(channelID) != types.IntType:
                     return
                 if self.__alertchannel != 0:
                     sm.GetService('LSC').GetChannelWindow(
                         self.__alertchannel).Speak(
                             u"AutoAlert:Alert havs already started",
                             eve.session.charid,
                             localEcho=True)
                 self.__alertchannel = channelID
                 # logmodule.general.Log(u"Alert Channel Set. CH is %s" % str(self.__alertchannel), logmodule.LGNOTICE)
                 sm.GetService('LSC').GetChannelWindow(
                     self.__alertchannel).Speak(u"AutoAlert:Alert started",
                                                eve.session.charid,
                                                localEcho=True)  # 本地聊天框刷新
                 if not self.__isinstant:
                     self.__timer = base.AutoTimer(
                         self.__timer_interval, self.__SendMessage)  #开启定时器
             elif args[0] == ".stopalert":
                 if self.__alertchannel == 0:
                     sm.GetService('LSC').GetChannelWindow(
                         self.__alertchannel).Speak(
                             u"AutoAlert:Alert has already stopped",
                             eve.session.charid,
                             localEcho=True)
                     return
                 sm.GetService('LSC').GetChannelWindow(
                     self.__alertchannel).Speak(u"AutoAlert:Alert stopped",
                                                eve.session.charid,
                                                localEcho=True)
                 self.__alertchannel = 0
                 self.__timer = None