Пример #1
0
 def GetRadialMenuOnGroup(self, group, droneData):
     if not droneData:
         return
     groupNode = group.sr.node
     droneState = groupNode.droneState
     if droneState == 'inbay':
         manyItemsData = uiutil.Bunch(menuFunction=sm.GetService('menu').InvItemMenu, itemData=droneData, displayName='<b>%s</b>' % groupNode.cleanLabel)
     elif droneState in ('inlocalspace', 'indistantspace'):
         manyItemsData = uiutil.Bunch(menuFunction=sm.GetService('menu').GetDroneMenu, itemData=droneData, displayName='<b>%s</b>' % groupNode.cleanLabel)
     else:
         return
     typeID = GetTypeIDForManyDrones(droneState, droneData)
     sm.GetService('menu').TryExpandActionMenu(itemID=None, typeID=typeID, clickedObject=group, manyItemsData=manyItemsData)
    def FindAvailableAds(self):
        adUrl = csUtil.GetCharacterSelectionAdPageUrl(session.languageID)
        feed = corebrowserutil.GetStringFromURL(adUrl).read()
        root = ET.fromstring(feed)
        namespaces = csUtil.xmlNamespaces
        itemlist = root.findall('atom:entry', namespaces=namespaces)
        targetedAds = []
        nonTargetedAds = []
        if session.userType == const.userTypeTrial:
            target = csUtil.adTrialTerm
        else:
            charData = self.GetCharacterSelectionData()
            creationDate = charData.GetUserCreationDate()
            now = blue.os.GetWallclockTime()
            if now - 6 * const.MONTH30 < creationDate:
                target = csUtil.adMediumTerm
            else:
                target = csUtil.adAdvancedTerm
        for eachItem in itemlist:
            with ExceptionEater('Failed to parse ad'):
                imageEntry = eachItem.find('ccpmedia:group/ccpmedia:content', namespaces=namespaces)
                linkEntry = eachItem.find('ccpmedia:group/ccpmedia:description', namespaces=namespaces)
                adID = eachItem.find('atom:id', namespaces=namespaces).text
                link = linkEntry.text
                imageUrl = imageEntry.attrib['url']
                imageWidth = imageEntry.attrib['width']
                imageHeight = imageEntry.attrib['height']
                adInfo = uiutil.Bunch(link=link, imageUrl=imageUrl, width=int(imageWidth), height=int(imageHeight), adID=adID)
                if eachItem.find("atom:category[@term='%s']" % target, namespaces=namespaces) is not None:
                    targetedAds.append(adInfo)
                elif eachItem.find('atom:category', namespaces=namespaces) is None:
                    nonTargetedAds.append(adInfo)

        return (targetedAds, nonTargetedAds)
Пример #3
0
    def Startup(self, tabs, groupID = None, _notUsed_callback = None, _notUsed_isSub = 0, _notUsed_detachable = 0, autoselecttab = 1, UIIDPrefix = None, silently = False):
        loadtabs = []
        for each in tabs:
            panelparent = None
            hint = None
            uiID = 'tab'
            if len(each) == 4:
                label, panel, code, args = each
            elif len(each) == 5:
                label, panel, code, args, panelparent = each
            elif len(each) == 6:
                label, panel, code, args, panelparent, hint = each
            if isinstance(label, tuple):
                name, label = label
            else:
                name = label
            if UIIDPrefix is not None:
                secondPart = name.replace(' ', '')
                secondPart = secondPart.capitalize()
                uiID = '%s%s' % (UIIDPrefix, secondPart)
            tabData = uiutil.Bunch()
            tabData.label = label
            tabData.code = code
            tabData.args = args
            tabData.panel = panel
            tabData.panelparent = panelparent
            tabData.hint = hint
            tabData.name = uiID
            loadtabs.append(tabData)

        self.LoadTabs(loadtabs, autoselecttab, settingsID=groupID, silently=silently)
