示例#1
0
	def __CreateModeButtons(self):

		self.modeTitle = ui.MakeTextLine(self)
		self.modeTitle.SetText(localeInfo.PARTY_EXP_DISTRIBUTION_MODE)

		self.modeButtonList = {}

		level = ui.RadioButton()
		level.SetParent(self)
		level.SetWindowHorizontalAlignCenter()
		level.SetEvent(ui.__mem_func__(self.OnClickEXPLevel))
		level.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		level.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		level.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		level.SetText(localeInfo.PARTY_EXP_DISTRIBUTION_MODE_LEVEL)
		level.SetToolTipText(localeInfo.PARTY_EXP_DISTRIBUTION_MODE_LEVEL_TOOLTIP, 70)
		level.Show()
		self.modeButtonList[player.PARTY_EXP_NON_DISTRIBUTION] = level

		parity = ui.RadioButton()
		parity.SetParent(self)
		parity.SetWindowHorizontalAlignCenter()
		parity.SetEvent(ui.__mem_func__(self.OnClickEXPDistributeParity))
		parity.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
		parity.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
		parity.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
		parity.SetText(localeInfo.PARTY_EXP_DISTRIBUTION_MODE_PARITY)
		parity.SetToolTipText(localeInfo.PARTY_EXP_DISTRIBUTION_MODE_PARITY_TOOLTIP, 70)
		parity.Show()
		self.modeButtonList[player.PARTY_EXP_DISTRIBUTION_PARITY] = parity

		self.ChangePartyParameter(self.distributionMode)
示例#2
0
	def __MakePageButton(self, pageCount):

		self.curPageIndex = 0
		self.pageButtonList = []

		text = "I"
		pos = -int(float(pageCount-1)/2 * 52)
		for i in xrange(pageCount):
			button = ui.RadioButton()
			button.SetParent(self)
			button.SetUpVisual("d:/ymir work/ui/game/windows/tab_button_middle_01.sub")
			button.SetOverVisual("d:/ymir work/ui/game/windows/tab_button_middle_02.sub")
			button.SetDownVisual("d:/ymir work/ui/game/windows/tab_button_middle_03.sub")
			button.SetWindowHorizontalAlignCenter()
			button.SetWindowVerticalAlignBottom()
			button.SetPosition(pos, 85)
			button.SetText(text)
			button.SetEvent(lambda arg=i: self.SelectPage(arg))
			button.Show()
			self.pageButtonList.append(button)

			pos += 52
			text += "I"

		self.pageButtonList[0].Down()
示例#3
0
    def ChannelSelectFunction(self):
        self.channelSelect = {}
        self.button_text = {}
        tab = 0
        buttons_info =[
        [[40,200,"Canalul I"]],
        [[40+41*3,200,"Canalul II"]],
        [[40,230,"Canalul III"]],
        [[40+41*3,230,"Canalul IV"]]]
        for a in buttons_info:
            self.channelSelect[tab] = ui.RadioButton()
            self.channelSelect[tab].SetParent(self.loginBoard)
            self.channelSelect[tab].SetPosition(a[0][0],a[0][1])
            self.channelSelect[tab].SetUpVisual("d:/ymir work/ui/intro/login/radio/empty_03_active.tga")
            self.channelSelect[tab].SetOverVisual("d:/ymir work/ui/intro/login/radio/filled_01_normal.tga")
            self.channelSelect[tab].SetDownVisual("d:/ymir work/ui/intro/login/radio/filled_01_normal.tga")
            self.channelSelect[tab].Show()

            self.button_text[tab] = ui.TextLine()
            self.button_text[tab].SetParent(self.channelSelect[tab])
            self.button_text[tab].SetPosition(50,3)
            self.button_text[tab].SetText(a[0][2])
            self.button_text[tab].SetPackedFontColor(twix_work.COLOR_NORMAL)
            self.button_text[tab].SetHorizontalAlignCenter()
            self.button_text[tab].Show()

            tab +=1

        self.Slot1 = (
            self.channelSelect[0],
            self.channelSelect[1],
            self.channelSelect[2],
            self.channelSelect[3],
        )
        self.Slot1_1 = (
            self.button_text[0],
            self.button_text[1],
            self.button_text[2],
            self.button_text[3],
        )

        self.Slot1[0].SetEvent((lambda : self.OpenEvents(0,1)))
        self.Slot1[0].Down()
        self.Slot1_1[0].SetPackedFontColor(twix_work.COLOR_HOVER)
        self.Slot1[1].SetEvent((lambda : self.OpenEvents(1,2)))
        self.Slot1[2].SetEvent((lambda : self.OpenEvents(2,3)))
        self.Slot1[3].SetEvent((lambda : self.OpenEvents(3,4)))
