def radio_add(win, bx):
    ad = win.data["ad"]

    i = 0

    bx2 = Box(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=(EVAS_HINT_FILL, 0.0), align=(0.0, 0.5),
        horizontal = True)
    bx.pack_end(bx2)
    bx2.show()

    rdg = rd = Radio(win, state_value=i, text="Nothing",
        size_hint_weight=EXPAND_BOTH)
    rd.group_add(rdg)
    bx2.pack_end(rd)
    rd.show()
    i += 1

    for profile in ad.profiles:
        rd = Radio(win, state_value=i, text=profile,
            size_hint_weight=EXPAND_BOTH)
        rd.group_add(rdg)
        bx2.pack_end(rd)
        rd.show()
        i += 1

    return rdg
예제 #2
0
def genlist10_clicked(obj, item=None):
    win = StandardWindow("genlist-decorate-item-mode",
                         "Genlist Decorate Item Mode",
                         autodel=True,
                         size=(520, 520))

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

    bx2 = Box(win)
    bx2.show()

    fr = Frame(win, text="Decorate Item Mode Type", content=bx2)
    bx.pack_end(fr)
    fr.show()

    rd = Radio(win,
               size_hint_weight=EXPAND_BOTH,
               state_value=0,
               text="Slide : Sweep genlist items to the right.")
    rd.show()
    bx2.pack_end(rd)
    rdg = rd

    rd = Radio(win,
               size_hint_weight=EXPAND_BOTH,
               state_value=1,
               text="Rotate : Click each item.")
    rd.group_add(rdg)
    rd.show()
    bx2.pack_end(rd)

    gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    gl.callback_drag_start_right_add(my_gl_mode_right, rdg)
    gl.callback_drag_start_left_add(my_gl_mode_left, rdg)
    gl.callback_drag_start_up_add(my_gl_mode_cancel, rdg)
    gl.callback_drag_start_down_add(my_gl_mode_cancel, rdg)
    gl.show()

    itc10 = ItemClass10(item_style="default", decorate_item_style="mode")
    itc10.state_get = gl_state_get

    for i in range(1000, 1050):
        GenlistItem(item_class=itc10,
                    item_data=i,
                    parent_item=None,
                    flags=ELM_GENLIST_ITEM_NONE,
                    func=gl_sel10,
                    func_data=(i, rdg)).append_to(gl)

    bx.pack_end(gl)

    win.size = 520, 520
    win.show()
def radio_add(win, bx):
    ad = win.data["ad"]

    i = 0

    bx2 = Box(win,
              size_hint_weight=EXPAND_HORIZ,
              size_hint_align=(EVAS_HINT_FILL, 0.0),
              align=(0.0, 0.5),
              horizontal=True)
    bx.pack_end(bx2)
    bx2.show()

    rdg = rd = Radio(win,
                     state_value=i,
                     text="Nothing",
                     size_hint_weight=EXPAND_BOTH)
    rd.group_add(rdg)
    bx2.pack_end(rd)
    rd.show()
    i += 1

    for profile in ad.profiles:
        rd = Radio(win,
                   state_value=i,
                   text=profile,
                   size_hint_weight=EXPAND_BOTH)
        rd.group_add(rdg)
        bx2.pack_end(rd)
        rd.show()
        i += 1

    return rdg
def genlist10_clicked(obj, item=None):
    win = StandardWindow("genlist-decorate-item-mode",
        "Genlist Decorate Item Mode", autodel=True, size=(520, 520))

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

    bx2 = Box(win)
    bx2.show()

    fr = Frame(win, text="Decorate Item Mode Type", content=bx2)
    bx.pack_end(fr)
    fr.show()

    rd = Radio(win, size_hint_weight=EXPAND_BOTH, state_value=0,
        text="Slide : Sweep genlist items to the right.")
    rd.show()
    bx2.pack_end(rd)
    rdg = rd

    rd = Radio(win, size_hint_weight=EXPAND_BOTH, state_value=1,
        text = "Rotate : Click each item.")
    rd.group_add(rdg)
    rd.show()
    bx2.pack_end(rd)

    gl = Genlist(win, size_hint_align=FILL_BOTH, size_hint_weight=EXPAND_BOTH)
    gl.callback_drag_start_right_add(my_gl_mode_right, rdg)
    gl.callback_drag_start_left_add(my_gl_mode_left, rdg)
    gl.callback_drag_start_up_add(my_gl_mode_cancel, rdg)
    gl.callback_drag_start_down_add(my_gl_mode_cancel, rdg)
    gl.show()

    itc10 = ItemClass10(item_style="default", decorate_item_style="mode")
    itc10.state_get = gl_state_get

    for i in range(1000, 1050):
        GenlistItem(item_class=itc10,
            item_data=i,
            parent_item=None,
            flags=ELM_GENLIST_ITEM_NONE,
            func=gl_sel10,
            func_data=(i, rdg)
            ).append_to(gl)

    bx.pack_end(gl)

    win.size = 520, 520
    win.show()
