Пример #1
0
 def GetWindowRects(self):
     windows = uicore.registry.GetValidWindows()
     ret = [(wnd.displayX, wnd.displayY, wnd.displayX + wnd.displayWidth,
             wnd.displayY + wnd.displayHeight) for wnd in windows]
     neocom = sm.GetService('neocom').neocom
     if neocom:
         l, t, w, h = neocom.GetAbsolute()
         ret.append(
             (ScaleDpi(l), ScaleDpi(t), ScaleDpi(l + w), ScaleDpi(t + h)))
     return ret
Пример #2
0
 def GetPick(self):
     scene = self.mapView.scene
     camera = self.mapView.camera
     x, y = ScaleDpi(uicore.uilib.x), ScaleDpi(uicore.uilib.y)
     if scene:
         projection, view, viewport = camera.GetProjectionViewViewPort()
         pick = scene.PickObject(x, y, projection, view, viewport)
         if pick:
             return ('scene', pick)
     return (None, None)
Пример #3
0
 def Load(self):
     MarkerLabelBase.Load(self)
     self.textSprite.displayX = ScaleDpi(6)
     self.textSprite.displayY = ScaleDpi(2)
     self.markerContainer.pos = (
         0, 0, ReverseScaleDpi(self.textSprite.textWidth + 12),
         ReverseScaleDpi(self.textSprite.textHeight + 4))
     self.projectBracket.offsetY = -ScaleDpi(self.markerContainer.height +
                                             8)
     Frame(bgParent=self.markerContainer, color=self.fontColor)
     Fill(bgParent=self.markerContainer, color=(0, 0, 0, 0.5))
Пример #4
0
 def _PrimeForCameraPanning(self):
     projection2view = geo2.MatrixInverse(self.mapView.camera.projectionMatrix.transform)
     view2world = geo2.MatrixInverse(self.mapView.camera.viewMatrix.transform)
     x, y = ScaleDpi(uicore.uilib.x), ScaleDpi(uicore.uilib.y)
     ray, start = self.mapView.camera.GetRayAndPointFromUI(x, y, projection2view, view2world)
     targetPlaneNormal = self.mapView.camera.GetViewVector()
     initPointOfInterest = self.mapView.camera._pointOfInterestCurrent
     initRayToPlaneIntersection = RayToPlaneIntersection(start, ray, initPointOfInterest, targetPlaneNormal)
     return (initRayToPlaneIntersection,
      initPointOfInterest,
      targetPlaneNormal,
      projection2view,
      view2world)
Пример #5
0
 def ShowLabel(self):
     if not self.label or self.label.destroyed:
         self.label = BracketShadowLabel(parent=self.markerContainer.parent, name='marker_label', align=uiconst.TOPLEFT, state=uiconst.UI_NORMAL, text=self.GetLabelText(), bracket=self.markerContainer, idx=0)
         xb, yb = self.label.bindings
         xb.offset = (ScaleDpi(26),
          0,
          0,
          0)
         yb.offset = (ScaleDpi(2),
          0,
          0,
          0)
     else:
         self.label.SetOrder(0)
Пример #6
0
 def DragMap(self):
     if not uicore.uilib.leftbtn:
         self.dragThread = None
     initLeft, initTop, initMouseX, initMouseY = self.initDragData
     dX = initMouseX - uicore.uilib.x
     dY = initMouseY - uicore.uilib.y
     parentWidth = ScaleDpi(self.parent.displayWidth)
     parentHeight = ScaleDpi(self.parent.displayHeight)
     w, h = self.width, self.height
     self.left = min(parentWidth / 2, max(parentWidth / 2 - w,
                                          initLeft - dX))
     self.top = min(parentHeight / 2, max(parentHeight / 2 - h,
                                          initTop - dY))
     self.TraverseHexMap()
 def __init__(self, *args, **kwds):
     MarkerBase.__init__(self, *args, **kwds)
     self.texturePath = kwds.get('texturePath', None)
     self.hintString = kwds.get('hintString', None)
     self.distanceFadeAlpha = kwds.get('distanceFadeAlpha',
                                       self.distanceFadeAlpha)
     self.projectBracket.offsetY = -ScaleDpi(self.height)
 def Load(self):
     self.isLoaded = True
     self.textLabel = EveLabelSmall(parent=self.markerContainer,
                                    text=self.GetLabelText(),
                                    bold=True,
                                    state=uiconst.UI_DISABLED)
     self.markerContainer.width = self.textLabel.textwidth
     self.markerContainer.height = self.textLabel.textheight
     self.projectBracket.offsetX = ScaleDpi(self.markerContainer.width *
                                            0.5 + 10)
     self.UpdateActiveAndHilightState()
