Exemple #1
0
    def ClockSyncDaemon(self):
        syncRateMS = 300000
        while self.IsConnected():
            with ExceptionEater('Exception during soft clock sync'):
                blue.synchro.SleepWallclock(syncRateMS)
                log.LogInfo('*** Soft Clock Sync Starting ***')
                results = []
                numPings = 5
                blue.os.timeSyncAdjust = 0
                for i in xrange(numPings):
                    myTime = blue.os.GetWallclockTimeNow()
                    serverTime = sm.ProxySvc('machoNet').GetTime()
                    now = blue.os.GetWallclockTimeNow()
                    elaps = now - myTime
                    serverTime += elaps / 2
                    diff = float(now - serverTime)
                    results.append((elaps, diff))
                    log.LogInfo('SoftClock:', elaps, diff)

                averageElaps = sum([ x[0] for x in results ]) / numPings
                results = filter(lambda x: x[0] < averageElaps * 1.2, results)
                log.LogInfo('SoftClock results:', results)
                avgDiff = sum([ x[1] for x in results ]) / len(results)
                log.LogInfo('*** Soft Clock Sync adjusting by', -avgDiff / const.SEC, 'seconds')
                blue.os.timeSyncAdjust = long(-avgDiff)
                if abs(avgDiff) > 3 * const.SEC:
                    log.LogError('Having to adjust more than 3 seconds in a single timesync interval! (%fs per %ds)' % (avgDiff / float(const.SEC), syncRateMS / 1000))
                    syncRateMS = max(60000, syncRateMS - 60000)
                else:
                    syncRateMS = min(300000, syncRateMS + 60000)
                driftFactor = abs(avgDiff) / float(syncRateMS * const.MSEC)
                driftFactor = min(0.95, max(0.02, driftFactor))
                blue.os.timeSyncAdjustFactor = driftFactor
    def DDXTabStationServiceAccessControl(self):
        try:
            log.LogInfo('>>>DDXTabStationServiceAccessControl')
            for serviceID, service in self.servicesByID.iteritems():
                if not self.IsActiveService(serviceID):
                    continue
                log.LogInfo('>>>--', service.serviceName, '--<<<')
                rule = self.serviceAccessRulesByServiceID[serviceID]
                minimumStanding = self.GetNodeValue('%smods_minimumStanding' % serviceID)
                minimumCharSecurity = self.GetNodeValue('%smods_minimumCharSecurity' % serviceID)
                maximumCharSecurity = self.GetNodeValue('%smods_maximumCharSecurity' % serviceID)
                minimumCorpSecurity = self.GetNodeValue('%smods_minimumCorpSecurity' % serviceID)
                maximumCorpSecurity = self.GetNodeValue('%smods_maximumCorpSecurity' % serviceID)
                if rule.minimumStanding == minimumStanding and rule.minimumCharSecurity == minimumCharSecurity and rule.maximumCharSecurity == maximumCharSecurity and rule.minimumCorpSecurity == minimumCorpSecurity and rule.maximumCorpSecurity == maximumCorpSecurity:
                    continue
                log.LogInfo('!!!--', service.serviceName, ' has modified data--!!!')
                rule.minimumStanding = minimumStanding
                rule.minimumCharSecurity = minimumCharSecurity
                rule.maximumCharSecurity = maximumCharSecurity
                rule.minimumCorpSecurity = minimumCorpSecurity
                rule.maximumCorpSecurity = maximumCorpSecurity
                self.modifiedServiceAccessRulesByServiceID[serviceID] = rule

        finally:
            log.LogInfo('<<<DDXTabStationServiceAccessControl')
    def DDXTabCostModifiers(self):
        try:
            log.LogInfo('>>>DDXTabCostModifiers')
            for row in self.serviceCostModifiers:
                if not self.IsServiceAvailable(row.serviceID):
                    continue
                if not self.IsActiveService(row.serviceID):
                    continue
                taskname = self.GetServiceName(self.servicesByID[row.serviceID])
                discountPerGoodStandingPoint = float(self.GetEntryDataByName('cost_%s_discountPerGoodStandingPoint' % taskname).setValue)
                surchargePerBadStandingPoint = float(self.GetEntryDataByName('cost_%s_surchargePerBadStandingPoint' % taskname).setValue)
                if discountPerGoodStandingPoint == row.discountPerGoodStandingPoint and surchargePerBadStandingPoint == row.surchargePerBadStandingPoint:
                    continue
                row.discountPerGoodStandingPoint = discountPerGoodStandingPoint
                row.surchargePerBadStandingPoint = surchargePerBadStandingPoint
                bFound = 0
                for each in self.modifiedServiceCostModifiers:
                    if each.serviceID == row.serviceID:
                        bFound = 1
                        each.discountPerGoodStandingPoint = discountPerGoodStandingPoint
                        each.surchargePerBadStandingPoint = surchargePerBadStandingPoint
                        break

                if not bFound:
                    self.modifiedServiceCostModifiers.append(row)

        finally:
            log.LogInfo('<<<DDXTabCostModifiers')
    def _Populate_t(self, gender, path, key, callBack):
        log.LogInfo('ResData: populating from ', path)
        if gender not in self.genderData:
            self.CreateGenderData(gender)
        genderData = self.genderData[gender]
        entries = genderData.GetEntries(key)
        pathsToEntries = genderData.GetPathsToEntries(key)
        path = path.lower()

        def processAsync(root, respath, dirs, files):
            self._AddEntry(gender, entries, pathsToEntries, root, respath, dirs, files)

        try:
            i = 0
            for root, dirs, files in walk.walk(path):
                if dirs or files:
                    pdCf.BeFrameNice(300)
                    respath = root.split(path)[1]
                    t = uthread.new(processAsync, root, respath, dirs, files)
                    i += 1
                    self._tasklets[t] = True

        finally:
            log.LogInfo('ResData:', i, ' entries populated from ', path)
            if callBack:
                uthread.new(callBack)
