Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ui
- import wndMgr
- import grp
- import item
- class ExampleTabs(ui.BoardWithTitleBar):
- text = [
- 'Lorem Ipsum is simply dummy text of the printing and Lorem Ipsum is simply dummy text of the printing and Lorem ',
- 'Lorem Ipsum is simply dummy text of the printing and1 Lorem Ipsum is simply dummy text of the printing and ',
- 'Lorem Ipsum is simply dummy text of the printing and2 Lorem Ipsum is simply ',
- 'Lorem Ipsum is simply dummy text of the printing and3',
- 'Lorem Ipsum is simply dummy text of the printing and3',
- 'Lorem Ipsum is simply dummy text of the printing and4',
- 'Lorem Ipsum is simply dummy text of the printing and65',
- 'Lorem Ipsum is simply dummy text of the printing and6',
- '',
- 'Lorem Ipsum is simply dummy text of the printing and7',
- 'Lorem Ipsum is simply dummy text of the printing and8',
- 'Lorem Ipsum is simply dummy text of the printing and9',
- 'Lorem Ipsum is simply dummy text of the printing and0',
- 'Lorem Ipsum is simply dummy text of the printing and1',
- 'Lorem Ipsum is simply dummy text of the printing and1',
- 'Lorem Ipsum is simply dummy text of the printing and1',
- 'Lorem Ipsum is simply dummy text of the printing and2 Lorem Ipsum is simply dummy text of the printing and',
- 'Lorem Ipsum is simply dummy text of the printing and3',
- 'Lorem Ipsum is simply dummy text of the printing and4',
- 'Lorem Ipsum is simply dummy text of the printing and6',
- 'Lorem Ipsum is simply dummy text of the printing and7Lorem Ipsum is simply dummy text of the printing and Lorem ',
- 'Lorem Ipsum is simply dummy text of the printing and8',
- 'Lorem Ipsum is simply dummy text of the printing and9',
- 'Lorem Ipsum is simply dummy text of the printing and0',
- 'Lorem Ipsum is simply dummy text of the printing and1',
- 'Lorem Ipsum is simply dummy text of the printing and2',
- 'Lorem Ipsum is simply dummy text of the printing and3',
- 'Lorem Ipsum is simply dummy text of the printing and',
- 'Lorem Ipsum is simply dummy text of the printing and744',
- 'Lorem Ipsum is simply dummy text of the printing an11d4',
- 'Lorem Ipsum is simply dummy text of the printing and4',
- 'Lorem Ipsum is simply dummy text of the printing a2nd4',
- 'Lorem Ipsum is simply dummy text of the printing and114',
- 'Lorem Ipsum is simply dummy text of the printing a2nd4',
- 'Lorem Ipsum is simply dummy text of the printing and4',
- 'Lorem Ipsum is simply dummy text of the printing 3and4',
- 'Lorem Ipsum is simply dummy text of the printing and4',
- ]
- def __init__(self):
- ui.BoardWithTitleBar.__init__(self)
- self.isLoaded = FALSE
- if FALSE == self.isLoaded:
- self.__LoadMe()
- def __del__(self):
- ui.BoardWithTitleBar.__del__(self)
- def __LoadMe(self):
- self.SetSize(700, 700)
- self.SetCenterPosition()
- self.AddFlag('movable')
- self.SetTitleName("Przykładowe Okno")
- self.SetCloseEvent(self.Close)
- self.textLines = []
- thinBoard = ui.ThinBoard()
- thinBoard.SetParent(self)
- thinBoard.SetSize(300-15-15, 50)
- thinBoard.SetPosition(15, 35)
- thinBoard.Show()
- self.thinBoard = thinBoard
- ## Okno buttonów
- thinBoard = ui.ThinBoard()
- thinBoard.SetParent(self)
- thinBoard.SetSize(95, 650)
- thinBoard.SetPosition(15, 35)
- thinBoard.Show()
- self.thinBoard = thinBoard
- ## Tworzenie 5 kart
- ## Tworzenie 1 karty
- tabOnePage = ui.ThinBoard()
- tabOnePage.SetParent(self)
- tabOnePage.SetSize(550, 650)
- tabOnePage.SetPosition(115, 35)
- tabOnePage.Hide()
- self.tabOnePage = tabOnePage
- ## Dodanie buttona do 1 karty
- button = ui.Button()
- button.SetParent(self.tabOnePage)
- button.SetUpVisual("d:/ymir work/ui/public/small_button_01.sub")
- button.SetOverVisual("d:/ymir work/ui/public/small_button_02.sub")
- button.SetDownVisual("d:/ymir work/ui/public/small_button_03.sub")
- button.SetText("Button")
- button.SetPosition(20,20)
- button.Show()
- self.button = button
- ## Tworzenie 2 karty
- tabTwoPage = ui.ThinBoard()
- tabTwoPage.SetParent(self)
- tabTwoPage.SetSize(550, 650)
- tabTwoPage.SetPosition(115, 35)
- tabTwoPage.Hide()
- self.tabTwoPage = tabTwoPage
- ## Dodanie buttona do 2 karty
- buttonExit = ui.Button()
- buttonExit.SetParent(self.tabTwoPage)
- buttonExit.SetUpVisual("d:/ymir work/ui/public/small_button_01.sub")
- buttonExit.SetOverVisual("d:/ymir work/ui/public/small_button_02.sub")
- buttonExit.SetDownVisual("d:/ymir work/ui/public/small_button_03.sub")
- buttonExit.SetText("Exit")
- buttonExit.SetEvent(self.Close)
- buttonExit.SetPosition(50,50)
- buttonExit.Show()
- self.buttonExit = buttonExit
- ## Tworzenie 3 karty
- tabThreePage = ui.ThinBoard()
- tabThreePage.SetParent(self)
- tabThreePage.SetSize(550, 650)
- tabThreePage.SetPosition(115, 35)
- tabThreePage.Hide()
- self.tabThreePage = tabThreePage
- ## Dodanie tekstu do 3 karty
- for i in range(15):
- textLine = ui.TextLine()
- textLine.SetParent(self.tabThreePage)
- textLine.SetPosition(15, 35*i)
- textLine.SetSize(20, 20)
- textLine.SetText(self.text[i])
- textLine.Show()
- self.textLines.append(textLine)
- ## Tworzenie 4 karty
- tabFourPage = ui.ThinBoard()
- tabFourPage.SetParent(self)
- tabFourPage.SetSize(550, 650)
- tabFourPage.SetPosition(115, 35)
- tabFourPage.Hide()
- self.tabFourPage = tabFourPage
- ## Dodanie drag buttona do 4 karty
- dragButton = ui.DragButton()
- dragButton.SetParent(self.tabFourPage)
- dragButton.SetUpVisual("d:/ymir work/ui/public/small_button_01.sub")
- dragButton.SetOverVisual("d:/ymir work/ui/public/small_button_02.sub")
- dragButton.SetDownVisual("d:/ymir work/ui/public/small_button_03.sub")
- dragButton.SetText("Drag me")
- dragButton.SetPosition(0, 0)
- dragButton.SetRestrictMovementArea(0, 0, self.tabFourPage.GetWidth(), self.tabFourPage.GetHeight())
- dragButton.Show()
- self.dragButton = dragButton
- ## Tworzenie pustej 5 karty
- tabFivePage = ui.ThinBoard()
- tabFivePage.SetParent(self)
- tabFivePage.SetSize(550, 650)
- tabFivePage.SetPosition(115, 35)
- tabFivePage.Hide()
- self.tabFivePage = tabFivePage
- ## Dodanie 5 kart
- self.pages = []
- self.pages.append(self.tabOnePage)
- self.pages.append(self.tabTwoPage)
- self.pages.append(self.tabThreePage)
- self.pages.append(self.tabFourPage)
- self.pages.append(self.tabFivePage)
- ## Tworzenie buttonów dla kart
- self.curTab = 0
- tabButtons = []
- for i in xrange(5):
- radioButton = ui.RadioButton()
- radioButton.SetParent(self.thinBoard)
- radioButton.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
- radioButton.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
- radioButton.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
- radioButton.SetText("Tab %d"%i)
- radioButton.SetPosition(2, 10+26*i)
- #radioButton.SetWindowVerticalAlignCenter()
- radioButton.Show()
- tabButtons.append(radioButton)
- self.tabButtonGroup = ui.RadioButtonGroup.Create([
- ## [button, selectEvent, unselectEvent],
- [tabButtons[0], lambda : self._OnClickTabButton(0), None],
- [tabButtons[1], lambda : self._OnClickTabButton(1), None],
- [tabButtons[2], lambda : self._OnClickTabButton(2), None],
- [tabButtons[3], lambda : self._OnClickTabButton(3), None],
- [tabButtons[4], lambda : self._OnClickTabButton(4), None]
- ])
- ## Tworzenie Scrollbara
- scrollBar = ui.ScrollBar()
- scrollBar.SetParent(self)
- scrollBar.SetScrollBarSize(650)
- scrollBar.SetPosition(670,35)
- scrollBar.SetScrollEvent(self.__OnScroll)
- self.scrollBar = scrollBar
- self.scrollBar.Show()
- self.isLoaded = True
- def __OnScroll(self):
- pos = int(self.scrollBar.GetPos() * (len(self.text) - 5))
- for i in xrange(15):
- self.textLines[i].SetText(self.text[i+pos])
- def _OnClickTabButton(self, id):
- self.SetCurTab(id)
- def GetCurTab(self):
- return self.curTab
- def SetCurTab(self, tab):
- self.curTab = tab
- self.RefreshTab()
- def RefreshTab(self):
- for page in self.pages:
- page.Hide()
- self.pages[self.GetCurTab()].Show()
- def Open(self):
- self.Show()
- def Close(self):
- self.Hide()
- def OnPressEscapeKey(self):
- self.Close()
- return True
- def OnPressExitKey(self):
- self.Close()
- return True
- wnd = ExampleTabs()
- wnd.Open()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement