def _run(self):
        self.is_running = True
        while self.is_running:
            while blue.resMan.pendingLoads > RESMAN_QUEUE_THRESHOLD:
                if self.stop_requested:
                    break
                blue.synchro.Yield()

            if not self.is_running:
                break
            if self.stop_requested:
                break
            if len(self.sets) == 0:
                break
            current_set = self.sets[0]
            if len(current_set.fileset) > 0:
                filename = current_set.fileset[0]
                del current_set.fileset[0]
                if not blue.paths.FileExistsLocally(filename):
                    log.debug('Downloading %s' % filename)
                    uthread2.StartTasklet(remotefilecache.prefetch_single_file,
                                          filename)
                    blue.synchro.Yield()
            if len(current_set.fileset) == 0:
                log.debug('Finished downloading %s' % current_set.key)
                if current_set.key in self.sets_by_key:
                    self.sets.remove(current_set)
                    del self.sets_by_key[current_set.key]

        self.is_running = False
        self.stop_requested = False
 def ApplyAttributes(self, attributes):
     super(RenderJobProfiler, self).ApplyAttributes(attributes)
     self.SetCaption('Render Job Profiler')
     self._renderJob = None
     self.SetTopparentHeight(0)
     parent = self.GetMainArea()
     parent.SetAlign(uiconst.TOALL)
     parent.padding = 5
     top = Container(parent=parent, align=uiconst.TOTOP, height=20)
     Label(text='Render Job', parent=top, align=uiconst.TOLEFT, padding=4)
     combo = Combo(parent=top,
                   options=[(rj.name, rj)
                            for rj in trinity.renderJobs.recurring],
                   callback=self._OnRenderJob,
                   align=uiconst.TOALL)
     bottom = Container(parent=parent,
                        align=uiconst.TOBOTTOM,
                        height=20,
                        padding=2)
     Button(parent=bottom,
            align=uiconst.CENTER,
            label='Copy',
            func=self._Copy,
            args=())
     self._scroll = Scroll(parent=parent, align=uiconst.TOALL, top=4)
     self._OnRenderJob(None, None, combo.selectedValue)
     uthread2.StartTasklet(self._UpdateTiming)
Exemple #3
0
 def __init__(self, video):
     super(Controls, self).__init__(None, title='Video Controls')
     self.video = video
     self._update_slider = True
     video.on_state_change = self.on_video_state
     layout = wx.BoxSizer(wx.HORIZONTAL)
     self.status = wx.StaticText(self)
     self.status.SetMinSize((100, 10))
     layout.Add(self.status)
     play = wx.Button(self, label='Play')
     play.Bind(wx.EVT_BUTTON, self.on_play)
     layout.Add(play)
     pause = wx.Button(self, label='Pause')
     pause.Bind(wx.EVT_BUTTON, self.on_pause)
     layout.Add(pause)
     self.slider = wx.Slider(self)
     self.slider.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK,
                      self.on_slider_tracking)
     self.slider.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.on_slider)
     layout.Add(self.slider)
     self.time = wx.StaticText(self)
     self.time.SetMinSize((100, 10))
     layout.Add(self.time)
     layout.Add(wx.StaticText(self, label='/'))
     self.duration = wx.StaticText(self)
     self.duration.SetMinSize((100, 10))
     layout.Add(self.duration)
     self.SetSizerAndFit(layout)
     uthread2.StartTasklet(self.update_time)
