Exemple #1
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()
Exemple #2
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))