Exemple #5
0
    def Setup(self, menu, parent = None, minwidth = None):
        log.LogInfo('Menu.Setup', id(self))
        entries = menu.GetEntries()
        wasLine = 0
        idNo = 0
        for i, entry in enumerate(entries):
            if entry is None:
                if not len(self.sr.entries.children) or i == len(entries) - 1 or wasLine:
                    continue
                item = uicls.Line(align=uiconst.TOTOP, parent=self.sr.entries)
                wasLine = 1
            else:
                size = settings.user.ui.Get('cmenufontsize', 10)
                menuEntryViewClass = entry.menuClass or uicls.MenuEntryView
                item = menuEntryViewClass(name='entry', align=uiconst.TOTOP, state=uiconst.UI_NORMAL, parent=self.sr.entries)
                item.Setup(entry, size, menu, idNo)
                idNo += 1
                wasLine = 0

        self.height = sum([ each.height for each in self.sr.entries.children ]) + self.sr.entries.top + self.sr.entries.height
        if len(self.sr.entries.children):
            self.width = max(max([ each.width for each in self.sr.entries.children ]) + 8, minwidth or 0) + self.sr.entries.left + self.sr.entries.width
        else:
            self.width = 100
        self.menu = menu
        log.LogInfo('Menu.Setup Completed', id(self))
    def PropogateLODRules(self):
        """
        Propogates lod cutoff values from entries that have values to those decendants of theirs 
        that dont.
        """
        log.LogInfo('PaperDoll - ResData: Propagating LOD rules')

        def TraverseLODCutoff(currentEntry, lodCutoff, entries):
            if not currentEntry:
                return
            if currentEntry.lodCutoff is not None:
                lodCutoff = currentEntry.lodCutoff
            elif lodCutoff is not None:
                currentEntry.lodCutoff = lodCutoff
            for childEntry in entries[currentEntry]:
                TraverseLODCutoff(childEntry, lodCutoff, entries)
                pdCf.BeFrameNice()

        for gender in self.genderData.iterkeys():
            genderData = self.genderData[gender]
            for key, entries in genderData.IterEntries():
                rootEntries = [ entry for entry in entries.iterkeys() if not entry.respath ]
                for rootEntry in rootEntries:
                    TraverseLODCutoff(rootEntry, 2, entries)

        log.LogInfo('PaperDoll - ResData: Done propagating LOD rules!')
Exemple #7
0
def AggregateEvent(eventTypeID, event, storage, aggregatePath, aggregateKeys, valueIx):
    prevPath = None
    prevKey = None
    for key in aggregateKeys:
        prevPath = aggregatePath
        if event[key] not in aggregatePath:
            aggregatePath[event[key]] = {}
        aggregatePath = aggregatePath[event[key]]
        prevKey = event[key]

    if not len(aggregatePath):
        log.LogInfo('IGS has no record for the current aggregate event. IGS will create a new record for aggregation.')
        prevPath[prevKey] = event
        storage[eventTypeID].append(prevPath[prevKey])
    else:
        log.LogInfo('IGS already has a record for the current aggregate event. IGS will aggregate on non grouping columns.')
        for ix in valueIx.difference([IDX_DATETIME]):
            if type(event[ix]) == types.IntType:
                log.LogInfo('IGS Treating aggregate event parameter at idx=', ix, 'as an Integer')
                if prevPath[prevKey][ix] + event[ix] <= const.maxInt:
                    prevPath[prevKey][ix] += event[ix]
                else:
                    log.LogException('Integer Overflow error on event! Event discarded: Consider using float!')
            elif type(event[ix]) == types.LongType:
                log.LogInfo('IGS Treating aggregate event parameter at idx=', ix, 'as Bigint')
                if prevPath[prevKey][ix] + event[ix] <= const.maxBigint:
                    prevPath[prevKey][ix] += event[ix]
                else:
                    log.LogException('Integer Overflow error on event! Event discared: Consider using float!')
            elif type(event[ix]) == types.FloatType:
                log.LogInfo('IGS Treating aggregate event parameter at idx=', ix, 'as an Float')
                prevPath[prevKey][ix] += event[ix]
            elif ix > 0:
                log.LogException('IGS received data of unhandled datatype!')