示例#4
0
	def RadioButton(self, parent, buttonName, tooltipText, x, y, func, UpVisual, OverVisual, DownVisual):
		tmpRadioButton = ui.RadioButton()
		
		if parent:
			tmpRadioButton.SetParent(parent)
		
		tmpRadioButton.SetPosition(x, y)
		
		tmpRadioButton.SetEvent(func)
		tmpRadioButton.SetUpVisual(UpVisual)
		tmpRadioButton.SetOverVisual(OverVisual)
		tmpRadioButton.SetDownVisual(DownVisual)
		
		tmpRadioButton.SetText(buttonName)
		tmpRadioButton.SetToolTipText(tooltipText)
		
		tmpRadioButton.SetEvent(func)
		tmpRadioButton.Show()
		return tmpRadioButton
示例#5
0
    def __init__(self, x, y, size_x, size_y, parent, list_tab_names):
        ui.Window.__init__(self)
        self.SetParent(parent)
        self.SetPosition(x, y)
        self.SetSize(size_x, size_y)
        self.Show()

        self.header = ui.ThinBoard()
        self.header.SetParent(self)
        self.header.SetSize(size_x, 35)
        self.header.SetPosition(0, 0)
        self.header.Show()

        #Buttons and tabs
        self.curTab = 0
        self.tabs = [
        ]  #Array of tuples, the tupple is represented as (button,tab)
        for i, name in enumerate(list_tab_names):

            tabWindow = ui.ThinBoard()
            tabWindow.SetParent(self)
            tabWindow.SetSize(size_x, size_y - 35)
            tabWindow.SetPosition(0, 35)
            tabWindow.Hide()

            radioButton = ui.RadioButton()
            radioButton.SetParent(self.header)
            radioButton.SetUpVisual(
                "d:/ymir work/ui/public/small_button_01.sub")
            radioButton.SetOverVisual(
                "d:/ymir work/ui/public/small_button_02.sub")
            radioButton.SetDownVisual(
                "d:/ymir work/ui/public/small_button_03.sub")
            radioButton.SetText(name)
            radioButton.SetPosition(10 + 52 * i, 0)
            radioButton.SetWindowVerticalAlignCenter()
            radioButton.Show()
            self.tabs.append((radioButton, tabWindow))

        self.tabButtonGroup = ui.RadioButtonGroup.Create(
            [[btn[0], self._OnClickTabButton, None]
             for i, btn in enumerate(self.tabs)])
示例#6
0
        def TabControl(self, parent, width, heigh, *tabv):
            self.tabs = []
            for arg in tabv:
                tab_item = {"TAB": arg[0], "TAB_NAME": arg[1]}
                self.tabs.append(tab_item)

            x = -70
            self.tabPageList = {}
            self.tabList = {}
            for tabs in self.tabs:
                x += 80

                Tab = ui.RadioButton()
                Tab.SetParent(parent)
                Tab.SetPosition(x, 30)
                Tab.SetUpVisual(
                    "d:/ymir work/ui/game/windows/tab_button_large_01.sub")
                Tab.SetOverVisual(
                    "d:/ymir work/ui/game/windows/tab_button_large_02.sub")
                Tab.SetDownVisual(
                    "d:/ymir work/ui/game/windows/tab_button_large_03.sub")
                Tab.SetText(tabs["TAB_NAME"])
                Tab.SetEvent(lambda arg=tabs["TAB"]: self.TabEvent(arg))
                Tab.SetUp()
                Tab.Show()

                Page = ui.Box()
                Page.SetParent(parent)
                Page.SetPosition(8, 50)
                Page.SetSize(width - 16, heigh - 60)
                Page.SetColor(grp.GenerateColor(0.0, 0.0, 0.5, 0.3))
                Page.Show()

                self.tabList[tabs["TAB"]] = Tab
                self.tabPageList[tabs["TAB"]] = Page

            if self.tabs:
                self.SetState(self.tabs[0]["TAB"])

            return (self.tabPageList, self.tabList)