Пример #4
0
    def ReloadTabs(self, selectTab = None):
        if not self.tabs or len(self.tabs) < 1:
            return
        tabs = []
        for tab in self.tabs:
            tabData = uiutil.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:
            tabGroup = uicls.TabGroup(name='tabparent', parent=self.tabBar, minTabsize=50, maxTabsize=200, leftMargin=self.delTabBtn.width + const.defaultPadding * 2, rightMargin=self.addTabBtn.width + const.defaultPadding * 2, 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)
    def OnTabImprovements(self, *args):
        tiers = self.GetRemoteImprovementTiers()
        installed = self.GetRemoteInstalledImprovements()
        for tier in tiers:
            for improvement in filter(None, tier.improvements):
                improvement.installed = improvement.typeID in installed
                if improvement.installed:
                    statusHint = localization.GetByLabel('UI/Station/StationManagment/ImprovementInstalled')
                else:
                    statusHint = localization.GetByLabel('UI/Station/StationManagment/ImprovementNotInstalled')
                improvementType = ImprovementTypeResolver.GetImprovementTypeName(improvement.typeID)
                description = ImprovementTypeResolver.GetImprovementTypeDescription(improvement.typeID)
                improvement.hint = localization.GetByLabel('UI/Station/StationManagment/ImprovementHint', type=improvementType, statusHint=statusHint, description=description)

        outpostData = self.GetOutpostData()
        forkData = uiutil.Bunch()
        for data in (outpostData, forkData):
            data.nBranches = len(tiers[0].improvements)

        scrolllist = []
        scrolllist.append(listentry.Get('OutpostImprovementsHeader', data=outpostData))
        scrolllist.append(listentry.Get('OutpostImprovementsFork', data=forkData))
        for i, tier in enumerate(tiers):
            tier.tier = i + 1
            scrolllist.append(listentry.Get('OutpostImprovementTierLines', data=tier))
            scrolllist.append(listentry.Get('OutpostImprovementTierIcons', data=tier.Copy()))

        scrolllist.append(listentry.Get('Empty', data=util.KeyVal(height=30)))
        self.sr.scroll.Load(contentList=scrolllist)
Пример #6
0
 def GetDragData(self, *args):
     if getattr(self, 'url', None) and getattr(self, 'linkText', None):
         entry = uiutil.Bunch()
         entry.__guid__ = 'TextLink'
         entry.url = self.url
         entry.displayText = self.linkText
         return [entry]
Пример #7
0
    def GetAgentMissions(self, *args):
        allMissionsList = []
        missions = sm.GetService('journal').GetMyAgentJournalDetails()[0]
        HOMEBASE = 0
        NOTHOMEBASE = 1
        if missions:
            for mission in missions:
                missionState, importantMission, missionType, missionNameID, agentID, expirationTime, bookmarks, remoteOfferable, remoteCompletable, contentID = mission
                if missionState != const.agentMissionStateAccepted or expirationTime and expirationTime < blue.os.GetWallclockTime(
                ):
                    continue
                homeBaseBms = []
                otherBms = []
                foundHomeBaseBm = False
                for bm in bookmarks:
                    if bm.locationType == 'agenthomebase':
                        homeBaseBms.append((HOMEBASE, bm))
                    elif 'isAgentBase' in bm.__dict__ and bm.isAgentBase:
                        foundHomeBaseBm = True
                        otherBms.append((HOMEBASE, bm))
                    else:
                        otherBms.append((NOTHOMEBASE, bm))

                bookmarksIwant = otherBms
                if not foundHomeBaseBm:
                    bookmarksIwant.extend(homeBaseBms)
                bookmarksIwant = uiutil.SortListOfTuples(bookmarksIwant)
                bmInfo = uiutil.Bunch(missionNameID=missionNameID,
                                      bookmarks=bookmarksIwant,
                                      agentID=agentID)
                allMissionsList.append((expirationTime, bmInfo))

            allMissionsList = uiutil.SortListOfTuples(allMissionsList)
        return allMissionsList
    def GetRemoteImprovementTiers(self):
        """
        Return the improvement options for this outpost.
        
        The data is fetched from the server, then organized in a list of tiers,
        where each tier has a list of (possibly None) improvements matched by 
        position with other improvements.
        
        Each improvement is an object with the following attributes:
            typeID: 
                The typeID of the improvement.
            requiredImprovementTypeID: 
                The typeID of the improvement this one requires,
                None for tier 1 improvements.
        """
        outpostData = self.GetOutpostData()
        isd = sm.RemoteSvc('corpStationMgr').GetImprovementStaticData()
        outpostRaceID = cfg.invtypes.Get(outpostData.typeID).raceID
        outpostAsmLines = set()

        def IndexBenefitRowset(rowset):
            ret = {}
            for row in rowset:
                ret.setdefault(row.improvementTypeID, []).append(row)

            return ret

        def MakeImprovement(imp):
            return uiutil.Bunch(typeID=imp.typeID, requiredImprovementTypeID=imp.requiredImprovementTypeID)

        available = [ MakeImprovement(imp) for imp in isd.improvementTypes if imp.raceID == outpostRaceID and (imp.requiredAssemblyLineTypeID is None or imp.requiredAssemblyLineTypeID in outpostAsmLines) ]
        byReq = {}
        for imp in available:
            byReq.setdefault(imp.requiredImprovementTypeID, []).append(imp)

        branches = []
        for imp in byReq.get(None, []):
            branch = []
            while True:
                branch.append(imp)
                if imp.typeID not in byReq:
                    break
                imp = byReq[imp.typeID][0]

            branches.append(branch)

        nTiers = max([ len(branch) for branch in branches ])
        tiers = []
        for i in xrange(nTiers):
            improvements = []
            for branch in branches:
                if len(branch) > i:
                    improvements.append(branch[i])
                else:
                    improvements.append(None)

            tiers.append(uiutil.Bunch(improvements=improvements))

        return tiers
