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 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 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()
示例#4
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()
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 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()
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()
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()
    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()
示例#10
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()
示例#11
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()
示例#12
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()
示例#13
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()
示例#14
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 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()
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()
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()
示例#18
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 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()
示例#21
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()
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()
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()
示例#25
0
 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()
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()
def core_evas_canvas_callbacks_clicked(obj, item=None):
    win = StandardWindow("evascanvascbs",
                         "Evas canvas callbacks",
                         autodel=True,
                         size=(320, 320))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    text = Text(win.evas,
                text="Events printed on console",
                size=(300, 30),
                color=(0, 0, 0, 255))
    text.font_set("Sans", 12)
    text.pos = (10, 10)
    text.show()

    canvas = win.evas_get()
    canvas.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_IN, events_cb1,
                              "EVAS_CALLBACK_CANVAS_FOCUS_IN")
    canvas.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_OUT, events_cb1,
                              "EVAS_CALLBACK_CANVAS_FOCUS_OUT")
    canvas.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN, events_cb2,
                              "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN")
    canvas.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
                              events_cb2,
                              "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT")

    canvas.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_PRE, events_cb1,
                              "EVAS_CALLBACK_RENDER_FLUSH_PRE")
    canvas.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_POST, events_cb1,
                              "EVAS_CALLBACK_RENDER_FLUSH_POST")
    canvas.event_callback_add(EVAS_CALLBACK_RENDER_PRE, events_cb1,
                              "EVAS_CALLBACK_RENDER_PRE")
    canvas.event_callback_add(EVAS_CALLBACK_RENDER_POST, events_cb1,
                              "EVAS_CALLBACK_RENDER_POST")

    r2 = Rectangle(win.evas,
                   size=(120, 70),
                   color=(0, 100, 0, 100),
                   pos=(70, 70))
    r2.show()

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

    b = Button(win, text="del cbs", size_hint_align=(0.5, 1.0))
    hbox.pack_end(b)
    b.callback_clicked_add(btn_del_cbs_cb)
    b.show()

    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()
