Exemplo n.º 1
0
 def GetDragData(self, *args):
     if getattr(self, 'url', None) and getattr(self, 'linkText', None):
         entry = Bunch()
         entry.__guid__ = 'TextLink'
         entry.url = self.url
         entry.displayText = self.linkText
         return [entry]
Exemplo n.º 2
0
 def GetDragData(self, *args):
     if getattr(self, 'url', None) and getattr(self, 'linkText', None):
         entry = Bunch()
         entry.__guid__ = 'TextLink'
         entry.url = self.url
         entry.displayText = self.linkText
         return [entry]
Exemplo n.º 3
0
    def LoadProfileList(self):
        selectedProfileID = self.structureBrowserController.GetSelectedProfileID(
        )
        profileControllers = self.allStructuresProfileController.GetProfiles()
        scrollList = []
        for profileID, eachProfileController in profileControllers.iteritems():
            nodeData = Bunch(
                decoClass=StructureProfileEntry,
                profileController=eachProfileController,
                allStructuresProfileController=self.
                allStructuresProfileController,
                structureBrowserController=self.structureBrowserController,
                isSelected=profileID == selectedProfileID)
            sortValue = eachProfileController.GetProfileName().lower()
            scrollList.append((sortValue, nodeData))

        scrollList = SortListOfTuples(scrollList)
        anyProfileText = GetByLabel('UI/Structures/Browser/AnyProfile')
        anyProfileDesc = GetByLabel('UI/StructureProfiles/AnyProfileDesc')
        controllerForShowAll = SlimStructureAllProfilesController(
            ALL_PROFILES,
            profileData=KeyVal(name=anyProfileText,
                               description=anyProfileDesc))
        nodeData = Bunch(
            decoClass=StructureAllProfilesEntry,
            profileController=controllerForShowAll,
            allStructuresProfileController=self.allStructuresProfileController,
            structureBrowserController=self.structureBrowserController,
            isSelected=ALL_PROFILES == selectedProfileID)
        scrollList.insert(0, nodeData)
        self.scroll.Load(contentList=scrollList)
Exemplo n.º 4
0
 def GetDragData(self, *args):
     displayText = self.GetDragText()
     if self.itemID and self.typeID and displayText:
         url = 'showinfo:%d//%d' % (self.typeID, self.itemID)
         entry = Bunch()
         entry.__guid__ = 'TextLink'
         entry.url = url
         entry.displayText = StripTags(displayText)
         return [entry]
Exemplo n.º 5
0
 def GetLinkFormat(self, url, linkState=None, linkStyle=None):
     linkState = linkState or uiconst.LINK_IDLE
     fmt = Bunch()
     if linkState in (uiconst.LINK_IDLE, uiconst.LINK_DISABLED):
         fmt.color = -23040
     elif linkState in (uiconst.LINK_ACTIVE, uiconst.LINK_HOVER):
         fmt.color = -256
     fmt.bold = True
     return fmt
 def AddCheckbox(self, cbName, parent, groupname=None):
     setting = Bunch(settings.user.ui.Get('assetRenderState', {}))
     cb = Checkbox(parent=parent,
                   text=cbName,
                   checked=bool(setting.Get(cbName, None)),
                   callback=self.CBChange,
                   groupname=groupname)
     cb.name = cbName
     return cb
Exemplo n.º 7
0
 def GetLinkFormat(self, url, linkState = None, linkStyle = None):
     linkState = linkState or uiconst.LINK_IDLE
     fmt = Bunch()
     if linkState in (uiconst.LINK_IDLE, uiconst.LINK_DISABLED):
         fmt.color = -23040
     elif linkState in (uiconst.LINK_ACTIVE, uiconst.LINK_HOVER):
         fmt.color = -256
     fmt.bold = True
     return fmt
Exemplo n.º 8
0
 def GetDragData(self, *args):
     displayText = self.GetDragText()
     if self.itemID and self.typeID and displayText:
         url = 'showinfo:%d//%d' % (self.typeID, self.itemID)
         entry = Bunch()
         entry.__guid__ = 'TextLink'
         entry.url = url
         entry.displayText = StripTags(displayText)
         return [entry]
Exemplo n.º 9
0
 def AddEntry(self, name, value, icon, identifier, enabled = 1, menuClass = None):
     m = Bunch()
     m.caption = name
     m.value = value
     m.enabled = enabled
     m.icon = icon
     m.id = identifier
     m.menuClass = menuClass
     if not m.value:
         m.enabled = False
     self.entrylist.append(m)
