コード例 #1
0
	def MakeNextButton(self, button_type):
		if self.SKIN_NONE == self.skin:
			return

		yPos = event.GetEventSetLocalYPosition(self.descIndex)

		b = BarButton()
		b.SetParent(self.board)

		b.SetSize(100,26)
		b.SetPosition(self.sx+self.board.GetWidth()/2-50,self.sy+yPos)

		self.nextButtonType = button_type;
		
		import localeInfo
		if event.BUTTON_TYPE_CANCEL == button_type:
			b.SetEvent(lambda s=self:event.SelectAnswer(s.descIndex, 254) or s.OnCancel())
			b.SetText(localeInfo.UI_CANCEL)
		elif event.BUTTON_TYPE_DONE == button_type:
			b.SetEvent(lambda s=self:s.CloseSelf())
			b.SetText(localeInfo.UI_OK)
		elif event.BUTTON_TYPE_NEXT == button_type:
			b.SetEvent(lambda s=self:event.SelectAnswer(s.descIndex, 254) or s.CloseSelf())
			b.SetText(localeInfo.UI_NEXT)
		b.Show()
		b.SetTextColor(0xffffffff)
		self.btnNext = b
コード例 #2
0
	def OnInput(self):

		self.needInputString = True

		event.AddEventSetLocalYPosition(self.descIndex, 5+10)
		yPos = event.GetEventSetLocalYPosition(self.descIndex)

		self.editSlot = ui.SlotBar()
		self.editSlot.SetSize(200, 18)
		self.editSlot.SetPosition(0, yPos)
		self.editSlot.SetParent(self.board)
		self.editSlot.SetWindowHorizontalAlignCenter()
		self.editSlot.Show()

		self.editLine = ui.EditLine()
		self.editLine.SetParent(self.editSlot)
		self.editLine.SetPosition(3, 3)
		self.editLine.SetSize(200, 17)
		self.editLine.SetMax(30)
		self.editLine.SetFocus()
		self.editLine.Show()

		event.AddEventSetLocalYPosition(self.descIndex, 25+10)

		self.MakeNextButton(event.BUTTON_TYPE_DONE)

		self.editLine.UpdateRect()
		self.editSlot.UpdateRect()
		self.board.UpdateRect()
コード例 #3
0
    def OnInsertImage(self,
                      filename,
                      underTitle,
                      title,
                      desc,
                      index=0,
                      total=1):

        if index == 0:
            event.AddEventSetLocalYPosition(self.descIndex, 24)

        y = event.GetEventSetLocalYPosition(self.descIndex)
        xBoard, yBoard = self.board.GetGlobalPosition()

        try:
            img = ToolTipImageBox()
            img.SetParent(self.board)
            img.LoadImage(filename)
            pos_x = (self.board.GetWidth() * (index + 1) /
                     (total + 1)) - (img.GetWidth() / 2)
            img.SetPosition(pos_x, y)
            #img.SetWindowHorizontalAlignCenter()
            img.DestroyToolTip()
            if title and desc:
                img.CreateToolTip(self.board, title, desc, 0,
                                  yBoard + y + img.GetHeight())
            img.Show()
            self.images.append(img)
        except RuntimeError:
            pass

        event.AddEventSetLocalYPosition(self.descIndex, img.GetHeight() - 20)

        if underTitle:
            event.AddEventSetLocalYPosition(self.descIndex, 3)
            event.InsertTextInline(self.descIndex, underTitle,
                                   (self.board.GetWidth() * (index + 1) /
                                    (total + 1)))
            if index != total - 1:
                event.AddEventSetLocalYPosition(self.descIndex, -(3 + 16))
        else:
            if index == total - 1:
                event.AddEventSetLocalYPosition(self.descIndex, 4)

        if index != total - 1:
            event.AddEventSetLocalYPosition(self.descIndex,
                                            -(img.GetHeight() - 20))