def gesture_layer_clicked(obj):
    w = 480
    h = 800

    win = Window("gesture-layer", ELM_WIN_BASIC, title="Gesture Layer",
        autodel=True, size=(w, h))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = Background(win, file=os.path.join(img_path, "wood_01.jpg"),
        size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    photos = []

    photos.append(photo_object_add(win, None,
        os.path.join(img_path, "pol_sky.png"), 200, 200, 365, 400, 0))
    photos.append(photo_object_add(win, None,
        os.path.join(img_path, "pol_twofish.png"), 40, 300, 365, 400, 45))

    en = Entry(win, line_wrap=ELM_WRAP_MIXED)
    en.text = "You can use whatever object you want, even entries like this."

    postit = Layout(win,
        file=(os.path.join(script_path, "postit_ent.edj"), "main"))
    postit.part_content_set("ent", en)

    photos.append(photo_object_add(win, postit, None, 50, 50, 382, 400, 355))

    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()
Exemple #3
0
 def date_add(self, date, from_row, to_row):
     ly = self.child_get(0, from_row)
     if ly is None:
         ly = Layout(self, file=(self.themef, 'egitu/graph/date'),
                     size_hint_align=FILL_BOTH)
     fmt = '%d %b' if to_row - from_row > 2 else '%d'
     ly.part_text_set('date.text', date.strftime(fmt))
     self.pack(ly, 0, from_row, 1, to_row - from_row)
     ly.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()
Exemple #5
0
def edje_external_slider_clicked(obj, item=None):
    win = StandardWindow("edje-external-slider",
                         "Edje External Slider",
                         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/slider"),
                size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(ly)
    ly.show()

    win.show()
def plug_add(win, bx, name):
    plug = Plug(win, size_hint_weight=EXPAND_BOTH)

    if plug.connect(name, 0, False):
        ly = Layout(win,
            file=(os.path.join(script_path, "test.edj"), "win_config"),
            size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        ly.show()

        bx.pack_end(ly)
        ly.part_content_set("swallow", plug)
        plug.show()
    else:
        print("No plug")
        plug.delete()
        return None

    return plug
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()
Exemple #8
0
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()
Exemple #9
0
def gesture_layer_clicked(obj):
    w = 480
    h = 800

    win = Window("gesture-layer",
                 ELM_WIN_BASIC,
                 title="Gesture Layer",
                 autodel=True,
                 size=(w, h))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = Background(win,
                    file=os.path.join(img_path, "wood_01.jpg"),
                    size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    photos = []

    photos.append(
        photo_object_add(win, None, os.path.join(img_path, "pol_sky.png"), 200,
                         200, 365, 400, 0))
    photos.append(
        photo_object_add(win, None, os.path.join(img_path, "pol_twofish.png"),
                         40, 300, 365, 400, 45))

    en = Entry(win, line_wrap=ELM_WRAP_MIXED)
    en.text = "You can use whatever object you want, even entries like this."

    postit = Layout(win,
                    file=(os.path.join(script_path, "postit_ent.edj"), "main"))
    postit.part_content_set("ent", en)

    photos.append(photo_object_add(win, postit, None, 50, 50, 382, 400, 355))

    win.show()
Exemple #10
0
    def popup_player_add(self, popup, player):
        # create the edje obj for this player from 'e/gadgets/audio/player'
        o = Layout(popup)
        e.theme_object_set(o, 'audio', 'player')
        o.size_hint_min = o.edje.size_min

        o.signal_callback_add('act,play', '', lambda o,sig,src: player.play())
        o.signal_callback_add('act,prev', '', lambda o,sig,src: player.prev())
        o.signal_callback_add('act,next', '', lambda o,sig,src: player.next())
        o.signal_callback_add('act,rais', '', lambda o,sig,src: player.rais())

        self.player_update(o, player)
        o.show()

        # insert the player in the popup box
        popup.part_box_append('players.box', o)
        popup.size_hint_min = popup.size_min

        # keep track of this obj in the player_objs dict
        if not player in self.player_objs:
            self.player_objs[player] = []
        self.player_objs[player].append(o)
def plug_add(win, bx, name):
    plug = Plug(win, size_hint_weight=EXPAND_BOTH)

    if plug.connect(name, 0, False):
        ly = Layout(win,
                    file=(os.path.join(script_path, "test.edj"), "win_config"),
                    size_hint_weight=EXPAND_BOTH,
                    size_hint_align=FILL_BOTH)
        ly.show()

        bx.pack_end(ly)
        ly.part_content_set("swallow", plug)
        plug.show()
    else:
        print("No plug")
        plug.delete()
        return None

    return plug
Exemple #12
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()
Exemple #13
0
def focus_clicked(obj, item=None):
    win = StandardWindow("focus", "Focus", autodel=True, size=(800, 600))

    win.focus_highlight_enabled = True

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

    ### Toolbar
    tbar = Toolbar(win,
                   shrink_mode=ELM_TOOLBAR_SHRINK_MENU,
                   size_hint_align=(EVAS_HINT_FILL, 0.0))

    tb_it = tbar.item_append("document-print", "Hello", _tb_sel)
    tb_it.disabled = True
    tb_it = tbar.item_append("folder-new", "World", _tb_sel)
    tb_it = tbar.item_append("object-rotate-right", "H", _tb_sel)
    tb_it = tbar.item_append("mail-send", "Comes", _tb_sel)
    tb_it = tbar.item_append("clock", "Elementary", _tb_sel)

    tb_it = tbar.item_append("refresh", "Menu", _tb_sel)
    tb_it.menu = True
    tbar.menu_parent = win
    menu = tb_it.menu

    menu.item_add(None, "Shrink", "edit-cut", _tb_sel)
    menu_it = menu.item_add(None, "Mode", "edit-copy", _tb_sel)
    menu.item_add(menu_it, "is set to", "edit-paste", _tb_sel)
    menu.item_add(menu_it, "or to", "edit-paste", _tb_sel)
    menu.item_add(None, "Menu", "edit-delete", _tb_sel)

    tbx.pack_end(tbar)
    tbar.show()

    mainbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
    tbx.pack_end(mainbx)
    mainbx.show()

    ## First Col
    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    mainbx.pack_end(bx)
    bx.show()

    lb = Label(win,
               text="<b>Use Tab or Shift+Tab<br/>or Arrow keys</b>",
               size_hint_align=FILL_BOTH)
    bx.pack_end(lb)
    lb.show()

    tg = Check(win, style="toggle")
    tg.part_text_set("on", "Yes")
    tg.part_text_set("off", "No")
    bx.pack_end(tg)
    tg.show()

    en = Entry(win,
               scrollable=True,
               single_line=True,
               text="This is a single line",
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ)
    bx.pack_end(en)
    en.show()

    #
    bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    bx.pack_end(bx2)
    bx2.show()

    for i in range(2):
        bt = Button(win,
                    text="Box",
                    size_hint_align=FILL_BOTH,
                    disabled=(i % 2))
        bx2.pack_end(bt)
        bt.show()

    sc = Scroller(win,
                  bounce=(True, True),
                  content_min_limit=(1, 1),
                  size_hint_weight=EXPAND_BOTH,
                  size_hint_align=FILL_BOTH)
    bx2.pack_end(sc)
    sc.show()

    bt = Button(win, text="Scroller", size_hint_align=FILL_BOTH)
    sc.content = bt
    bt.show()

    #
    bt = Button(win, text="Box", size_hint_align=FILL_BOTH)
    bx.pack_end(bt)
    bt.show()

    #
    bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    bx.pack_end(bx2)
    bx2.show()

    for i in range(2):
        bx3 = Box(win, size_hint_align=FILL_BOTH)
        bx2.pack_end(bx3)
        bx3.show()

        for j in range(3):
            bt = Button(win, text="Box", size_hint_align=FILL_BOTH)
            bx3.pack_end(bt)
            bt.show()

    sc = Scroller(win,
                  bounce=(False, True),
                  content_min_limit=(1, 0),
                  size_hint_align=FILL_BOTH,
                  size_hint_weight=EXPAND_BOTH)
    sc.content_min_limit = (1, 1)
    bx2.pack_end(sc)
    sc.show()

    bx3 = Box(win, size_hint_align=FILL_BOTH)
    sc.content = bx3
    bx3.show()

    for i in range(5):
        bt = Button(win, text="BX Scroller", size_hint_align=FILL_BOTH)
        bx3.pack_end(bt)
        bt.show()

    ## Second Col
    ly = Layout(win, size_hint_weight=EXPAND_BOTH)
    ly.file = edj_file, "twolines"
    mainbx.pack_end(ly)
    ly.show()

    bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    ly.part_content_set("element1", bx2)
    bx2.show()

    for i in range(3):
        bt = Button(win, text="Layout", size_hint_align=FILL_BOTH)
        bx2.pack_end(bt)
        bt.show()
        bx2.focus_custom_chain_prepend(bt)

    bx2 = Box(win, size_hint_align=FILL_BOTH)
    ly.part_content_set("element2", bx2)
    bx2.show()

    bt = Button(win, text="Disable", size_hint_align=FILL_BOTH)
    bt.callback_clicked_add(lambda b: b.disabled_set(True))
    bx2.pack_end(bt)
    bt.show()
    bx2.focus_custom_chain_prepend(bt)

    bt2 = Button(win, text="Enable", size_hint_align=FILL_BOTH)
    bt2.callback_clicked_add(lambda b, b1: b1.disabled_set(False), bt)
    bx2.pack_end(bt2)
    bt2.show()
    bx2.focus_custom_chain_append(bt2)

    ## Third Col
    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    mainbx.pack_end(bx)
    bx.show()

    fr = Frame(
        win,
        text="Frame",
    )
    bx.pack_end(fr)
    fr.show()

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

    for j in range(1):
        for i in range(2):
            bt = Button(win,
                        text="Table",
                        size_hint_align=FILL_BOTH,
                        size_hint_weight=EXPAND_BOTH)
            tb.pack(bt, i, j, 1, 1)
            bt.show()

    #
    fr = Bubble(win,
                text="Bubble",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_BOTH)
    bx.pack_end(fr)
    fr.show()

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

    for j in range(2):
        for i in range(1):
            bt = Button(win,
                        text="Table",
                        size_hint_align=FILL_BOTH,
                        size_hint_weight=EXPAND_BOTH)
            tb.pack(bt, i, j, 1, 1)
            bt.show()

    win.show()
def focus2_clicked(obj, item=None):
    win = StandardWindow("focus2", "Focus 2", autodel=True, size=(400, 400))

    win.focus_highlight_enabled = True

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

    PARENT = bx

    en = Entry(PARENT, scrollable=True, single_line=True,
               text="Entry that should get focus",
               size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bx.pack_end(en)
    en.show()
    
    bt = Button(PARENT, text="Give focus to entry")
    bt.callback_clicked_add(_focus_obj, en)
    bx.pack_end(bt)
    bt.show()
   
    ly = Layout(PARENT, size_hint_weight=EXPAND_BOTH)
    ly.file = edj_file, "layout"
    bx.pack_end(ly)
    ly.show()

    bt1 = bt = Button(ly, text="Button 1")
    ly.part_content_set("element1", bt)

    en1 = Entry(ly, scrollable=True, single_line=True,
                text="Scrolled Entry that should get focus",
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ )
    ly.part_content_set("element2", en1)

    bt = Button(ly, text="Button 2")
    ly.part_content_set("element3", bt)


    bt = Button(PARENT, text="Give focus to layout",
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_focus_obj, ly)
    bx.pack_end(bt)
    bt.show()

    bt = Button(PARENT, text="Give focus to layout part",
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_focus_layout_part, ly)
    bx.pack_end(bt)
    bt.show()

    bt = Button(PARENT, text="Give focus to layout 'Button 1'",
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_focus_obj, bt1)
    bx.pack_end(bt)
    bt.show()

    bt = Button(PARENT, text="Give focus to layout 'Entry'",
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_focus_obj, en1)
    bx.pack_end(bt)
    bt.show()

    bt.focus_next_object_set(en, ELM_FOCUS_DOWN)
    en.focus_next_object_set(bt, ELM_FOCUS_UP)
    win.show()
def focus_clicked(obj, item=None):
    win = StandardWindow("focus", "Focus", autodel=True, size=(800,600))
    
    win.focus_highlight_enabled = True

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

    ### Toolbar
    tbar = Toolbar(win, shrink_mode=ELM_TOOLBAR_SHRINK_MENU,
                   size_hint_align=(EVAS_HINT_FILL,0.0))

    tb_it = tbar.item_append("document-print", "Hello", _tb_sel)
    tb_it.disabled = True
    tb_it = tbar.item_append("folder-new", "World", _tb_sel)
    tb_it = tbar.item_append("object-rotate-right", "H", _tb_sel)
    tb_it = tbar.item_append("mail-send", "Comes", _tb_sel)
    tb_it = tbar.item_append("clock", "Elementary", _tb_sel)

    tb_it = tbar.item_append("refresh", "Menu", _tb_sel)
    tb_it.menu = True
    tbar.menu_parent = win
    menu = tb_it.menu

    menu.item_add(None, "Shrink", "edit-cut", _tb_sel)
    menu_it = menu.item_add(None, "Mode", "edit-copy", _tb_sel)
    menu.item_add(menu_it, "is set to", "edit-paste", _tb_sel)
    menu.item_add(menu_it, "or to", "edit-paste", _tb_sel)
    menu.item_add(None, "Menu", "edit-delete", _tb_sel)

    tbx.pack_end(tbar)
    tbar.show()


    mainbx = Box(win, horizontal=True, size_hint_weight=EXPAND_BOTH)
    tbx.pack_end(mainbx)
    mainbx.show()

    ## First Col
    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    mainbx.pack_end(bx)
    bx.show()

    lb = Label(win, text="<b>Use Tab or Shift+Tab<br/>or Arrow keys</b>",
                    size_hint_align=FILL_BOTH)
    bx.pack_end(lb)
    lb.show()

    tg = Check(win, style="toggle")
    tg.part_text_set("on", "Yes")
    tg.part_text_set("off", "No")
    bx.pack_end(tg)
    tg.show()
    
    en = Entry(win, scrollable=True, single_line=True, text="This is a single line",
                    size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bx.pack_end(en)
    en.show()

    #
    bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    bx.pack_end(bx2)
    bx2.show()

    for i in range(2):
        bt = Button(win, text="Box", size_hint_align=FILL_BOTH, disabled=(i % 2))
        bx2.pack_end(bt)
        bt.show()

    sc = Scroller(win, bounce=(True,True), content_min_limit=(1,1),
                  size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    bx2.pack_end(sc)
    sc.show()

    bt = Button(win, text="Scroller", size_hint_align=FILL_BOTH)
    sc.content = bt
    bt.show()

    #
    bt = Button(win, text="Box", size_hint_align=FILL_BOTH)
    bx.pack_end(bt)
    bt.show()

    #
    bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    bx.pack_end(bx2)
    bx2.show()
    
    for i in range(2):
        bx3 = Box(win, size_hint_align=FILL_BOTH)
        bx2.pack_end(bx3)
        bx3.show()

        for j in range(3):
            bt = Button(win, text="Box", size_hint_align=FILL_BOTH)
            bx3.pack_end(bt)
            bt.show()
    

    sc = Scroller(win, bounce=(False, True), content_min_limit=(1,0),
                  size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    sc.content_min_limit=(1,1)
    bx2.pack_end(sc)
    sc.show()

    bx3 = Box(win, size_hint_align=FILL_BOTH)
    sc.content = bx3
    bx3.show()

    for i in range(5):
        bt = Button(win, text="BX Scroller", size_hint_align=FILL_BOTH)
        bx3.pack_end(bt)
        bt.show()


    ## Second Col
    ly = Layout(win, size_hint_weight=EXPAND_BOTH)
    ly.file = edj_file, "twolines"
    mainbx.pack_end(ly)
    ly.show()

    bx2 = Box(win, horizontal=True, size_hint_align=FILL_BOTH)
    ly.part_content_set("element1", bx2)
    bx2.show()

    for i in range(3):
        bt = Button(win, text="Layout", size_hint_align=FILL_BOTH)
        bx2.pack_end(bt)
        bt.show()
        bx2.focus_custom_chain_prepend(bt)

    bx2 = Box(win, size_hint_align=FILL_BOTH)
    ly.part_content_set("element2", bx2)
    bx2.show()

    bt = Button(win, text="Disable", size_hint_align=FILL_BOTH)
    bt.callback_clicked_add(lambda b: b.disabled_set(True))
    bx2.pack_end(bt)
    bt.show()
    bx2.focus_custom_chain_prepend(bt)

    bt2 = Button(win, text="Enable", size_hint_align=FILL_BOTH)
    bt2.callback_clicked_add(lambda b, b1: b1.disabled_set(False), bt)
    bx2.pack_end(bt2)
    bt2.show()
    bx2.focus_custom_chain_append(bt2)

    ## Third Col
    bx = Box(win, size_hint_weight=EXPAND_BOTH)
    mainbx.pack_end(bx)
    bx.show()

    fr = Frame(win, text="Frame", )
    bx.pack_end(fr)
    fr.show()

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

    for j in range(1):
        for i in range(2):
            bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
            tb.pack(bt, i, j, 1, 1)
            bt.show()

    #
    fr = Bubble(win, text="Bubble", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    bx.pack_end(fr)
    fr.show()

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

    for j in range(2):
        for i in range(1):
            bt = Button(win, text="Table", size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
            tb.pack(bt, i, j, 1, 1)
            bt.show()


    win.show()
Exemple #16
0
    def _gl_content_get(self, gl, part, commit):
        if part == 'egitu.swallow.pad':
            # padding rect (to place the point in the right column)
            size = commit.dag_data.col * self.COLW, 10
            r = Rectangle(gl.evas, color=(0,0,0,0),
                          size_hint_min=size, size_hint_max=size)
            return r

        elif part == 'egitu.swallow.icon':
            # the icon object (+ swallows for the connection lines)
            icon = Layout(gl, file=(self.themef,'egitu/graph/icon'))
            icon.tooltip_content_cb_set(lambda o,t: CommitTooltip(t, commit))
            commit.dag_data.icon_obj = icon
            if 'HEAD' in commit.heads:
                icon.signal_emit('head,show', 'egitu')
            return icon

        elif part == 'egitu.swallow.refs':
            box = Box(gl, horizontal=True)
            # local refs
            for head in commit.heads:
                ref = Layout(gl, file=(self.themef, 'egitu/graph/ref'))
                ref.text_set('ref.text', head)
                box.pack_end(ref)
                ref.show()
            # remote refs
            if options.show_remotes_in_dag:
                for head in commit.remotes:
                    ref = Layout(gl, file=(self.themef, 'egitu/graph/ref'))
                    ref.text_set('ref.text', head)
                    box.pack_end(ref)
                    ref.show()
            # tags
            for tag in commit.tags:
                ref = Layout(gl, file=(self.themef, 'egitu/graph/tag'))
                ref.text_set('tag.text', tag)
                box.pack_end(ref)
                ref.show()
            return box

        elif commit.dag_data.date_span and part == 'egitu.swallow.date':
            dt = Edje(gl.evas, file=self.themef, group='egitu/graph/date')
            dt.size_hint_min = self.COLW, commit.dag_data.date_span * self.ROWH
            fmt = '%d %b' if commit.dag_data.date_span > 2 else '%d'
            dt.part_text_set('date.text', commit.commit_date.strftime(fmt))
            return dt
Exemple #17
0
def flip_clicked(obj, item=None):
    win = StandardWindow("flip", "Flip", autodel=True, size=(320, 320))

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

    fl = Flip(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
    fl.callback_animate_begin_add(my_flip_animate_begin)
    fl.callback_animate_done_add(my_flip_animate_done)
    box.pack_end(fl)
    fl.show()

    # flip front content
    o = Background(win, size_hint_weight=EXPAND_BOTH,
        file=os.path.join(img_path, "sky_01.jpg"))
    fl.part_content_set("front", o)
    o.show()

    # flip back content
    ly = Layout(win, file=(os.path.join(script_path, "test.edj"), "layout"),
        size_hint_weight=EXPAND_BOTH)
    fl.part_content_set("back", ly)
    ly.show()

    bt = Button(win, text="Button 1")
    ly.part_content_set("element1", bt)
    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()

    # flip buttons (first row)
    hbox = Box(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
    hbox.show()
    box.pack_end(hbox)
    count = 1

    for mode in [ELM_FLIP_ROTATE_X_CENTER_AXIS,
                 ELM_FLIP_ROTATE_Y_CENTER_AXIS,
                 ELM_FLIP_ROTATE_XZ_CENTER_AXIS,
                 ELM_FLIP_ROTATE_YZ_CENTER_AXIS]:
        bt = Button(win, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH, text=str(count))
        bt.callback_clicked_add(my_flip_go, fl, mode)
        hbox.pack_end(bt)
        bt.show()
        count += 1

    # flip buttons (second row)
    hbox = Box(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
    hbox.show()
    box.pack_end(hbox)

    for mode in [ELM_FLIP_CUBE_LEFT,
                 ELM_FLIP_CUBE_RIGHT,
                 ELM_FLIP_CUBE_UP,
                 ELM_FLIP_CUBE_DOWN]:
        bt = Button(win, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH, text=str(count))
        bt.callback_clicked_add(my_flip_go, fl, mode)
        hbox.pack_end(bt)
        bt.show()
        count += 1

    # flip buttons (third row)
    hbox = Box(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
    hbox.show()
    box.pack_end(hbox)

    for mode in [ELM_FLIP_PAGE_LEFT,
                 ELM_FLIP_PAGE_RIGHT,
                 ELM_FLIP_PAGE_UP,
                 ELM_FLIP_PAGE_DOWN]:
        bt = Button(win, size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH, text=str(count))
        bt.callback_clicked_add(my_flip_go, fl, mode)
        hbox.pack_end(bt)
        bt.show()
        count += 1

    win.show()
Exemple #18
0
def flip_interactive_clicked(obj, item=None):
    win = StandardWindow("flip", "Flip", autodel=True, size=(320, 320))

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

    # flip object
    fl = Flip(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        interaction=ELM_FLIP_INTERACTION_NONE)
    fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_UP, True)
    fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_DOWN, True)
    fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_LEFT, True)
    fl.interaction_direction_enabled_set(ELM_FLIP_DIRECTION_RIGHT, True)
    fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_UP, 0.25)
    fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_DOWN, 0.25)
    fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_LEFT, 0.25)
    fl.interaction_direction_hitsize_set(ELM_FLIP_DIRECTION_RIGHT, 0.25)
    fl.callback_animate_begin_add(my_flip_animate_begin)
    fl.callback_animate_done_add(my_flip_animate_done)
    box.pack_end(fl)
    fl.show()

    # front content (image)
    o = Background(win, size_hint_weight=EXPAND_BOTH,
        file=os.path.join(img_path, "sky_01.jpg"))
    fl.part_content_set("front", o)
    o.show()

    # back content (layout)
    ly = Layout(win, size_hint_weight=EXPAND_BOTH,
        file=(os.path.join(script_path, "test.edj"), "layout"))
    fl.part_content_set("back", ly)
    ly.show()

    bt = Button(win, text="Button 1")
    ly.part_content_set("element1", bt)
    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()


    # radio buttons
    rd = Radio(win, state_value=ELM_FLIP_INTERACTION_NONE, text="None")
    rd.callback_changed_add(my_cb_radios, fl)
    box.pack_end(rd)
    rd.show()
    rdg = rd

    rd = Radio(win, state_value=ELM_FLIP_INTERACTION_ROTATE, text="Rotate")
    rd.callback_changed_add(my_cb_radios, fl)
    rd.group_add(rdg)
    box.pack_end(rd)
    rd.show()

    rd = Radio(win, state_value=ELM_FLIP_INTERACTION_CUBE, text="Cube")
    rd.callback_changed_add(my_cb_radios, fl)
    rd.group_add(rdg)
    box.pack_end(rd)
    rd.show()

    rd = Radio(win, state_value=ELM_FLIP_INTERACTION_PAGE, text="Page")
    rd.callback_changed_add(my_cb_radios, fl)
    rd.group_add(rdg)
    box.pack_end(rd)
    rd.show()

    # window show
    win.show()
Exemple #19
0
def focus2_clicked(obj, item=None):
    win = StandardWindow("focus2", "Focus 2", autodel=True, size=(400, 400))

    win.focus_highlight_enabled = True

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

    PARENT = bx

    en = Entry(PARENT,
               scrollable=True,
               single_line=True,
               text="Entry that should get focus",
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ)
    bx.pack_end(en)
    en.show()

    bt = Button(PARENT, text="Give focus to entry")
    bt.callback_clicked_add(_focus_obj, en)
    bx.pack_end(bt)
    bt.show()

    ly = Layout(PARENT, size_hint_weight=EXPAND_BOTH)
    ly.file = edj_file, "layout"
    bx.pack_end(ly)
    ly.show()

    bt1 = bt = Button(ly, text="Button 1")
    ly.part_content_set("element1", bt)

    en1 = Entry(ly,
                scrollable=True,
                single_line=True,
                text="Scrolled Entry that should get focus",
                size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
    ly.part_content_set("element2", en1)

    bt = Button(ly, text="Button 2")
    ly.part_content_set("element3", bt)

    bt = Button(PARENT,
                text="Give focus to layout",
                size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_focus_obj, ly)
    bx.pack_end(bt)
    bt.show()

    bt = Button(PARENT,
                text="Give focus to layout part",
                size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_focus_layout_part, ly)
    bx.pack_end(bt)
    bt.show()

    bt = Button(PARENT,
                text="Give focus to layout 'Button 1'",
                size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_focus_obj, bt1)
    bx.pack_end(bt)
    bt.show()

    bt = Button(PARENT,
                text="Give focus to layout 'Entry'",
                size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_focus_obj, en1)
    bx.pack_end(bt)
    bt.show()

    bt.focus_next_object_set(en, ELM_FOCUS_DOWN)
    en.focus_next_object_set(bt, ELM_FOCUS_UP)
    win.show()
Exemple #20
0
    def point_add(self, commit, col, row):
        p = Layout(self, file=(self.themef,'egitu/graph/item'))
        p.signal_callback_add("mouse,down,*", "base",
                              self.point_mouse_down_cb, commit)
        p.tooltip_content_cb_set(lambda o,tt:
                CommitPopup(self, self.repo, commit))

        if options.show_message_in_dag is True:
            l = Layout(self, file=(self.themef, 'egitu/graph/msg'))
            l.text_set('msg.text', commit.title)
            p.box_append('refs.box', l)
            l.show()

        for head in commit.heads:
            if head == 'HEAD':
                p.signal_emit('head,show', 'egitu')
            else:
                l = Layout(self, file=(self.themef, 'egitu/graph/ref'))
                l.text_set('ref.text', head)
                p.box_append('refs.box', l)
                l.show()

        if options.show_remotes_in_dag:
            for head in commit.remotes:
                l = Layout(self, file=(self.themef, 'egitu/graph/ref'))
                l.text_set('ref.text', head)
                p.box_append('refs.box', l)
                l.show()

        for tag in commit.tags:
            l = Layout(self, file=(self.themef, 'egitu/graph/tag'))
            l.text_set('tag.text', tag)
            p.box_append('refs.box', l)
            l.show()

        self.pack(p, col, row, 1, 1)
        p.show()