Exemplo n.º 10
0
def LoadBaseSettings():
    import __builtin__
    if not hasattr(__builtin__, 'settings'):
        __builtin__.settings = Bunch()
    sections = (('user', session.userid, 'dat'),
                ('char', session.charid, 'dat'), ('public', None, 'yaml'))

    def _LoadSettingsIntoBuiltins(sectionName, identifier, settingsClass,
                                  extension):
        key = '%s%s' % (sectionName, identifier)
        filePath = blue.paths.ResolvePathForWriting(
            u'settings:/core_%s_%s.%s' %
            (sectionName, identifier or '_', extension))
        section = settingsClass(sectionName, filePath, 62, service=None)
        __builtin__.settings.Set(sectionName, section)

    for sectionName, identifier, format in sections:
        _LoadSettingsIntoBuiltins(sectionName, identifier, SettingSection,
                                  'dat')

    settings.public.CreateGroup('generic')
    settings.public.CreateGroup('device')
    settings.public.CreateGroup('ui')
    settings.public.CreateGroup('audio')
    settings.user.CreateGroup('tabgroups')
    settings.user.CreateGroup('windows')
    settings.user.CreateGroup('suppress')
    settings.user.CreateGroup('ui')
    settings.user.CreateGroup('cmd')
    settings.user.CreateGroup('localization')
    settings.char.CreateGroup('windows')
    settings.char.CreateGroup('ui')
    settings.char.CreateGroup('zaction')
Exemplo n.º 11
0
 def GetNodeAndSortValueForAccessEntry(self, groupID, memberID,
                                       membershipType):
     ownerInfo, ownerName, entryType = self._GetOwnerInfoAndName(memberID)
     sortValue = self.GetSortValue(membershipType, ownerName, entryType)
     node = Bunch(decoClass=AccessMemberEntry,
                  ownerName=ownerName,
                  itemID=memberID,
                  memberID=memberID,
                  membershipType=membershipType,
                  entryType=entryType,
                  controller=self.controller,
                  groupID=groupID,
                  ownerInfo=ownerInfo,
                  OnDropData=self.OnDropDataInScroll)
     node.sort_sortValue = sortValue
     return (node, sortValue)
Exemplo n.º 12
0
    def ReloadTabs(self, selectTab=None):
        if not self.tabs or len(self.tabs) < 1:
            return
        tabs = []
        for tab in self.tabs:
            tabData = Bunch()
            tabData.label = tab.title
            tabData.hint = tab.title
            tabData.code = self
            tabData.args = tab
            tabData.panel = None
            tabs.append(tabData)

        if getattr(self, 'tabGroup', None):
            tabGroup = self.tabGroup
        else:
            import uicontrols
            tabGroup = uicontrols.TabGroup(name='tabparent',
                                           parent=self.tabBar,
                                           minTabsize=50,
                                           maxTabsize=200,
                                           tabMenuMargin=8,
                                           align=uiconst.TOBOTTOM)
            self.tabGroup = tabGroup
        tabGroup.LoadTabs(tabs, autoselecttab=0)
        if self.currentTab is None:
            self.currentTab = self.tabs[0]
        else:
            self.currentTab.SetBrowserSurface(None, None)
            if selectTab is not None:
                self.currentTab = self.tabs[selectTab]
        tabGroup.ShowPanelByName(self.currentTab.title)
Exemplo n.º 13
0
    def GetScrollList(self, decoClass, sortFunction, roleGroup = None, titles = None, divisionNames = None):
        scrollList = []
        for member in self.membersToShow:
            scrollList.append(Bunch(decoClass=decoClass, member=member, charID=member.characterID, corp=self.corp, label=cfg.eveowners.Get(member.characterID).ownerName, roleGroup=roleGroup, GetSortValue=sortFunction, roleGroupings=self.roleGroupings, myBaseID=self.myBaseID, myGrantableRoles=self.myGrantableRoles, titles=titles, divisionNames=divisionNames, bases=self.bases))
            blue.pyos.BeNice()
            if self.destroyed:
                return scrollList

        return scrollList
Exemplo n.º 14
0
    def GetScrollList(self, blueprints, showFacility = True, showLocation = True):
        scrollList = []
        jumpsAndBlueprints = self.GetFilteredBlueprints(blueprints)
        for jumps, bpData in jumpsAndBlueprints:
            node = Bunch(bpData=bpData, decoClass=BlueprintEntry, sortValues=BlueprintEntry.GetColumnSortValues(bpData, jumps, showFacility, showLocation), viewMode=self.viewModeButtons.GetViewMode(), jumps=jumps, activityCallback=self.SelectActivity, showFacility=showFacility, showLocation=showLocation, item=bpData.GetItem(), charIndex=bpData.GetLabel())
            scrollList.append(node)
            blue.pyos.BeNice()

        return scrollList
