Example #1
0
    def enterDisplayPage(self):
        self.book.createPageButtons(False, False)
        self.book.setTitle("Display Options")
        dialog_gui = loader.loadModel(
            "phase_3/models/gui/dialog_box_buttons_gui.bam")
        width, height, fs, music, sfx, tex_detail, model_detail, aa, af = SettingsManager(
        ).getSettings("settings.json")
        self.width = width
        self.height = height
        self.windowType = [fs]
        self.buttons = [
            DirectRadioButton(text="Windowed",
                              variable=self.windowType,
                              value=[False],
                              scale=0.1,
                              pos=(-0.45, 0.15, 0.15)),
            DirectRadioButton(text="Fullscreen",
                              variable=self.windowType,
                              value=[True],
                              scale=0.1,
                              pos=(-0.45, -0.15, -0.15))
        ]

        for button in self.buttons:
            button.setOthers(self.buttons)

        self.resoLbl = DirectLabel(text="%sx%s" % (width, height),
                                   scale=0.08,
                                   relief=None,
                                   pos=(0.25, 0, 0))
        self.resSlider = DirectSlider(range=(0, 200),
                                      pageSize=50,
                                      command=self.setResoText,
                                      scale=0.3,
                                      orientation=DGG.VERTICAL,
                                      pos=(0.6, 0, 0))
        self.okBtn = DirectButton(text="OK",
                                  geom=CIGlobals.getOkayBtnGeom(),
                                  relief=None,
                                  pos=(-0.5, -0.5, -0.5),
                                  text_scale=0.05,
                                  text_pos=(0, -0.11),
                                  command=self.applyDisplaySettings)
        self.cancelBtn = DirectButton(text="Cancel",
                                      geom=CIGlobals.getCancelBtnGeom(),
                                      relief=None,
                                      pos=(-0.3, -0.5, -0.5),
                                      text_scale=0.05,
                                      text_pos=(0, -0.11),
                                      command=self.cancelDisplaySettings)
        if self.resoLbl['text'] == "640x480":
            self.resSlider['value'] = 0
        elif self.resoLbl['text'] == "800x600":
            self.resSlider['value'] = 50
        elif self.resoLbl['text'] == "1024x768":
            self.resSlider['value'] = 100
        elif self.resoLbl['text'] == "1280x1024":
            self.resSlider['value'] = 150
        elif self.resoLbl['text'] == "1600x1200":
            self.resSlider['value'] = 200
Example #2
0
 def createButton(self, text, index, eventArgs):
     btn = DirectRadioButton(text=text,
                             text_align=TextNode.ALeft,
                             scale=0.07,
                             frameColor=(0, 0, 0, 0.0),
                             pos=(1.1, 0, (0.65 - (index * .1))),
                             variable=self.menuVerticalChoice,
                             value=[index],
                             text_fg=(1, 1, 1, 1),
                             command=self.menuVerticalEvent)
     self.menuVerticalButtons.append(btn)
     btn.reparentTo(self.frameMain)
Example #3
0
 def createButton(self, text, index, eventArgs):
     index_row = index % self.COLUMN_HEIGHT
     index_col = index // self.COLUMN_HEIGHT
     btn = DirectRadioButton(text=text,
                             text_align=TextNode.ALeft,
                             scale=0.07,
                             frameColor=(0, 0, 0, 0.0),
                             pos=(base.a2dLeft + 0.2 + (index_col * .5), 0,
                                  (-0.55 - (index_row * .1))),
                             variable=self.menuVerticalChoice,
                             value=[index],
                             text_fg=(1, 1, 1, 1),
                             command=self.menuVerticalEvent)
     self.menuVerticalButtons.append(btn)
     btn.reparentTo(self.frameMain)