def label_clicked(obj):
    win = StandardWindow("label", "Label test", autodel=True, size=(280, 400))
    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()

    lb = Label(win, "<b>This is a small label</b>", size_hint_align=(0.0, 0.5))
    vbox.pack_end(lb)
    lb.show()

    lb = Label(win, size_hint_align=(0.0, 0.5))
    lb.text = "This is a larger label with newlines<br/>" \
              "to make it bigger, bit it won't expand or wrap<br/>" \
              "just be a block of text that can't change its<br/>" \
              "formatting as it's fixed based on text<br/>"
    vbox.pack_end(lb)
    lb.show()

    lb = Label(win,
               line_wrap=ELM_WRAP_CHAR,
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_BOTH)
    lb.text =  "<b>This is more text designed to line-wrap here as " \
               "This object is resized horizontally. As it is " \
               "resized vertically though, nothing should change. " \
               "The amount of space allocated vertically should " \
               "change as horizontal size changes.</b>"
    vbox.pack_end(lb)
    lb.show()

    lb = Label(win,
               text="This small label set to wrap",
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_BOTH)
    vbox.pack_end(lb)
    lb.show()

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

    gd = Grid(win,
              size=(100, 100),
              size_hint_weight=EXPAND_BOTH,
              size_hint_align=FILL_BOTH)
    vbox.pack_end(gd)
    gd.show()

    lb = Label(win, text="Test Label Ellipsis:", size_hint_align=(0.0, 0.5))
    gd.pack(lb, 5, 5, 90, 15)
    lb.show()

    rect = Rectangle(win.evas, color=(255, 125, 125, 255))
    gd.pack(rect, 5, 15, 90, 15)
    rect.show()

    lb = Label(win, ellipsis=True, size_hint_align=(0.0, 0.5))
    lb.text = "This is a label set to ellipsis. " \
              "If set ellipsis to true and the text doesn't fit " \
              "in the label an ellipsis(\"...\") will be shown " \
              "at the end of the widget."
    gd.pack(lb, 5, 15, 90, 15)
    lb.show()

    lb = Label(win, text="Test Label Slide:", size_hint_align=(0.0, 0.5))
    gd.pack(lb, 5, 30, 90, 15)
    lb.show()

    rect = Rectangle(win.evas, color=(255, 125, 125, 255))
    gd.pack(rect, 5, 40, 90, 15)
    rect.show()

    lb = Label(win,
               slide_mode=ELM_LABEL_SLIDE_MODE_AUTO,
               style="slide_short",
               size_hint_align=(0.0, 0.5),
               slide_duration=15)
    lb.text = "This is a label set to slide. " \
              "If set slide to true the text of the label " \
              "will slide/scroll through the length of label." \
              "This only works with the themes \"slide_short\", " \
              "\"slide_long\" and \"slide_bounce\"."
    gd.pack(lb, 5, 40, 90, 15)
    lb.show()

    rd = Radio(win, state_value=1, text="slide_short")
    gd.pack(rd, 5, 55, 30, 15)
    rd.callback_changed_add(cb_slide_radio, lb)
    rd.show()
    rdg = rd

    rd = Radio(win, state_value=2, text="slide_long")
    rd.group_add(rdg)
    gd.pack(rd, 35, 55, 30, 15)
    rd.callback_changed_add(cb_slide_radio, lb)
    rd.show()

    rd = Radio(win, state_value=3, text="slide_bounce")
    rd.group_add(rdg)
    gd.pack(rd, 65, 55, 30, 15)
    rd.callback_changed_add(cb_slide_radio, lb)
    rd.show()

    sl_dur = Slider(win,
                    text="Slide Duration",
                    unit_format="%1.1f secs",
                    min_max=(1, 40),
                    value=15,
                    size_hint_align=FILL_HORIZ,
                    size_hint_weight=EXPAND_HORIZ)
    sl_dur.callback_changed_add(cb_slider_duration, lb)
    gd.pack(sl_dur, 5, 70, 90, 15)
    sl_dur.show()

    sl_spd = Slider(win,
                    text="Slide Speed",
                    unit_format="%1.1f px/sec",
                    min_max=(10, 300),
                    value=10,
                    size_hint_align=FILL_HORIZ,
                    size_hint_weight=EXPAND_HORIZ)
    sl_spd.callback_changed_add(cb_slider_speed, lb)
    gd.pack(sl_spd, 5, 80, 90, 15)
    sl_spd.show()

    lb.data["slider_duration"] = sl_dur
    lb.data["slider_speed"] = sl_spd

    win.show()
예제 #6
0
파일: tags.py 프로젝트: druonysus/egitu
    def __init__(self, parent, app):
        self.app = app

        Popup.__init__(self, parent)
        self.part_text_set('title,text', 'Create tag')
        self.part_content_set('title,icon', Icon(self, standard='git-tag'))

        # main vertical box
        tb = Table(self, padding=(4,4),
                    size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        self.content = tb
        tb.show()

        # sep
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        tb.pack(sep, 0, 0, 2, 1)
        sep.show()

        # tag name
        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        en.part_text_set('guide', 'Type the tag name, ex: v1.15.0')
        en.callback_changed_user_add(self._something_changed_cb)
        tb.pack(en, 0, 1, 2, 1)
        en.show()
        self.name_entry  = en

        # annotated or light
        rdg = Radio(self, state_value=1, value=1, text='Annotated',
                    size_hint_expand=EXPAND_BOTH)
        rdg.callback_changed_add(self._annotated_radio_changed_cb)
        rdg.callback_changed_add(self._something_changed_cb)
        tb.pack(rdg, 0, 2, 1, 1)
        rdg.show()
        self.annotated_radio  = rdg

        rd = Radio(self, state_value=0, text='Lightweight',
                   size_hint_expand=EXPAND_BOTH)
        rd.callback_changed_add(self._annotated_radio_changed_cb)
        rd.callback_changed_add(self._something_changed_cb)
        rd.group_add(rdg)
        tb.pack(rd, 1, 2, 1, 1)
        rd.show()

        # message entry
        en = Entry(self, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        en.part_text_set('guide', 'Type a message for the tag')
        en.callback_changed_user_add(self._something_changed_cb)

        r = Rectangle(self.evas, size_hint_min=(200,150),
                      size_hint_expand=EXPAND_BOTH)
        tb.pack(r, 0, 3, 2, 1)
        tb.pack(en, 0, 3, 2, 1)
        en.show()
        self.msg_entry  = en

        # buttons
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        tb.pack(sep, 0, 4, 2, 1)
        sep.show()

        bt = Button(self, text='Cancel')
        bt.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', bt)
        bt.show()

        bt = Button(self, text='Create', disabled=True,
                    content=Icon(self, standard='git-tag'))
        bt.callback_clicked_add(self._create_clicked_cb)
        self.part_content_set('button2', bt)
        bt.show()
        self.create_btn = bt

        #
        self.name_entry.focus = True
        self.show()
def fileselector_clicked(obj, item=None):
    win = StandardWindow("fileselector",
                         "File selector test",
                         autodel=True,
                         size=(500, 500))

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

    fs = Fileselector(win,
                      is_save=True,
                      expandable=False,
                      folder_only=False,
                      path=os.getenv("HOME"),
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
    fs.callback_done_add(fs_cb_done, win)
    fs.callback_selected_add(fs_cb_selected, win)
    fs.callback_directory_open_add(fs_cb_directory_open, win)
    box1.pack_end(fs)
    fs.show()

    fs.custom_filter_append(custom_filter_all, filter_name="All Files")
    fs.custom_filter_append(custom_filter_edje, filter_name="Edje Files")
    fs.mime_types_filter_append(["text/*"], "Text Files")
    fs.mime_types_filter_append(["image/*"], "Image Files")

    sep = Separator(win)
    box1.pack_end(sep)
    sep.show()

    vbox = Box(win)
    box1.pack_end(vbox)
    vbox.show()

    # Options frame
    fr = Frame(win, text="Options")
    vbox.pack_end(fr)
    fr.show()

    fbox1 = Box(win)
    fr.content = fbox1
    fbox1.show()

    fbox2 = Box(win, horizontal=True)
    fbox1.pack_end(fbox2)
    fbox2.show()

    ck = Check(win, text="is_save", state=fs.is_save)
    ck.callback_changed_add(ck_cb_is_save, fs)
    fbox2.pack_end(ck)
    ck.show()

    ck = Check(win, text="folder_only", state=fs.folder_only)
    ck.callback_changed_add(ck_cb_folder_only, fs)
    fbox2.pack_end(ck)
    ck.show()

    ck = Check(win, text="expandable", state=fs.expandable)
    ck.callback_changed_add(ck_cb_expandable, fs)
    fbox2.pack_end(ck)
    ck.show()

    fbox2 = Box(win, horizontal=True)
    fbox1.pack_end(fbox2)
    fbox2.show()

    ck = Check(win, text="multiple selection", state=fs.multi_select)
    ck.callback_changed_add(ck_cb_multi_select, fs)
    fbox2.pack_end(ck)
    ck.show()

    ck = Check(win, text="buttons", state=fs.buttons_ok_cancel)
    ck.callback_changed_add(ck_cb_buttons, fs)
    fbox2.pack_end(ck)
    ck.show()

    ck = Check(win, text="hidden", state=fs.hidden_visible)
    ck.callback_changed_add(ck_cb_hidden, fs)
    fbox2.pack_end(ck)
    ck.show()

    # Getters frame
    fr = Frame(win, text="Getters", size_hint_align=FILL_BOTH)
    vbox.pack_end(fr)
    fr.show()

    fbox = Box(win, horizontal=True)
    fr.content = fbox
    fbox.show()

    bt = Button(win, text="selected_get")
    bt.callback_clicked_add(bt_cb_sel_get, fs)
    fbox.pack_end(bt)
    bt.show()

    bt = Button(win, text="path_get")
    bt.callback_clicked_add(bt_cb_path_get, fs)
    fbox.pack_end(bt)
    bt.show()

    bt = Button(win, text="selected_paths")
    bt.callback_clicked_add(bt_cb_paths_get, fs)
    fbox.pack_end(bt)
    bt.show()

    # Mode frame
    fr = Frame(win, text="Mode", size_hint_align=FILL_BOTH)
    vbox.pack_end(fr)
    fr.show()

    fbox = Box(win, horizontal=True)
    fr.content = fbox
    fbox.show()

    rdg = rd = Radio(win, text="List", state_value=ELM_FILESELECTOR_LIST)
    rd.callback_changed_add(rd_cb_mode, fs)
    fbox.pack_end(rd)
    rd.show()

    rd = Radio(win, text="Grid", state_value=ELM_FILESELECTOR_GRID)
    rd.callback_changed_add(rd_cb_mode, fs)
    rd.group_add(rdg)
    fbox.pack_end(rd)
    rd.show()

    # Thumbsize frame
    fr = Frame(win, text="Thumbnail size", size_hint_align=FILL_BOTH)
    vbox.pack_end(fr)
    fr.show()

    sl = Slider(win,
                min_max=(4, 130),
                unit_format="%.0f px",
                value=fs.thumbnail_size[0])
    sl.callback_delay_changed_add(sl_cb_thumb_size, fs)
    fr.content = sl
    sl.show()

    # Sort method frame
    fr = Frame(win, text="Sort method", size_hint_align=FILL_BOTH)
    vbox.pack_end(fr)
    fr.show()

    hs = Hoversel(win, text="File name (asc)")
    sorts = (
        ("File name (asc)", ELM_FILESELECTOR_SORT_BY_FILENAME_ASC),
        ("File name (desc)", ELM_FILESELECTOR_SORT_BY_FILENAME_DESC),
        ("Type (asc)", ELM_FILESELECTOR_SORT_BY_TYPE_ASC),
        ("Type (desc)", ELM_FILESELECTOR_SORT_BY_TYPE_DESC),
        ("Size (asc)", ELM_FILESELECTOR_SORT_BY_SIZE_ASC),
        ("Size (desc)", ELM_FILESELECTOR_SORT_BY_SIZE_DESC),
        ("Modified time (asc)", ELM_FILESELECTOR_SORT_BY_MODIFIED_ASC),
        ("Modified time (desc)", ELM_FILESELECTOR_SORT_BY_MODIFIED_DESC),
    )
    for sort in sorts:
        hs.item_add(label=sort[0],
                    callback=hs_cb_sort_method,
                    fs=fs,
                    method=sort[1])
    fr.content = hs
    hs.show()

    win.show()
def fileselector_clicked(obj, item=None):
    win = StandardWindow("fileselector", "File selector test",
                         autodel=True, size=(500,500))

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

    fs = Fileselector(win, is_save=True, expandable=False, folder_only=False,
                      path=os.getenv("HOME"), size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
    fs.callback_done_add(fs_cb_done, win)
    fs.callback_selected_add(fs_cb_selected, win)
    fs.callback_directory_open_add(fs_cb_directory_open, win)
    box1.pack_end(fs)
    fs.show()

    fs.custom_filter_append(custom_filter_all, filter_name="All Files")
    fs.custom_filter_append(custom_filter_edje, filter_name="Edje Files")
    fs.mime_types_filter_append(["text/*"], "Text Files")
    fs.mime_types_filter_append(["image/*"], "Image Files")


    sep = Separator(win)
    box1.pack_end(sep)
    sep.show()

    vbox = Box(win)
    box1.pack_end(vbox)
    vbox.show()

    # Options frame
    fr = Frame(win, text="Options")
    vbox.pack_end(fr)
    fr.show()

    fbox1 = Box(win)
    fr.content = fbox1
    fbox1.show()

    fbox2 = Box(win, horizontal=True)
    fbox1.pack_end(fbox2)
    fbox2.show()

    ck = Check(win, text="is_save", state=fs.is_save)
    ck.callback_changed_add(ck_cb_is_save, fs)
    fbox2.pack_end(ck)
    ck.show()

    ck = Check(win, text="folder_only", state=fs.folder_only)
    ck.callback_changed_add(ck_cb_folder_only, fs)
    fbox2.pack_end(ck)
    ck.show()

    ck = Check(win, text="expandable", state=fs.expandable)
    ck.callback_changed_add(ck_cb_expandable, fs)
    fbox2.pack_end(ck)
    ck.show()

    fbox2 = Box(win, horizontal=True)
    fbox1.pack_end(fbox2)
    fbox2.show()

    ck = Check(win, text="multiple selection", state=fs. multi_select)
    ck.callback_changed_add(ck_cb_multi_select, fs)
    fbox2.pack_end(ck)
    ck.show()

    ck = Check(win, text="buttons", state=fs.buttons_ok_cancel)
    ck.callback_changed_add(ck_cb_buttons, fs)
    fbox2.pack_end(ck)
    ck.show()

    ck = Check(win, text="hidden", state=fs.hidden_visible)
    ck.callback_changed_add(ck_cb_hidden, fs)
    fbox2.pack_end(ck)
    ck.show()

    # Getters frame
    fr = Frame(win, text="Getters", size_hint_align=FILL_BOTH)
    vbox.pack_end(fr)
    fr.show()

    fbox = Box(win, horizontal=True)
    fr.content = fbox
    fbox.show()

    bt = Button(win, text="selected_get")
    bt.callback_clicked_add(bt_cb_sel_get, fs)
    fbox.pack_end(bt)
    bt.show()

    bt = Button(win, text="path_get")
    bt.callback_clicked_add(bt_cb_path_get, fs)
    fbox.pack_end(bt)
    bt.show()

    bt = Button(win, text="selected_paths")
    bt.callback_clicked_add(bt_cb_paths_get, fs)
    fbox.pack_end(bt)
    bt.show()

    # Mode frame
    fr = Frame(win, text="Mode", size_hint_align=FILL_BOTH)
    vbox.pack_end(fr)
    fr.show()

    fbox = Box(win, horizontal=True)
    fr.content = fbox
    fbox.show()

    rdg = rd = Radio(win, text="List", state_value=ELM_FILESELECTOR_LIST)
    rd.callback_changed_add(rd_cb_mode, fs)
    fbox.pack_end(rd)
    rd.show()

    rd = Radio(win, text="Grid", state_value=ELM_FILESELECTOR_GRID)
    rd.callback_changed_add(rd_cb_mode, fs)
    rd.group_add(rdg)
    fbox.pack_end(rd)
    rd.show()

    # Thumbsize frame
    fr = Frame(win, text="Thumbnail size", size_hint_align=FILL_BOTH)
    vbox.pack_end(fr)
    fr.show()

    sl = Slider(win, min_max=(4, 130), unit_format="%.0f px",
                value=fs.thumbnail_size[0])
    sl.callback_delay_changed_add(sl_cb_thumb_size, fs)
    fr.content = sl
    sl.show()

    # Sort method frame
    fr = Frame(win, text="Sort method", size_hint_align=FILL_BOTH)
    vbox.pack_end(fr)
    fr.show()

    hs = Hoversel(win, text="File name (asc)")
    sorts = (
        ("File name (asc)", ELM_FILESELECTOR_SORT_BY_FILENAME_ASC),
        ("File name (desc)", ELM_FILESELECTOR_SORT_BY_FILENAME_DESC),
        ("Type (asc)", ELM_FILESELECTOR_SORT_BY_TYPE_ASC),
        ("Type (desc)", ELM_FILESELECTOR_SORT_BY_TYPE_DESC),
        ("Size (asc)", ELM_FILESELECTOR_SORT_BY_SIZE_ASC),
        ("Size (desc)", ELM_FILESELECTOR_SORT_BY_SIZE_DESC),
        ("Modified time (asc)", ELM_FILESELECTOR_SORT_BY_MODIFIED_ASC),
        ("Modified time (desc)", ELM_FILESELECTOR_SORT_BY_MODIFIED_DESC),
    )
    for sort in sorts:
        hs.item_add(label=sort[0], callback=hs_cb_sort_method, fs=fs, method=sort[1])
    fr.content = hs
    hs.show()

    win.show()
예제 #9
0
def radio_clicked(obj):
    win = StandardWindow("radio", "Radio test", autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

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

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

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

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

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

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

    rdg.value = 2

    win.show()
예제 #10
0
def radio_clicked(obj):
    win = StandardWindow("radio", "Radio test", autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

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

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

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

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

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

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

    rdg.value = 2

    win.show()
예제 #11
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()
예제 #12
0
파일: branches.py 프로젝트: DaveMDS/egitu
    def __init__(self, parent, app, branch=None):
        self.app = app

        Popup.__init__(self, parent)
        self.part_text_set('title,text', 'Create a new local branch')
        self.part_content_set('title,icon', SafeIcon(self, 'git-branch'))

        # main table
        tb = Table(self, padding=(4,4),
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        self.content = tb
        tb.show()

        # sep
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        tb.pack(sep, 0, 0, 2, 1)
        sep.show()

        # branch name
        lb = Label(self, text='Branch name', size_hint_align=(0.0, 0.5))
        tb.pack(lb, 0, 1, 1, 1)
        lb.show()

        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        tb.pack(en, 1, 1, 1, 1)
        en.show()
        self.name_entry = en

        # branch type
        lb = Label(self, text='Branch type', size_hint_align=(0.0, 0.5))
        tb.pack(lb, 0, 2, 1, 1)
        lb.show()

        hbox = Box(self, horizontal=True, padding=(6,0),
                   size_hint_expand=EXPAND_BOTH, size_hint_align=(0.0, 0.5))
        tb.pack(hbox, 1, 2, 1, 1)
        hbox.show()

        rdg = Radio(self, state_value=0, text='Local branch')
        rdg.callback_changed_add(self._type_radio_changed_cb)
        hbox.pack_end(rdg)
        rdg.show()

        rd = Radio(self, state_value=1, text='Tracking branch')
        rd.callback_changed_add(self._type_radio_changed_cb)
        rd.group_add(rdg)
        hbox.pack_end(rd)
        rd.show()

        self.type_radio = rdg

        # starting revision
        fr = Frame(self, text='Starting revision',
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        tb.pack(fr, 0, 3, 2, 1)
        fr.show()

        r = Rectangle(self.evas, size_hint_min=(300,200),
                      size_hint_expand=EXPAND_BOTH)
        tb.pack(r, 0, 3, 2, 1)

        # TODO: use genlist to speedup population
        self.itc = GenlistItemClass(item_style='one_icon',
                                    text_get_func=self._gl_text_get,
                                    content_get_func=self._gl_content_get)
        li = Genlist(self, homogeneous=True,
                     size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        li.callback_selected_add(self._revision_selected_cb)
        fr.content = li
        li.show()
        self.rev_list = li

        # sep
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        tb.pack(sep, 0, 4, 2, 1)
        sep.show()

        # buttons
        hbox = Box(self, horizontal=True,
                   size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH)
        tb.pack(hbox, 0, 5, 2, 1)
        hbox.show()

        bt = Button(self, text='Close')
        bt.callback_clicked_add(lambda b: self.delete())
        hbox.pack_end(bt)
        bt.show()

        sep = Separator(self, size_hint_expand=EXPAND_HORIZ)
        hbox.pack_end(sep)

        bt = Button(self, text='Create')
        bt.callback_clicked_add(self._create_clicked_cb)
        hbox.pack_end(bt)
        bt.show()

        # populate the revision list and show the popup
        self.populate()
        self.show()
        self.name_entry.focus = True
예제 #13
0
파일: branches.py 프로젝트: DaveMDS/egitu
    def __init__(self, parent, app, branch):
        self.app = app
        self.branch = branch

        Popup.__init__(self, parent)
        self.part_text_set('title,text', 'Merge branch')
        self.part_content_set('title,icon', SafeIcon(self, 'git-merge'))

        box = Box(self)
        self.content = box
        box.show()

        # sep
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        box.pack_end(sep)
        sep.show()

        # info entry
        text = 'We are going to merge branch:<br><hilight>%s</hilight><br><br>' \
               'into current branch:<br><hilight>%s</hilight><br><br>' \
               '<info>Note:</info> No commit will be performed, ' \
               'you will need to manually commit after the merge.' % \
                (self.branch, app.repo.status.current_branch.name)
        if not app.repo.status.is_clean:
            text += '<br><br><warning>Warning:</warning> The current status is not clean, ' \
                    'I suggested to only merge in a clean status, or you can make a mess.'
        en = Entry(self, editable=False, text=text,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        box.pack_end(en)
        en.show()

        # fast forward ?
        rdg = Radio(self, state_value=0, text='Fast Forward when possible',
                    size_hint_align=(0.0, 0.5))
        box.pack_end(rdg)
        rdg.show()
        self.ff_rdg = rdg

        rd = Radio(self, state_value=1, text='Never Fast Forward',
                   size_hint_align=(0.0, 0.5))
        rd.group_add(rdg)
        box.pack_end(rd)
        rd.show()

        rd = Radio(self, state_value=2, text='Fast Forward Only',
                   size_hint_align=(0.0, 0.5))
        rd.group_add(rdg)
        box.pack_end(rd)
        rd.show()

        # sep
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        box.pack_end(sep)
        sep.show()

        # buttons
        bt = Button(self, text='Close')
        bt.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', bt)
        bt.show()

        ic = SafeIcon(self, 'git-merge')
        bt = Button(self, text='Merge', content=ic)
        bt.callback_clicked_add(self._merge_clicked_cb)
        self.part_content_set('button2', bt)
        bt.show()

        #
        self.show()