Exemple #4
0
 def OnSubSystemChanged(self, newSlim):
     self.typeData['slimItem'] = newSlim
     if self.model is None:
         self.LogError('OnSlimItemUpdated - no model to remove')
         return
     self.fitted = False
     uthread2.StartTasklet(self.LoadT3ShipWithThrottle)
    def RunSimulation(self):
        trinity.settings.SetValue('frustumCullingDisabled', 1)
        trinity.settings.SetValue('eveSpaceSceneVisibilityThreshold', 0)
        trinity.settings.SetValue('eveSpaceSceneLowDetailThreshold', 0)
        trinity.settings.SetValue('eveSpaceSceneMediumDetailThreshold', 0)
        ut.StartTasklet(self._PumpBlue)
        import sceneutils
        scene = sceneutils.GetOrCreateScene()
        scene.objects.append(self.redNodeMutated)
        self._UpdateBoundingBox(True)
        rj = trinity.CreateRenderJob('CallbackJob')
        projection = trinity.TriProjection()
        projection.PerspectiveFov(1, 1, 1, 10000000)
        rj.steps.append(trinity.TriStepSetProjection(projection))
        view = trinity.TriView()
        view.SetLookAtPosition((50000, 0, 0), (0, 0, 0), (0, 1, 0))
        rj.steps.append(trinity.TriStepSetView(view))
        rj.steps.append(trinity.TriStepUpdate(scene))
        rj.steps.append(trinity.TriStepRenderScene(scene))
        rj.steps.append(trinity.TriStepPythonCB(self.AccumulateBounds))
        rj.ScheduleRecurring()
        for i in range(self._passes):
            self.activeIndex[0] = i
            for cs in self.curveSets:
                cs.Play()

            for sys in self.systems:
                sys.ClearParticles()

            self.started[0] = True
            ut.SleepSim(self._time)

        rj.UnscheduleRecurring()
        self._pumpBlue = False
Exemple #6
0
 def OnUnlocking(self, charID, shipID):
     if self.scrambledShipID is not None:
         if self.scrambledShipID == shipID:
             return
         self._UnscrambleShip(self.scrambledShipID)
     self.scramblingShipThread = uthread2.StartTasklet(
         self._ScrambleShip, shipID)
Exemple #7
0
 def FitHardpoints(self, blocking=False):
     if getattr(self.fittingThread, 'alive', False):
         self.fitted = False
         self.fittingThread.kill()
     if blocking:
         self._FitHardpoints()
     else:
         self.fittingThread = uthread2.StartTasklet(self._FitHardpoints)
 def GetDamageStateForDrone(self, droneID):
     if self.IsDroneDamageReady(droneID):
         return self.droneDamageStatesByDroneIDs.get(droneID, None)
     droneIDsMissingDamage = self.FindDronesMissingDamageState([droneID])
     if droneIDsMissingDamage:
         uthread2.StartTasklet(self.FetchInBayDroneDamageToServer,
                               droneIDsMissingDamage)
     return DAMAGESTATE_NOT_READY
Exemple #9
0
 def _add_to_update_challenges(self, challenge_id,
                               new_challenge_or_progress, update_function):
     self.challenges_for_update.append(
         (challenge_id, new_challenge_or_progress, update_function))
     if self.update_challenge_thread is None or not self.update_challenge_thread.IsAlive(
     ):
         self.update_challenge_thread = uthread2.StartTasklet(
             self._update_challenges)
 def AddPoint(self):
     if self._currentPath is None or self._cameraController is None:
         return
     self._currentPath.UpdatePosition(self._cameraController)
     self._currentPath.AddPoint()
     sm.GetService('audio').SendUIEvent('msg_ComboEntryEnter_play')
     if self._currentPath.IsComplete():
         uthread2.StartTasklet(self._Finalize)
 def Connect(self):
     logger.debug('Debugger connecting to behavior of entity %s',
                  self.entryKey)
     updateListener.AddObserverForItemId(self.entryKey,
                                         self.OnBehaviorDebugUpdate)
     entityLocation = moniker.GetEntityLocation()
     treeData = entityLocation.EnableBehaviorDebugging(self.entryKey)
     self.isConnected = True
     uthread2.StartTasklet(self.SetupDebugTree, treeData)
 def ApplyAttributes(self, attributes):
     uicontrols.Window.ApplyAttributes(self, attributes)
     self.SetTopparentHeight(0)
     self.graph = Container(parent=self.sr.main, align=uiconst.TOALL)
     self.data = None
     self.graphs = []
     self.isBuilding = False
     self.isResizing = False
     uthread2.StartTasklet(self.UpdateGraph)