Exemplo n.º 15
0
 def AddEntry(self, name, value, icon, identifier, enabled = 1, menuClass = None):
     m = Bunch()
     m.caption = name
     m.value = value
     m.enabled = enabled
     m.icon = icon
     m.id = identifier
     m.menuClass = menuClass
     if not m.value:
         m.enabled = False
     self.entrylist.append(m)
Exemplo n.º 16
0
    def GetScrollList(self, structureServicesChecked):
        scrollList = []
        structureControllers = self.controller.GetAllStructures()
        for controller in structureControllers:
            if self.IsFilteredOut(controller):
                continue
            node = Bunch(controller=controller, decoClass=StructureEntry, columnSortValues=StructureEntry.GetColumnSortValues(controller, structureServicesChecked), charIndex=controller.GetName(), structureServicesChecked=structureServicesChecked, GetSortValue=StructureEntry.GetSortValue)
            scrollList.append(node)

        return scrollList
Exemplo n.º 17
0
    def LoadAuditLog(self):
        groupLogs = self.controller.GetGroupLogs(self.currentGroupID)
        nodes = []
        for eachEvent in groupLogs:
            eventBundle = ConvertDBRowToBundle(eachEvent)
            decoClasss = self.GetEntryClass(eventBundle.actionID)
            node = Bunch(decoClass=decoClasss,
                         controller=self.controller,
                         eventInfo=eventBundle)
            nodes.append(node)

        self.scroll.Load(contentList=nodes)
Exemplo n.º 18
0
 def GetAllianceDragData(self, *args, **kwds):
     allianceID = self.structureInfo['allianceID']
     typeID = cfg.eveowners.Get(allianceID).typeID
     fakeNode = Bunch()
     fakeNode.__guid__ = 'listentry.User'
     fakeNode.charID = allianceID
     fakeNode.info = cfg.eveowners.Get(allianceID)
     fakeNode.itemID = allianceID
     fakeNode.typeID = typeID
     return [fakeNode]
Exemplo n.º 19
0
    def ReloadTabs(self, selectTab = None):
        if not self.tabs or len(self.tabs) < 1:
            return
        tabs = []
        for tab in self.tabs:
            tabData = Bunch()
            tabData.label = tab.title
            tabData.hint = tab.title
            tabData.code = self
            tabData.args = tab
            tabData.panel = None
            tabs.append(tabData)

        if getattr(self, 'tabGroup', None):
            tabGroup = self.tabGroup
        else:
            import uicontrols
            tabGroup = uicontrols.TabGroup(name='tabparent', parent=self.tabBar, minTabsize=50, maxTabsize=200, tabMenuMargin=8, align=uiconst.TOBOTTOM)
            self.tabGroup = tabGroup
        tabGroup.LoadTabs(tabs, autoselecttab=0)
        if self.currentTab is None:
            self.currentTab = self.tabs[0]
        else:
            self.currentTab.SetBrowserSurface(None, None)
            if selectTab is not None:
                self.currentTab = self.tabs[selectTab]
        tabGroup.ShowPanelByName(self.currentTab.title)
Exemplo n.º 20
0
def GetAssetSafetyScrollContent(controller):
    scrollList = []
    safetyRowSet = controller.GetItemsInSafety()
    for safetyData in safetyRowSet:
        node = Bunch(
            safetyData=safetyData,
            decoClass=AssetSafetyEntry,
            sortValues=AssetSafetyEntry.GetColumnSortValues(safetyData),
            label='<t>'.join(AssetSafetyEntry.GetNameAndSystem(safetyData)))
        scrollList.append(node)
        blue.pyos.BeNice()

    return scrollList
Exemplo n.º 21
0
    def GetKnownUniverseSolarSystems(self):
        if self.knownSolarSystems is None:
            self.knownSolarSystems = {}
            for systemID, system in self.GetStarMapCache()['solarSystems'].iteritems():
                if IsWormholeSystem(systemID):
                    continue
                center = system['center']
                solarSystemInfo = Bunch()
                solarSystemInfo.center = center
                solarSystemInfo.mapPosition = WorldPosToMapPos(center)
                solarSystemInfo.regionID = system['regionID']
                solarSystemInfo.constellationID = system['constellationID']
                solarSystemInfo.star = SUN_DATA[system['sunTypeID']]
                solarSystemInfo.factionID = system['factionID']
                solarSystemInfo.neighbours = system['neighbours']
                solarSystemInfo.planetCountByType = system['planetCountByType']
                self.knownSolarSystems[systemID] = solarSystemInfo

        return self.knownSolarSystems
