def MakeCharacterDragObject(self, charid): typeID = cfg.eveowners.Get(charid).typeID fakeNode = KeyVal() fakeNode.charID = charid fakeNode.info = cfg.eveowners.Get(charid) fakeNode.itemID = charid fakeNode.__guid__ = 'listentry.User' return [fakeNode]
def GetDragData(self, *args): if self and not self.destroyed: fakeNode = KeyVal() fakeNode.charID = self.charID fakeNode.typeID = self.info.typeID fakeNode.info = self.info fakeNode.itemID = self.itemID fakeNode.__guid__ = 'listentry.User' return [fakeNode] else: return []
def LoadContent(self): if self.contentLoaded: return self.contentLoaded = True self.filler = Frame(name='myFrame', bgParent=self, texturePath='res:/UI/Texture/classes/Notifications/historyBackReadUp.png', cornerSize=6, offset=-5) self.leftContainer = Container(name='leftContainer', width=40, padding=(5, 5, 10, 5), parent=self, align=uiconst.TOLEFT) self.rightContainer = ContainerAutoSize(name='rightContainer', width=MAINAREA_WIDTH, parent=self, align=uiconst.TOLEFT) self.titleLabel = EveLabelMedium(name='subject', parent=self.rightContainer, align=uiconst.TOTOP, text=self.title, padding=TITLE_PADDING, bold=True) if self.subtext: self.subtextLabel = EveLabelMedium(name='subtext', parent=self.rightContainer, align=uiconst.TOTOP, text=self.subtext, padding=SUBTEXT_PADDING) if self.notification: texture = self.GetTexturePathForNotification(self.notification.typeID) else: texture = 'res:/ui/Texture/WindowIcons/bountyoffice.png' self.imageSprite = Sprite(name='MySprite', parent=self.leftContainer, texturePath=texture, align=uiconst.TOPLEFT, width=40, height=40) self.characterSprite = Sprite(name='CharacterSprite', parent=self.leftContainer, texturePath=texture, align=uiconst.TOPLEFT, width=40, height=40, state=uiconst.UI_HIDDEN) if self.created: timeinterval = max(blue.os.GetWallclockTime() - self.created, 0) createdText = localization.GetByLabel('Notifications/NotificationWidget/NotificationTimeAgo', time=timeinterval) self.timeLabel = EveLabelSmall(name='timeLabel', parent=self.rightContainer, align=uiconst.TOTOP, color=(0.5, 0.5, 0.5), padding=TIMETEXT_PADDING) self.timeLabel.text = createdText notification = self.notification if notification.typeID in [notificationConst.notificationTypeKillReportFinalBlow, notificationConst.notificationTypeKillReportVictim]: shipTypeID = KillMailFinalBlowFormatter.GetVictimShipTypeID(notification.data) if shipTypeID is not None: parentContainer = self.leftContainer Icon(parent=parentContainer, align=uiconst.TOPRIGHT, size=40, typeID=shipTypeID) shipTechIcon = Sprite(name='techIcon', parent=parentContainer, width=16, height=16, idx=0) uiUtils.GetTechLevelIcon(shipTechIcon, 0, shipTypeID) self.imageSprite.GetDragData = lambda *args: self.MakeKillDragObject(notification) if self.ShouldDisplayPortrait(notification): item = cfg.eveowners.Get(notification.senderID) if item.IsCharacter(): sm.GetService('photo').GetPortrait(notification.senderID, 128, self.characterSprite) if notification.typeID in notificationConst.notificationShowStanding: charinfo = item self.imageSprite.GetMenu = lambda : sm.GetService('menu').GetMenuFormItemIDTypeID(notification.senderID, charinfo.typeID) self.imageSprite.GetDragData = lambda *args: self.MakeCharacterDragObject(notification.senderID) charData = KeyVal() charData.charID = notification.senderID charData.charinfo = charinfo AddAndSetFlagIconFromData(charData, parentCont=self.leftContainer, top=self.characterSprite.height - 10) else: self.corpLogo = GetLogoIcon(itemID=notification.senderID, parent=self.leftContainer, align=uiconst.TOPLEFT, size=40, state=uiconst.UI_DISABLED, ignoreSize=True) self.characterSprite.state = uiconst.UI_NORMAL
def GetStateFlagFromData(data): charID = getattr(data, 'charID', 0) if charID == session.charid: return fakeSlimItem = KeyVal() fakeSlimItem.ownerID = charID fakeSlimItem.charID = charID fakeSlimItem.corpID = data.Get('corpID', 0) fakeSlimItem.allianceID = data.Get('allianceID', 0) fakeSlimItem.warFactionID = data.Get('warFactionID', 0) if getattr(data, 'bounty', None): if data.bounty.bounty > 0.0: fakeSlimItem.bounty = data.bounty fakeSlimItem.groupID = data.Get('groupID', inventoryConst.groupCharacter) fakeSlimItem.categoryID = data.Get('categoryID', inventoryConst.categoryOwner) fakeSlimItem.securityStatus = data.Get('securityStatus', None) flag = sm.GetService('state').CheckStates(fakeSlimItem, 'flag') return flag
def LoadJoinRequests(self): scrolllist = [] for joinRequest in sm.GetService( 'fleet').GetJoinRequests().itervalues(): if joinRequest is None: continue name = localization.GetByLabel('UI/Common/CharacterNameLabel', charID=joinRequest.charID) data = KeyVal() data.label = name data.props = None data.checked = False data.charID = joinRequest.charID data.retval = None data.hint = None scrolllist.append( (name, listentry.Get('JoinRequestField', data=data))) scrolllist = uiutil.SortListOfTuples(scrolllist) self.sr.scroll.Load(contentList=scrolllist)
def LoadContent(self): if self.contentLoaded: return self.contentLoaded = True self._CreateMainBackground() self._CreatePanels() self._CreateNotificationText() self._CreateNotificationImage() if self.created: timeinterval = max(blue.os.GetWallclockTime() - self.created, 0) createdText = localization.GetByLabel(TIME_AGO_LABEL, time=timeinterval) self.timeLabel = EveLabelSmall(name='timeLabel', parent=self.rightContainer, align=uiconst.TOTOP, color=TIMETEXT_COLOR, padding=TIMETEXT_PADDING) self.timeLabel.text = createdText notification = self.notification if notification.typeID in [ notificationConst.notificationTypeKillReportFinalBlow, notificationConst.notificationTypeKillReportVictim ]: shipTypeID = KillMailFinalBlowFormatter.GetVictimShipTypeID( notification.data) if shipTypeID is not None: parentContainer = self.leftContainer Icon(name='shipTypeIcon', parent=parentContainer, align=uiconst.TOPRIGHT, size=SHIP_TYPE_ICON_SIZE, typeID=shipTypeID) shipTechIcon = Sprite(name='shipTechIcon', parent=parentContainer, width=SHIP_TECH_ICON_SIZE, height=SHIP_TECH_ICON_SIZE, idx=0) uiUtils.GetTechLevelIcon(shipTechIcon, 0, shipTypeID) self.imageSprite.GetDragData = lambda *args: self.MakeKillDragObject( notification) if self.ShouldDisplayPortrait(notification): item = cfg.eveowners.Get(notification.senderID) if item.IsCharacter(): sm.GetService('photo').GetPortrait(notification.senderID, CHAR_PORTRAIT_SIZE, self.characterSprite) if notification.typeID in notificationConst.notificationShowStanding: charinfo = item self.imageSprite.GetMenu = lambda: sm.GetService( 'menu').GetMenuFormItemIDTypeID( notification.senderID, charinfo.typeID) self.imageSprite.GetDragData = lambda *args: self.MakeCharacterDragObject( notification.senderID) charData = KeyVal() charData.charID = notification.senderID charData.charinfo = charinfo AddAndSetFlagIconFromData(charData, parentCont=self.leftContainer, top=self.characterSprite.height - FLAG_ICON_PADDING) else: self.corpLogo = GetLogoIcon(itemID=notification.senderID, parent=self.leftContainer, align=uiconst.TOPLEFT, size=CORP_LOGO_SIZE, state=uiconst.UI_DISABLED, ignoreSize=True) self.characterSprite.state = uiconst.UI_NORMAL
def LoadComposition(self): fleetSvc = sm.GetService('fleet') if not fleetSvc.IsCommanderOrBoss(): raise UserError('FleetNotCommanderOrBoss') scrolllist = [] composition = fleetSvc.GetFleetComposition() fleetHierarchy = fleetSvc.GetFleetHierarchy() fleetPositionText = localization.GetByLabel( 'UI/Fleet/FleetWindow/FleetPosition') for kv in composition: blue.pyos.BeNice() member = fleetSvc.GetMemberInfo(kv.characterID, fleetHierarchy) if not fleetSvc.IsMySubordinate( kv.characterID) and not fleetSvc.IsBoss(): continue data = KeyVal() charName = localization.GetByLabel('UI/Common/CharacterNameLabel', charID=kv.characterID) locationName = localization.GetByLabel('UI/Common/LocationDynamic', location=kv.solarSystemID) if kv.stationID: locationName = '%s %s' % ( locationName, localization.GetByLabel('UI/Fleet/FleetComposition/Docked') ) if kv.shipTypeID is not None: shipTypeName = evetypes.GetName(kv.shipTypeID) shipGroupName = evetypes.GetGroupName(kv.shipTypeID) else: shipTypeName = '' shipGroupName = '' if kv.skills: skillLevels = localization.GetByLabel( 'UI/Fleet/FleetComposition/SkillLevels', skillLevelA=kv.skills[2], skillLevelB=kv.skills[1], skillLevelC=kv.skills[0]) data.hint = localization.GetByLabel( 'UI/Fleet/FleetComposition/SkillsHint', skillTypeA=kv.skillIDs[2], skillLevelA=kv.skills[2], skillTypeB=kv.skillIDs[1], skillLevelB=kv.skills[1], skillTypeC=kv.skillIDs[0], skillLevelC=kv.skills[0]) else: skillLevels = '' if not member.wingName: fleetPosition = '' positionSortValue = (None, None) elif not member.squadName: fleetPosition = member.wingName positionSortValue = (fleetPosition, None) else: fleetPosition = '%s / %s ' % (member.wingName, member.squadName) positionSortValue = (member.wingName, member.squadName) data.label = '<t>'.join([ charName, locationName, shipTypeName, shipGroupName, member.roleName, skillLevels, fleetPosition ]) data.GetMenu = self.OnCompositionEntryMenu data.cfgname = charName data.retval = None data.charID = kv.characterID data.shipTypeID = kv.shipTypeID data.solarSystemID = kv.solarSystemID data.info = cfg.eveowners.Get(kv.characterID) data.Set('sort_%s' % fleetPositionText, positionSortValue) scrolllist.append(listentry.Get('FleetCompositionEntry', data=data)) self.counterLabel.text = localization.GetByLabel( 'UI/Fleet/FleetComposition/PilotsSelected', numSelected=0, numTotalPilots=len(scrolllist)) self.sr.scrollBroadcasts.sr.id = 'scrollComposition' headers = [ localization.GetByLabel('UI/Common/Name'), localization.GetByLabel('UI/Common/Location'), localization.GetByLabel('UI/Fleet/FleetComposition/ShipType'), localization.GetByLabel('UI/Fleet/FleetComposition/ShipGroup'), localization.GetByLabel('UI/Fleet/FleetComposition/FleetRole'), localization.GetByLabel('UI/Fleet/FleetComposition/FleetSkills'), fleetPositionText ] self.sr.scrollBroadcasts.Load(headers=headers, contentList=scrolllist)