Пример #9
0
 def Load(self):
     self.isLoaded = True
     if self.measurer is None:
         measurer = trinity.Tr2FontMeasurer()
         measurer.limit = 0
         measurer.font = self.fontPath
         measurer.fontSize = ScaleDpi(self.fontSize)
         measurer.letterSpace = ScaleDpi(self.letterSpace)
         measurer.AddText(StripTags(self.GetLabelText()))
         measurer.CommitText(0, measurer.ascender)
         self.measurer = measurer
     textSprite = trinity.Tr2Sprite2dTextObject()
     textSprite.fontMeasurer = self.measurer
     textSprite.color = self.fontColor
     textSprite.blendMode = trinity.TR2_SBM_ADD
     self.markerContainer.renderObject.children.append(textSprite)
     self.textSprite = textSprite
     height = self.measurer.ascender - self.measurer.descender
     width = self.measurer.cursorX
     self.textSprite.textWidth = width
     self.textSprite.textHeight = height
     self.markerContainer.pos = (0, 0, ReverseScaleDpi(width),
                                 ReverseScaleDpi(height))
Пример #10
0
 def UpdateCamera(self, *args):
     if self.destroyed:
         self.cameraUpdateTimer = None
         return
     if not (uicore.uilib.leftbtn or uicore.uilib.rightbtn):
         self.cameraUpdateTimer = None
         return
     if uicore.registry.GetFocus() is not self:
         self.cameraUpdateTimer = None
         return
     camera = self.mapView.camera
     mouseX, mouseY = trinity.GetCursorPos()
     if uicore.uilib.leftbtn:
         if (mouseX, mouseY) != self.leftMouseDownPosition or self.doLeftMouseUp is False:
             self.doLeftMouseUp = False
             oldX, oldY = self.leftMouseDownPosition
             dx = mouseX - oldX
             dy = mouseY - oldY
             self.leftMouseDownPosition = (mouseX, mouseY)
             if uicore.uilib.rightbtn:
                 self.doRightMouseUp = False
                 modifier = uicore.mouseInputHandler.GetCameraZoomModifier()
                 camera.ZoomMouseDelta(dx, modifier * dy)
             else:
                 camera.OrbitMouseDelta(dx, dy)
     elif uicore.uilib.rightbtn:
         if (mouseX, mouseY) != self.rightMouseDownPosition or self.doRightMouseUp is False:
             self.doRightMouseUp = False
             initRayToPlaneIntersection, initPointOfInterest, initTargetPlaneNormal, projection2view, view2world = self.rightButtonCameraData
             x, y = ScaleDpi(uicore.uilib.x), ScaleDpi(uicore.uilib.y)
             ray, start = self.mapView.camera.GetRayAndPointFromUI(x, y, projection2view, view2world)
             rayToPlaneIntersection = RayToPlaneIntersection(start, ray, initPointOfInterest, initTargetPlaneNormal)
             rayToPlaneIntersectionDiff = geo2.Vec3Subtract(initRayToPlaneIntersection, rayToPlaneIntersection)
             newPointOfInterest = geo2.Vec3Add(initPointOfInterest, rayToPlaneIntersectionDiff)
             camera.SetPointOfInterest(newPointOfInterest)
             self.mapView.DisableAutoFocus()
Пример #11
0
 def Load(self):
     self.isLoaded = True
     labelLeft = CIRCLESIZE + LABEL_LEFT_MARGIN
     self.textLabel = EveLabelSmall(parent=self.markerContainer,
                                    text=self.GetLabelText(),
                                    bold=True,
                                    state=uiconst.UI_DISABLED,
                                    left=labelLeft)
     self.markerContainer.width = labelLeft + self.textLabel.textwidth
     self.markerContainer.height = self.textLabel.textheight
     Fill(bgParent=self.markerContainer,
          padding=(labelLeft - 2, 0, -2, 0),
          color=(0, 0, 0, 0.5))
     self.projectBracket.offsetX = ScaleDpi(self.markerContainer.width *
                                            0.5 - CIRCLESIZE / 2)
     self.UpdateActiveAndHilightState()