Exemple #8
0
 def Expand(self, *args):
     self.expanding = 1
     if sm.GetService('connection').IsConnected():
         eve.Message('ComboExpand')
     log.LogInfo('ColorPreview', self.name, 'expanding')
     colorpar = uiprimitives.Container(name='colors',
                                       align=uiconst.TOPLEFT,
                                       width=112,
                                       height=62)
     uicore.layer.menu.children.insert(0, colorpar)
     colorSwatch = ColorSwatch(name='colorSwatch',
                               align=uiconst.TOALL,
                               parent=colorpar)
     colorSwatch.Startup()
     colorSwatch.sr.dad = self
     self.sr.wndUnderlay = uicontrols.WindowUnderlay(parent=colorpar)
     self.sr.wndUnderlay.padding = -6
     l, t, w, h = self.sr.preview.GetAbsolute()
     colorpar.left = [l + w, l - colorpar.width
                      ][l + w + colorpar.width > uicore.desktop.width]
     colorpar.top = [t + h, t - colorpar.height
                     ][t + h + colorpar.height > uicore.desktop.height]
     colorpar.state = uiconst.UI_NORMAL
     self.colorpar = colorpar
     self.sr.cookie = uicore.event.RegisterForTriuiEvents(
         uiconst.UI_MOUSEUP, self.OnGlobalClick)
     self.expanding = 0
     self.expanded = 1
     log.LogInfo('ColorPreview', self.name, 'expanded')
    def ShowMembers(self):
        log.LogInfo('ShowMembers')
        try:
            sm.GetService('corpui').ShowLoad()
            scrolllist = []
            headers = []
            hint = localization.GetByLabel(
                'UI/Corporations/CorporationWindow/Alliances/Members/NoMembersFound'
            )
            if self is None or self.destroyed:
                log.LogInfo('ShowAllianceApplications Destroyed or None')
                hint = '\xfe\xfa s\xe1st mig ekki.'
            elif eve.session.allianceid is None:
                hint = localization.GetByLabel(
                    'UI/Corporations/CorporationWindow/Alliances/Members/CorporationNotInAllianceATM',
                    corpName=cfg.eveowners.Get(eve.session.corpid).ownerName)
            else:
                members = sm.GetService('alliance').GetMembers()
                log.LogInfo('ShowMembers len(members):', len(members))
                owners = []
                for member in members.itervalues():
                    if member.corporationID not in owners:
                        owners.append(member.corporationID)

                if len(owners):
                    cfg.eveowners.Prime(owners)
                for member in members.itervalues():
                    self.__AddToList(member, scrolllist)

            self.sr.scroll.adjustableColumns = 1
            self.sr.scroll.Load(contentList=scrolllist,
                                headers=self.sr.headers,
                                noContentHint=hint)
        finally:
            sm.GetService('corpui').HideLoad()
 def OnJumpQueueMessage(self, msgtext, ready):
     if ready:
         log.LogInfo('Jump Queue: ready, slamming through...')
         self.__Confirm(sm.GetService('jumpQueue').GetPreparedQueueCharID())
     else:
         log.LogInfo('Jump Queue: message=', msgtext)
         sm.GetService('gameui').Say(msgtext)
Exemple #11
0
 def _RequestTrust(self, inputUrl):
     if not inputUrl.startswith('http://') and not inputUrl.startswith(
             'https://'):
         log.LogError(
             'CCPEVE.RequestTrust - Input URL must start with either http:// or https:// -- received',
             inputUrl)
         return
     scheme, netloc, path, query, fragment = urlparse.urlsplit(inputUrl)
     if path is None or path == '':
         path = '/'
     trustUrl = '%s://%s%s' % (scheme, netloc, path)
     if sm.GetService('sites').IsTrusted(trustUrl) or sm.GetService(
             'sites').IsIgnored(trustUrl):
         log.LogInfo(
             'CCPEVE.RequestTrust - Received top-level URL is already trusted or ignored:',
             trustUrl)
         return
     currentUrl = self.GetCurrentURL()
     if sm.GetService('sites').IsIgnored(currentUrl):
         log.LogInfo(
             'CCPEVE.RequestTrust - Calling URL is ignored, discarding:',
             currentUrl)
         return
     wnd = uicls.TrustedSitePromptWindow.GetIfOpen(
         windowID='trustPromptWindow_%s' % netloc)
     if wnd:
         wnd.Maximize()
         log.LogWarn(
             'CCPEVE.RequestTrust - Trust prompt window was already open - skipping!'
         )
         return
     wnd = uicls.TrustedSitePromptWindow.Open(
         windowID='trustPromptWindow_%s' % netloc,
         trustUrl=inputUrl,
         inputUrl=currentUrl)
def update_image_titles(client, nmb_threads=8):
    log.LogInfo('Getting all images...')
    images = client.findImages()
    total = len(images)
    log.LogInfo(f"Found {total} images")
    if total == 0:
        log.LogInfo('Why are you even running this plugin?')
        return

    # nmb of finished images
    count = 0
    # in the rare case, that there are less then #threads images
    nmb_threads = min(nmb_threads, total)
    thread_lock = threading.Lock()
    q = Queue(maxsize=0)
    for image in images:
        q.put(image)

    log.LogInfo('Start updating images (this might take a while)')
    # Create threads and start them
    for i in range(nmb_threads):
        worker = threading.Thread(target=thread_function, name=f"Thread-{i}", args=(q, thread_lock, count, total, client))
        worker.start()

    # Wait for all threads to be finished
    q.join()

    log.LogInfo(f'Finished updating all {total} images')
    def ShowAllianceApplications(self, viewRejected):
        log.LogInfo('ShowAllianceApplications')
        try:
            sm.GetService('corpui').ShowLoad()
            scrolllist = []
            headers = []
            hint = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Applications/NoApplicationsFound')
            if eve.session.allianceid is None:
                hint = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Applications/CorporationNotInAlliance', corpName=cfg.eveowners.Get(eve.session.corpid).ownerName)
            elif const.corpRoleDirector & eve.session.corprole != const.corpRoleDirector:
                log.LogInfo('ShowAllianceApplications Invalid Callee')
                hint = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Applications/RequireDirectorHint')
            elif self is None or self.destroyed:
                log.LogInfo('ShowAllianceApplications Destroyed or None')
            else:
                nameLabel = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Applications/Name')
                statusLabel = localization.GetByLabel('UI/Corporations/CorporationWindow/Alliances/Applications/Status')
                headers = [nameLabel, statusLabel]
                applications = sm.GetService('alliance').GetApplications(viewRejected)
                log.LogInfo('ShowAllianceApplications len(applications):', len(applications))
                owners = []
                for application in applications.itervalues():
                    if application.corporationID not in owners:
                        owners.append(application.corporationID)

                if len(owners):
                    cfg.eveowners.Prime(owners)
                for application in applications.itervalues():
                    self.__AddApplicationToList(application, scrolllist, 0)

            self.sr.rejectedContainer.state = uiconst.UI_PICKCHILDREN
            self.sr.scroll.Load(fixedEntryHeight=19, contentList=scrolllist, headers=headers, noContentHint=hint)
        finally:
            sm.GetService('corpui').HideLoad()
    def DDXTabOffices(self):
        try:
            log.LogInfo('>>>DDXTabOffices')
            for each in self.rentableItems:
                if each.typeID == const.typeOfficeFolder:
                    pass
                else:
                    log.LogError('Unknown typeID on Corporation Folder %s (typeID) %s (CorpID)' % each.typeID, eve.session.corpid)
                    continue
                publiclyAvailable = self.GetEntryDataByName('offices_type%s_number%s' % (each.typeID, each.number)).checked
                if each.publiclyAvailable == publiclyAvailable:
                    continue
                each.publiclyAvailable = publiclyAvailable
                bFound = 0
                for row in self.modifiedRentableItems:
                    if row.typeID == each.typeID and row.number == each.number:
                        bFound = 1
                        row.publiclyAvailable = publiclyAvailable
                        break

                if not bFound:
                    self.modifiedRentableItems.append(each)

        finally:
            log.LogInfo('<<<DDXTabOffices')
Exemple #15
0
def add_tag(client):
    tag_id = client.findTagIdWithName(control_tag)

    if tag_id is None:
        client.createTagWithName(control_tag)
        log.LogInfo("Tag created successfully")
    else:
        log.LogInfo("Tag already exists")
 def InitializeList(self):
     if self.ddxFunction is not None:
         try:
             log.LogInfo('Calling ddxFunction:', self.ddxFunction)
             self.ddxFunction()
             log.LogInfo('Called ddxFunction:', self.ddxFunction)
         finally:
             self.ddxFunction = None
             self.ddxArguments = {}
Exemple #17
0
def remove_tag(client):
    tag_id = client.findTagIdWithName(control_tag)

    if tag_id is None:
        log.LogInfo("Tag does not exist. Nothing to remove")
        return

    log.LogInfo("Destroying tag")
    client.destroyTag(tag_id)
Exemple #18
0
def add_tag(client):
    tag_name = "scrape"
    tag_id = client.findTagIdWithName(tag_name)

    if tag_id is None:
        client.createTagWithName(tag_name)
        log.LogInfo("Tag created successfully")
    else:
        log.LogInfo("Tag already exists")
Exemple #19
0
def removeTag(client):
    tagName = "Hawwwwt"
    tagID = client.findTagIdWithName(tagName)

    if tagID == None:
        log.LogInfo("Tag does not exist. Nothing to remove")
        return

    log.LogInfo("Destroying tag")
    client.destroyTag(tagID)
Exemple #20
0
    def Expand(self):
        self.expanding = 1
        if sm.GetService('connection').IsConnected():
            eve.Message('ComboExpand')
        log.LogInfo('Combo', self.name, 'expanding')
        colorpar = uiprimitives.Container(name='colors',
                                          align=uiconst.TOPLEFT,
                                          width=130,
                                          height=133)
        uicore.layer.menu.children.insert(0, colorpar)
        colorscroll = Scroll(parent=colorpar)
        colors = [((1.0, 1.0, 1.0, 1.0), 'white'),
                  ((0.7, 0.7, 0.7, 1.0), 'grey 70%'),
                  ((0.3, 0.3, 0.3, 1.0), 'grey 30%'),
                  ((0.0, 0.0, 0.0, 1.0), 'black'),
                  ((1.0, 1.0, 0.0, 1.0), 'yellow'),
                  ((0.0, 1.0, 0.0, 1.0), 'green'),
                  ((1.0, 0.0, 0.0, 1.0), 'red'),
                  ((0.0, 0.0, 1.0, 1.0), 'blue'),
                  ((0.5, 0.5, 0.0, 1.0), 'dark yellow'),
                  ((0.0, 0.5, 0.0, 1.0), 'dark green'),
                  ((0.5, 0.0, 0.0, 1.0), 'dark red'),
                  ((0.0, 0.0, 0.5, 1.0), 'dark blue'),
                  ((0.5, 0.0, 0.5, 1.0), 'dark mangenta'),
                  ((0.0, 1.0, 1.0, 1.0), 'cyan'),
                  ((1.0, 0.0, 1.0, 1.0), 'mangenta'),
                  ((0.0, 0.5, 1.0, 1.0), 'dark blue'),
                  ((1.0, 0.5, 0.0, 1.0), 'dark blue')]
        x = y = 0
        scrolllist = []
        icons = []
        import listentry
        for each in colors:
            color, labelstr = each
            icons.append((None, color, color, self.PickCol))
            x += 1
            if x == 4:
                scrolllist.append(listentry.Get('Icons', {'icons': icons}))
                icons = []
                y += 1
                x = 0

        colorscroll.Load(32, contentList=scrolllist)
        colorpar.left, colorpar.top = self.sr.color.absoluteLeft, [
            self.sr.color.absoluteTop + self.sr.color.height,
            self.sr.color.absoluteTop - colorpar.height
        ][self.sr.color.absoluteTop + self.sr.color.height +
          colorpar.height > uicore.desktop.height]
        colorpar.state = uiconst.UI_NORMAL
        self.sr.colorpar = _weakref.ref(colorscroll)
        uicore.event.RegisterForTriuiEvents(uiconst.UI_MOUSEUP,
                                            self.OnGlobalClick)
        self.expanding = 0
        self.expanded = 1
        log.LogInfo('Colors', self.name, 'expanded')
Exemple #21
0
 def OnAllianceChanged(self, allianceID, change):
     log.LogInfo('OnAllianceChanged allianceID', allianceID, 'change', change)
     if eve.session.allianceid != allianceID:
         return
     if self.state != uiconst.UI_NORMAL:
         log.LogInfo('OnAllianceChanged state != UI_NORMAL')
         return
     if self.sr.scroll is None:
         log.LogInfo('OnAllianceChanged no scroll')
         return
     self.ShowDetails()
Exemple #22
0
    def LoadTypeIcon(self, *args):
        attrs = self.attrs
        src = attrs.src
        typeID = None
        try:
            typeID = int(src[9:])
        except:
            log.LogInfo("couldn't convert string to typeID, looking up constvalue, Img::Load", src)
            typeID = util.LookupConstValue('type%s' % attrs.src[9:].strip().capitalize(), None)

        bumped = getattr(attrs, 'bumped', 0)
        showFitting = getattr(attrs, 'showfitting', 0)
        showTechLevel = getattr(attrs, 'showtechlevel', 0)
        isCopy = getattr(attrs, 'iscopy', 0)
        if not typeID:
            kw = htmlwriter.PythonizeArgs(src[9:])
            typeID = kw.get('typeID', None)
            bumped = kw.get('bumped', 0)
            isCopy = kw.get('isCopy', 0)
            showFitting = kw.get('showFitting', 0)
            showTechLevel = kw.get('showTechLevel', 0)
        if typeID:
            if bumped:
                if hasattr(self, 'icon') and self.icon:
                    self.icon.Close()
                self.icon = DraggableIcon(parent=self, typeID=typeID, isCopy=True if isCopy == 1 else False, state=uiconst.UI_DISABLED)
                if showFitting:
                    powerEffect = None
                    powerIcon = None
                    powerEffects = [const.effectHiPower, const.effectMedPower, const.effectLoPower]
                    for effect in cfg.dgmtypeeffects.get(typeID, []):
                        if effect.effectID in powerEffects:
                            powerEffect = cfg.dgmeffects.Get(effect.effectID, None)
                            powerIcon = {const.effectHiPower: 11,
                             const.effectMedPower: 10,
                             const.effectLoPower: 9}.get(powerEffect.effectID, None)
                            break

                    if powerIcon:
                        c = uiprimitives.Container(name='powericon', align=uiconst.BOTTOMRIGHT, parent=self.icon, width=attrs.width / 4, height=attrs.width / 4, idx=0)
                        uiprimitives.Line(parent=c, align=uiconst.TOLEFT, color=(1.0, 1.0, 1.0, 0.5))
                        uiprimitives.Line(parent=c, align=uiconst.TOTOP, color=(1.0, 1.0, 1.0, 0.5))
                        uiprimitives.Fill(parent=c, padRight=2, padBottom=2, color=(0.0, 0.0, 0.0, 1.0))
                        pwrIcon = uicontrols.Icon(icon='ui_8_64_%s' % powerIcon, parent=c, align=uiconst.TOALL, idx=0, hint=localization.GetByLabel('UI/Common/FitsToSlot', slotType=powerEffect.displayName), ignoreSize=True)
                if showTechLevel:
                    techSprite = uix.GetTechLevelIcon(None, 0, typeID)
                    if techSprite:
                        c = uiprimitives.Container(name='techIcon', align=uiconst.TOPLEFT, parent=self.icon, width=16, height=16, idx=0)
                        c.children.append(techSprite)
            else:
                uicontrols.Icon(parent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED, pos=(0, 0, 0, 0), typeID=typeID, size=attrs.width, isCopy=isCopy)
        else:
            log.LogInfo('Couldnt convert', attrs.src[9:], 'to typeID')
 def ConfirmWithCharID(self, charID, *_):
     log.LogInfo('Character selection: Character selection confirmation')
     if not self.ready:
         log.LogInfo('Character selection: Denied character selection confirmation, not ready')
         eve.Message('Busy')
         return
     isInSync = self.WaitForClockSynchroAndGetSynchroState()
     if not isInSync:
         eve.Message('ClockSynchroInProgress')
         return
     if sm.GetService('jumpQueue').GetPreparedQueueCharID() != charID:
         self.__Confirm(charID)