示例#29
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()
示例#31
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)
def theme_clicked(obj, data=None):

    win = StandardWindow("config", "Theme", autodel=True, size=(400,200))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    bt = Button(win, text = "A button with a custom style")
    bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    bt.style = "my_custom_style"
    bt.show()
    box.pack_end(bt)

    bt = Button(win, text = "A button with default style")
    bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    bt.show()
    box.pack_end(bt)

    sep = Separator(win, horizontal=True)
    sep.show()
    box.pack_end(sep)
    
    hbox = Box(win, horizontal=True)
    hbox.show()
    box.pack_end(hbox)

    bt = Button(win, text = "Add Extension")
    bt.callback_clicked_add(add_ext_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text = "Remove Extension")
    bt.callback_clicked_add(del_ext_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text = "Add Overlay")
    bt.callback_clicked_add(add_ovr_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text = "Remove Overlay")
    bt.callback_clicked_add(del_ovr_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    win.show()
示例#33
0
def theme_clicked(obj, data=None):

    win = StandardWindow("config", "Theme", autodel=True, size=(400, 200))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    bt = Button(win, text="A button with a custom style")
    bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    bt.style = "my_custom_style"
    bt.show()
    box.pack_end(bt)

    bt = Button(win, text="A button with default style")
    bt.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
    bt.show()
    box.pack_end(bt)

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

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

    bt = Button(win, text="Add Extension")
    bt.callback_clicked_add(add_ext_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text="Remove Extension")
    bt.callback_clicked_add(del_ext_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text="Add Overlay")
    bt.callback_clicked_add(add_ovr_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    bt = Button(win, text="Remove Overlay")
    bt.callback_clicked_add(del_ovr_clicked_cb)
    bt.show()
    hbox.pack_end(bt)

    win.show()
def edje_external_scroller_clicked(obj, item=None):
    win = StandardWindow("edje-external-scroller", "Edje External Scroller",
        autodel=True, size=(320, 400))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    ly = Layout(win, file=(
        os.path.join(script_path, "test_external.edj"),
        "external/scroller"),
        size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(ly)
    ly.show()

    win.show()
示例#35
0
def cnp_clicked(obj):
    win = StandardWindow("copypaste", "CopyPaste", autodel=True)
    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, line_wrap=ELM_WRAP_CHAR,
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        text="Elementary provides ")
    gd.pack(en, 10, 10, 60, 30)
    en.show()

    bt = Button(win, text="Copy from left entry")
    bt.callback_clicked_add(bt_copy_clicked, en)
    gd.pack(bt, 70, 10, 22, 30)
    bt.show()

    bt = Button(win, text="Clear clipboard")
    bt.callback_clicked_add(bt_clear_clicked, en)
    gd.pack(bt, 70, 70, 22, 20)
    bt.show()

    en = Entry(win, scrollable=True, line_wrap=ELM_WRAP_CHAR,
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        text="rich copying and pasting functionality,")
    gd.pack(en, 10, 40, 60, 30)
    en.show()

    bt = Button(win, text="Paste to left entry")
    bt.callback_clicked_add(bt_paste_clicked, en)
    gd.pack(bt, 70, 40, 22, 30)
    bt.show()

    lb = Label(win, text="<b>Clipboard:</b>", size_hint_weight=(0.0, 0.0),
        size_hint_align=FILL_BOTH)
    gd.pack(lb, 10, 70, 60, 10)
    lb.show()

    global glb
    glb = Label(win, text="", size_hint_weight=(0.0, 0.0),
        size_hint_align=FILL_BOTH)
    gd.pack(glb, 10, 80, 60, 10)
    glb.show()

    win.size = 480, 200
    win.show()
def frame_clicked(obj):
    win = StandardWindow("frame", "Frame test", autodel=True, size=(320, 320))
    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()

    # frame 1 (label)
    lbl = Label(win, text="content")
    fr = Frame(win,
               size_hint_align=FILL_BOTH,
               text="Frame (label)",
               content=lbl)
    vbox.pack_end(fr)
    fr.show()

    # frame 1 (icon)
    ic = Icon(win,
              file=os.path.join(img_path, "logo_small.png"),
              resizable=(False, False))
    fr = Frame(win, size_hint_align=FILL_BOTH, text="Frame (icon)", content=ic)
    vbox.pack_end(fr)
    fr.show()

    # frame 2 (collapsable label)
    lbl = Label(win, text="content")
    fr = Frame(win,
               size_hint_align=FILL_BOTH,
               autocollapse=True,
               text="Frame (collapsable label)",
               content=lbl)
    vbox.pack_end(fr)
    fr.show()

    # frame 3(collapsable icon)
    ic = Icon(win,
              file=os.path.join(img_path, "logo_small.png"),
              resizable=(False, False))
    fr = Frame(win,
               size_hint_align=FILL_BOTH,
               autocollapse=True,
               text="Frame (collapsable icon)",
               content=ic)
    vbox.pack_end(fr)
    fr.show()

    win.show()
def check_clicked(obj):
    win = StandardWindow("check", "Check 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=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    ck = Check(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ,
        text="Icon sized to check", content=ic, state=True
        )
    ck.callback_changed_add(ck_1)
    bx.pack_end(ck)
    ck.show()
    ic.show()

    ic = Icon(win, file=ic_file, resizable=(0, 0))
    ck = Check(win, text="Icon no scale", content=ic)
    ck.callback_changed_add(ck_2)
    bx.pack_end(ck)
    ck.show()
    ic.show()

    ck = Check(win, text="Label Only")
    ck.callback_changed_add(ck_3)
    bx.pack_end(ck)
    ck.show()

    ic = Icon(win, file=ic_file, size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
    ck = Check(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ,
        text="Disabled check", content=ic, state=True
        )
    ck.callback_changed_add(ck_never)
    bx.pack_end(ck)
    ck.disabled_set(True)
    ck.show()
    ic.show()

    ic = Icon(win, file=ic_file,
        size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1), resizable=(0, 0))
    ck = Check(win, content=ic)
    ck.callback_changed_add(ck_4)
    bx.pack_end(ck)
    ck.show()
    ic.show()

    win.show()
示例#38
0
    def __init__( self ):
        win = StandardWindow("Testing", "Elementary SearchableList")
        win.callback_delete_request_add(lambda o: elm.exit())
        
        ourList = SearchableList(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.keys = ["Jeff", "Kristi", "Jacob", "Declan", "Joris", 
                "Timmy", "Tristam"]
        for kbl in self.keys:
            ourList.item_append(kbl)
        ourList.show()
        
        win.resize_object_add(ourList)

        win.resize(600, 400)
        win.show()
    def __init__( self ):
        win = StandardWindow("Testing", "Elementary File Selector")
        win.callback_delete_request_add(lambda o: elm.exit())

        self.fs = fs = FileSelector(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        #fs.setMode("Open")
        fs.show()
        
        fs.callback_activated_add(self.showFile)
        fs.callback_cancel_add(lambda o: elm.exit())
        
        win.resize_object_add(fs)

        win.resize(600, 400)
        win.show()
    def __init__(self):
        win = StandardWindow("Testing", "Elementary SearchableList")
        win.callback_delete_request_add(lambda o: elm.exit())
        win.show()

        ourList = SearchableList(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.keys = ["Jeff", "Kristi", "Jacob", "Declan", "Joris", "Timmy", "Tristam"]
        for kbl in self.keys:
            ourList.item_append(kbl)
        ourList.show()

        win.resize_object_add(ourList)

        win.resize(600, 400)
        win.show()
def floating_clicked(obj):
    win = StandardWindow("floating", "Floating", autodel=True, size=(480, 800))

    gl = Genlist(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        pos=(800, 0), size=(480, 800))
    gl.show()

    for i in range(20):
        GenlistItem(ItemClass(), i, None, ELM_GENLIST_ITEM_NONE, gl_sel_cb, i).append_to(gl)

    win.show()

    ani = Animator(anim, gl)
    win.callback_delete_request_add(del_cb, ani)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())
示例#42
0
def edje_external_scroller_clicked(obj, item=None):
    win = StandardWindow("edje-external-scroller",
                         "Edje External Scroller",
                         autodel=True,
                         size=(320, 400))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    ly = Layout(win,
                file=(os.path.join(script_path,
                                   "test_external.edj"), "external/scroller"),
                size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(ly)
    ly.show()

    win.show()
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 separator_clicked(obj):
    win = StandardWindow("separators", "Separators", autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    bx0.pack_end(bx)
    bx.show()

    bt = Button(win, text="Left upper corner")
    bx.pack_end(bt)
    bt.show()

    sp = Separator(win, horizontal=True)
    bx.pack_end(sp)
    sp.show()

    bt = Button(win, text="Left lower corner", disabled=True)
    bx.pack_end(bt)
    bt.show()

    sp = Separator(win)
    bx0.pack_end(sp)
    sp.show()

    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    bx0.pack_end(bx)
    bx.show()

    bt = Button(win, text="Right upper corner", disabled=True)
    bx.pack_end(bt)
    bt.show()

    sp = Separator(win, horizontal=True)
    bx.pack_end(sp)
    sp.show()

    bt = Button(win, text="Right lower corner")
    bx.pack_end(bt)
    bt.show()

    win.show()
示例#45
0
def start():
    win = StandardWindow("Robot Eyes", "Eyes of the robot", autodel=True)
    win.callback_delete_request_add(lambda o: elementary.exit())

    face = Face(win)
    
    draw(win, face)
    def on_tick(*args, **kargs):
        draw(win, face)
        return True

    Animator(on_tick)

    win.resize(screenX, screenY)
    win.show()

    listener(face)
def core_evas_canvas_callbacks_clicked(obj, item=None):
    win = StandardWindow("evascanvascbs", "Evas canvas callbacks", autodel=True,
        size=(320,320))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    text = Text(win.evas, text="Events printed on console", size=(300, 30),
        color=(0,0,0,255))
    text.font_set("Sans", 12)
    text.pos = (10, 10)
    text.show()

    canvas = win.evas_get()
    canvas.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_IN,
        events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_IN")
    canvas.event_callback_add(EVAS_CALLBACK_CANVAS_FOCUS_OUT,
        events_cb1, "EVAS_CALLBACK_CANVAS_FOCUS_OUT")
    canvas.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN,
        events_cb2, "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_IN")
    canvas.event_callback_add(EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT,
        events_cb2, "EVAS_CALLBACK_CANVAS_OBJECT_FOCUS_OUT")

    canvas.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_PRE,
        events_cb1, "EVAS_CALLBACK_RENDER_FLUSH_PRE")
    canvas.event_callback_add(EVAS_CALLBACK_RENDER_FLUSH_POST,
        events_cb1, "EVAS_CALLBACK_RENDER_FLUSH_POST")
    canvas.event_callback_add(EVAS_CALLBACK_RENDER_PRE,
        events_cb1, "EVAS_CALLBACK_RENDER_PRE")
    canvas.event_callback_add(EVAS_CALLBACK_RENDER_POST,
        events_cb1, "EVAS_CALLBACK_RENDER_POST")

    r2 = Rectangle(win.evas, size=(120,70), color=(0,100,0,100), pos=(70,70))
    r2.show()

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

    b = Button(win, text="del cbs", size_hint_align=(0.5, 1.0))
    hbox.pack_end(b)
    b.callback_clicked_add(btn_del_cbs_cb)
    b.show()

    win.show()
    def __init__(self):
        win = StandardWindow("Testing", "Elementary File Selector")
        # pylint: disable=no-member
        win.callback_delete_request_add(lambda o: elm.exit())

        self.f_selector = f_selector = FileSelector(
            win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        # f_selector.folderOnlySet(True)
        f_selector.set_mode("Open")
        f_selector.show()

        f_selector.callback_activated_add(self.cb_activated)
        f_selector.callback_cancel_add(lambda o: elm.exit())

        win.resize_object_add(f_selector)

        win.resize(600, 400)
        win.show()
    def __init__(self):
        win = StandardWindow("Testing", "Elementary File Selector")
        win.callback_delete_request_add(lambda o: elm.exit())

        self.fs = fs = FileSelector(win,
                                    size_hint_weight=EXPAND_BOTH,
                                    size_hint_align=FILL_BOTH)
        #fs.folderOnlySet(True)
        fs.setMode("Open")
        fs.show()

        fs.callback_activated_add(self.showFile)
        fs.callback_cancel_add(lambda o: elm.exit())

        win.resize_object_add(fs)

        win.resize(600, 400)
        win.show()
def inner_window_clicked(obj):
    win = StandardWindow("inner-window", "InnerWindow test", autodel=True,
        size=(320, 320))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    lb = Label(win)
    lb.text_set("This is an \"inwin\" - a window in a<br/>"
                "window. This is handy for quick popups<br/>"
                "you want centered, taking over the window<br/>"
                "until dismissed somehow. Unlike hovers they<br/>"
                "don't hover over their target.")

    iw = InnerWindow(win, content=lb)
    iw.show()

    win.resize(320, 320)
    win.show()
def edje_external_pbar_clicked(obj, item=None):
    win = StandardWindow("edje-external-pbar", "Edje External Progress Bar",
        autodel=True, size=(320, 400))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    ly = Layout(win, file=(
        os.path.join(script_path, "test_external.edj"),
        "external/pbar"),
        size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(ly)
    ly.show()

    bt = ly.edje.part_external_object_get("ext_button3")
    bt.text = "...or from Python"
    bt.callback_clicked_add(cb_btn3_clicked, ly)

    win.show()
示例#51
0
    def __init__( self ):
        win = StandardWindow("Testing", "Elementary About Dialog")
        win.callback_delete_request_add(lambda o: elm.exit())
        win.show()
        
        lbl = Label(win, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH)
        lbl.text = "This is a parent window for the About Dialog. Close when done."
        lbl.show()
        
        win.resize_object_add(lbl)

        win.resize(600, 400)
        win.show()
        
        AboutWindow(win, title="About Test", standardicon="dialog-information", \
                        version="1.0", authors=AUTHORS, \
                        licen=LICENSE, webaddress="https://github.com/JeffHoogland/python-elm-extensions", \
                        info=INFO)
示例#52
0
def ctxpopup_clicked(obj):
    win = StandardWindow("ctxpopup", "Context popup test", autodel=True,
        size=(400,400))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    li.item_append("Ctxpopup with icons and labels", callback=cb_item1)
    li.item_append("Ctxpopup with icons only", callback=cb_item2)
    li.item_append("Ctxpopup with labels only", callback=cb_item3)
    li.item_append("Ctxpopup at horizontal mode", callback=cb_item4)
    li.item_append("Ctxpopup with user content", callback=cb_item5)
    li.item_append("Ctxpopup with restacking", callback=cb_item6)
    li.go()

    win.show()
def floating_clicked(obj):
    win = StandardWindow("floating", "Floating", autodel=True, size=(480, 800))

    gl = Genlist(win,
                 size_hint_weight=EXPAND_BOTH,
                 size_hint_align=FILL_BOTH,
                 pos=(800, 0),
                 size=(480, 800))
    gl.show()

    for i in range(20):
        GenlistItem(ItemClass(), i, None, ELM_GENLIST_ITEM_NONE, gl_sel_cb,
                    i).append_to(gl)

    win.show()

    ani = Animator(anim, gl)
    win.callback_delete_request_add(del_cb, ani)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())