Exemple #13
0
 def Unlock(self, charID, shipID, unlockDelay, callback):
     self._CheckCanUnlock(shipID)
     self.SetUnlockingFor(charID, shipID)
     self._UpdateSlimItem(
         bountyEscrow.GetSlimStateForUnlocking(self.GetSimTime(),
                                               unlockDelay, shipID))
     self.RegisterForEvents(shipID)
     self.unlockingThread = uthread2.StartTasklet(self._UnlockThread,
                                                  charID, unlockDelay,
                                                  callback)
 def Enable(self, enable):
     if enable:
         if self.shipid not in self.items:
             self.items.append(self.shipid)
         if not self._updateThreadRunning:
             self._updateThreadRunning = True
             uthread2.StartTasklet(self._UpdateThread)
     else:
         self.ClearAll()
         self._updateThreadRunning = False
Exemple #15
0
 def ApplyAttributes(self, attributes):
     self._ready = False
     Window.ApplyAttributes(self, attributes)
     self.SetTopparentHeight(8)
     self.settingsContainer = Container(parent=self.sr.main, align=uiconst.TOTOP, height=16, padding=8)
     self.filterEdit = SinglelineEdit(parent=self.settingsContainer, align=uiconst.TOLEFT, width=150, label='Filter:')
     Button(parent=self.settingsContainer, label='Reset', align=uiconst.TORIGHT, func=self.Reset, padRight=8)
     self.scroll = Scroll(parent=self.sr.main, id='livecountscroll', align=uiconst.TOALL)
     self.Reset()
     self._ready = True
     uthread2.StartTasklet(self.Refresh)
    def Show(self, width=800, height=600):
        displayMode = trinity.adapters.GetCurrentDisplayMode(0)
        trinity.app.width = width
        trinity.app.height = height
        trinity.app.left = (displayMode.width - trinity.app.width) / 2
        trinity.app.top = (displayMode.height - trinity.app.height) / 2
        trinity.app.windowed = True
        trinity.app.AdjustWindowForChange(True, True)
        trinity.app.Create()
        pp = {
            'BackBufferWidth': trinity.app.width,
            'BackBufferHeight': trinity.app.height,
            'Windowed': True,
            'EnableAutoDepthStencil': True,
            'AutoDepthStencilFormat': trinity.DEPTH_STENCIL_FORMAT.D24S8,
            'BackBufferFormat': trinity.PIXEL_FORMAT.B8G8R8A8_UNORM,
            'PresentationInterval': trinity.PRESENT_INTERVAL.IMMEDIATE
        }
        trinity.app.ChangeDevice(0, 0, 0, pp)
        self.renderjob = trinity.CreateRenderJob('LoadingScreen')
        scene = trinity.Tr2Sprite2dScene()
        scene.isFullscreen = True
        scene.clearBackground = True
        scene.backgroundColor = (0, 0, 0, 0)
        self.renderjob.Update(scene)
        self.renderjob.RenderScene(scene)
        self.renderjob.ScheduleRecurring()
        sprite = trinity.Tr2Sprite2d()
        sprite.displayWidth = 32
        sprite.displayHeight = 32
        sprite.spriteEffect = trinity.TR2_SFX_FILL
        sprite.color = (1, 1, 1, 1)
        scene.children.append(sprite)

        def loading_screen():
            x = 100
            dx = 4
            y = height * 2 / 3
            while self.active:
                sprite.displayX = x
                sprite.displayY = y
                x += dx
                if x > width - 100 - sprite.displayWidth:
                    dx = -dx
                if x < 100:
                    dx = -dx
                blue.synchro.Yield()

        self.active = True
        uthread2.StartTasklet(loading_screen)
        blue.os.Pump()
        blue.os.Pump()
        blue.os.Pump()