Exemple #24
0
    def Read(self, *args, **keywords):
        with bluepy.Timer('Socket::GPS::Read'):
            if stackless.getcurrent().is_main:
                raise RuntimeError("You can't Read from a socket in a synchronous manner without blocking, dude.")
            try:
                while True:
                    if self.packetNumber in self.packetQueue:
                        r = self.packetQueue[self.packetNumber]
                        serial = self.packetNumber
                        del self.packetQueue[self.packetNumber]
                        log.LogInfo('[Packet Order] address:', self.address, 'removed packet', self.packetNumber, 'from reordering map (queue:', len(self.packetQueue), 'elems)')
                        break
                    else:
                        value = self.socket.recvpacketoob()
                    if value is not None:
                        r, oob, serial = value
                        if self.packetNumber == -1:
                            self.packetNumber = serial
                        if self.packetNumber < serial:
                            log.LogInfo('[Packet Order] address:', self.address, 'got', serial, 'expected', self.packetNumber, ', adding to map (queue:', len(self.packetQueue), ' elems)')
                            self.packetQueue[serial] = r
                            self.numReorderedPackets += 1
                            continue
                        elif self.packetNumber > serial:
                            log.LogError('[Packet Order] address:', self.address, 'got', serial, 'expected', self.packetNumber, ', dropping old packet (queue:', len(self.packetQueue), ' elems)')
                            continue
                        break
                    else:
                        r = None
                        break

                self.packetNumber += 1
            except socket.error as e:
                if e[0] == errno.WSAENOBUFS:
                    log.LogException()
                self.Close(localization.GetByLabel('/Carbon/MachoNet/SocketWasClosed'), exception=e)
                raise GPSTransportClosed(**self.closeReason)
            except Exception as e:
                if isinstance(e, RuntimeError) and e.args and 'too large a packet' in e.args[0]:
                    self.Close(localization.GetByLabel('/Carbon/MachoNet/ConnectionWasClosed'), exception=e)
                    raise GPSTransportClosed(**self.closeReason)
                self.Close(localization.GetByLabel('/Carbon/MachoNet/SomethingHappenedSocketWasClosed'), exception=e)
                log.LogTraceback()
                raise 

            if r is None:
                self.Close(localization.GetByLabel('/Carbon/MachoNet/ConnectionWasClosed'))
                raise GPSTransportClosed(**self.closeReason)
            if self.socketStatsEnabled:
                self.statsBytesReadPerPacket.AddSample(len(r))
                self.statsBytesRead.Add(len(r))
                self.statsPacketsRead.Add()
            return r
 def DDXTabStationDetails(self):
     try:
         log.LogInfo('>>>DDXTabStationDetails')
         self.station.stationName = self.GetNodeValue('details_name')
         self.station.description = self.GetNodeValue('details_description')
         self.station.dockingCostPerVolume = self.GetNodeValue('details_dockingCostPerVolume')
         self.station.officeRentalCost = self.GetNodeValue('details_officeRentalCost')
         self.station.exitTime = self.GetNodeValue('details_exitTime') * 100
         if self.IsServiceAvailable(const.stationServiceReprocessingPlant):
             self.station.reprocessingStationsTake = self.GetNodeValue('details_reprocessingStationsTake') / 100
     finally:
         log.LogInfo('<<<DDXTabStationDetails')
Exemple #26
0
 def UpdateViewPort(self, *args):
     l, t, w, h = self.GetAbsoluteViewport()
     log.LogInfo('SceneContainerBrackets::UpdateViewPort', l, t, w, h)
     if not w and not h:
         return
     self.viewport.width = uicore.ScaleDpi(w)
     self.viewport.height = uicore.ScaleDpi(h)
     log.LogInfo('new viewport dimensions', self.viewport.x,
                 self.viewport.y, self.viewport.width, self.viewport.height)
     log.LogInfo('projection', self.fov, self.viewport.GetAspectRatio(),
                 self.frontClip, self.backClip)
     self.camera.UpdateViewportSize(uicore.ScaleDpi(w), uicore.ScaleDpi(h))
Exemple #27
0
    def SetSceneType(self, sceneType):
        if self.primaryJob.sceneType == sceneType:
            if sceneType == SCENE_TYPE_INTERIOR:
                self._EnableLoadingClear()
            return
        if sceneType != SCENE_TYPE_SPACE:
            self.DeactivateFISCamera()
        self.primaryJob = SceneContext(sceneType=sceneType)
        if sceneType == SCENE_TYPE_INTERIOR:
            log.LogInfo('Setting up WiS interior scene rendering')
            self.primaryJob.renderJob = self.incarnaRenderJob
            self.characterRenderJob.Disable()
            self.fisRenderJob.SetActiveScene(None)
            self.fisRenderJob.Disable()
            for each in self.registeredJobs:
                each.object.UseFXAA(True)

            self.ApplyClothSimulationSettings()
            if getattr(self.secondaryJob, 'sceneType',
                       None) == SCENE_TYPE_SPACE:
                self.secondaryJob.renderJob.UseFXAA(True)
            else:
                self._EnableLoadingClear()
        elif sceneType == SCENE_TYPE_CHARACTER_CREATION:
            log.LogInfo('Setting up character creation scene rendering')
            self.primaryJob.renderJob = self.characterRenderJob
            self.incarnaRenderJob.SetScene(None)
            self.incarnaRenderJob.SetBackgroundScene(None)
            self.incarnaRenderJob.Disable()
            self.fisRenderJob.SetActiveScene(None)
            self.fisRenderJob.Disable()
            self.ApplyClothSimulationSettings()
            self._DisableLoadingClear()
            self.characterRenderJob.Enable()
        elif sceneType == SCENE_TYPE_SPACE:
            log.LogInfo('Setting up space scene rendering')
            self.primaryJob.renderJob = self.fisRenderJob
            self.incarnaRenderJob.SetScene(None)
            self.incarnaRenderJob.SetBackgroundScene(None)
            self.incarnaRenderJob.Disable()
            self.characterRenderJob.SetScene(None)
            self.characterRenderJob.Disable()
            self.fisRenderJob.UseFXAA(False)
            for each in self.registeredJobs:
                each.object.UseFXAA(False)

            self._DisableLoadingClear()
            if getattr(self.secondaryJob, 'sceneType',
                       None) == SCENE_TYPE_SPACE:
                self.secondaryJob.renderJob.UseFXAA(False)
            if self.secondaryJob is None:
                self.fisRenderJob.Enable()