Example #4
0
    def build_likert_question(self):
        self._buttons = []
        for i, label in enumerate(self._LABELS):
            print 'len', xPos, yPos
            xPos = ((i * 40) / 100.0) - 0.6
            yPos = 0.2
            print 'static + offset', xPos, yPos

            self._buttonLabels.append(
                DirectLabel(parent=self._rButtonFrame,
                            text=label,
                            scale=0.05,
                            pos=(xPos, 0, yPos),
                            frameColor=(0, 0, 0, 0),
                            text_wordwrap=7))
            self._buttons.append(
                DirectRadioButton(parent=self._rButtonFrame,
                                  pos=(xPos, 0, 0),
                                  variable=self._rButtonValue,
                                  value=[i],
                                  scale=0.05,
                                  frameColor=(1, 1, 1, 0),
                                  indicatorValue=0))

        for button in self._buttons:
            button.setOthers(self._buttons)
Example #5
0
 def createDifficultyDRB(self, text, value, initialValue, xPos):
     drb = DirectRadioButton(
         text=text,
         text_fg=(240 / 255.0, 255 / 255.0, 240 / 255.0, 1),
         variable=self.difficulty,
         value=value,
         indicatorValue=initialValue,
         boxGeom=radioGeom,
         boxGeomScale=0.5,
         #indicator_pad = (0.1, 0.1),
         scale=0.05,
         frameColor=(0.5, 0.5, 0.5, 1),
         pressEffect=False,
         relief=1,
         pad=(0.5, 0, 0.5, 0.5),
         pos=(xPos, 0, -0.6),
         command=self.rbDifficulty_ValueChanged)
     drb.indicator.setX(drb.indicator.getX() + 0.1)
     drb.indicator.setZ(drb.indicator.getZ() + 0.1)
     drb.reparentTo(self.frameMain)
     return drb
Example #6
0
 def makeRadioButton(text, x, value):
     return DirectRadioButton(
         parent=self.dialog,
         text=text,
         variable=self.createAccountVar,
         value=[value],
         scale=0.05,
         text_align=TextNode.ACenter,
         pos=(x, 0, 0.32),
         pad=(0.2, 0.1),
         relief=None,
         command=self._radioChanged,
     )