Exemplo n.º 22
0
    def GetScrollList(self, jobs):
        scrollList = []
        for jobData in jobs:
            if self.IsFilteredOut(jobData):
                continue
            node = Bunch(jobData=jobData,
                         decoClass=JobEntry,
                         sortValues=JobEntry.GetColumnSortValues(
                             jobData, jobData.distance),
                         viewMode=self.viewModeButtons.GetViewMode(),
                         jumps=max(0, jobData.distance))
            scrollList.append(node)

        return scrollList
def GetFittingItemDragData(itemID, dogmaLocation):
    dogmaItem = dogmaLocation.dogmaItems[itemID]
    data = Bunch()
    data.__guid__ = 'listentry.InvItem'
    data.item = KeyVal(itemID=dogmaItem.itemID, typeID=dogmaItem.typeID, groupID=dogmaItem.groupID, categoryID=dogmaItem.categoryID, flagID=dogmaItem.flagID, ownerID=dogmaItem.ownerID, locationID=dogmaItem.locationID, stacksize=dogmaLocation.GetAttributeValue(itemID, const.attributeQuantity))
    data.rec = data.item
    data.itemID = itemID
    data.viewMode = 'icons'
    return [data]
Exemplo n.º 24
0
 def AddInput(self, attrs, add=1):
     attrs.vspace = getattr(attrs, 'vspace', 1)
     if attrs.type is None:
         attrs.type = 'text'
     create = getattr(self, 'Create_%s' % attrs.type.lower(), None)
     if create:
         wnd = create(attrs)
     else:
         wnd = Container()
     browser = GetBrowser(self.browser)
     if not browser:
         return
     if add:
         self.fields.append((attrs, wnd))
     attrs.control = wnd
     attrs.align = getattr(attrs, 'align', None)
     obj = Bunch()
     obj.font = None
     obj.key = 'input_%s' % attrs.type.lower()
     obj.type = '<input>'
     obj.attrs = attrs
     wnd.state = uiconst.UI_HIDDEN
     if hasattr(self.browser, 'sr'):
         wnd.SetParent(self.browser.sr.cacheContainer)
     startup = getattr(self, 'Startup_%s' % attrs.type.lower(), None)
     if startup:
         startup(wnd, attrs)
     obj.width = wnd.width + 5
     obj.height = wnd.height + 5
     obj.valign = 1
     if add:
         obj.control = wnd
         wnd.loaded = 1
     else:
         wnd.Close()
     return obj
 def GetAllianceDragData(self, *args, **kwds):
     allianceID = self.structureInfo['allianceID']
     typeID = cfg.eveowners.Get(allianceID).typeID
     fakeNode = Bunch()
     fakeNode.__guid__ = 'listentry.User'
     fakeNode.charID = allianceID
     fakeNode.info = cfg.eveowners.Get(allianceID)
     fakeNode.itemID = allianceID
     fakeNode.typeID = typeID
     return [fakeNode]
Exemplo n.º 26
0
 def GetDragData(self, *args):
     dragDisplayText, url = cfg.evelocations.Get(
         self.markerID).name, 'showinfo:%d//%d' % (const.typeRegion,
                                                   self.markerID)
     entry = Bunch()
     entry.__guid__ = 'TextLink'
     entry.url = url
     entry.dragDisplayText = dragDisplayText
     entry.displayText = StripTags(dragDisplayText)
     return [entry]
Exemplo n.º 27
0
    def GetScrollList(self, installations):
        scrollList = []
        for facilityData in installations:
            jumps = self.GetJumpsTo(facilityData.solarSystemID)
            if self.IsFilteredOut(facilityData):
                continue
            activityID = self.activityCombo.GetValue()
            node = Bunch(facilityData=facilityData,
                         decoClass=FacilityEntry,
                         sortValues=FacilityEntry.GetColumnSortValues(
                             facilityData, jumps, activityID),
                         viewMode=self.viewModeButtons.GetViewMode(),
                         jumps=jumps,
                         charIndex=facilityData.GetName(),
                         activityID=activityID)
            scrollList.append(node)

        return scrollList