Пример #12
0
    def tick_score_bar(self, counter, new_score_bar_length):
        while counter >= new_score_bar_length:
            counter += 1
            if counter >= ScaleDpi(self.scoreBarLength):
                counter = -1
                self.rank_band = calculate_rank_band(self.player_rank)
                if self.rank_band > self.original_rank_band:
                    self.original_rank_band = self.rank_band
                    self.fade_badge_out()
            else:
                self.set_score_bar_length(counter)
                blue.synchro.Sleep(1)

        while counter < new_score_bar_length:
            counter += 1
            self.set_score_bar_length(counter)
            blue.synchro.Sleep(1)
Пример #13
0
    def update_score_bar(self):
        new_score_bar_length = self.calculate_score_bar_length()
        counter = self.oldScoreBarLength
        self.oldScoreBarLength = new_score_bar_length
        while counter >= new_score_bar_length:
            counter += 0.5
            if counter >= ScaleDpi(self.scoreBarLength - 5):
                counter = -1
                self.update_rank_values()
            else:
                if self.scoreBar.renderObject:
                    self.scoreBar.renderObject.translationTo = (counter, 0)
                blue.synchro.Sleep(1)

        while counter < new_score_bar_length:
            counter += 0.5
            if self.scoreBar.renderObject:
                self.scoreBar.renderObject.translationTo = (counter, 0)
            blue.synchro.Sleep(1)

        self.update_rank_values()
Пример #14
0
 def zoom_in(self):
     if not self.image_sprite.texture or self.image_sprite.texture.resPath.startswith(
             'res:'):
         return
     if self.is_zoom_fixed:
         uicore.uilib.SetCursor(uiconst.UICURSOR_POINTER)
     else:
         self.show_zoom_image()
         self.hide_main_image()
         self.show_minimap_frames()
         uicore.uilib.SetCursor(uiconst.UICURSOR_MAGNIFIER)
         mouse_position = (uicore.uilib.x, uicore.uilib.y)
         img_position = self.image_sprite.GetAbsolutePosition()
         if self.is_mouse_out_of_bounds(mouse_position, img_position):
             return
         zoom_aspect_ratio = ScaleDpi(
             self.zoom_image_sprite._displayWidth) / float(
                 self.image_sprite._displayWidth) - 1
         self.zoom_image_sprite.displayX = (
             img_position[0] - mouse_position[0]) * zoom_aspect_ratio
         self.zoom_image_sprite.displayY = (
             img_position[1] - mouse_position[1]) * zoom_aspect_ratio
         self.mini_map_frame_container.displayX = self.zoom_image_sprite.displayX / -17
         self.mini_map_frame_container.displayY = self.zoom_image_sprite.displayY / -17
Пример #15
0
 def __init__(self, *args, **kwds):
     MarkerSolarSystemBased.__init__(self, *args, **kwds)
     self.texturePath = kwds.get('texturePath', self.texturePath)
     self.projectBracket.offsetY = -ScaleDpi(30)
     self.highlightOnLoad = kwds.get('highlightOnLoad', False)
Пример #16
0
 def GetRayToPlaneDenominator(self, targetPlaneNormal, offsetMouse = (0, 0)):
     oX, oY = offsetMouse
     x, y = ScaleDpi(uicore.uilib.x + oX), ScaleDpi(uicore.uilib.y + oY)
     ray, start = self.mapView.camera.GetRayAndPointFromUI(x, y)
     denom = geo2.Vec3Dot(targetPlaneNormal, ray)
     return denom
Пример #17
0
 def GetDotOnTargetPlaneFromPosition(self, targetPlanePos, targetPlaneNormal, offsetMouse = (0, 0)):
     oX, oY = offsetMouse
     x, y = ScaleDpi(uicore.uilib.x + oX), ScaleDpi(uicore.uilib.y + oY)
     ray, start = self.mapView.camera.GetRayAndPointFromUI(x, y)
     pos = RayToPlaneIntersection(start, ray, targetPlanePos, targetPlaneNormal)
     return pos
 def Load(self):
     MarkerLabelBase.Load(self)
     self.projectBracket.offsetY = -ScaleDpi(self.markerContainer.height -
                                             20)
Пример #19
0
 def GetExtraContainerDisplayOffset(self):
     return (ScaleDpi(CIRCLESIZE + LABEL_LEFT_MARGIN),
             self.markerContainer.renderObject.displayHeight)