예제 #1
0
    def _settings_open(self, obj, it):
        h = Hover(self)
        t = it.track_object
        h.pos = t.bottom_center
        del t
        del it.track_object

        l = List(h)
        l.mode = ELM_LIST_EXPAND
        h.part_content_set("bottom", l)
        l.show()

        chk = Check(self, text="Scroll By Page")
        chk.state = self.settings["scroll_by_page"]

        def _scroll_by_page_cb(obj):
            target_state = obj.state
            self.settings["scroll_by_page"] = target_state
            if self.tabs.currentContent:
                if target_state:
                    self.tabs.currentContent.scroll_freeze()
                else:
                    self.tabs.currentContent.scroll_thaw()
            h.dismiss()

        chk.callback_changed_add(_scroll_by_page_cb)

        l.item_append(None, chk)
        l.go()

        h.show()
def hover_clicked(obj, item=None):
    win = StandardWindow("hover", "Hover", autodel=True, size=(320, 320))

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bx)
    bx.show()

    hv = Hover(win)

    bt = Button(win, text="Button")
    bt.callback_clicked_add(hover_bt1_clicked, hv)
    bx.pack_end(bt)
    bt.show()
    hv.target = bt

    bt = Button(win, text="Popup")
    hv.part_content_set("middle", bt)
    bt.show()

    bx = Box(win)

    ic = Icon(win,
              file=os.path.join(img_path, "logo_small.png"),
              resizable=(False, False))
    bx.pack_end(ic)
    ic.show()

    for t in "Top 1", "Top 2", "Top 3":
        bt = Button(win, text=t)
        bx.pack_end(bt)
        bt.show()

    bx.show()

    hv.part_content_set("top", bx)

    bt = Button(win, text="Bottom")
    hv.part_content_set("bottom", bt)
    bt.show()

    bt = Button(win, text="Left")
    hv.part_content_set("left", bt)
    bt.show()

    bt = Button(win, text="Right")
    hv.part_content_set("right", bt)
    bt.show()

    win.show()