Exemplo n.º 28
0
    def ReloadTabs(self, selectTab=None):
        """
            Reloads the tab list. This is necessary because the TabGroup object does not
            support dynamic addition/removal of tabs.
        
            If this is the first time that tabs are being created, it will autoselect
            the first tab in the tabgroup.
        
            ARGUMENTS:
                selectTab       An integer representing the index of the tab to be
                                selected in the self.tabs list.
                                Defaults to None. If None, it will not change the
                                tab selection.
            RETURNS:
                None
        """
        if not self.tabs or len(self.tabs) < 1:
            return
        tabs = []
        for tab in self.tabs:
            tabData = Bunch()
            tabData.label = tab.title
            tabData.hint = tab.title
            tabData.code = self
            tabData.args = tab
            tabData.panel = None
            tabs.append(tabData)

        if getattr(self, 'tabGroup', None):
            tabGroup = self.tabGroup
        else:
            import uicontrols
            tabGroup = uicontrols.TabGroup(name='tabparent',
                                           parent=self.tabBar,
                                           minTabsize=50,
                                           maxTabsize=200,
                                           tabMenuMargin=8,
                                           align=uiconst.TOBOTTOM)
            self.tabGroup = tabGroup
        tabGroup.LoadTabs(tabs, autoselecttab=0)
        if self.currentTab is None:
            self.currentTab = self.tabs[0]
        else:
            self.currentTab.SetBrowserSurface(None, None)
            if selectTab is not None:
                self.currentTab = self.tabs[selectTab]
        tabGroup.ShowPanelByName(self.currentTab.title)
Exemplo n.º 29
0
def GetFittingItemDragData(itemID, dogmaLocation):
    dogmaItem = dogmaLocation.dogmaItems[itemID]
    data = Bunch()
    data.__guid__ = 'listentry.InvItem'
    data.item = KeyVal(itemID=dogmaItem.itemID,
                       typeID=dogmaItem.typeID,
                       groupID=dogmaItem.groupID,
                       categoryID=dogmaItem.categoryID,
                       flagID=dogmaItem.flagID,
                       ownerID=dogmaItem.ownerID,
                       locationID=dogmaItem.locationID,
                       stacksize=dogmaLocation.GetAttributeValue(
                           itemID, const.attributeQuantity))
    data.rec = data.item
    data.itemID = itemID
    data.viewMode = 'icons'
    return [data]
Exemplo n.º 30
0
 def AddInput(self, attrs, add = 1):
     attrs.vspace = getattr(attrs, 'vspace', 1)
     if attrs.type is None:
         attrs.type = 'text'
     create = getattr(self, 'Create_%s' % attrs.type.lower(), None)
     if create:
         wnd = create(attrs)
     else:
         wnd = Container()
     browser = GetBrowser(self.browser)
     if not browser:
         return
     if add:
         self.fields.append((attrs, wnd))
     attrs.control = wnd
     attrs.align = getattr(attrs, 'align', None)
     obj = Bunch()
     obj.font = None
     obj.key = 'input_%s' % attrs.type.lower()
     obj.type = '<input>'
     obj.attrs = attrs
     wnd.state = uiconst.UI_HIDDEN
     if hasattr(self.browser, 'sr'):
         wnd.SetParent(self.browser.sr.cacheContainer)
     startup = getattr(self, 'Startup_%s' % attrs.type.lower(), None)
     if startup:
         startup(wnd, attrs)
     obj.width = wnd.width + 5
     obj.height = wnd.height + 5
     obj.valign = 1
     if add:
         obj.control = wnd
         wnd.loaded = 1
     else:
         wnd.Close()
     return obj
Exemplo n.º 31
0
    def GetScrollList(self, decoClass):
        scrollList = []
        structureControllers = self.structureBrowserController.GetMyStructures(
        )
        for controller in structureControllers:
            if self.IsFilteredOut(controller):
                continue
            slimProfileController = self.allStructuresProfileController.GetSlimProfileController(
                controller.GetProfileID())
            node = Bunch(controller=controller,
                         decoClass=decoClass,
                         columnSortValues=decoClass.GetColumnSortValues(
                             controller, slimProfileController),
                         charIndex=controller.GetName(),
                         slimProfileController=slimProfileController,
                         GetSortValue=decoClass.GetSortValue)
            scrollList.append(node)

        return scrollList
Exemplo n.º 32
0
    def GetKnownUniverseConstellations(self):
        if self.knownConstellations is None:
            self.knownConstellations = {}
            for constellationID, constellation in self.GetStarMapCache()['constellations'].iteritems():
                if IsWormholeConstellation(constellationID):
                    continue
                constellationInfo = Bunch()
                constellationInfo.regionID = constellation['regionID']
                constellationInfo.neighbours = constellation['neighbours']
                constellationInfo.solarSystemIDs = constellation['solarSystemIDs']
                constellationInfo.center = constellation['center']
                constellationInfo.mapPosition = WorldPosToMapPos(constellation['center'])
                self.knownConstellations[constellationID] = constellationInfo

        return self.knownConstellations
Exemplo n.º 33
0
    def GetKnownUniverseRegions(self):
        if self.knownRegions is None:
            self.knownRegions = {}
            for regionID, region in self.GetStarMapCache()['regions'].iteritems():
                if IsWormholeRegion(regionID):
                    continue
                regionInfo = Bunch()
                regionInfo.neighbours = region['neighbours']
                regionInfo.solarSystemIDs = region['solarSystemIDs']
                regionInfo.constellationIDs = region['constellationIDs']
                regionInfo.center = region['center']
                regionInfo.mapPosition = WorldPosToMapPos(region['center'])
                self.knownRegions[regionID] = regionInfo

        return self.knownRegions