Пример #9
0
 def AssureSetup(self):
     if self.logme:
         self.LogInfo('Tactical::AssureSetup')
     if getattr(self, 'setupAssured', None):
         return
     if getattr(self, 'sr', None) is None:
         self.sr = uiutil.Bunch()
     self.setupAssured = 1
Пример #10
0
 def OnMouseDown_thread(self):
     selelectedDrones = self.sr.node.scroll.GetSelectedNodes(self.sr.node)
     droneState = self.sr.node.droneState
     displayLabel = self.sr.node.label
     if len(selelectedDrones) > 1:
         displayLabel += '<fontsize=14> + %s' % (len(selelectedDrones) - 1)
     if droneState == 'inbay':
         nodesData = [ (drone.invItem, 0, None) for drone in selelectedDrones if drone.invItem is not None ]
         manyItemsData = uiutil.Bunch(menuFunction=sm.GetService('menu').InvItemMenu, itemData=nodesData, displayName='<b>%s</b>' % displayLabel)
     elif droneState in ('inlocalspace', 'inDistantSpace'):
         if len(selelectedDrones) > 1:
             nodesData = [ (drone.itemID, evetypes.GetGroupID(drone.typeID), drone.ownerID) for drone in selelectedDrones if drone.typeID ]
             manyItemsData = uiutil.Bunch(menuFunction=sm.GetService('menu').GetDroneMenu, itemData=nodesData, displayName='<b>%s</b>' % displayLabel)
         else:
             manyItemsData = None
     else:
         return
     sm.GetService('menu').TryExpandActionMenu(itemID=self.sr.node.itemID, typeID=self.sr.node.typeID, clickedObject=self, manyItemsData=manyItemsData)
Пример #11
0
 def AddCheckbox(self, cbName, parent, groupname=None):
     setting = uiutil.Bunch(settings.user.ui.Get('assetRenderState', {}))
     cb = uicls.Checkbox(parent=parent,
                         text=cbName,
                         checked=bool(setting.Get(cbName, None)),
                         callback=self.CBChange,
                         groupname=groupname)
     cb.name = cbName
     return cb
Пример #12
0
 def GetLinkFormat(self, url, linkState=None, linkStyle=None):
     linkState = linkState or uiconst.LINK_IDLE
     fmt = uiutil.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
Пример #13
0
 def GetDragData(self, itemID):
     if itemID in self.items:
         return [uix.GetItemData(self.items[itemID], 'icons')]
     dogmaItem = self.dogmaItems[itemID]
     data = uiutil.Bunch()
     data.__guid__ = 'listentry.InvItem'
     data.item = util.KeyVal(itemID=dogmaItem.itemID, typeID=dogmaItem.typeID, groupID=dogmaItem.groupID, categoryID=dogmaItem.categoryID, flagID=dogmaItem.flagID, ownerID=dogmaItem.ownerID, locationID=dogmaItem.locationID, stacksize=self.GetAttributeValue(itemID, const.attributeQuantity))
     data.rec = data.item
     data.itemID = itemID
     data.viewMode = 'icons'
     return [data]
Пример #14
0
 def AddEntry(self, name, value, icon, identifier, enabled = 1, menuClass = None):
     m = uiutil.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)