示例#7
0
    def __CreateButton(self):

        if localeInfo.IsARABIC():
            bx = 20
        else:
            bx = 13

        btnAll = ui.RadioButton()
        btnAll.SetParent(self)
        btnAll.SetPosition(bx, 24)
        btnAll.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
        btnAll.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
        btnAll.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
        btnAll.SetText(localeInfo.CHAT_ALL)
        btnAll.SetEvent(ui.__mem_func__(self.ToggleAllChatMode))
        btnAll.Down()
        btnAll.Show()
        self.btnAll = btnAll

        x = bx + 48
        i = 0
        self.modeButtonList = []
        for name in self.CHAT_MODE_NAME:
            btn = ui.ToggleButton()
            btn.SetParent(self)
            btn.SetPosition(x, 24)
            btn.SetUpVisual("d:/ymir work/ui/public/xsmall_button_01.sub")
            btn.SetOverVisual("d:/ymir work/ui/public/xsmall_button_02.sub")
            btn.SetDownVisual("d:/ymir work/ui/public/xsmall_button_03.sub")
            btn.SetText(name)
            btn.Show()

            mode = self.CHAT_MODE_INDEX[i]
            btn.SetToggleUpEvent(lambda arg=mode: self.ToggleChatMode(arg))
            btn.SetToggleDownEvent(lambda arg=mode: self.ToggleChatMode(arg))
            self.modeButtonList.append(btn)

            x += 48
            i += 1
示例#8
0
	def InitLanguageBoard(self):
		self.Y_START = 7
		self.X_SPACE = self.Y_START
		self.WIDTH_FLAG = 36

		self.typeButtonList, languageList, groupButtonDict = [], app.GetLanguageList(), {}

		for i in xrange(len(languageList)):
			bLanguage = languageList[i]

			groupButtonDict[i] = ui.RadioButton()
			groupButtonDict[i].SetParent(self.loginLanguageBoard)
			groupButtonDict[i].SetPosition(self.X_SPACE, 8)
			groupButtonDict[i].SetUpVisual("d:/ymir work/ui/language_system/login_language/flag_%s_norm.tga" % bLanguage)
			groupButtonDict[i].SetOverVisual("d:/ymir work/ui/language_system/login_language/flag_%s_over.tga" % bLanguage)
			groupButtonDict[i].SetDownVisual("d:/ymir work/ui/language_system/login_language/flag_%s_down.tga" % bLanguage)
			groupButtonDict[i].SAFE_SetEvent(self.OnSelectLanguageButton, bLanguage)
			groupButtonDict[i].Show()

			self.typeButtonList.append(groupButtonDict[i])
			self.X_SPACE += self.WIDTH_FLAG
			
		self.loginLanguageBoard.SetSize(self.Y_START + (self.WIDTH_FLAG * len(groupButtonDict)) + 4, self.loginLanguageBoard.GetHeight())
		self.ClickRadioButton(self.typeButtonList, app.GetLanguageIndex(app.GetLanguage()))