Exemplo n.º 34
0
    def LoadGroups(self, *args):
        myGroups = self.controller.GetMyGroups()
        searchResults = self.controller.GetCurrentSearchResults()
        groupIDs = set()
        nodesByMembership = defaultdict(list)
        for groupID, g in myGroups.iteritems():
            groupIDs.add(groupID)
            groupName = g.name
            nodeData = Bunch(decoClass=AccessGroupEntry,
                             controller=self.controller,
                             groupInfo=g,
                             isNormal=self.IsNormalGroup(
                                 groupID, searchResults))
            node = (groupName.lower(), nodeData)
            if g.creatorID == session.corpid:
                myMembership = DEFAULT_CORP_GROUP
            else:
                myMembership = g.membershipType
            nodesByMembership[myMembership].append(node)

        scrollList = []
        for eachMemberShipType in [DEFAULT_CORP_GROUP] + ACCESS_SORT_ORDER:
            nodes = nodesByMembership.get(eachMemberShipType)
            if nodes:
                sortedNodes = SortListOfTuples(nodes)
                scrollList += sortedNodes
                scrollList.append(listentry.Get('Space', {'height': 12}))

        self.scroll.Load(contentList=scrollList)
        groupID = None
        lastLoadedGroupID = settings.user.ui.Get('accessGroup_lastGroup', None)
        if lastLoadedGroupID in groupIDs:
            groupID = lastLoadedGroupID
        elif len(scrollList) > 1:
            firstNode = scrollList[0]
            groupID = firstNode.groupInfo.groupID
        self.controller.SelectGroup(groupID)
Exemplo n.º 35
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 = 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]
            self.sr.tabs.Flush()
            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)
Exemplo n.º 36
0
    def LoadGroups(self):
        self.sectionCont.Flush()
        canHaveGroups = CanHaveGroups(self.settingID)
        if not canHaveGroups:
            return
        sgControllers = self.structureProfileController.GetGroupsBySettingID(
            self.settingID)
        if sgControllers:
            accessGroupsController = sm.GetService(
                'structureControllers').GetAccessGroupController()
            groupIDs = [c.GetGroupID() for c in sgControllers]
            accessGroupsController.PopulatePublicGroupInfo(groupIDs)
            toSort = []
            for c in sgControllers:
                groupInfo = accessGroupsController.GetGroupInfoFromID(
                    c.GetGroupID())
                if groupInfo is None:
                    continue
                nameLower = groupInfo['name'].lower()
                toSort.append((nameLower, (c, groupInfo)))

            sortedControllers = SortListOfTuples(toSort)
            for c, groupInfo in sortedControllers:
                GroupEntry(
                    parent=self.sectionCont,
                    groupID=c.GetGroupID(),
                    settingGroupController=c,
                    structureProfileController=self.structureProfileController,
                    groupInfo=groupInfo)

        else:
            x = Generic(parent=self.sectionCont, height=30)
            x.Startup()
            x.Load(
                node=Bunch(label=GetByLabel('UI/StructureSettingWnd/NoGroups'),
                           sublevel=1))