Exemple #28
0
def bulk_scrape(client, create_missing_performers=False, create_missing_tags=False, create_missing_studios=False, delay=5):
    try:
        create_missing_studios = bool(config.create_missing_studios)
        create_missing_tags = bool(config.create_missing_tags)
        create_missing_performers = bool(config.create_missing_performers)
        delay = int(config.delay)
    except AttributeError as e:
        log.LogWarning(e)
        log.LogWarning("Using defaults for missing config values")
    except ValueError as e:
        log.LogWarning(e)
        log.LogWarning("Using defaults for wrong values")

    log.LogInfo('##### Bulk URL Scraper #####')
    log.LogInfo(f'create_missing_performers: {create_missing_performers}')
    log.LogInfo(f'create_missing_tags: {create_missing_tags}')
    log.LogInfo(f'create_missing_studios: {create_missing_studios}')
    log.LogInfo(f'delay: {delay}')
    log.LogInfo('#############################')

    # Search for all scenes with scrape tag
    tag = client.findTagIdWithName(control_tag)
    if tag is None:
        sys.exit("Tag scrape does not exist. Please create it via the 'Create scrape tag' task")

    tag_ids = [tag]
    scenes = client.findScenesByTags(tag_ids)
    log.LogInfo(f'Found {len(scenes)} scenes with scrape tag')
    count = __bulk_scrape(client, scenes, create_missing_performers, create_missing_tags, create_missing_studios, delay)
    log.LogInfo(f'Scraped data for {count} scenes')
def copy_all_tags(client):
    log.LogWarning("#######################################")
    log.LogWarning("Warning! This task will copy all information to all galleries with attached scenes")
    log.LogWarning("You have 30 seconds to cancel this task before it starts copying")
    log.LogWarning("#######################################")

    time.sleep(30)
    log.LogInfo("Start copying information. This may take a while depending on the amount of galleries")
    # Get all galleries
    galleries = client.findGalleriesByTags([])
    log.LogDebug(f"Found {len(galleries)} galleries")
    count = __copy_tags(client, galleries)

    log.LogInfo(f'Copied scene information to {count} galleries')
Exemple #30
0
def ShowMenu(object, auxObject=None):
    CloseContextMenus()
    m = None
    menuFunc = getattr(object, 'GetMenu', None)
    if menuFunc:
        if type(menuFunc) == types.TupleType:
            func, args = menuFunc
            m = func(args)
        else:
            m = menuFunc()
    if not m or not filter(None, m):
        if auxObject and hasattr(auxObject, 'GetAuxiliaryMenuOptions'):
            m = auxObject.GetAuxiliaryMenuOptions()
        else:
            log.LogInfo('menu', 'ShowMenu: No Menu!')
            return
    elif auxObject and hasattr(auxObject, 'GetAuxiliaryMenuOptions'):
        m = m + auxObject.GetAuxiliaryMenuOptions()
    if getattr(object, 'showingMenu', 0):
        log.LogInfo('menu', 'ShowMenu: Already showing a menu')
        return
    object.showingMenu = 1
    uicore.contextMenuOwner = weakref.ref(object)
    try:
        d = uicore.desktop
        mv = CreateMenuView(CreateMenuFromList(m), None,
                            getattr(object, 'minwidth', None))
        object.menuObject_weakref = weakref.ref(mv)
        topLeft = 1
        func = getattr(object, 'GetMenuPosition', None)
        if func is not None:
            ret = func(object)
            if len(ret) == 2:
                x, y = ret
            else:
                x, y, topLeft = ret
        else:
            x, y = uicore.uilib.x + 10, uicore.uilib.y
        if topLeft:
            x, y = min(d.width - mv.width, x), min(d.height - mv.height, y)
        else:
            x, y = min(d.width - mv.width,
                       x - mv.width), min(d.height - mv.height, y)
        mv.left, mv.top = x, y
        uicore.layer.menu.children.insert(0, mv)
    finally:
        object.showingMenu = 0

    log.LogInfo('menu', 'ShowMenu finished OK')