示例#9
0
    def __init__(self):
        ui.BoardWithTitleBar.__init__(self)
        self.SetSize(350, 350)
        self.SetCenterPosition()
        self.SetTitleName("Daily-Quest")
        self.AddFlag("movable")
        self.AddFlag("float")
        self.Hide()

        self.Index = 0
        self.AddQuestHeight = 1

        self.OverLines = []
        for i in [["Auftrag:", 45], ["Zeit bis zur nächsten Daily:", 80],
                  ["Belohnung:", 130], ["Auftrag starten:", 255]]:
            b = ui.HorizontalBar()
            b.SetParent(self)
            b.SetPosition(12, i[1] + (i[1] > 45 and self.AddQuestHeight * 15))
            b.pos = i[1]
            b.Create(326)
            b.Show()
            b.line = ui.TextLine()
            b.line.SetParent(b)
            b.line.SetPosition(326 / 2, 1)
            b.line.SetHorizontalAlignCenter()
            b.line.SetText(i[0])
            b.line.Show()
            self.OverLines.append(b)

        self.MobInfoLines = []
        for i in xrange(10):
            l = ui.TextLine()
            l.SetParent(self)
            if i in [1, 3, 5, 7, 9]:
                l.SetPosition(336, 70 + (i - 1) / 2 * 15)
            else:
                l.SetPosition(14, 70 + i / 2 * 15)
            if i in [1, 3, 5, 7, 9]:
                l.SetHorizontalAlignRight()
            # l.SetText("Töte 10 Wildhunde")
            l.Hide()
            self.MobInfoLines.append(l)

        self.TimeLeft = ui.TextLine()
        self.TimeLeft.SetParent(self)
        self.TimeLeft.SetPosition(14, self.AddQuestHeight * 15 + 105)
        self.TimeLeft.SetText("Du kannst wieder einen Auftrag starten.")
        self.TimeLeft.Time = 0
        self.TimeLeft.Show()

        self.qLimit = ui.Button()
        self.qLimit.SetParent(self)
        self.qLimit.SetPosition(50, 280 + self.AddQuestHeight * 15)
        self.qLimit.SetUpVisual(
            "d:/ymir work/ui/game/windows/tab_button_large_03.sub")
        self.qLimit.SetOverVisual(
            "d:/ymir work/ui/game/windows/tab_button_large_03.sub")
        self.qLimit.SetDownVisual(
            "d:/ymir work/ui/game/windows/tab_button_large_03.sub")
        self.qLimit.limit = 2
        self.qLimit.limitTable = [[
            "Lv. 1 bis Lv. 84", "Lv. 85 bis Lv. 134", "Lv. 135"
        ], ["Leicht", "Mittel", "Schwer"]]
        # self.qLimit.SetEvent(ui.__mem_func__(self.ChangeLimit))
        self.qLimit.Show()

        self.qStart = ui.RadioButton()
        self.qStart.SetParent(self)
        self.qStart.SetPosition(220, 280 + self.AddQuestHeight * 15)
        self.qStart.SetUpVisual(
            "d:/ymir work/ui/game/windows/tab_button_large_01.sub")
        self.qStart.SetOverVisual(
            "d:/ymir work/ui/game/windows/tab_button_large_02.sub")
        self.qStart.SetDownVisual(
            "d:/ymir work/ui/game/windows/tab_button_large_03.sub")
        self.qStart.SetText("Auftrag starten")
        self.qStart.SetEvent(ui.__mem_func__(self.StartQuest))
        self.qStart.Show()
        self.qStart.Down()

        self.ThinWinText = ui.ThinBoard()
        self.ThinWinText.SetParent(self)
        self.ThinWinText.SetPosition(12, 155 + self.AddQuestHeight * 15)
        self.ThinWinText.SetSize(165, 90)
        self.ThinWinText.Show()

        self.InfoLines = []
        for i in xrange(7):
            l = ui.TextLine()
            if i < 5:
                l.SetParent(self.ThinWinText)
                l.SetPosition(165 / 2, 7 + i * 15)
            else:
                l.SetParent(self)
                l.SetPosition(262,
                              165 + self.AddQuestHeight * 15 + 45 * (i - 5))
            l.SetHorizontalAlignCenter()
            l.SetText([
                "Nach abschließen", "dieser Quest", "erhälst du",
                "folgend gelistete", "Items:", "Daily-Kiste", "1 Dailypoint(s)"
            ][i])
            l.Show()
            self.InfoLines.append(l)

        #self.ItemImage = ui.ImageBox()
        #self.ItemImage.SetParent(self)
        #self.ItemImage.SetPosition(262-16,185+self.AddQuestHeight*15)
        #self.ItemImage.LoadImage("icon/item/daily.tga")
        #self.ItemImage.Show()

        self.ItemImage2 = ui.ImageBox()
        self.ItemImage2.SetParent(self)
        self.ItemImage2.SetPosition(262 - 16,
                                    185 + self.AddQuestHeight * 15 + 45)
        self.ItemImage2.LoadImage("icon/sidebar/daily.tga")
        self.ItemImage2.Show()

        self.ChangeLimit()

        self.SetSize(350, 320 + self.AddQuestHeight * 15)
示例#10
0
    def __init__(self):
        now = dt.datetime.now()

        graphics.Scene.__init__(self)

        self.notebook = ui.Notebook(tab_position = "top-left", scroll_position="end", show_scroll = "auto_invisible", scroll_selects_tab = False)

        # boxes packed and nested horizontally and vertically, with a draggable corner
        self.box = ui.HBox(spacing = 3, x=10, y=10)
        self.button = ui.Button("My image changes position", image = graphics.Image("assets/hamster.png"), fill = False)
        self.button.connect("on-click", self.on_button_click)

        self.box.add_child(*[ui.VBox([self.button,
                                      ui.ToggleButton("I'm a toggle button! Have a tooltip too!", image = graphics.Image("assets/day.png"), fill = True, tooltip="Oh hey there, i'm a tooltip!"),
                                      ui.Label("I'm a label \nand we all can wrap", image = graphics.Image("assets/week.png"), spacing = 5, padding = 5, x_align = 0),
                                      ui.Entry("Feel free to edit me! I'm a rather long text that will scroll nicely perhaps. No guarantees though!", expand = False),
                                      ui.Entry("And me too perhaps", expand = False)],
                                     spacing = 5, padding = 10),
                             Rectangle(20, expand = False),
                             graphics.Label("rrrr", color="#666"),
                             Rectangle(20, expand = False),
                             ui.VBox([Rectangle(fill = False), Rectangle(), Rectangle()], spacing = 3)
                             ])


        box_w, box_h = self.box.get_min_size()
        self.corner = graphics.Rectangle(10, 10, fill="#666",
                                         x = self.box.x + box_w,
                                         y = self.box.y + box_h,
                                         draggable=True,
                                         interactive=True,
                                         z_order = 100)
        self.corner.connect("on-drag", self.on_corner_drag)


        # a table
        self.table = ui.Table(3, 3, snap_to_pixel = False, padding=10)
        self.table.attach(Rectangle(fill_color = "#f00", expand_vert = False), 0, 3, 0, 1) # top
        self.table.attach(Rectangle(fill_color = "#0f0", expand = False), 2, 3, 1, 2)      # right
        self.table.attach(Rectangle(fill_color = "#f0f", expand_vert = False), 0, 3, 2, 3) # bottom
        self.table.attach(Rectangle(fill_color = "#0ff", expand = False), 0, 1, 1, 2)      # left
        center = Rectangle()
        center.connect("on-mouse-over", self.on_table_mouse_over)
        center.connect("on-mouse-out", self.on_table_mouse_out)
        self.table.attach(center, 1, 2, 1, 2)


        # a scroll area with something to scroll in it
        self.scroll = ui.ScrollArea(border = 0)
        self.scroll.add_child(ui.Container(ui.Button("Scroll me if you can!", width = 1000, height = 300, fill=False), fill = False, padding=15))


        # bunch of different input elements
        inputs = ui.Panes(padding=10)
        listitem = ui.ListItem(["Sugar", "Spice", "Everything Nice", "--", "Feel",
                                "Free", "To", "Click", "On", "Me", {'markup': "<span color='red'>And</span>"},
                                "Use", "The", "Arrows!", "Ah", "And", "It", "Seems",
                                "That", "There", "Are", "So", "Many", "Elements"])

        def print_selection(listitem, item):
            print "selection", item

        def print_change(listitem, item):
            print "change", item

        listitem.connect("on-change", print_change)
        listitem.connect("on-select", print_selection)
        inputs.add_child(listitem)

        one = ui.ToggleButton("One", margin=[15, 10, 20, 30], id="one")

        group1 = ui.Group([one,
                           ui.ToggleButton("Two", scale_x = 0.5, scale_y = 0.5, expand=False, id="two"),
                           ui.ToggleButton("Three", id="three"),
                           ui.ToggleButton("Four", id="four")],
                          expand = False, allow_no_selection=True)
        label1 = ui.Label("Current value: none selected", x_align=0, expand = False)
        def on_toggle1(group, current_item):
            if current_item:
                label1.text = "Current value: %s" % current_item.label
            else:
                label1.text = "No item selected"
        group1.connect("on-change", on_toggle1)

        group2 = ui.Group([ui.RadioButton("One"),
                           ui.RadioButton("Two"),
                           ui.RadioButton("Three"),
                           ui.RadioButton("Four")],
                          horizontal = False)
        label2 = ui.Label("Current value: none selected", x_align = 0, expand=False)
        def on_toggle2(group, current_item):
            label2.text = "Current value: %s" % current_item.label
        group2.connect("on-change", on_toggle2)

        slider = ui.Slider(range(100),
                           expand = False,
                           snap_to_ticks = False,
                           range=True,
                           selection=(23, 80),
                           grips_can_cross = False,
                           snap_points = [5, 20, 50, 75],
                           snap_on_release = True)
        slider_value = ui.Label(" ")
        def on_slider_change(slider, value):
            slider_value.text = str(value)
        slider.connect("on_change", on_slider_change)

        spinner = ui.Spinner(active = False, expand=False, width = 40)
        spinner_button = ui.Button("Toggle spin", expand=False)
        spinner_button.spinner = spinner

        def on_spinner_button_click(button, event):
            button.spinner.active = not button.spinner.active
        spinner_button.connect("on-click", on_spinner_button_click)

        combo = ui.ComboBox(["Sugar", "Spice", "Everything Nice", "And", "Other", "Nice", "Things"],
                             open_below=True,
                             expand = False)
        inputs.add_child(ui.VBox([combo,
                                  group1, label1,
                                  ui.HBox([group2,
                                           ui.VBox([ui.CheckButton("And a few of those", expand = False),
                                                    ui.CheckButton("Check boxes", expand = False),
                                                    ui.CheckButton("Which don't work for groups", expand = False)])
                                          ]),
                                  label2,
                                  slider,
                                  slider_value,
                                  ui.HBox([spinner, spinner_button], expand=False, spacing = 10),
                                  ui.HBox([ui.ScrollArea(ui.Label(sample_text * 3, overflow = pango.WrapMode.WORD, fill=True, padding=[2, 5]), height=45, scroll_horizontal=False),
                                           ui.SpinButton(expand = False, fill=False)], expand = False),
                                  ],
                                 expand = False, spacing = 10))

        combo.rows = ["some", "things", "are", "made", "of", "bananas", "and", "icecream"]


        menu = ui.Menu([ui.MenuItem(label="One", menu=ui.Menu([ui.MenuItem(label="One one", menu=ui.Menu([ui.MenuItem(label="One one one"),
                                                                                                          ui.MenuItem(label="One one two"),
                                                                                                          ui.MenuSeparator(),
                                                                                                          ui.MenuItem(label="One one three")])),
                                                               ui.MenuSeparator(),
                                                               ui.MenuItem(label="One two", mnemonic="Ctrl+1"),
                                                               ui.MenuItem(label="One three", mnemonic="Alt+1")])),

                        ui.MenuItem(label="Two", menu=ui.Menu([ui.MenuItem(label="Two one", mnemonic="Ctrl+Alt+2"),
                                                               ui.MenuItem(label="Two two", mnemonic="Ctrl+2"),
                                                               ui.MenuSeparator(),
                                                               ui.MenuItem(label="Two three", mnemonic="Alt+2")])),

                        ui.MenuItem(label="Three", menu=ui.Menu([ui.MenuItem(label="Three one", mnemonic="Ctrl+Alt+3"),
                                                                 ui.MenuItem(label="Three two", mnemonic="Ctrl+3"),
                                                                 ui.MenuSeparator(),
                                                                 ui.MenuItem(label="Three three", mnemonic="Alt+3")])),
                        ui.MenuItem(label="Four", menu=ui.Menu([ui.MenuItem(label="Four one", mnemonic="Ctrl+Alt+4"),
                                                                ui.MenuItem(label="Four two", mnemonic="Ctrl+4"),
                                                                ui.MenuSeparator(),
                                                                ui.MenuItem(label="Four three", mnemonic="Alt+4")])),
                       ], horizontal=True)

        self.menu_selection_label = ui.Label("Pick a menu item!", expand = False, x_align = 1)
        def on_menuitem_selected(menu, item, event):
            self.menu_selection_label.text = item.label
        menu.connect("selected", on_menuitem_selected)

        # adding notebook and attaching pages
        self.notebook.add_page(ui.NotebookTab(image=graphics.Image("assets/day.png"), label="boxes", padding=[1,5]),
                               ui.Fixed([self.box, self.corner], x = 10, y = 10))
        self.notebook.add_page(ui.NotebookTab("Table", tooltip="Oh hey, i'm a table!"), self.table)
        self.notebook.add_page("Scroll Area", self.scroll)
        self.notebook.add_page("Input Elements", inputs)

        self.notebook.add_page("Menu", ui.VBox([menu, self.menu_selection_label,
                                                ui.HBox(ui.Menu([ui.MenuItem(label="", image = graphics.Image("assets/day.png"), submenu_offset_x = 0, submenu_offset_y = 0,
                                                                       menu=ui.Menu([ui.MenuItem(label="", image = graphics.Image("assets/month.png")),
                                                                                     ui.MenuItem(label="", image = graphics.Image("assets/hamster.png")),
                                                                                     ui.MenuSeparator(),
                                                                                     ui.MenuItem(label="", image = graphics.Image("assets/hamster.png")),
                                                                                     ui.MenuItem(label="", image = graphics.Image("assets/month.png"))], horizontal=True)),
                                                                 ui.MenuItem(label="", image = graphics.Image("assets/hamster.png"),submenu_offset_x = 0, submenu_offset_y = 0,
                                                                       menu=ui.Menu([ui.MenuItem(label="", image = graphics.Image("assets/month.png")),
                                                                                     ui.MenuItem(label="", image = graphics.Image("assets/month.png")),
                                                                                     ui.MenuItem(label="", image = graphics.Image("assets/week.png")),
                                                                                     ui.MenuSeparator(),
                                                                                     ui.MenuItem(label="", image = graphics.Image("assets/month.png"))], horizontal=True)),
                                                                 ui.MenuItem(label="", image = graphics.Image("assets/month.png"), submenu_offset_x = 0, submenu_offset_y = 0,
                                                                       menu=ui.Menu([ui.MenuItem(label="", image = graphics.Image("assets/week.png")),
                                                                                     ui.MenuItem(label="", image = graphics.Image("assets/week.png")),
                                                                                     ui.MenuSeparator(),
                                                                                     ui.MenuItem(label="", image = graphics.Image("assets/week.png")),
                                                                                     ui.MenuItem(label="", image = graphics.Image("assets/month.png"))], horizontal=True)),
                                                                ], horizontal=False, spacing=50, hide_on_leave = True, open_on_hover = 0.01), expand=False),
                                                ui.Box()], padding=10))



        self.slice_image = ui.Image('assets/slice9.png', fill=True, slice_left = 35, slice_right = 230, slice_top = 35, slice_bottom = 220)

        data = []
        image = graphics.Image("assets/day.png")
        for i in range(10):
            data.append(["aasdf asdfasdf asdfasdf", "basdfasdf asdfasdf asdfasdf", image, "rrr"])
            data.append(["1", "2", None, "rrr"])
            data.append(["4", "5", None, "rrr"])

        tree = ui.ListItem(data,
                           [ui.LabelRenderer(editable=True),
                            ui.LabelRenderer(editable=True),
                            ui.ImageRenderer(expand=False, width=90)],
                           headers=["Text", "More text", "An icon!"],
                           fixed_headers = False,
                           scroll_border = 0
                           )
        self.notebook.add_page("Tree View", tree)

        #tree.data[0][1] = "I was actually modified afterwards!"


        self.notebook.add_page("Accordion", ui.Accordion([
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm am the first in the row", [ui.Label(accordion_text, overflow = pango.WrapMode.WORD, padding=5)]),
            ui.AccordionPage("I'm different!", [
                ui.VBox([
                    ui.Button("I'm a button", fill=False, expand=False),
                    ui.Button("I'm another one", fill=False, expand=False),
                    ui.Group([
                        ui.ToggleButton("We"),
                        ui.ToggleButton("Are"),
                        ui.ToggleButton("Brothers"),
                        ui.ToggleButton("Radio Brothers"),
                    ], expand=False)
                ], expand=False)
            ]),
        ], padding_top = 1, padding_left = 1))

        from pie_menu import Menu
        pie_menu = Menu(0, 0)
        pie_menu.y_align = 0.45

        self.magic_box = ui.VBox([ui.HBox([ui.Button("Hello", expand=False),
                                           ui.Button("Thar", expand=False),
                                           ui.Label("Drag the white area around", x_align=1)], expand=False, padding=5),
                                  pie_menu], x=50, y=50, spacing=50, draggable=True)
        self.magic_box.width = 500
        self.magic_box.height = 400
        def just_fill():
            box = self.magic_box
            box.graphics.fill_area(0, 0, box.width, box.height, "#fefefe")
        self.magic_box.do_render = just_fill
        self.notebook.add_page("Ordinary Sprite", ui.Fixed(self.magic_box))

        for i in range(5):
            self.notebook.add_page("Tab %d" % i)


        self.notebook.current_page = 3


        # a little button to change tab orientation
        self.tab_orient_switch = ui.Button("Change tab attachment", expand=False, tooltip="change")
        self.tab_orient_switch.connect("on-click", self.on_tab_orient_click)

        self.page_disablist = ui.Button("Enable/Disable current tab", expand=False, tooltip="disable")
        self.page_disablist.connect("on-click", self.on_page_disablist_click)

        self.dialog_button = ui.Button("Show a dialog", expand=False, tooltip="show")
        self.dialog_button.connect("on-click", self.on_dialog_button_click)


        top_menu = ui.Menu([ui.MenuItem(label="One", menu=ui.Menu([ui.MenuItem(label="One one oh one oh one etc etc",
                                                                               menu=ui.Menu([ui.MenuItem(label="One one one"),
                                                                                    ui.MenuItem(label="One one two"),
                                                                                    ui.MenuItem(label="One one three")])),
                                                                   ui.MenuItem(label="One two"),
                                                                   ui.MenuItem(label="One three")])),
                            ui.MenuItem(label="Two", menu=ui.Menu([ui.MenuItem(label="Two one"),
                                                        ui.MenuItem(label="Two two"),
                                                        ui.MenuItem(label="Two three")])),
                            ui.MenuItem(label="Three", menu=ui.Menu([ui.MenuItem(label="Three one"),
                                                          ui.MenuItem(label="Three two"),
                                                          ui.MenuItem(label="Three three")])),
                            ui.MenuItem(label="Four", menu=ui.Menu([ui.MenuItem(label="Four one"),
                                                         ui.MenuItem(label="Four two"),
                                                         ui.MenuItem(label="Four three")])),
                            ui.MenuItem(label="Five")
                            ], horizontal=True, disable_toggling=True)


        # not sure how elegant but let's override the flow for now for demo purposes!
        dummy_flow = ui.Flow()
        def flow_resize():
            dummy_flow.alloc_w, dummy_flow.alloc_h = top_menu.alloc_w, top_menu.alloc_h
            dummy_flow.sprites = top_menu.sprites
            dummy_flow.resize_children()
            top_menu.height = top_menu.sprites[-1].y + top_menu.sprites[-1].height

        def flow_height_for_width_size():
            dummy_flow.alloc_w, dummy_flow.alloc_h = top_menu.alloc_w, top_menu.alloc_h
            dummy_flow.sprites = top_menu.sprites
            w, h = dummy_flow.get_height_for_width_size()
            return w, h

        def flow_min_size():
            dummy_flow.sprites = top_menu.sprites
            w, h = dummy_flow.get_min_size()
            return w+ top_menu.horizontal_padding, h  + top_menu.vertical_padding

        # flow if b0rken ATM
        for i in range(20):
            top_menu.add_child(ui.MenuItem(label="flow %d" % i))
        top_menu.resize_children = flow_resize
        #top_menu.get_height_for_width_size = flow_height_for_width_size
        top_menu.get_min_size = flow_min_size





        self.add_child(ui.VBox([top_menu, ui.VBox([self.notebook,
                                                   ui.HBox([self.tab_orient_switch,
                                                            self.page_disablist,
                                                            self.dialog_button], expand = False, fill=False, x_align=1),
                               ], padding=20, spacing=10)], spacing = 10))






        self.connect("on-click", self.on_click)

        self.notebook.after_tabs.add_child(ui.Button("Yohoho"))
        print dt.datetime.now() - now