Пример #1
0
def dnd_genlist_user_anim_clicked(obj, item=None):
    win = StandardWindow("dnd-genlist-user-anim", "DnD-Genlist-User-Anim",
        autodel=True, size=(680,800))

    bxx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bxx)
    bxx.show()

    for j in range(2):
        gl = Genlist(win, multi_select=True, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH)

        # START Drag and Drop handling
        win.callback_delete_request_add(win_del, gl)
        gl.drop_item_container_add(ELM_SEL_FORMAT_TARGETS, gl_item_getcb,
            dropcb=gl_dropcb)

        gl.drag_item_container_add(ANIM_TIME, DRAG_TIMEOUT, gl_item_getcb,
            gl_data_getcb)

        # We add mouse-down, up callbacks to start/stop drag animation
        gl.event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, gl_obj_mouse_down, gl)
        # END Drag and Drop handling

        # FIXME: This causes genlist to resize the horiz axis very slowly :(
        # Reenable this and resize the window horizontally, then try to resize it back
        #elm_genlist_mode_set(gl, ELM_LIST_LIMIT)
        bxx.pack_end(gl)
        gl.show()

        for i in range(20):
            gl.item_append(itc1, img[i % 9], flags=ELM_GENLIST_ITEM_NONE)

    win.show()
def video_clicked(obj):
    win = StandardWindow("video", "video", autodel=True, size=(800, 600))
    win.alpha = True  # Needed to turn video fast path on

    video = Video(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(video)
    video.show()

    player = Player(win, content=video)
    player.show()

    notify = Notify(win, orient=ELM_NOTIFY_ORIENT_BOTTOM, timeout=3.0)
    notify.content = player

    tb = Table(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(tb)

    bt = FileselectorButton(win,
                            text="Select Video",
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=(0.5, 0.1))
    bt.callback_file_chosen_add(my_bt_open, video)
    tb.pack(bt, 0, 0, 1, 1)
    bt.show()

    tb.show()

    video.event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, notify_show, notify)
    video.event_callback_add(EVAS_CALLBACK_MOUSE_IN, notify_block, notify)
    video.event_callback_add(EVAS_CALLBACK_MOUSE_OUT, notify_unblock, notify)

    win.show()
Пример #3
0
def core_evas_smart_clicked(obj, item=None):
    win = StandardWindow("evassmart", "Evas Smart Object Test", autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    box = Box(win, horizontal=True,
              size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    box.show()
    win.resize_object_add(box)

    b = Button(win, text="Add one", size_hint_align=(0.0,0.0))
    b.callback_clicked_add(btn_add_cb)
    box.pack_end(b)
    b.show()

    b = Button(win, text="Del last", size_hint_align=(0.0,0.0))
    b.callback_clicked_add(btn_del_cb)
    box.pack_end(b)
    b.show()

    b = Button(win, text="Hide all", size_hint_align=(0.0,0.0))
    b.callback_clicked_add(btn_hide_cb)
    box.pack_end(b)
    b.show()

    b = Button(win, text="Show all", size_hint_align=(0.0,0.0))
    b.callback_clicked_add(btn_show_cb)
    box.pack_end(b)
    b.show()

    win.resize(320, 320)
    win.show()
Пример #4
0
def access_clicked(obj, item=None):
    win = StandardWindow("access", "Access")
    win.autodel = True
    win.on_free_add(cleanup_cb)

    config.access = True

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

    gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    bx.pack_end(gl)
    gl.show()

    gl.callback_realized_add(_realized)

    itc1 = GLItC1(item_style="default")
    itc2 = GLItC2(item_style="full")

    for i in range(1, 9):
        if i % 4:
            gl.item_append(itc1, i, None, ELM_GENLIST_ITEM_NONE)
        else:
            gl.item_append(itc2, i, None, ELM_GENLIST_ITEM_NONE)

    itc1.free()
    itc2.free()
    win.resize(500, 400)
    win.show()
def layout_clicked(obj):
    win = StandardWindow("layout", "Layout", autodel=True)
    win.elm_event_callback_add(_event)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    ly = Layout(win, file=(os.path.join(script_path, "test.edj"), "layout"),
        size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(ly)
    ly.show()

    bt = Button(win, text="Button 1")
    ly.part_content_set("element1", bt)
    bt.elm_event_callback_add(_event)
    bt.elm_event_callback_del(_event)
    bt.show()

    bt = Button(win, text="Button 2")
    ly.part_content_set("element2", bt)
    bt.show()

    bt = Button(win, text="Button 3")
    ly.part_content_set("element3", bt)
    bt.show()

    for o in ly.content_swallow_list_get():
        print("Swallowed: " + str(o))

    win.show()
Пример #6
0
def clock_clicked(obj):
    win = StandardWindow("clock", "Clock", autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    L = []

    ck = Clock(win)
    bx.pack_end(ck)
    ck.show()
    L.append(ck)

    ck = Clock(win, show_am_pm=True)
    bx.pack_end(ck)
    ck.show()
    L.append(ck)

    print((ck.time_get()))

    ck = Clock(win, show_seconds=True)
    bx.pack_end(ck)
    ck.show()
    L.append(ck)

    ck = Clock(win, show_seconds=True, show_am_pm=True)
    bx.pack_end(ck)
    ck.show()
    L.append(ck)

    ck = Clock(win, edit=True, show_seconds=True, show_am_pm=True,
        time=(10, 11, 12))
    bx.pack_end(ck)
    ck.show()
    L.append(ck)

    ck = Clock(
        win, edit=True, show_seconds=True, edit_mode = (
            ELM_CLOCK_EDIT_HOUR_DECIMAL |
            ELM_CLOCK_EDIT_MIN_DECIMAL |
            ELM_CLOCK_EDIT_SEC_DECIMAL
            )
        )
    bx.pack_end(ck)
    ck.show()
    L.append(ck)

    hbox = Box(win, horizontal=True)
    bx.pack_end(hbox)
    hbox.show()

    ck = Check(win, text="pause")
    ck.callback_changed_add(pause_changed_cb, L)
    ck.show()
    hbox.pack_end(ck)

    win.show()
    def __init__( self ):
        win = StandardWindow("Testing", "Elementary Sorted Table")
        win.callback_delete_request_add(lambda o: elm.exit())

        titles = []
        for i in range(COLUMNS):
            titles.append(
                    ("Column " + str(i), True if i != 2 else False)
                    )

        slist = SortedList(win, titles=titles, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH)

        for i in range(ROWS):
            row = []
            for j in range(COLUMNS):
                data = random.randint(0, ROWS*COLUMNS)
                row.append(data)
            slist.row_pack(row, sort=False)
        #slist.sort_by_column(1)
        slist.show()
        
        win.resize_object_add(slist)

        win.resize(600, 400)
        win.show()
Пример #8
0
def evas_textgrid_clicked(obj, item=None):
    win = StandardWindow("evastextgrid", "Evas Textgrid Test", autodel=True,
        size=(320, 320))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    tg = Textgrid(win.evas)
    tg.size = 15, 1
    tg.size_hint_weight_set(1.0, 1.0)
    win.resize_object_add(tg)
    tg.font = "Courier", 20
    tg.palette_set(EVAS_TEXTGRID_PALETTE_STANDARD, 0, 0, 0, 0, 255)
    tg.palette_set(EVAS_TEXTGRID_PALETTE_STANDARD, 1, 255, 255, 255, 255)

    row = tg.cellrow_get(0)
    for cell in row:
        cell.codepoint="ö"
        cell.fg = 1
        cell.bg = 0
    tg.cellrow_set(0, row)

    tg.show()
    tg.update_add(0, 0, 10, 1)

    rowback = tg.cellrow_get(0)

    win.show()
def focus3_clicked(obj, item=None):
    win = StandardWindow("focus3", "Focus 3", autodel=True, size=(320, 480))

    win.focus_highlight_enabled = True

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

    en = Entry(win, scrollable=True, single_line=True, text="An entry",
               size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    en.callback_focused_add(_focused_cb)
    en.callback_unfocused_add(_unfocused_cb)
    bx.pack_end(en)
    en.show()

    bt = Button(win, text="Add", focus_allow=False,
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_add_cb, win, bx)
    bx.pack_end(bt)
    bt.show()

    bt = Button(win, text="Del", focus_allow=False,
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_del_cb, bx)
    bx.pack_end(bt)
    bt.show()

    bt = Button(win, text="hide", focus_allow=False,
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_hide_cb)
    bx.pack_end(bt)
    bt.show()

    win.show()
Пример #10
0
def panel_clicked(obj):
    win = StandardWindow("panel", "Panel test", autodel=True, size=(300, 300))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    bt = Button(win,
                text="HIDE ME :)",
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=FILL_BOTH)
    bt.show()

    panel = Panel(win,
                  orient=ELM_PANEL_ORIENT_LEFT,
                  content=bt,
                  size_hint_weight=EXPAND_VERT,
                  size_hint_align=FILL_VERT_ALIGN_LEFT)

    bx.pack_end(panel)
    panel.show()

    win.show()
def buttons_clicked(obj):
    win = StandardWindow("buttons", "Buttons", focus_highlight_enabled=True,
        autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    ic = Icon(win, file=ic_file,
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    ic.show()
    bt = Button(win, text="Icon sized to button", content=ic)
    bx.pack_end(bt)
    bt.show()

    ic = Icon(win, file=ic_file, resizable=(False, False))
    ic.show()
    bt = Button(win, text="Icon no scale", content=ic)
    bx.pack_end(bt)
    bt.show()

    bt = Button(win, text="No icon")
    bx.pack_end(bt)
    bt.show()

    ic = Icon(win, file=ic_file, resizable=(False, False))
    bt = Button(win, content=ic)
    bx.pack_end(bt)
    bt.show()
    ic.show()

    win.show()
Пример #12
0
def store_clicked(obj):
    win = StandardWindow("store", "Store")
    win.autodel = True
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    gl = Genlist(win)
    gl.mode = ELM_LIST_COMPRESS
    gl.callback_selected_add(st_selected)
    gl.callback_clicked_double_add(st_double_clicked)
    gl.callback_longpressed_add(st_longpress)
    gl.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    gl.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
    bx.pack_end(gl)
    gl.show()

    itc1 = GenlistItemClass()
    itc1.item_style = "message"

    st = Store()
    st.fs_list_func_set(st_store_list)
    st.fetch_func_set(st_store_fetch)
    #st.fetch_thread = False
    #st.unfetch_func_set(st_store_unfetch)
    st.items_sorted = False
    st.target_genlist = gl
    st.filesystem_directory = "."

    win.size = 480, 800
    win.show()
Пример #13
0
def panes_clicked(obj):
    win = StandardWindow("panes", "Panes test", autodel=True, size=(320, 480))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    panes = Panes(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    win.resize_object_add(panes)
    panes.callback_clicked_add(cb_panes, "clicked")
    panes.callback_clicked_double_add(cb_panes, "clicked,double")
    panes.callback_press_add(cb_panes, "press")
    panes.callback_unpress_add(cb_panes, "unpress")
    panes.show()

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

    panes_h = Panes(win,
                    horizontal=True,
                    size_hint_weight=EXPAND_BOTH,
                    size_hint_align=FILL_BOTH)
    panes_h.horizontal = True
    panes.part_content_set("right", panes_h)
    panes_h.show()

    bt = Button(win, text="Up")
    panes_h.part_content_set("left", bt)
    bt.show()

    bt = Button(win, text="Down")
    panes_h.part_content_set("right", bt)
    bt.show()

    win.show()
Пример #14
0
def genlist_clicked(obj, item=None):
    win = StandardWindow("Genlist", "Genlist test", autodel=True)

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

    gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    gl.callback_selected_add(_gl_selected,
                             "arg1",
                             "arg2",
                             kwarg1="kwarg1",
                             kwarg2="kwarg2")
    gl.callback_clicked_double_add(_gl_clicked_double,
                                   "arg1",
                                   "arg2",
                                   kwarg1="kwarg1",
                                   kwarg2="kwarg2")
    gl.callback_longpressed_add(_gl_longpressed,
                                "arg1",
                                "arg2",
                                kwarg1="kwarg1",
                                kwarg2="kwarg2")
    bx.pack_end(gl)
    gl.show()

    over = Rectangle(win.evas_get())
    over.color_set(0, 0, 0, 0)
    over.event_callback_add(evas.EVAS_CALLBACK_MOUSE_DOWN, _gl_over_click, gl)
    over.repeat_events_set(True)
    over.show()
    over.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    win.resize_object_add(over)

    vbx = Box(win, horizontal=True)
    bx.pack_end(vbx)
    vbx.show()

    itc1 = GenlistItemClass(item_style="default",
                            text_get_func=gl_text_get,
                            content_get_func=gl_content_get,
                            state_get_func=gl_state_get)

    bt_50 = Button(win, text="Go to 50")
    vbx.pack_end(bt_50)
    bt_50.show()

    bt_1500 = Button(win, text="Go to 1500")
    vbx.pack_end(bt_1500)
    bt_1500.show()

    for i in range(0, 2000):
        gli = gl.item_append(itc1, i, func=gl_item_sel)
        if i == 50:
            bt_50._callback_add("clicked", lambda bt, it: it.bring_in(), gli)
        elif i == 1500:
            bt_1500._callback_add("clicked", lambda bt, it: it.bring_in(), gli)

    win.resize(480, 800)
    win.show()
def bubble_clicked(obj, item=None):
    win = StandardWindow("bubble", "Bubble", autodel=True, size=(320,320))

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

    # bb 1
    ic = Icon(win, file=ic_file,
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    lb = Label(win, text="Blah, Blah, Blah")

    bb = Bubble(win, text = "Message 1", content = lb,
        pos = ELM_BUBBLE_POS_TOP_LEFT, size_hint_weight = EXPAND_BOTH,
        size_hint_align = FILL_BOTH)
    bb.part_text_set("info", "Corner: top_left")
    bb.part_content_set("icon", ic)
    bx.pack_end(bb)
    bb.show()

    # bb 2
    ic = Icon(win, file=ic_file,
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    lb = Label(win, text="Blah, Blah, Blah")

    bb = Bubble(win, text = "Message 2", content = lb,
        pos = ELM_BUBBLE_POS_TOP_RIGHT,
        size_hint_weight = EXPAND_BOTH, size_hint_align = FILL_BOTH)
    bb.part_text_set("info", "Corner: top_right")
    bb.part_content_set("icon", ic)
    bx.pack_end(bb)
    bb.show()

    # bb 3
    ic = Icon(win, file=ic_file,
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    lb = Label(win, text="Blah, Blah, Blah")

    bb = Bubble(win, text = "Message 3", content = ic,
        pos = ELM_BUBBLE_POS_BOTTOM_LEFT,
        size_hint_weight = EXPAND_BOTH, size_hint_align = FILL_BOTH)
    bb.part_text_set("info", "Corner: bottom_left")
    bx.pack_end(bb)
    bb.show()

    # bb 4
    ic = Icon(win, file=ic_file,
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    lb = Label(win, text="Blah, Blah, Blah")

    bb = Bubble(win, text = "Message 4", content = lb,
        pos = ELM_BUBBLE_POS_BOTTOM_RIGHT,
        size_hint_weight = EXPAND_BOTH, size_hint_align = FILL_BOTH)
    bb.part_text_set("info", "Corner: bottom_right")
    bb.part_content_set("icon", ic)
    bx.pack_end(bb)
    bb.show()

    win.show()
Пример #16
0
def photo_clicked(obj):
    win = StandardWindow("photo", "Photo test", autodel=True, size=(300, 300))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    elementary.need_ethumb()

    tb = Table(win, size_hint_weight=EXPAND_BOTH)
    tb.show()

    sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb)
    win.resize_object_add(sc)
    sc.show()

    n = 0
    for j in range(12):
        for i in range(12):
            ph = Photo(win, aspect_fixed=False, size=80, editable=True,
                size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
            name = os.path.join(img_path, images[n])
            n += 1
            if n >= 9: n = 0
            if n == 8:
                ph.thumb = name
            else:
                ph.file = name
            if n in [2, 3]:
                ph.fill_inside = True
                ph.style = "shadow"

            tb.pack(ph, i, j, 1, 1)
            ph.show()

    win.show()
Пример #17
0
def box_transition_clicked(obj, item=None):
    win = StandardWindow("box-layout-transition",
                         "Box Layout Transition",
                         autodel=True)

    vbox = Box(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(vbox)
    vbox.show()

    bx = Box(win,
             layout=ELM_BOX_LAYOUT_HORIZONTAL,
             size_hint_align=FILL_BOTH,
             size_hint_weight=EXPAND_BOTH)
    vbox.pack_end(bx)
    bx.show()

    sep = Separator(win, horizontal=True)
    vbox.pack_end(sep)
    sep.show()

    bt = Button(win, text="layout: %s" % layout_list[current_layout])
    bt.callback_clicked_add(box_transition_button_cb, bx)
    vbox.pack_end(bt)
    bt.show()

    for i in range(4):
        ic = Icon(win,
                  file=ic_file,
                  resizable=(0, 0),
                  size_hint_align=(0.5, 0.5))
        bx.pack_end(ic)
        ic.show()

    win.show()
Пример #18
0
def entry_anchor_clicked(obj, item=None):
    win = StandardWindow("entry",
                         "Entry Anchor",
                         autodel=True,
                         size=(400, 400))

    box = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(box)

    entry = Entry(win, anchor_hover_style="popout", anchor_hover_parent=win)
    entry.text = "<a href=url:http://www.enlightenment.org/>Enlightenment</a>"
    entry.callback_anchor_clicked_add(anchor_clicked)
    entry.callback_anchor_hover_opened_add(anchor_hover_opened)
    entry.show()

    frame = Frame(win,
                  size_hint_align=FILL_BOTH,
                  text="Entry test",
                  content=entry)
    frame.show()

    box.pack_end(frame)
    box.show()

    win.show()
def genlist3_clicked(obj, item=None):
    win = StandardWindow("Genlist", "Genlist Group test", autodel=True,
        size=(320, 320))

    gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(gl)
    gl.show()

    itc_i = GenlistItemClass(item_style="default",
                             text_get_func=gl_text_get,
                             content_get_func=gl_content_get,
                             state_get_func=gl_state_get)

    itc_g = GenlistItemClass(item_style="group_index",
                             text_get_func=glg_text_get,
                             content_get_func=glg_content_get)

    for i in range(300):
        if i % 10 == 0:
            git = gl.item_append(itc_g, i/10,
                                 flags=ELM_GENLIST_ITEM_GROUP)
            git.select_mode_set(ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
        gl.item_append(itc_i, i, git)

    win.show()
Пример #20
0
def grid_clicked(obj):
    win = StandardWindow("grid", "Grid test", autodel=True, size=(480, 480))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    gd = Grid(win, size=(100, 100), size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(gd)
    gd.show()

    en = Entry(win, scrollable=True, text="Entry text 2", single_line=True)
    gd.pack(en, 60, 20, 30, 10)
    en.show()

    bt = Button(win, text="Next API function", disabled=True)
    gd.pack(bt, 30, 0, 40, 10)
    bt.disabled = True
    bt.show()

    bt = Button(win, text="Button")
    gd.pack(bt, 0, 0, 20, 20)
    bt.show()

    bt = Button(win, text="Button")
    gd.pack(bt, 10, 10, 40, 20)
    bt.show()

    bt = Button(win, text="Button")
    gd.pack(bt, 10, 30, 20, 50)
    bt.show()

    bt = Button(win, text="Button")
    gd.pack(bt, 80, 80, 20, 20)
    bt.show()

    bt = Button(win, text="Change")
    bt.callback_clicked_add(cb_change)
    gd.pack(bt, 40, 40, 20, 20)
    bt.show()

    re = Rectangle(win.evas, color=(128, 0, 0, 128))
    gd.pack(re, 40, 70, 20, 10)
    re.show()

    re = Rectangle(win.evas, color=(0, 128, 0, 128))
    gd.pack(re, 60, 70, 10, 10)
    re.show()

    re = Rectangle(win.evas, color=(0, 0, 128, 128))
    gd.pack(re, 40, 80, 10, 10)
    re.show()

    re = Rectangle(win.evas, color=(128, 0, 128, 128))
    gd.pack(re, 50, 80, 10, 10)
    re.show()

    re = Rectangle(win.evas, color=(128, 64, 0, 128))
    gd.pack(re, 60, 80, 10, 10)
    re.show()

    win.show()
def transit_clicked(obj, item=None):
    win = StandardWindow("transit", "Transit")
    win.autodel = True

    bx = Box(win)
    bx.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    win.resize_object_add(bx)
    bx.size_hint_min = 318, 318
    bx.show()

    ic = Image(win, file=os.path.join(img_path, "icon_11.png"),
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))

    bt = Button(win, text="ImageAnimation Effect")
    bt.part_content_set("icon", ic)
    bx.pack_end(bt)
    bt.show()
    ic.show()
    bt.callback_clicked_add(transit_image_animation, ic)

    bt = Button(win, text="Color, Rotation and Translation")
    bx.pack_end(bt)
    bt.show()
    bt.callback_clicked_add(transit_rotation_translation_color)

    bt = Button(win, text="Wipe Effect")
    bx.pack_end(bt)
    bt.show()
    bt.callback_clicked_add(transit_wipe)

    win.show()
Пример #22
0
def popup_clicked(obj):
    win = StandardWindow("popup", "Popup test", autodel=True, size=(480, 800))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    li = List(win, mode=ELM_LIST_LIMIT, size_hint_weight=EXPAND_BOTH)
    li.callback_selected_add(lambda li, it: it.selected_set(False))
    win.resize_object_add(li)
    li.show()

    li.item_append("popup-center-text", None, None,
                   cb_popup_center_text, win)
    li.item_append("popup-center-text + 1 button", None, None,
                   cb_popup_center_title_text_1button, win)
    li.item_append("popup-center-title + text + 1 button", None, None,
                   cb_popup_center_title_text_1button, win)
    li.item_append("popup-center-title + text (block,clicked handling)", None, None,
                   cb_popup_center_title_text_block_clicked_event, win)
    li.item_append("popup-bottom-title + text + 3 buttons", None, None,
                   cb_popup_bottom_title_text_3button, win)
    li.item_append("popup-center-title + content + 3 buttons", None, None,
                   cb_popup_center_title_content_3button, win)
    li.item_append("popup-center-title + items + 3 buttons", None, None,
                   cb_popup_center_title_item_3button, win)
    li.item_append("popup-center-title + text + 2 buttons (check restacking)", None, None,
                   cb_popup_center_title_text_2button_restack, win)
    li.item_append("popup-center-text + 1 button (check hide, show)", None, None,
                   cb_popup_center_text_1button_hide_show, win)

    li.go()

    win.show()
def cursor2_clicked(obj, item=None):
    win = StandardWindow("cursors", "Cursors 2", autodel=True, size=(320, 480))

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

    tb = Toolbar(win,
                 size_hint_weight=(0.0, 0.0),
                 size_hint_align=(EVAS_HINT_FILL, 0.0))
    ti = tb.item_append("folder-new", "Bogosity", None, None)
    ti.cursor_set("bogosity")
    ti = tb.item_append("clock", "Unset", None, None)
    ti.cursor_unset()
    ti = tb.item_append("document-print", "Xterm", None, None)
    ti.cursor_set("xterm")
    bx.pack_end(tb)
    tb.show()

    lst = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    li = lst.item_append("cursor bogosity")
    li.cursor_set("bogosity")
    li = lst.item_append("cursor unset")
    li.cursor_unset()
    li = lst.item_append("cursor xterm")
    li.cursor_set("xterm")
    bx.pack_end(lst)
    lst.go()
    lst.show()

    win.show()
def access_clicked(obj, item=None):
    win = StandardWindow("access", "Access")
    win.autodel = True
    win.on_free_add(cleanup_cb)

    config.access = True

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

    gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    bx.pack_end(gl)
    gl.show()

    gl.callback_realized_add(_realized)

    itc1 = GLItC1(item_style="default")
    itc2 = GLItC2(item_style="full")

    for i in range(1,9):
        if i % 4:
            gl.item_append(itc1, i, None, ELM_GENLIST_ITEM_NONE)
        else:
            gl.item_append(itc2, i, None, ELM_GENLIST_ITEM_NONE)

    itc1.free()
    itc2.free()
    win.resize(500, 400)
    win.show()
Пример #25
0
def layout_clicked(obj):
    win = StandardWindow("layout", "Layout", autodel=True)
    win.elm_event_callback_add(_event)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    ly = Layout(win,
                file=(os.path.join(script_path, "test.edj"), "layout"),
                size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(ly)
    ly.show()

    bt = Button(win, text="Button 1")
    ly.part_content_set("element1", bt)
    bt.elm_event_callback_add(_event)
    bt.elm_event_callback_del(_event)
    bt.show()

    bt = Button(win, text="Button 2")
    ly.part_content_set("element2", bt)
    bt.show()

    bt = Button(win, text="Button 3")
    ly.part_content_set("element3", bt)
    bt.show()

    for o in ly.content_swallow_list_get():
        print("Swallowed: " + str(o))

    win.show()
Пример #26
0
def table5_clicked(obj, item=None):
    win = StandardWindow("table5", "Table 5", autodel=True)

    tb = Table(win, homogeneous=True, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(tb)
    tb.show()

    bt = Button(win, text="A", size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    tb.pack(bt, 33, 0, 34, 33)
    bt.show()

    bt = Button(win, text="B", size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    tb.pack(bt, 67, 33, 33, 34)
    bt.show()

    bt = Button(win, text="C", size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    tb.pack(bt, 33, 67, 34, 33)
    bt.show()

    bt = Button(win, text="D", size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    tb.pack(bt, 0, 33, 33, 34)
    bt.show()

    bt = Button(win, text="X", size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    tb.pack(bt, 33, 33, 34, 34)
    bt.show()

    win.show()
Пример #27
0
def index_clicked(obj):
    win = StandardWindow("index", "Index test", autodel=True, size=(320, 480))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    # index
    idx = Index(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    idx.callback_delay_changed_add(cb_idx_delay_changed)
    idx.callback_changed_add(cb_idx_changed)
    idx.callback_selected_add(cb_idx_selected)
    win.resize_object_add(idx)
    idx.show()

    # genlist
    itc = GenlistItemClass(item_style="default",
                           text_get_func=gl_text_get)
                           # content_get_func=gl_content_get,
                           # state_get_func=gl_state_get)
    gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    vbox.pack_end(gl)
    gl.show()


    for i in 'ABCDEFGHILMNOPQRSTUVZ':
        for j in 'acegikmo':
            gl_item = gl.item_append(itc, i + j)
            if j == 'a':
                idx_item = idx.item_append(i, cb_idx_item, gl_item)
                idx_item.data["gl_item"] = gl_item

    idx.level_go(0)

    sep = Separator(win, horizontal=True)
    vbox.pack_end(sep)
    sep.show()

    hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
    vbox.pack_end(hbox)
    hbox.show()

    ck = Check(win, text="autohide_disabled")
    ck.callback_changed_add(lambda ck: idx.autohide_disabled_set(ck.state))
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="indicator_disabled")
    ck.callback_changed_add(lambda ck: idx.indicator_disabled_set(ck.state))
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="horizontal")
    ck.callback_changed_add(lambda ck: idx.horizontal_set(ck.state))
    hbox.pack_end(ck)
    ck.show()

    win.show()
Пример #28
0
def table4_clicked(obj, item=None):
    win = StandardWindow("table4", "Table 4", autodel=True)

    tb = Table(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(tb)
    win.data["tb"] = tb
    tb.show()

    bt = Button(win, text="Button 1", size_hint_weight=(0.25, 0.25),
        size_hint_align=FILL_BOTH)
    tb.pack(bt, 0, 0, 1, 1)
    win.data["b1"] = bt
    bt.callback_clicked_add(my_tb_ch, win)
    bt.show()

    bt = Button(win, text="Button 2", size_hint_weight=(0.75, 0.25),
        size_hint_align=FILL_BOTH)
    tb.pack(bt, 1, 0, 1, 1)
    win.data["b2"] = bt
    bt.callback_clicked_add(my_tb_ch, win)
    bt.show()

    bt = Button(win, text="Button 3", size_hint_weight=(0.25, 0.75),
        size_hint_align=FILL_BOTH)
    tb.pack(bt, 0, 1, 1, 1)
    win.data["b3"] = bt
    bt.callback_clicked_add(my_tb_ch, win)
    bt.show()

    win.show()
def calendar_clicked(obj, item=None):
    win = StandardWindow("calendar", "Calendar", autodel=True)

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

    bt = Button(bx, text="Next API function")
    bt.callback_clicked_add(api_bt_clicked, api)
    bx.pack_end(bt)
    if api["state"] == API_STATE_LAST:
        bt.disabled = True
    bt.show()

    the_time = datetime(2010, 12, 31)
    cal = Calendar(bx,
                   first_day_of_week=ELM_DAY_MONDAY,
                   size_hint_weight=EXPAND_BOTH,
                   selected_time=the_time,
                   min_max_year=(2010, 2012))
    api["cal"] = cal
    bx.pack_end(cal)
    cal.show()

    win.show()
Пример #30
0
def panes_clicked(obj):
    win = StandardWindow("panes", "Panes test", autodel=True, size=(320, 480))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    panes = Panes(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    win.resize_object_add(panes)
    panes.callback_clicked_add(cb_panes, "clicked")
    panes.callback_clicked_double_add(cb_panes, "clicked,double")
    panes.callback_press_add(cb_panes, "press")
    panes.callback_unpress_add(cb_panes, "unpress")
    panes.show()

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

    panes_h = Panes(win, horizontal=True, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    panes_h.horizontal = True
    panes.part_content_set("right", panes_h)
    panes_h.show()

    bt = Button(win, text="Up")
    panes_h.part_content_set("left", bt)
    bt.show()

    bt = Button(win, text="Down")
    panes_h.part_content_set("right", bt)
    bt.show()

    win.show()
def cursor2_clicked(obj, item=None):
    win = StandardWindow("cursors", "Cursors 2", autodel=True, size=(320, 480))

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

    tb = Toolbar(win, size_hint_weight=(0.0, 0.0),
        size_hint_align=(EVAS_HINT_FILL, 0.0))
    ti = tb.item_append("folder-new", "Bogosity", None, None)
    ti.cursor_set("bogosity")
    ti = tb.item_append("clock", "Unset", None, None)
    ti.cursor_unset()
    ti = tb.item_append("document-print", "Xterm", None, None)
    ti.cursor_set("xterm")
    bx.pack_end(tb)
    tb.show()

    lst = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    li = lst.item_append("cursor bogosity")
    li.cursor_set("bogosity")
    li = lst.item_append("cursor unset")
    li.cursor_unset()
    li = lst.item_append("cursor xterm")
    li.cursor_set("xterm")
    bx.pack_end(lst)
    lst.go()
    lst.show()

    win.show()
Пример #32
0
def popup_clicked(obj):
    win = StandardWindow("popup", "Popup test", autodel=True, size=(480, 800))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    li = List(win, mode=ELM_LIST_LIMIT, size_hint_weight=EXPAND_BOTH)
    li.callback_selected_add(lambda li, it: it.selected_set(False))
    win.resize_object_add(li)
    li.show()

    li.item_append("popup-center-text", None, None, cb_popup_center_text, win)
    li.item_append("popup-center-text + 1 button", None, None,
                   cb_popup_center_title_text_1button, win)
    li.item_append("popup-center-title + text + 1 button", None, None,
                   cb_popup_center_title_text_1button, win)
    li.item_append("popup-center-title + text (block,clicked handling)", None,
                   None, cb_popup_center_title_text_block_clicked_event, win)
    li.item_append("popup-bottom-title + text + 3 buttons", None, None,
                   cb_popup_bottom_title_text_3button, win)
    li.item_append("popup-center-title + content + 3 buttons", None, None,
                   cb_popup_center_title_content_3button, win)
    li.item_append("popup-center-title + items + 3 buttons", None, None,
                   cb_popup_center_title_item_3button, win)
    li.item_append("popup-center-title + text + 2 buttons (check restacking)",
                   None, None, cb_popup_center_title_text_2button_restack, win)
    li.item_append("popup-center-text + 1 button (check hide, show)", None,
                   None, cb_popup_center_text_1button_hide_show, win)

    li.go()

    win.show()
    def __init__(self):
        win = StandardWindow("Testing", "Elementary Sorted Table")
        win.callback_delete_request_add(lambda o: elm.exit())

        titles = []
        for i in range(COLUMNS):
            titles.append(("Column " + str(i), True if i != 2 else False))

        slist = SortedList(win,
                           titles=titles,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)

        for i in range(ROWS):
            row = []
            for j in range(COLUMNS):
                data = random.randint(0, ROWS * COLUMNS)
                row.append(data)
            slist.row_pack(row, sort=False)
        #slist.sort_by_column(1)
        slist.show()

        win.resize_object_add(slist)

        win.resize(600, 400)
        win.show()
Пример #34
0
def genlist3_clicked(obj, item=None):
    win = StandardWindow("Genlist",
                         "Genlist Group test",
                         autodel=True,
                         size=(320, 320))

    gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(gl)
    gl.show()

    itc_i = GenlistItemClass(item_style="default",
                             text_get_func=gl_text_get,
                             content_get_func=gl_content_get,
                             state_get_func=gl_state_get)

    itc_g = GenlistItemClass(item_style="group_index",
                             text_get_func=glg_text_get,
                             content_get_func=glg_content_get)

    for i in range(300):
        if i % 10 == 0:
            git = gl.item_append(itc_g, i / 10, flags=ELM_GENLIST_ITEM_GROUP)
            git.select_mode_set(ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY)
        gl.item_append(itc_i, i, git)

    win.show()
Пример #35
0
def thumb_clicked(obj):
    if not elementary.need_ethumb():
        print("Ethumb not available!")
        return

    images = ("panel_01.jpg", "plant_01.jpg", "rock_01.jpg", "rock_02.jpg",
              "sky_01.jpg", "sky_02.jpg", "sky_03.jpg", "sky_04.jpg",
              "wood_01.jpg", "mystrale.jpg", "mystrale_2.jpg")

    win = StandardWindow("thumb", "Thumb", autodel=True, size=(600, 600))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    tb = Table(win, size_hint_weight=EXPAND_BOTH)

    n = 0
    for j in range(12):
        for i in range(12):
            n = (n + 1) % 11
            th = Thumb(win,
                       file=os.path.join(img_path, images[n]),
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH,
                       editable=True)
            tb.pack(th, i, j, 1, 1)
            th.show()

    sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb)
    win.resize_object_add(sc)

    tb.show()
    sc.show()

    win.show()
Пример #36
0
    def __init__(self):
        win = StandardWindow("Testing", "Elementary Tabbed Widget")
        # pylint: disable=no-member
        win.callback_delete_request_add(lambda o: elm.exit())

        tabbs = TabbedBox(win,
                          size_hint_weight=EXPAND_BOTH,
                          size_hint_align=FILL_BOTH)
        tabbs.close_cb = self.close_checks

        for i in range(10):
            lbl = Label(win)
            lbl.text = "Tab %s" % i
            lbl.show()
            tabbs.add(lbl, "Tab %s" % i)

        tabbs.disable(0)
        tabbs.disable(3)

        tabbs.show()

        win.resize_object_add(tabbs)

        win.resize(600, 400)
        win.show()
def naviframe_clicked(obj):
    win = StandardWindow("naviframe",
                         "Naviframe test",
                         autodel=True,
                         size=(400, 400))
    win.focus_highlight_enabled = True
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    nf = Naviframe(win,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
    win.resize_object_add(nf)
    nf.show()

    bt = Button(win, text="Next")
    bt.callback_clicked_add(page2, nf)

    content = Photo(nf,
                    file=os.path.join(img_path, "logo.png"),
                    fill_inside=True,
                    style="shadow")

    item = nf.item_push("Page 1", None, bt, content, "basic")
    nf.data["page1"] = item

    win.show()
Пример #38
0
def video_clicked(obj):
    win = StandardWindow("video", "video", autodel=True, size=(800, 600))
    win.alpha = True # Needed to turn video fast path on

    video = Video(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(video)
    video.show()

    player = Player(win, content=video)
    player.show()

    notify = Notify(win, orient=ELM_NOTIFY_ORIENT_BOTTOM, timeout=3.0)
    notify.content = player

    tb = Table(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(tb)

    bt = FileselectorButton(win, text="Select Video",
        size_hint_weight=EXPAND_BOTH, size_hint_align=(0.5, 0.1))
    bt.callback_file_chosen_add(my_bt_open, video)
    tb.pack(bt, 0, 0, 1, 1)
    bt.show()

    tb.show()

    video.event_callback_add(EVAS_CALLBACK_MOUSE_MOVE, notify_show, notify)
    video.event_callback_add(EVAS_CALLBACK_MOUSE_IN, notify_block, notify)
    video.event_callback_add(EVAS_CALLBACK_MOUSE_OUT, notify_unblock, notify)

    win.show()
Пример #39
0
def genlist15_clicked(obj, item=None):
    win = StandardWindow("genlist-decorate-all-mode",
                         "Genlist Decorate All Mode",
                         autodel=True,
                         size=(520, 520))

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

    gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    gl.show()

    itc15 = ItemClass15(item_style="default", decorate_all_item_style="edit")
    itc15.state_get = gl_state_get

    for i in range(100):
        ck = Check(gl)
        data = [i, False]
        it = GenlistItem(
            item_class=itc15,
            item_data=data,
            parent_item=None,
            flags=ELM_GENLIST_ITEM_NONE,
            func=gl15_sel,
            func_data=data,
        ).append_to(gl)

        data.append(it)

    bx.pack_end(gl)
    bx.show()

    bx2 = Box(win,
              horizontal=True,
              homogeneous=True,
              size_hint_weight=EXPAND_HORIZ,
              size_hint_align=FILL_BOTH)

    bt = Button(win,
                text="Decorate All mode",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(gl15_deco_all_mode, gl)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="Normal mode",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(gl15_normal_mode, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    win.show()
def transit2_clicked(obj, item=None):
    win = StandardWindow("transit2", "Transit 2", autodel=True, size=(400, 400))

    bt = Button(win, text="Resizing Effect", pos=(50, 100), size=(100, 50))
    bt.show()
    bt.callback_clicked_add(transit_resizing)

    win.show()
Пример #41
0
def index_clicked(obj):
    win = StandardWindow("index", "Index test", autodel=True, size=(320, 480))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    # index
    idx = Index(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    idx.callback_delay_changed_add(cb_idx_delay_changed)
    idx.callback_changed_add(cb_idx_changed)
    idx.callback_selected_add(cb_idx_selected)
    win.resize_object_add(idx)
    idx.show()

    # genlist
    itc = GenlistItemClass(item_style="default", text_get_func=gl_text_get)
    # content_get_func=gl_content_get,
    # state_get_func=gl_state_get)
    gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    vbox.pack_end(gl)
    gl.show()

    for i in 'ABCDEFGHILMNOPQRSTUVZ':
        for j in 'acegikmo':
            gl_item = gl.item_append(itc, i + j)
            if j == 'a':
                idx_item = idx.item_append(i, cb_idx_item, gl_item)
                idx_item.data["gl_item"] = gl_item

    idx.level_go(0)

    sep = Separator(win, horizontal=True)
    vbox.pack_end(sep)
    sep.show()

    hbox = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ)
    vbox.pack_end(hbox)
    hbox.show()

    ck = Check(win, text="autohide_disabled")
    ck.callback_changed_add(lambda ck: idx.autohide_disabled_set(ck.state))
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="indicator_disabled")
    ck.callback_changed_add(lambda ck: idx.indicator_disabled_set(ck.state))
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="horizontal")
    ck.callback_changed_add(lambda ck: idx.horizontal_set(ck.state))
    hbox.pack_end(ck)
    ck.show()

    win.show()
Пример #42
0
def dnd_genlist_gengrid_clicked(obj, item=None):
    win = StandardWindow("dnd-genlist-gengrid",
                         "DnD-Genlist-Gengrid",
                         autodel=True,
                         size=(680, 800))

    bxx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bxx)
    bxx.show()

    gl = Genlist(win,
                 multi_select=True,
                 size_hint_weight=EXPAND_BOTH,
                 size_hint_align=FILL_BOTH)
    win.callback_delete_request_add(win_del, gl)

    # START Drag and Drop handling
    gl.drop_item_container_add(ELM_SEL_FORMAT_TARGETS,
                               gl_item_getcb,
                               dropcb=gl_dropcb)

    gl.drag_item_container_add(ANIM_TIME, DRAG_TIMEOUT, gl_item_getcb,
                               gl_dnd_default_anim_data_getcb)
    # END Drag and Drop handling

    # FIXME: This causes genlist to resize the horiz axis very slowly :(
    # Reenable this and resize the window horizontally, then try to resize it back
    #elm_genlist_mode_set(gl, ELM_LIST_LIMIT)
    bxx.pack_end(gl)
    gl.show()

    for i in range(20):
        gl.item_append(itc1, img[i % 9], flags=ELM_GENLIST_ITEM_NONE)

    grid = Gengrid(win,
                   item_size=(conf.scale * 150, conf.scale * 150),
                   horizontal=False,
                   reorder_mode=False,
                   multi_select=True,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
    win.callback_delete_request_add(win_del, grid)

    grid.drop_item_container_add(ELM_SEL_FORMAT_TARGETS,
                                 grid_item_getcb,
                                 dropcb=grid_dropcb)

    grid.drag_item_container_add(ANIM_TIME, DRAG_TIMEOUT, grid_item_getcb,
                                 grid_data_getcb)

    for i in range(20):
        grid.item_append(gic, img[i % 9])

    bxx.pack_end(grid)
    grid.show()

    win.show()
    def __init__(self):
        win = StandardWindow("Testing", "Elementary Sorted Table")
        # pylint: disable=no-member
        win.callback_delete_request_add(lambda o: elm.exit())
        # Build the titles for the table. The titles is a list of tuples
        #   with the following format:
        #       ( <str - Header Text>, <Bool - Sortable> )'''
        titles = []
        for i in range(COLUMNS):
            titles.append(("Column " + str(i), True if i != 2 else False))

        # Create our sorted list object
        slist = SortedList(win,
                           titles=titles,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)

        # Populate the rows in our table
        for _i in range(ROWS):
            # Each row is a list with the number of elements
            #   that must equal the number of headers
            row = []
            for j in range(COLUMNS):
                # Row elements can be ANY elementary object
                if j == 0:
                    # For the first column in each row, we will create a button
                    #    that will delete the row when pressed
                    btn = Button(slist,
                                 size_hint_weight=EXPAND_BOTH,
                                 size_hint_align=FILL_BOTH)
                    btn.text = "Delete row"
                    btn.callback_clicked_add(
                        lambda x, y=row: slist.row_unpack(y, delete=True))
                    btn.show()
                    # Add the btn created to our row
                    row.append(btn)
                else:
                    # For each other row create a label with a random number
                    data = random.randint(0, ROWS * COLUMNS)
                    label = Label(slist,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=FILL_BOTH)
                    label.text = str(data)
                    # For integer data we also need to assign value to "sort_data"
                    #     because otherwise things get sorted as text
                    label.data["sort_data"] = data
                    label.show()
                    # Append our label to the row
                    row.append(label)
            # Add the row into the SortedList
            slist.row_pack(row, sort=False)

        # Show the list
        slist.show()
        win.resize_object_add(slist)
        win.resize(600, 400)
        win.show()
def transit4_clicked(obj, item=None):
    win = StandardWindow("transit4", "Transit 4", autodel=True, size=(300, 300))

    bt = Button(win, text="Zoom Effect", size=(100, 50), pos=(100, 125))
    bt.show()

    bt.callback_clicked_add(transit_zoom)

    win.show()
    def __init__( self ):
        win = StandardWindow("Testing", "Elementary Sorted Table")
        win.callback_delete_request_add(lambda o: elm.exit())

        """Build the titles for the table. The titles is a list of tuples with the following format:
        
        ( <String - Header Text>, <Bool - Sortable> )"""
        titles = []
        for i in range(COLUMNS):
            titles.append(
                    ("Column " + str(i), True if i != 2 else False)
                    )

        #Create our sorted list object
        slist = SortedList(win, titles=titles, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH)

        #Populate the rows in our table
        for i in range(ROWS):
            #Each row is a list with the number of elements that must equal the number of headers
            row = []
            for j in range(COLUMNS):
                #Row elements can be ANY elementary object
                if j == 0:
                    #For the first column in each row, we will create a button that will delete the row when pressed
                    btn = Button(slist, size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
                    btn.text = "Delete row"
                    btn.callback_clicked_add(
                        lambda x, y=row: slist.row_unpack(y, delete=True)
                        )
                    btn.show()
                    #Add the btn created to our row
                    row.append(btn)
                else:
                    #For each other row create a label with a random number
                    data = random.randint(0, ROWS*COLUMNS)
                    lb = Label(slist, size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
                    lb.text=str(data)
                    """For integer data we also need to assign value to "sort_data" because otherwise things get sorted as text"""
                    lb.data["sort_data"] = data
                    lb.show()
                    #Append our label to the row
                    row.append(lb)
            #Add the row into the SortedList
            slist.row_pack(row, sort=False)
        
        #Show the list
        slist.show()
        
        win.resize_object_add(slist)

        win.resize(600, 400)
        win.show()
Пример #46
0
def radio_clicked(obj):
    win = StandardWindow("radio", "Radio test", autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    rd = Radio(win, state_value=0, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_HORIZ, text="Icon sized to radio", content=ic)
    bx.pack_end(rd)
    rd.show()
    ic.show()
    rdg = rd

    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        resizable=(False, False))
    rd = Radio(win, state_value=1, text="Icon no scale", content=ic)
    rd.group_add(rdg)
    bx.pack_end(rd)
    rd.show()
    ic.show()

    rd = Radio(win, state_value=2, text="Label Only")
    rd.group_add(rdg)
    bx.pack_end(rd)
    rd.show()

    rd = Radio(win, state_value=3, text="Disabled", disabled=True)
    rd.group_add(rdg)
    bx.pack_end(rd)
    rd.show()

    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        resizable=(False, False))
    rd = Radio(win, state_value=4, content=ic)
    rd.group_add(rdg)
    bx.pack_end(rd)
    rd.show()
    ic.show()

    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        resizable=(False, False))
    rd = Radio(win, state_value=5, content=ic, disabled=True)
    rd.group_add(rdg)
    bx.pack_end(rd)
    rd.show()
    ic.show()

    rdg.value = 2

    win.show()
Пример #47
0
def list3_clicked(obj, item=None):
    win = StandardWindow("list-3", "List 3", autodel=True, size=(320, 300))

    li = List(win, size_hint_weight=EXPAND_BOTH, mode=ELM_LIST_COMPRESS)
    win.resize_object_add(li)

    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"))
    li.item_append("Hello", ic)
    ic = Icon(win, file=os.path.join(img_path, "logo_small.png"),
        resizable=(False, False))
    li.item_append("world", ic)
    ic = Icon(win, standard="edit", resizable=(False, False))
    li.item_append(".", ic)

    ic = Icon(win, standard="delete", resizable=(False, False))
    ic2 = Icon(win, standard="clock", resizable=(False, False))
    it2 = li.item_append("How", ic, ic2)

    bx = Box(win, horizontal=True)
    bx.horizontal_set(True)

    ic = Icon(win, standard="delete", resizable=(False, False),
        size_hint_align=ALIGN_CENTER)
    bx.pack_end(ic)
    ic.show()

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

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

    li.item_append("are", bx)
    li.item_append("you")
    li.item_append("doing")
    li.item_append("out")
    li.item_append("there")
    li.item_append("today")
    li.item_append("?")
    li.item_append("Here")
    li.item_append("are")
    li.item_append("some")
    li.item_append("more")
    li.item_append("items")
    li.item_append("Is this label long enough?")
    it5 = li.item_append("Maybe this one is even longer so we can test long long items.")

    li.go()
    li.show()

    win.show()
Пример #48
0
def image_clicked(obj):
    win = StandardWindow("image", "Image test", autodel=True, size=(320, 480))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    vbox = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    win.resize_object_add(vbox)
    vbox.show()

    im = Image(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        file=os.path.join(img_path, "logo.png"))
    vbox.pack_end(im)
    im.show()

    sep = Separator(win, horizontal=True)
    vbox.pack_end(sep)
    sep.show()

    hbox = Box(win, layout=ELM_BOX_LAYOUT_FLOW_HORIZONTAL,
        size_hint_align=FILL_BOTH)
    vbox.pack_end(hbox)
    hbox.show()

    for rot in orients:
        b = Button(win, text=rot[0])
        hbox.pack_end(b)
        b.callback_clicked_add(lambda b, y=rot[1]: im.orient_set(y))
        b.show()

    sep = Separator(win, horizontal=True)
    vbox.pack_end(sep)
    sep.show()

    hbox = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    vbox.pack_end(hbox)
    hbox.show()

    b = Button(win, text="Set remote URL")
    hbox.pack_end(b)
    b.callback_clicked_add(lambda b: im.file_set(remote_url))
    b.show()

    pb = Progressbar(win, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    hbox.pack_end(pb)
    pb.show()

    im.callback_download_start_add(_cb_im_download_start, pb)
    im.callback_download_done_add(_cb_im_download_done)
    im.callback_download_progress_add(_cb_im_download_progress, pb)
    im.callback_download_error_add(_cb_im_download_error, pb)

    win.show()
    def __init__(self):
        win = StandardWindow("Testing", "Elementary Embedded Terminal")
        win.callback_delete_request_add(lambda o: elm.exit())

        term = EmbeddedTerminal(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

        term.show()

        win.resize_object_add(term)

        win.resize(600, 400)
        win.show()
Пример #50
0
def bt_clicked(obj):
    win = StandardWindow("preload-prescale", "Preload & Prescale", autodel=True,
        size=(350, 350))

    ic = Icon(win, file=os.path.join(img_path, "insanely_huge_test_image.jpg"),
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        resizable=(True, True), aspect_fixed=True, preload_disabled=True,
        prescale=True)
    win.resize_object_add(ic)
    ic.show()

    win.show()
Пример #51
0
class Interface(object):

    def __init__(self):
        self.win = StandardWindow("test", "Toolbar_issue",
            size=(600, 400))
        self.win.callback_delete_request_add(lambda x: elementary.exit())

        box0 = Box(self.win)
        #, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
        self.win.resize_object_add(box0)
        box0.show()

        tb = Toolbar(self.win, homogeneous=True,
                size_hint_weight=EXPAND_HORIZ, size_hint_align=(EVAS_HINT_FILL, 0.0),
                select_mode=ELM_OBJECT_SELECT_MODE_DEFAULT)
        self.menuItem = tb.item_append("document-save", "Save", self.popup)
        tb.show()
        box0.pack_end(tb)

        lb = Label(self.win) 
        lb.text_set("<br>This is a test program to illustrate a problem <br>"
                    "with the Radiance e19 theme.<br><br>"
                    "Disabling a toolbar item and then re-enabling it does not<br>"
                    "re-enable the toolbar item's <i>callback function</i>.<br><br>"
                    "To test this first click <b>Save</b> when this program is opened<br>"
                    "This opens a popup as expected. Dismiss popup.<br><br>"
                    "Now click the <b>Toggle</b> button to disable <b>Save</b> Toolbar Item<br>"
                    "After this the <b>Save</b> button is disabled and 'looks different'<br><br>"
                    "Click the <b>Toggle</b> button again to enable <b>Save</b><br>"
                    "After this clicking <b>Save</b> does nothing even tho it 'looks' enabled<br><br>"
                    )
        lb.show()
        box0.pack_end(lb)

        testButton = Button(self.win, text="Toogle")
        testButton.callback_clicked_add(self.disable)
        testButton.show()
        box0.pack_end(testButton)

        self.win.show()

    def popup(self, tb, it):
        msg = Popup(self.win, size_hint_weight=EXPAND_BOTH, text="Save Clicked")
        msg.callback_block_clicked_add(self.closePopup)
        msg.show()
        it.selected_set(False)

    def closePopup(self, obj):
        obj.delete()

    def disable(self, obj):
        self.menuItem.disabled_set(not self.menuItem.disabled)
Пример #52
0
def entry_clicked(obj, item=None):
    win = StandardWindow("entry", "Entry", autodel=True)

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

    en = Entry(win, line_wrap=False, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    en.entry_set("This is an entry widget in this window that<br>"
                 "uses markup <b>like this</> for styling and<br>"
                 "formatting <em>like this</>, as well as<br>"
                 "<a href=X><link>links in the text</></a>, so enter text<br>"
                 "in here to edit it. By the way, links are<br>"
                 "called <a href=anc-02>Anchors</a> so you will need<br>"
                 "to refer to them this way.")
    en.callback_anchor_clicked_add(my_entry_anchor_test, en)
    bx.pack_end(en)
    en.show()

    bx2 = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_BOTH)

    bt = Button(win, text="Clear", size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_BOTH)
    bt.callback_clicked_add(my_entry_bt_1, en)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win, text="Print", size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_BOTH)
    bt.callback_clicked_add(my_entry_bt_2, en)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win, text="Selection", size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_BOTH)
    bt.callback_clicked_add(my_entry_bt_3, en)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win, text="Insert", size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_BOTH)
    bt.callback_clicked_add(my_entry_bt_4, en)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    en.focus_set(True)
    win.show()
def conformant_clicked(obj, item=None):
    win = StandardWindow("conformant", "Conformant", autodel=True,
        conformant=True, size=(240,240))

    conform = Conformant(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(conform)
    conform.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

    en = ScrollableEntry(win, single_line=True, bounce=(True, False),
        text="This is the top entry here", size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_HORIZ)
    en.show()
    bx.pack_end(en)

    btn = Button(win, text="Test Conformant", size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_BOTH)
    bx.pack_end(btn)
    btn.show()

    en = ScrollableEntry(win, single_line=True, bounce=(True, False),
        text="This is the middle entry here", size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_HORIZ)
    en.show()
    bx.pack_end(en)

    btn = Button(win, text="Test Conformant", size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    bx.pack_end(btn)
    btn.show()

    en = ScrollableEntry(win, bounce=(False, True),
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    en.text = \
        "This is a multi-line entry at the bottom<br/>" \
        "This can contain more than 1 line of text and be " \
        "scrolled around to allow for entering of lots of " \
        "content. It is also to test to see that autoscroll " \
        "moves to the right part of a larger multi-line " \
        "text entry that is inside of a scroller than can be " \
        "scrolled around, thus changing the expected position " \
        "as well as cursor changes updating auto-scroll when " \
        "it is enabled."
    en.show()
    bx.pack_end(en)

    conform.content = bx
    bx.show()

    win.show()