Exemplo n.º 37
0
    def LoadSettings(self):
        """
        Creates the actual settings object in the __builtin__ namespace and populates it
        with groups required by core services.
        """
        import __builtin__
        self.SaveSettings()
        if not hasattr(__builtin__, 'settings'):
            __builtin__.settings = Bunch()
        sections = (('user', session.userid, 'dat'),
                    ('char', session.charid, 'dat'), ('public', None, 'yaml'))

        def _MigrateSettingsToYAML(sectionName, identifier, extension):
            filePathYAML = blue.paths.ResolvePathForWriting(
                u'settings:/core_%s_%s.%s' %
                (sectionName, identifier or '_', 'yaml'))
            filePathDAT = blue.paths.ResolvePathForWriting(
                u'settings:/core_%s_%s.%s' %
                (sectionName, identifier or '_', 'dat'))
            if not os.path.exists(filePathYAML) and os.path.exists(
                    filePathDAT):
                old = SettingSection(sectionName,
                                     filePathDAT,
                                     62,
                                     service=self)
                new = YAMLSettingSection(sectionName,
                                         filePathYAML,
                                         62,
                                         service=self)
                new.SetDatastore(old.GetDatastore())
                new.FlagDirty()
                new.WriteToDisk()
                return True
            return False

        def _LoadSettingsIntoBuiltins(sectionName, identifier, settingsClass,
                                      extension):
            key = '%s%s' % (sectionName, identifier)
            if key not in self.loadedSettings:
                filePath = blue.paths.ResolvePathForWriting(
                    u'settings:/core_%s_%s.%s' %
                    (sectionName, identifier or '_', extension))
                section = settingsClass(sectionName,
                                        filePath,
                                        62,
                                        service=self)
                __builtin__.settings.Set(sectionName, section)
                self.loadedSettings.append(key)

        def _MigrateGraphicsSettingsFromPrefs():
            prefsToMigrate = [
                'antiAliasing', 'depthEffectsEnabled', 'charClothSimulation',
                'charTextureQuality', 'fastCharacterCreation',
                'textureQuality', 'shaderQuality', 'shadowQuality',
                'lodQuality', 'hdrEnabled', 'loadstationenv2',
                'resourceCacheEnabled', 'postProcessingQuality',
                'resourceCacheEnabled', 'MultiSampleQuality',
                'MultiSampleType', 'interiorGraphicsQuality',
                'interiorShaderQuality'
            ]
            for prefKey in prefsToMigrate:
                if prefs.HasKey(prefKey):
                    settings.public.device.Set(prefKey,
                                               prefs.GetValue(prefKey))

        movePrefsToSettings = False
        for sectionName, identifier, format in sections:
            if format == 'yaml':
                didMigrate = _MigrateSettingsToYAML(sectionName, identifier,
                                                    'yaml')
                if sectionName == 'public':
                    movePrefsToSettings = didMigrate
                _LoadSettingsIntoBuiltins(sectionName, identifier,
                                          YAMLSettingSection, 'yaml')
            _LoadSettingsIntoBuiltins(sectionName, identifier, SettingSection,
                                      'dat')

        settings.public.CreateGroup('generic')
        settings.public.CreateGroup('device')
        settings.public.CreateGroup('ui')
        settings.public.CreateGroup('audio')
        if movePrefsToSettings is True:
            _MigrateGraphicsSettingsFromPrefs()
        settings.user.CreateGroup('tabgroups')
        settings.user.CreateGroup('windows')
        settings.user.CreateGroup('suppress')
        settings.user.CreateGroup('ui')
        settings.user.CreateGroup('cmd')
        settings.user.CreateGroup('localization')
        settings.char.CreateGroup('windows')
        settings.char.CreateGroup('ui')
        settings.char.CreateGroup('zaction')
        return settings
Exemplo n.º 38
0
 def GetLinkFormat(self, url, linkState = None, linkStyle = None):
     linkState = linkState or uiconst.LINK_IDLE
     linkStyle = linkStyle or uiconst.LINKSTYLE_REGULAR
     fmt = Bunch()
     if linkStyle == uiconst.LINKSTYLE_SUBTLE:
         if linkState in (uiconst.LINK_ACTIVE, uiconst.LINK_HOVER):
             fmt.color = -256
         elif linkState in (uiconst.LINK_IDLE, uiconst.LINK_DISABLED):
             if url.startswith('showinfo'):
                 fmt.color = -1
             elif url.startswith('http'):
                 fmt.color = -23040
             else:
                 fmt.color = -552162
     elif linkState in (uiconst.LINK_ACTIVE, uiconst.LINK_HOVER):
         fmt.color = -256
         fmt.underline = True
     elif linkState in (uiconst.LINK_IDLE, uiconst.LINK_DISABLED):
         if url.startswith('showinfo'):
             fmt.color = -23040
         elif url.startswith('http'):
             fmt.color = -23040
         else:
             fmt.color = -552162
     fmt.bold = True
     return fmt
Exemplo n.º 39
0
 def GetLinkFormat(self, url, linkState=None, linkStyle=None):
     linkState = linkState or uiconst.LINK_IDLE
     linkStyle = linkStyle or uiconst.LINKSTYLE_REGULAR
     fmt = Bunch()
     if linkStyle == uiconst.LINKSTYLE_SUBTLE:
         if linkState in (uiconst.LINK_ACTIVE, uiconst.LINK_HOVER):
             fmt.color = -256
         elif linkState in (uiconst.LINK_IDLE, uiconst.LINK_DISABLED):
             if url.startswith('showinfo'):
                 fmt.color = -1
             elif url.startswith('http'):
                 fmt.color = -23040
             else:
                 fmt.color = -552162
     elif linkState in (uiconst.LINK_ACTIVE, uiconst.LINK_HOVER):
         fmt.color = -256
         fmt.underline = True
     elif linkState in (uiconst.LINK_IDLE, uiconst.LINK_DISABLED):
         if url.startswith('showinfo'):
             fmt.color = -23040
         elif url.startswith('http'):
             fmt.color = -23040
         else:
             fmt.color = -552162
     fmt.bold = True
     return fmt