Exemple #17
0
 def __init__(self, audio2Manager, banksToKeepActive):
     """
     Takes in an audio2 AudManager and a list of banks that should be loaded
     
     :type audio2Manager: audio2.AudManager
     :param audio2Manager: An instance of audio2.AudManager
     :type banksToKeepActive: list()
     :param banksToKeepActive: A list of banks that should be loaded at all times.
     """
     self.manager = audio2Manager
     self.defaultBanks = banksToKeepActive
     uthread2.StartTasklet(self.LoadDefaultBanks)
Exemple #18
0
 def OnDamageStateChange(self, oldDamageState, newDamageState):
     newShieldLevel = newDamageState[0][0]
     if oldDamageState is not None:
         oldShieldLevel = oldDamageState[0][0]
     else:
         oldShieldLevel = self.lastShieldLevel
     if oldShieldLevel is None:
         self.lastShieldLevel = newShieldLevel
     elif oldShieldLevel >= self.turboShieldActivationLevel > newShieldLevel:
         self.shieldModeTasklet = uthread2.StartTasklet(
             self.DepleteTurboShield)
     else:
         self.lastShieldLevel = newShieldLevel
Exemple #19
0
 def ApplyAttributes(self, attributes):
     self._ready = False
     Window.ApplyAttributes(self, attributes)
     self.SetTopparentHeight(8)
     top = Container(parent=self.sr.main,
                     align=uiconst.TOTOP,
                     height=128,
                     padding=8)
     self.loadObjectCacheEnabledChk = Checkbox(
         parent=top,
         align=uiconst.TOTOP,
         text='Load Object Cache Enabled',
         width=120,
         checked=blue.resMan.loadObjectCacheEnabled,
         callback=self._OnLoadObjectCacheEnabledChk)
     self.attributes = Scroll(parent=top, align=uiconst.TOALL)
     bottom = LayoutGrid(parent=self.sr.main,
                         align=uiconst.TOBOTTOM,
                         height=100,
                         columns=4,
                         cellPadding=5)
     self.filterEdit = SinglelineEdit(parent=bottom,
                                      width=150,
                                      label='Filter:',
                                      OnReturn=self._OnRefresh)
     Button(parent=bottom,
            label='Refresh',
            func=self._OnRefresh,
            fixedwidth=80)
     Button(parent=bottom,
            label='Reload',
            func=self._OnReload,
            fixedwidth=80)
     Button(parent=bottom,
            label='Clear cache',
            func=self._OnClear,
            fixedwidth=80)
     Label(parent=self.sr.main,
           align=uiconst.TOTOP,
           text='<b>Resources',
           padLeft=8)
     self.scroll = Scroll(parent=self.sr.main,
                          id='resmanmonitorscroll',
                          align=uiconst.TOALL,
                          padding=2)
     self.PopulateAttributes()
     self.PopulateScroll()
     uthread2.StartTasklet(self.RefreshAttributes)
Exemple #20
0
def init_wx(video):
    controls = Controls(video)
    controls.Show()
    event_loop = wx.EventLoop()
    wx.EventLoop.SetActive(event_loop)

    def process_tasklet():
        while True:
            while event_loop.Pending():
                event_loop.Dispatch()
                wxapp.ProcessPendingEvents()

            wxapp.ProcessIdle()
            uthread2.Yield()

    uthread2.StartTasklet(process_tasklet)
Exemple #21
0
    def UpdateTargetingRange(self):
        def _inner():
            while self.initialized:
                if not session.shipid:
                    if self.tacticalCompass is not None:
                        self.tacticalCompass.compassDisc.HideFiringRange()
                else:
                    ship = sm.GetService('godma').GetItem(session.shipid)
                    if self.tacticalCompass is not None:
                        self.tacticalCompass.SetTargetingRange(
                            ship.maxTargetRange, not self.showingModuleRange)
                        self.actionDisplay.SetMaxMoveRange(
                            self.tacticalCompass.GetMaxRange())
                blue.synchro.SleepSim(1000)

        uthread2.StartTasklet(_inner)
 def _Release(self, origin=None):
     self.LogInfo('Release')
     if self.released:
         return
     self.released = True
     if self.explodeOnRemove:
         delay = self.Explode()
         if delay:
             delay = min(delay, 5000)
             blue.synchro.SleepSim(delay)
     self.Display(display=0, canYield=False)
     scene = self.spaceMgr.GetScene()
     uthread2.StartTasklet(self.RemoveAndClearModel, self.model, scene)
     if self.animationSequencer is not None:
         self.model.animationSequencer = None
         self.animationSequencer = None
     self._audioEntities = []
     self._audioEntity = None
     self.model = None
