예제 #1
0
 def ShowUI(self):
     self.SetupImpactArrow()
     uicontrols.Window.CloseIfOpen(windowID=self.windowID)
     wnd = uicontrols.Window.Open(windowID=self.windowID)
     wnd.SetTopparentHeight(0)
     wnd.SetMinSize([500, 100])
     wnd.SetCaption(self.name)
     wnd._OnClose = self._OnClose
     main = wnd.GetMainArea()
     headerCont = Container(name='headerCont',
                            parent=main,
                            align=uiconst.TOTOP,
                            height=30,
                            padBottom=10)
     bottomCont = Container(name='bottomCont',
                            parent=main,
                            align=uiconst.TOBOTTOM,
                            height=30)
     self.shipIdLabel = EveLabelSmall(name='shipIDLabel',
                                      align=uiconst.CENTER,
                                      parent=headerCont,
                                      text='Ship ID: %s' % self.shipId)
     Button(name='apply_button',
            align=uiconst.CENTER,
            parent=bottomCont,
            label='Apply Physical Impact',
            func=self._OnApplyPhysicalImpact)
     mainContainer = GridContainer(name='mainCont',
                                   parent=main,
                                   align=uiconst.TOALL,
                                   columns=4,
                                   rows=3)
     container = Container(name='impactVelocityLockAndLabel',
                           align=uiconst.TOALL,
                           parent=mainContainer,
                           padRight=10)
     self.lockVelocityButton = ButtonIcon(
         name='MyButtonIcon',
         parent=container,
         align=uiconst.TOPLEFT,
         width=16,
         height=16,
         iconSize=16,
         padLeft=10,
         texturePath='res:/UI/Texture/Icons/bookmark.png',
         func=self.OnLockVelocity)
     EveLabelSmall(name='impactVelocity',
                   align=uiconst.TORIGHT,
                   parent=container,
                   padRight=10,
                   text='Impact Velocity')
     self.impactVelocityXInput = SinglelineEdit(
         name='xVelocity',
         align=uiconst.TOTOP,
         label='X',
         parent=mainContainer,
         padRight=10,
         setvalue=str(self.impactVelocity[0]),
         OnFocusLost=self.OnSetImpactVelocityX,
         OnReturn=self.OnSetImpactVelocityX)
     self.impactVelocityYInput = SinglelineEdit(
         name='yVelocity',
         align=uiconst.TOTOP,
         label='Y',
         parent=mainContainer,
         padRight=10,
         setvalue=str(self.impactVelocity[1]),
         OnFocusLost=self.OnSetImpactVelocityY,
         OnReturn=self.OnSetImpactVelocityY)
     self.impactVelocityZInput = SinglelineEdit(
         name='zVelocity',
         align=uiconst.TOTOP,
         label='Z',
         parent=mainContainer,
         padRight=10,
         setvalue=str(self.impactVelocity[2]),
         OnFocusLost=self.OnSetImpactVelocityZ,
         OnReturn=self.OnSetImpactVelocityZ)
     EveLabelSmall(name='shipIDInputLabel',
                   parent=mainContainer,
                   align=uiconst.TORIGHT,
                   padRight=10,
                   text='Ship ID')
     self.shipInput = SinglelineEdit(name='shipIdInput',
                                     parent=mainContainer,
                                     align=uiconst.TOTOP,
                                     padRight=10,
                                     setvalue=str(session.shipid),
                                     OnFocusLost=self.OnSetShipId,
                                     OnReturn=self.OnSetShipId)
     EveLabelSmall(name='damageLocatorLabel',
                   align=uiconst.TORIGHT,
                   padRight=10,
                   parent=mainContainer,
                   text='Damage Locator')
     self.damageLocatorInput = SinglelineEdit(
         name='damageLocator',
         align=uiconst.TOTOP,
         label='',
         parent=mainContainer,
         padRight=10,
         setvalue=str(self.damageLocatorID),
         ints=(0, 0),
         OnChange=self.OnSetDamageLocator)
     EveLabelSmall(name='impactMassLabel',
                   align=uiconst.TORIGHT,
                   padRight=10,
                   parent=mainContainer,
                   text='Impact Mass')
     self.impactMassInput = SinglelineEdit(name='impactMass',
                                           align=uiconst.TOTOP,
                                           label='',
                                           parent=mainContainer,
                                           padRight=10,
                                           setvalue=str(
                                               self.impactObjectMass),
                                           OnChange=self.OnSetImpactMass)
     self.randomizeDL = Checkbox(name='myCheckbox',
                                 parent=mainContainer,
                                 text='Randomize Damage Locators',
                                 checked=self.randomize,
                                 callback=self.OnRandomize)
     self.AddImpactArrowToScene()
     self.OnSetShipId()
예제 #2
0
    def ApplyAttributes(self, attributes):
        Window.ApplyAttributes(self, attributes)
        self.SetTopparentHeight(4)
        self.fpsLabel = Label(parent=self.sr.main,
                              left=4,
                              width=80,
                              fontsize=18)
        self.platformLabel = Label(parent=self.sr.main,
                                   left=4,
                                   top=24,
                                   width=80,
                                   fontsize=12,
                                   text=trinity.platform)
        self.toggleDisplayResults = False
        self.legendContainer = GridContainer(parent=self.sr.main,
                                             align=uiconst.TORIGHT,
                                             width=28,
                                             columns=1,
                                             padRight=4,
                                             padBottom=4)
        self.startStatsBtn = Button(parent=self.sr.main,
                                    align=uiconst.BOTTOMLEFT,
                                    label='Start Collecting Stats',
                                    left=5,
                                    top=10,
                                    func=self.StartCollectingData)
        self.stopStatsBtn = Button(parent=self.sr.main,
                                   align=uiconst.BOTTOMLEFT,
                                   label='Stop Collecting Stats',
                                   left=5,
                                   top=10,
                                   func=self.StopCollectingData,
                                   state=uiconst.UI_HIDDEN)
        self.timeLabel = Label(parent=self.sr.main,
                               align=uiconst.BOTTOMLEFT,
                               left=142,
                               top=11,
                               width=100,
                               fontsize=12)
        self.displayResultsCheckbox = Checkbox(
            parent=self.sr.main,
            align=uiconst.BOTTOMRIGHT,
            left=10,
            top=10,
            callback=self.ToggleDisplayResults,
            width=100)
        self.labels = []
        for i in xrange(4):
            label = Label(parent=self.legendContainer,
                          align=uiconst.TOTOP,
                          width=20,
                          top=-4)
            self.labels.append(label)

        graphContainer = Container(parent=self.sr.main,
                                   align=uiconst.TOALL,
                                   padLeft=4,
                                   padRight=4,
                                   padBottom=4)
        gr = GraphRenderer(parent=graphContainer, align=uiconst.TOALL)
        self.renderer = gr.renderer
        self.renderer.scaleChangeCallback = self.ScaleChangeHandler
        uthread.new(self.UpdateFpsLabel)