Example #7
0
    def __init__(self):
        self.archivesShotMsg = []
        self.frameArchive = DirectFrame(image="gui/BackGround_a.png",
                                        image_scale=(1.7778, 1, 1),
                                        frameSize=(base.a2dLeft, base.a2dRight,
                                                   base.a2dBottom,
                                                   base.a2dTop),
                                        frameColor=(0, 0, 0, 0))
        self.frameArchive.setTransparency(1)

        ArchiveFrameTexture = loader.loadTexture("gui/ArchiveFrameBG.png")
        self.frameArchive1 = DirectFrame(
            frameTexture=ArchiveFrameTexture,
            frameSize=(-1.4, -0.6, base.a2dBottom + 0.5, base.a2dTop - 0.4),
            frameColor=(1, 1, 1, 0.5),
        )

        self.frameArchive1.reparentTo(self.frameArchive)

        self.frameArchive2 = DirectFrame(frameSize=(-0.4, 0.4,
                                                    base.a2dBottom + 0.5,
                                                    base.a2dTop - 0.4),
                                         frameColor=(1, 1, 1, 0.5),
                                         frameTexture=ArchiveFrameTexture)
        self.frameArchive2.reparentTo(self.frameArchive)

        self.frameArchive3 = DirectFrame(frameSize=(0.6, 1.4,
                                                    base.a2dBottom + 0.5,
                                                    base.a2dTop - 0.4),
                                         frameColor=(1, 1, 1, 0.5),
                                         frameTexture=ArchiveFrameTexture)
        self.frameArchive3.reparentTo(self.frameArchive)

        self.v = [0]

        self.archiveImg = loader.loadTexture("gui/ArchiveImg.png")
        self.questionMark = loader.loadTexture("gui/QuestionMark.jpg")
        self.pictures = [
            DirectFrame(frameSize=(-1.3, -0.7, base.a2dBottom + 0.9,
                                   base.a2dTop - 0.5),
                        frameColor=(1, 1, 1, 1),
                        frameTexture=self.questionMark),
            DirectFrame(frameSize=(-0.3, 0.3, base.a2dBottom + 0.9,
                                   base.a2dTop - 0.5),
                        frameColor=(1, 1, 1, 1),
                        frameTexture=self.questionMark),
            DirectFrame(frameSize=(0.7, 1.3, base.a2dBottom + 0.9,
                                   base.a2dTop - 0.5),
                        frameColor=(1, 1, 1, 1),
                        frameTexture=self.questionMark)
        ]
        self.pictures[0].reparentTo(self.frameArchive1)
        self.pictures[1].reparentTo(self.frameArchive2)
        self.pictures[2].reparentTo(self.frameArchive3)

        self.buttons = [
            DirectRadioButton(variable=self.v,
                              value=[0],
                              scale=0.05,
                              pos=(-0.98, 0, base.a2dTop - 1.4),
                              command=self.updateUI),
            DirectRadioButton(variable=self.v,
                              value=[1],
                              scale=0.05,
                              pos=(0.02, 0, base.a2dTop - 1.4),
                              command=self.updateUI),
            DirectRadioButton(variable=self.v,
                              value=[2],
                              scale=0.05,
                              pos=(1.02, 0, base.a2dTop - 1.4),
                              command=self.updateUI)
        ]
        self.buttons[0].reparentTo(self.frameArchive1)
        self.buttons[1].reparentTo(self.frameArchive2)
        self.buttons[2].reparentTo(self.frameArchive3)
        for button in self.buttons:
            button.setOthers(self.buttons)

        titles0 = [
            OnscreenText(scale=.05,
                         align=TextNode.ACenter,
                         pos=(-1.0, base.a2dBottom + 0.85),
                         text="time",
                         fg=(0, 0, 0, 1)),
            OnscreenText(scale=.05,
                         align=TextNode.ACenter,
                         pos=(-1.0, base.a2dBottom + 0.8),
                         text="room",
                         fg=(0, 0, 0, 1)),
            #    DirectLabel(frameColor = (0, 0, 0, 0),scale = .05, align = TextNode.ALeft, pos=(-1.1, 0, base.a2dBottom+0.75), text="attribute", fg = (0,0,0,1))
        ]
        titles0[0].hide()
        titles0[1].hide()
        # titles0[0].reparentTo(self.frameArchive1)
        # titles0[1].reparentTo(self.frameArchive1)
        #  titles0[2].reparentTo(self.frameArchive1)

        titles1 = [
            OnscreenText(scale=.05,
                         align=TextNode.ACenter,
                         pos=(-0.0, base.a2dBottom + 0.85),
                         text="time",
                         fg=(0, 0, 0, 1)),
            OnscreenText(scale=.05,
                         align=TextNode.ACenter,
                         pos=(-0.0, base.a2dBottom + 0.8),
                         text="room",
                         fg=(0, 0, 0, 1)),
            #     DirectLabel(frameColor = (0, 0, 0, 0),scale = .05, align = TextNode.ALeft, pos=(-0.1, 0, base.a2dBottom+0.75), text="attribute", fg = (0,0,0,1))
        ]
        titles1[0].hide()
        titles1[1].hide()
        # titles1[0].reparentTo(self.frameArchive2)
        # titles1[1].reparentTo(self.frameArchive2)
        #  titles1[2].reparentTo(self.frameArchive2)

        titles2 = [
            OnscreenText(scale=.05,
                         align=TextNode.ACenter,
                         pos=(1, base.a2dBottom + 0.85),
                         text="time",
                         fg=(0, 0, 0, 1)),
            OnscreenText(scale=.05,
                         align=TextNode.ACenter,
                         pos=(1, base.a2dBottom + 0.8),
                         text="room",
                         fg=(0, 0, 0, 1)),
            #     DirectLabel(frameColor = (0, 0, 0, 0),scale = .05, align = TextNode.ALeft, pos=(0.9, 0, base.a2dBottom+0.75), text="attribute", fg = (0,0,0,1))
        ]
        titles2[0].hide()
        titles2[1].hide()
        # titles2[0].reparentTo(self.frameArchive3)
        # titles2[1].reparentTo(self.frameArchive3)
        #  titles2[2].reparentTo(self.frameArchive3)
        self.title = [titles0, titles1, titles2]

        self.btn_load = self.createButton("Load", -0.6, ["LoadArchive"])
        self.btn_delete = self.createButton("Delete", -0.8, ["DeleteArchive"])
        self.btn_newgame = self.createButton("NewGame", -0.7, ["NewGame"])

        self.hide()