Пример #15
0
    def GetCharCreationInfo(self):
        if self.charCreationInfo is None:
            uthread.Lock(self)
            try:
                if self.charCreationInfo is None:
                    o = uiutil.Bunch()
                    o.update(
                        sm.RemoteSvc('charUnboundMgr').GetCharCreationInfo())
                    o.update(
                        sm.RemoteSvc(
                            'charUnboundMgr').GetCharNewExtraCreationInfo())
                    self.charCreationInfo = o
            finally:
                uthread.UnLock(self)

        return self.charCreationInfo
Пример #16
0
 def GetParams(self):
     fontParams = uiutil.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
Пример #17
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 = uiutil.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]
            uiutil.Flush(self.sr.tabs)
            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)
Пример #18
0
def ScrollEntryNode(**kw):
    data = uiutil.Bunch(**kw)
    decoClass = data.get('decoClass', uicls.SE_Generic)
    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 = uiutil.GetAsUnicode(data.label).split('<t>')[0]
    if data.charIndex:
        data.charIndex = data.charIndex.lower()
    return data
Пример #19
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 = uicls.Container()
     browser = uiutil.GetBrowser(self.browser)
     if not browser:
         return
     if add:
         self.fields.append((attrs, wnd))
     attrs.control = wnd
     attrs.align = getattr(attrs, 'align', None)
     obj = uiutil.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'):
         uiutil.Transplant(wnd, 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
Пример #20
0
    def GetWnd(self, new=0):
        wnd = uicls.MonitorWnd.GetIfOpen()
        if wnd is None and new:
            wnd = uicls.MonitorWnd.Open()
            wnd.OnClose = self.CloseWnd
            wnd._OnResize = self._OnResize
            main = wnd.sr.maincontainer
            topcontainer = uicls.Container(name='push',
                                           parent=main,
                                           align=uiconst.TOTOP,
                                           height=46,
                                           clipChildren=1)
            w = wnd.sr.telemetryButton = uicls.Button(parent=topcontainer,
                                                      label='Telemetry',
                                                      align=uiconst.TOPRIGHT,
                                                      func=self.RunTelemetry)
            w = wnd.sr.fpsText = uicls.Label(text='',
                                             parent=topcontainer,
                                             align=uiconst.TOPLEFT,
                                             top=0,
                                             left=8)
            w = wnd.sr.vmText = uicls.Label(text='',
                                            parent=topcontainer,
                                            align=uiconst.TOPLEFT,
                                            top=14,
                                            left=8)
            w = wnd.sr.cacheText = uicls.Label(text='',
                                               parent=topcontainer,
                                               align=uiconst.TOPLEFT,
                                               top=28,
                                               left=8)
            self.tabs = maintabs = uicls.TabGroup(parent=main)
            wnd.sr.scroll = uicls.Scroll(
                parent=main,
                padding=(const.defaultPadding, const.defaultPadding,
                         const.defaultPadding, const.defaultPadding))
            wnd.sr.scroll.sr.id = 'monitorscroll'
            textonly = uicls.Container(name='textonly',
                                       parent=main,
                                       clipChildren=1,
                                       padding=8)
            graph = wnd.sr.graph = uicls.Container(name='graph',
                                                   parent=main,
                                                   clipChildren=1,
                                                   padding=8)
            statusHeader = ' '
            for tme in self.intvals:
                statusHeader += '<t><right>%s' % util.FmtDate(
                    long(tme * 10000), 'ss')

            statusHeader += '<t><right>total'
            wnd.statusLabels = []
            txt = uicls.Label(text=statusHeader,
                              parent=textonly,
                              align=uiconst.TOPLEFT,
                              tabs=[80, 130, 180, 230, 280, 330, 380],
                              state=uiconst.UI_DISABLED)
            for i in xrange(7):
                statusLabel = uicls.Label(
                    text='',
                    parent=textonly,
                    top=(i + 1) * txt.height + 1,
                    align=uiconst.TOPLEFT,
                    tabs=[80, 130, 180, 230, 280, 330, 380],
                    state=uiconst.UI_DISABLED)
                wnd.statusLabels.append(statusLabel)

            wnd.sr.settings = uicls.Container(name='settings',
                                              parent=main,
                                              clipChildren=1,
                                              padding=8)
            w = wnd.sr.queueText = uicls.Label(text='',
                                               parent=wnd.sr.settings,
                                               align=uiconst.TOTOP)
            wnd.sr.settingsInner = uicls.Container(name='settingsInner',
                                                   parent=wnd.sr.settings,
                                                   align=uiconst.TOALL)
            tabs = [('Main', wnd.sr.settings, self, 'settings'),
                    ('Network', textonly, self, 'network'),
                    ('Rot', wnd.sr.scroll, self, 'rot'),
                    ('Timers', wnd.sr.scroll, self, 'timers'),
                    ('Objects', wnd.sr.scroll, self, 'objects'),
                    ('Memory', graph, self, 'memory'),
                    ('Performance', graph, self, 'performance'),
                    ('Outstanding', wnd.sr.scroll, self, 'outstanding'),
                    ('Logs', wnd.sr.scroll, self, 'logs')]
            if prefs.GetValue('heapinfo', 0):
                tabs.append(['Heap', graph, self, 'heap'])
            if session.role & service.ROLE_GML:
                tabs.append(
                    ['Method Calls', wnd.sr.scroll, self, 'methodcalls'])
            tabData = []
            for label, panel, code, args in tabs:
                tabData.append(
                    uiutil.Bunch(label=label,
                                 panel=panel,
                                 code=code,
                                 args=args,
                                 LoadTabCallback=self.Load))

            self.tabs.LoadTabs(tabData, 1, settingsID='monitortabs')
            wnd.sr.bottomCont = bottomCont = uicls.Container(
                parent=main, align=uiconst.TOBOTTOM, height=48, idx=0)
            wnd.sr.resetWnd = uicls.Container(name='resetwnd',
                                              parent=bottomCont,
                                              align=uiconst.TOTOP,
                                              height=24,
                                              idx=0)
            wnd.sr.logWnd = uicls.Container(name='logwnd',
                                            parent=bottomCont,
                                            align=uiconst.TOTOP,
                                            height=24,
                                            idx=0)
            wnd.sr.logWnd2 = uicls.Container(name='logwnd2',
                                             parent=bottomCont,
                                             align=uiconst.TOTOP,
                                             height=24,
                                             idx=0)
            btns = uicls.ButtonGroup(
                parent=wnd.sr.logWnd,
                line=False,
                btns=[['Start', self.StartLogInMemory, (), 51],
                      ['Stop', self.StopLogInMemory, (), 51],
                      ['Clear', self.ClearLogInMemory, (), 51],
                      ['Copy', self.ExportLogInMemory, (), 51],
                      ['Attach', self.AttachToLogServer, (), 51],
                      ['Save', self.SaveLogsToFile, (), 51]])
            uicls.Label(parent=wnd.sr.logWnd2,
                        text='<b>Threshold:</b>',
                        align=uiconst.TOLEFT,
                        padLeft=10,
                        padTop=1)
            options = (('Info', 0), ('Notice', 1), ('Warning', 2), ('Error',
                                                                    3))
            for text, value in options:
                isChecked = blue.logInMemory.threshold == value
                uicls.Checkbox(parent=wnd.sr.logWnd2,
                               text=text,
                               groupname='threshold',
                               align=uiconst.TOLEFT,
                               width=100,
                               top=5,
                               checked=isChecked,
                               callback=self.OnLogThresholdRadioButtons,
                               retval=value)

            edit = uicls.SinglelineEdit(parent=wnd.sr.logWnd2,
                                        name='capacityEdit',
                                        align=uiconst.TORIGHT,
                                        ints=(1, MAX_LOG_CAPACITY),
                                        padRight=5,
                                        padBottom=5,
                                        setvalue=blue.logInMemory.capacity,
                                        OnChange=self.OnLogCapacityEdit)
            uicls.Label(parent=wnd.sr.logWnd2,
                        text='<b>Capacity:</b>',
                        align=uiconst.TORIGHT,
                        padLeft=10,
                        padTop=1)
            wnd.sr.methodcallWnd = uicls.Container(name='methodcallwnd',
                                                   parent=bottomCont,
                                                   align=uiconst.TOTOP,
                                                   height=24,
                                                   idx=0)
            btns = uicls.ButtonGroup(
                btns=[['Copy', self.ExportMethodCalls, (), 51]])
            wnd.sr.methodcallWnd.children.insert(0, btns)
            uicls.Line(parent=wnd.sr.resetWnd, align=uiconst.TOTOP)
            uicls.Button(parent=wnd.sr.resetWnd,
                         label='Reset',
                         align=uiconst.CENTER,
                         func=self.Reset)
            wnd.SetMinSize([400, 300])
            wnd.Maximize(1)
            wnd.SetParent(uicore.layer.abovemain)
        return wnd
Пример #21
0
 def GetKillDragData(self, *args):
     fakeNode = uiutil.Bunch()
     fakeNode.mail = self.rawKillmail
     fakeNode.__guid__ = 'listentry.KillMail'
     return [fakeNode]
 def GetOutpostData(self):
     return uiutil.Bunch(itemID=eve.session.stationid, typeID=eve.stationItem.stationTypeID, upgradeLevel=self.station.upgradeLevel)
 def MakeImprovement(imp):
     return uiutil.Bunch(typeID=imp.typeID, requiredImprovementTypeID=imp.requiredImprovementTypeID)
Пример #24
0
    def LoadSettings(self):
        import __builtin__
        self.SaveSettings()
        if not hasattr(__builtin__, 'settings'):
            __builtin__.settings = uiutil.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 = uiutil.SettingSection(sectionName, filePathDAT, 62, service=self)
                new = uiutil.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, uiutil.YAMLSettingSection, 'yaml')
            _LoadSettingsIntoBuiltins(sectionName, identifier, uiutil.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')
Пример #25
0
 def GetDragData(self, *args):
     fakeNode = uiutil.Bunch(typeID=self.typeID, tokenInfo=(self.redeemTokenData.tokenID, self.redeemTokenData.massTokenID))
     return [fakeNode]
Пример #26
0
    def PopulateOfferScroll(self):
        offers = self.storeSvc.GetPreparedOffers(reloadOffers=1)
        scrolllist = []
        for offerID, offerKV in offers.iteritems():
            invType = cfg.invtypes.Get(offerKV.typeID)
            if offerKV.numberOffered > 1:
                itemName = localization.GetByLabel(
                    'UI/VirtualGoodsStore/ItemNameAndQuantity',
                    itemName=invType.typeName,
                    quantity=offerKV.numberOffered)
            else:
                itemName = invType.typeName
            if invType.categoryID == const.categoryBlueprint:
                itemName += '<br>'
                opts = {
                    'materialLevel': offerKV.bpME,
                    'productivityLevel': offerKV.bpPE,
                    'runs': offerKV.bpRuns
                }
                if offerKV.bpRuns > 0:
                    itemName += localization.GetByLabel(
                        'UI/VirtualGoodsStore/BlueprintCopy', **opts)
                else:
                    itemName += localization.GetByLabel(
                        'UI/VirtualGoodsStore/OriginalBlueprint', **opts)
            if offerKV.genderRestrictions == const.FEMALE:
                genderText = localization.GetByLabel('UI/Common/Gender/Female')
            elif offerKV.genderRestrictions == const.MALE:
                genderText = localization.GetByLabel('UI/Common/Gender/Male')
            else:
                genderText = localization.GetByLabel(
                    'UI/VirtualGoodsStore/Unisex')
            url = '<url=showinfo:%d>' % offerKV.typeID
            data = uiutil.Bunch()
            data.itemLabel = '%s%s</url>' % (url, itemName)
            data.genderLabel = genderText
            data.priceLabel = localization.GetByLabel(
                'UI/VirtualGoodsStore/PriceLabel',
                price=util.FmtAUR(offerKV.price))
            data.offerID = offerID
            data.offerKV = offerKV
            data.label = 'bla'
            data.Set('sort_ ', offerID)
            data.Set(
                'sort_%s' %
                localization.GetByLabel('UI/VirtualGoodsStore/ItemName'),
                itemName)
            data.Set(
                'sort_%s' %
                localization.GetByLabel('UI/VirtualGoodsStore/Gender'),
                genderText)
            data.Set(
                'sort_%s' %
                localization.GetByLabel('UI/VirtualGoodsStore/Price'),
                offerKV.price)
            entry = listentry.Get('VStoreEntry', data=data)
            scrolllist.append(entry)

        self.scroll.Load(
            contentList=scrolllist,
            headers=[
                ' ',
                localization.GetByLabel('UI/VirtualGoodsStore/ItemName'),
                localization.GetByLabel('UI/VirtualGoodsStore/Gender'),
                localization.GetByLabel('UI/VirtualGoodsStore/Price')
            ])
Пример #27
0
 def __init__(self):
     self.sr = uiutil.Bunch()
     self.wr = util.WeakRefAttrObject()