Exemplo n.º 40
0
 def GetParams(self):
     fontParams = Bunch()
     fontParams.__doc__ = 'Font Parameters'
     fontParams.fontStyle = None
     fontParams.fontFamily = None
     fontParams.fontPath = None
     fontParams.fontsize = fontConst.DEFAULT_FONTSIZE
     fontParams.letterspace = fontConst.DEFAULT_LETTERSPACE or 0
     fontParams.uppercase = fontConst.DEFAULT_UPPERCASE
     fontParams.lineSpacing = 0.0
     fontParams.wordspace = 0
     fontParams.color = -1
     fontParams.underline = 0
     fontParams.bold = 0
     fontParams.italic = 0
     fontParams.face = None
     return fontParams
Exemplo n.º 41
0
def AppendNewMapOption(options):
    newMap = Bunch()
    newMap.settingKey = BETA_MAP_SETTING_KEY
    newMap.label = 'Try the New Map'
    options.append(newMap)
Exemplo n.º 42
0
def AppendNewScannersOption(options):
    newMap = Bunch()
    newMap.settingKey = BETA_SCANNERS_SETTING_KEY
    newMap.label = 'Try the New Probe and Directional Scanners'
    options.append(newMap)
Exemplo n.º 43
0
def AppendNewcamOption(options):
    newMap = Bunch()
    newMap.settingKey = BETA_NEWCAM_SETTING_KEY
    newMap.label = 'Try the New Camera'
    options.append(newMap)
Exemplo n.º 44
0
def ScrollEntryNode(**kw):
    data = Bunch(**kw)
    decoClass = data.get('decoClass', SE_GenericCore)
    data.decoClass = decoClass
    data.GetHeightFunction = getattr(decoClass, 'GetHeight', None)
    data.GetColumnWidthFunction = getattr(decoClass, 'GetColumnWidth', None)
    data.PreLoadFunction = getattr(decoClass, 'PreLoad', None)
    data.allowDynamicResize = getattr(decoClass, 'allowDynamicResize', False)
    if data.GetHeightFunction:
        data.GetHeightFunction = data.GetHeightFunction.im_func
    if data.PreLoadFunction:
        data.PreLoadFunction = data.PreLoadFunction.im_func
    if data.GetColumnWidthFunction:
        data.GetColumnWidthFunction = data.GetColumnWidthFunction.im_func
    if not data.charIndex and data.label:
        data.charIndex = GetAsUnicode(data.label).split('<t>')[0]
    if data.charIndex:
        data.charIndex = data.charIndex.lower()
    return data
Exemplo n.º 45
0
 def GetParams(self):
     fontParams = Bunch()
     fontParams.__doc__ = 'Font Parameters'
     fontParams.fontStyle = None
     fontParams.fontFamily = None
     fontParams.fontPath = None
     fontParams.fontsize = fontConst.DEFAULT_FONTSIZE
     fontParams.letterspace = fontConst.DEFAULT_LETTERSPACE or 0
     fontParams.uppercase = fontConst.DEFAULT_UPPERCASE
     fontParams.lineSpacing = 0.0
     fontParams.wordspace = 0
     fontParams.color = -1
     fontParams.underline = 0
     fontParams.bold = 0
     fontParams.italic = 0
     fontParams.face = None
     return fontParams
Exemplo n.º 46
0
 def __init__(self, **kw):
     uicontrols.ContainerAutoSize.__init__(self, **kw)
     attributesBunch = Bunch(**kw)
     self.PostApplyAttributes(attributesBunch)
Exemplo n.º 47
0
def ScrollEntryNode(**kw):
    data = Bunch(**kw)
    decoClass = data.get('decoClass', SE_GenericCore)
    data.decoClass = decoClass
    data.GetHeightFunction = getattr(decoClass, 'GetHeight', None)
    data.GetColumnWidthFunction = getattr(decoClass, 'GetColumnWidth', None)
    data.PreLoadFunction = getattr(decoClass, 'PreLoad', None)
    data.allowDynamicResize = getattr(decoClass, 'allowDynamicResize', False)
    if data.GetHeightFunction:
        data.GetHeightFunction = data.GetHeightFunction.im_func
    if data.PreLoadFunction:
        data.PreLoadFunction = data.PreLoadFunction.im_func
    if data.GetColumnWidthFunction:
        data.GetColumnWidthFunction = data.GetColumnWidthFunction.im_func
    if not data.charIndex and data.label:
        data.charIndex = GetAsUnicode(data.label).split('<t>')[0]
    if data.charIndex:
        data.charIndex = data.charIndex.lower()
    return data