Exemple #23
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     infoLeft = Container(parent=self, align=uiconst.TOLEFT_PROP, width=0.5)
     infoRight = Container(parent=self, align=uiconst.TOALL)
     self.fpsLabel = Label(parent=infoLeft, align=uiconst.TOTOP)
     self.workingSetLabel = Label(parent=infoLeft, align=uiconst.TOTOP)
     self.commitSizeLabel = Label(parent=infoLeft, align=uiconst.TOTOP)
     self.resCacheLabel = Label(parent=infoRight, align=uiconst.TOTOP)
     self.ciderVersionLabel = Label(parent=infoRight, align=uiconst.TOTOP)
     self.fpsStat = blue.statistics.Find('FPS')
     self.frameTimeStat = blue.statistics.Find('Trinity/SmoothedFrameTime')
     self.workingSetStat = blue.statistics.Find('Blue/Memory/WorkingSet')
     self.lastWorkingSetSize = 0
     self.baseWorkingSetSize = self.workingSetStat.value
     self.commitSizeStat = blue.statistics.Find('Blue/Memory/PageFileUsage')
     self.lastCommitSize = 0
     self.baseCommitSize = self.commitSizeStat.value
     self.ciderVersionLabel.text = 'Not running Cider'
     if blue.sysinfo.isTransgaming:
         self.ciderVersionLabel.text = 'Cider: %s' % blue.win32.TGGetVersion(
         )
     uthread2.StartTasklet(self.Update)
    def ApplyAttributes(self, attributes):
        self._ready = False
        Window.ApplyAttributes(self, attributes)
        self.Reset()
        self.SetTopparentHeight(4)
        self.settingsContainer = Container(parent=self.sr.main,
                                           align=uiconst.TOBOTTOM,
                                           height=16,
                                           padding=8)
        Button(parent=self.settingsContainer,
               label='Reset',
               align=uiconst.CENTER,
               func=self.Reset)
        container = Container(parent=self.sr.main,
                              align=uiconst.TOALL,
                              padding=8)
        statusHeader = ' '
        for tme in self.intvals:
            statusHeader += '<t><right>%s' % util.FmtDate(
                long(tme * 10000), 'ss')

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

        self.PopulateLabels()
        uthread2.StartTasklet(self.Refresh)
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     self.isGlobal = bool(attributes.isGlobal)
     if not self.isGlobal:
         sm.GetService('gameui').DisableResourceLoadingIndicator()
     self.wheel = SpriteThemeColored(
         parent=self,
         align=uiconst.CENTER,
         pos=(0, 0, 48, 48),
         texturePath='res:/UI/Texture/loadingWheel.png',
         state=uiconst.UI_DISABLED,
         colorType=uiconst.COLORTYPE_UIHILIGHTGLOW,
         opacity=0.0)
     self.wheelfull = SpriteThemeColored(
         parent=self,
         align=uiconst.CENTER,
         pos=(0, 0, 48, 48),
         texturePath='res:/UI/Texture/loadingWheel_full.png',
         state=uiconst.UI_DISABLED,
         colorType=uiconst.COLORTYPE_UIHILIGHTGLOW,
         opacity=0.1)
     self.downloadingBar = FillThemeColored(
         parent=self,
         align=uiconst.BOTTOMLEFT,
         state=uiconst.UI_HIDDEN,
         colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
     self.loadingBar = FillThemeColored(
         parent=self,
         align=uiconst.BOTTOMLEFT,
         state=uiconst.UI_HIDDEN,
         colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
     self.queueBar = FillThemeColored(
         parent=self,
         align=uiconst.BOTTOMLEFT,
         state=uiconst.UI_HIDDEN,
         colorType=uiconst.COLORTYPE_UIHILIGHTGLOW)
     uthread2.StartTasklet(self._Update_t)
Exemple #26
0
 def ApplyAttributes(self, attributes):
     Container.ApplyAttributes(self, attributes)
     barWidth = self.width / 3
     x = 0
     y = self.height
     self.downloadingBar = Fill(parent=self,
                                align=uiconst.TOPLEFT,
                                left=x,
                                top=y,
                                width=barWidth,
                                height=0,
                                color=Color.RED,
                                state=uiconst.UI_HIDDEN)
     x += barWidth
     self.loadingBar = Fill(parent=self,
                            align=uiconst.TOPLEFT,
                            left=x,
                            top=y,
                            width=barWidth,
                            height=0,
                            color=Color.GREEN,
                            state=uiconst.UI_HIDDEN)
     x += barWidth
     self.queueBar = Fill(parent=self,
                          align=uiconst.TOPLEFT,
                          left=x,
                          top=y,
                          width=barWidth,
                          height=0,
                          color=Color.BLUE,
                          state=uiconst.UI_HIDDEN)
     self.wheel = Sprite(parent=self,
                         align=uiconst.TOALL,
                         state=uiconst.UI_HIDDEN,
                         texturePath='res:/UI/Texture/loadingWheel.png')
     uthread2.StartTasklet(self._Update_t)
Exemple #27
0
    def _ErrorListener(self, *args):
        def _threaded():
            lookat = self.GetLookAtItemID()
            ball = sm.GetService('michelle').GetBall(lookat)
            model = getattr(ball, 'model', None)
            if model is None:
                exceptionMessage = 'EveCamera: Lookat model is none. '
                exceptionMessage += str(lookat) + '/' + str(session.shipid)
                raise Exception(exceptionMessage)
            exceptionMessage = 'EveCamera: \n'
            exceptionMessage += 'Lookat: ' + str(lookat) + '/' + str(
                session.shipid) + '\n'
            exceptionMessage += 'WorldPos: ' + str(
                model.modelWorldPosition) + '\n'
            exceptionMessage += 'Curves: ' + str(
                model.translationCurve.GetVectorAt(
                    blue.os.GetSimTime())) + ' / '
            exceptionMessage += str(
                model.rotationCurve.GetQuaternionAt(
                    blue.os.GetSimTime())) + '\n'
            if hasattr(model.rotationCurve, 'startCurve'):
                startCurve = model.rotationCurve.startCurve
                exceptionMessage += 'Is wasd ball\n'
                exceptionMessage += 'start' + str(
                    startCurve.GetVectorAt(blue.os.GetSimTime())) + ' / '
                exceptionMessage += str(
                    startCurve.GetQuaternionAt(blue.os.GetSimTime())) + '\n'
                endCurve = model.rotationCurve.endCurve
                exceptionMessage += 'end' + str(
                    endCurve.GetVectorAt(blue.os.GetSimTime())) + ' / '
                exceptionMessage += str(
                    endCurve.GetQuaternionAt(blue.os.GetSimTime())) + '\n'
            self.ResetCamera()
            raise Exception(exceptionMessage)

        uthread2.StartTasklet(_threaded)
 def _ClearBallAndBracketAfterTimeout(self, timeoutSeconds, bracket, ball):
     uthread2.StartTasklet(self._ClearBallAndBracketAfterTimeout_Thread, timeoutSeconds, bracket, ball)
 def _EnableUpdate(self, enable):
     if enable and not self._updateRunning:
         uthread2.StartTasklet(self._UpdateThread)
     self._updateRunning = enable
 def Start(self):
     self.ending = False
     uthread2.StartTasklet(self._DoCameraLookAnimation_Thread_New)