def ApplyAttributes(self, attributes):
     uicontrols.Window.ApplyAttributes(self, attributes)
     self.folder = attributes.get('folder', None)
     self.ownerID = None
     if self.folder is None:
         self.SetCaption(localization.GetByLabel('UI/PeopleAndPlaces/NewFolder'))
         self.isNew = True
     else:
         self.SetCaption(localization.GetByLabel('UI/PeopleAndPlaces/EditFolder'))
         self.isNew = False
     self.SetMinSize([280, 110])
     main = uiprimitives.Container(name='main', parent=self.sr.main, align=uiconst.TOALL, left=4, width=4)
     labelContainer = uiprimitives.Container(name='labelContainer', parent=main, align=uiconst.TOTOP, top=8, height=20, padding=(2, 2, 2, 2))
     uicontrols.EveLabelMedium(text=localization.GetByLabel('UI/PeopleAndPlaces/Name'), parent=labelContainer, align=uiconst.TOLEFT, width=60)
     self.nameEdit = uicontrols.SinglelineEdit(name='nameEdit', setvalue=self.folder.folderName if self.folder else '', parent=labelContainer, align=uiconst.TOALL, width=0)
     self.nameEdit.OnReturn = self.Confirm
     sectionContainer = uiprimitives.Container(name='sectionContainer', parent=main, align=uiconst.TOTOP, top=8, height=20, padding=(2, 2, 2, 2))
     uicontrols.EveLabelMedium(text=localization.GetByLabel('UI/PeopleAndPlaces/LocationSection'), parent=sectionContainer, align=uiconst.TOLEFT, width=60)
     if not self.isNew or util.IsNPCCorporation(session.corpid):
         if not self.isNew and self.folder.ownerID == session.corpid:
             sectionName = localization.GetByLabel('UI/PeopleAndPlaces/CorporationLocations')
             self.ownerID = session.corpid
         else:
             sectionName = localization.GetByLabel('UI/PeopleAndPlaces/PersonalLocations')
             self.ownerID = session.charid
         uicontrols.EveLabelMedium(text=sectionName, parent=sectionContainer, align=uiconst.TOALL, width=60)
     else:
         ownerID = settings.char.ui.Get('bookmarkFolderDefaultOwner', session.charid)
         self.sectionCombo = uicontrols.Combo(name='sectionCombo', parent=sectionContainer, align=uiconst.TOALL, width=0, select=ownerID, options=[(localization.GetByLabel('UI/PeopleAndPlaces/PersonalLocations'), session.charid), (localization.GetByLabel('UI/PeopleAndPlaces/CorporationLocations'), session.corpid)])
     buttons = self.GetButtons()
     buttonGroup = uicontrols.ButtonGroup(name='buttonGroup', parent=main, btns=buttons)
     submitButton = buttonGroup.GetBtnByIdx(0)
     submitButton.OnSetFocus()
Beispiel #2
0
def OwnerAccess(session, ownerID, locationID=None, flagID=None):
    if not session or session.role & service.ROLE_SERVICE:
        return True
    if util.IsCharacter(ownerID):
        if session.charid != ownerID and session.role & service.ROLE_SERVICE == 0:
            return False
    elif util.IsCorporation(ownerID) and not util.IsNPCCorporation(ownerID):
        if not session.corprole & const.corpRoleFactoryManager:
            return False
        if session.corpid != ownerID and session.role & service.ROLE_SERVICE == 0:
            return False
    else:
        return False
    if locationID and flagID and not CanViewItem(session, ownerID, locationID,
                                                 flagID):
        return False
    return True
    def GetFolderOptions(self):
        options = []
        locations = [
            (session.charid,
             localization.GetByLabel('UI/PeopleAndPlaces/PersonalLocations'))
        ]
        if not util.IsNPCCorporation(session.corpid):
            locations.append((session.corpid,
                              localization.GetByLabel(
                                  'UI/PeopleAndPlaces/CorporationLocations')))
        for ownerID, label in locations:
            folders = sm.GetService('bookmarkSvc').GetFoldersForOwner(ownerID)
            options.append((label, (ownerID, None)))
            subFolders = [('  ' + folder.folderName,
                           (ownerID, folder.folderID)) for folder in folders]
            subFolders = localization.util.Sort(subFolders, key=lambda x: x[0])
            options.extend(subFolders)

        return options
Beispiel #4
0
    def ShowPlaces(self):
        self.semaphore.acquire()
        try:
            self.ShowLoad()
            try:
                self.sr.bookmarkbtns.state = uiconst.UI_PICKCHILDREN
                locations = []
                for bm in sm.GetService(
                        'bookmarkSvc').GetAllBookmarks().itervalues():
                    if bm.itemID is not None:
                        locations.append(bm.itemID)
                    if bm.locationID is not None:
                        locations.append(bm.locationID)

                if len(locations):
                    cfg.evelocations.Prime(locations, 0)
                scrolllist = self.GetSectionList(session.charid)
                if not util.IsNPCCorporation(session.corpid):
                    scrolllist.extend(self.GetSectionList(session.corpid))
                scrolllist.extend(self.GetAgentPlacesScrollList())
                self.sr.scroll.sr.iconMargin = 18
                scrollToProportion = 0
                if getattr(self, 'lastTab', '') == 'places':
                    scrollToProportion = self.sr.scroll.GetScrollProportion()
                self.sr.scroll.Load(contentList=scrolllist,
                                    fixedEntryHeight=None,
                                    headers=self.placesHeaders,
                                    scrollTo=scrollToProportion,
                                    noContentHint=localization.GetByLabel(
                                        'UI/PeopleAndPlaces/NoKnownPlaces'))
            finally:
                if not self.destroyed:
                    self.HideLoad()

        finally:
            self.semaphore.release()