Exemplo n.º 1
0
def box_layout_clicked(obj, item=None):
    win = elementary.Window("box-layout", elementary.ELM_WIN_BASIC)
    win.title_set("Box Layout")
    win.autodel_set(True)

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    vbox = elementary.Box(win)
    win.resize_object_add(vbox)
    vbox.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.show()

    bx = elementary.Box(win)
    bx.layout_set(elementary.ELM_BOX_LAYOUT_HORIZONTAL)
    bx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.pack_end(bx)
    bx.show()

    sep = elementary.Separator(win)
    sep.horizontal_set(True)
    vbox.pack_end(sep)
    sep.show()

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

    for i in range(5):
        ic = elementary.Icon(win)
        ic.file_set("images/logo_small.png")
        ic.resizable_set(0, 0)
        ic.size_hint_align_set(0.5, 0.5)
        bx.pack_end(ic)
        ic.show()

    ic = elementary.Icon(win)
    ic.file_set("images/logo_small.png")
    ic.resizable_set(0, 0)
    ic.size_hint_align_set(1.0, 1.0)
    bx.pack_end(ic)
    ic.show()

    ic = elementary.Icon(win)
    ic.file_set("images/logo_small.png")
    ic.resizable_set(0, 0)
    ic.size_hint_align_set(0.0, 0.0)
    bx.pack_end(ic)
    ic.show()

    win.show()
Exemplo n.º 2
0
    def _actions_init(self):
        sp = elementary.Separator(self)
        sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
        sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
        sp.size_hint_min_set(600, 1)
        sp.horizontal_set(True)
        self.pack(sp, 0, 4, 4, 1)
        sp.show()

        self._actions = elementary.Box(self)
        self._actions.horizontal_set(True)
        self._actions.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
        self._actions.size_hint_align_set(1.0, evas.EVAS_HINT_FILL)
        self.pack(self._actions, 3, 5, 1, 1)
        self._actions.show()
Exemplo n.º 3
0
    def _navigator_init(self):
        bx = elementary.Box(self)
        bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
        bx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
        self.pack(bx, 0, 0, 1, 4)
        bx.show()

        self._nav_home = elementary.Button(self)
        self._nav_home.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
        self._nav_home.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
        self._nav_home.text_set("Home")
        ic = elementary.Icon(self)
        ic.standard_set("home")
        ic.resizable_set(0, 0)
        self._nav_home.content_set(ic)
        self._nav_home.callback_clicked_add(self._home_load)
        bx.pack_end(self._nav_home)
        self._nav_home.show()

        sp = elementary.Separator(self)
        sp.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
        sp.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
        sp.horizontal_set(True)
        bx.pack_end(sp)
        sp.show()

        self._nav_up = elementary.Button(self)
        self._nav_up.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
        self._nav_up.size_hint_align_set(evas.EVAS_HINT_FILL, 0.0)
        self._nav_up.text_set("Up")
        ic = elementary.Icon(self)
        ic.standard_set("arrow_up")
        ic.resizable_set(0, 0)
        self._nav_up.content_set(ic)
        self._nav_up.callback_clicked_add(self._parent_load)
        bx.pack_end(self._nav_up)
        self._nav_up.show()

        self._directories = elementary.List(self)
        self._directories.size_hint_align_set(evas.EVAS_HINT_FILL,
                                              evas.EVAS_HINT_FILL)
        self._directories.size_hint_weight_set(evas.EVAS_HINT_EXPAND,
                                               evas.EVAS_HINT_EXPAND)
        self._directories.callback_selected_add(self._folder_change)
        bx.pack_end(self._directories)
        self._directories.show()
Exemplo n.º 4
0
def index_clicked(obj):
    win = elementary.Window("index", elementary.ELM_WIN_BASIC)
    win.title_set("Index test")
    win.autodel_set(True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    vbox = elementary.Box(win)
    vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    win.resize_object_add(vbox)
    vbox.show()

    # index
    idx = elementary.Index(win)
    idx.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    idx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    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 = elementary.GenlistItemClass(item_style="default",
                                      text_get_func=gl_text_get)
    # content_get_func=gl_content_get,
    # state_get_func=gl_state_get)
    gl = elementary.Genlist(win)
    gl.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    gl.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    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)

                # TODO This is broken (data assignment to ItemObject)
                # ...for now just bringin on select
                # idx_item.data["gl_item"] = gl_item

    idx.level_go(0)

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

    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

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

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

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

    win.resize(320, 480)
    win.show()
Exemplo n.º 5
0
def separator_clicked(obj):
    win = elementary.Window("separators", elementary.ELM_WIN_BASIC)
    win.title_set("Separators")
    win.autodel_set(True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    bx0 = elementary.Box(win)
    bx0.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bx0.horizontal_set(True)
    win.resize_object_add(bx0)
    bx0.show()

    bx = elementary.Box(win)
    bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bx0.pack_end(bx)
    bx.show()

    bt = elementary.Button(win)
    bt.text_set("Left upper corner")
    bx.pack_end(bt)
    bt.show()

    sp = elementary.Separator(win)
    sp.horizontal_set(True)
    bx.pack_end(sp)
    sp.show()

    bt = elementary.Button(win)
    bt.text_set("Left lower corner")
    bt.disabled_set(True)
    bx.pack_end(bt)
    bt.show()

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

    bx = elementary.Box(win)
    bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bx0.pack_end(bx)
    bx.show()

    bt = elementary.Button(win)
    bt.text_set("Right upper corner")
    bt.disabled_set(True)
    bx.pack_end(bt)
    bt.show()

    sp = elementary.Separator(win)
    sp.horizontal_set(True)
    bx.pack_end(sp)
    sp.show()

    bt = elementary.Button(win)
    bt.text_set("Right lower corner")
    bx.pack_end(bt)
    bt.show()

    win.show()
Exemplo n.º 6
0
def label_clicked(obj):
    win = elementary.Window("label", elementary.ELM_WIN_BASIC)
    win.title = "Label test"
    win.autodel = True
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    vbox = elementary.Box(win)
    vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    win.resize_object_add(vbox)
    vbox.show()

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

    lb = elementary.Label(win)
    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/>"
    lb.size_hint_align = (0.0, 0.5)
    vbox.pack_end(lb)
    lb.show()

    lb = elementary.Label(win)
    lb.line_wrap_set(elementary.ELM_WRAP_CHAR)
    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>"
    lb.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    lb.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    vbox.pack_end(lb)
    lb.show()

    lb = elementary.Label(win)
    lb.text = "This small label set to wrap"
    lb.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    lb.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    vbox.pack_end(lb)
    lb.show()

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

    gd = elementary.Grid(win)
    gd.size = (100, 100)
    gd.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    gd.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    vbox.pack_end(gd)
    gd.show()

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

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

    lb = elementary.Label(win)
    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."
    lb.ellipsis = True
    lb.size_hint_align = (0.0, 0.5)
    gd.pack(lb, 5, 15, 90, 15)
    lb.show()

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

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

    lb = elementary.Label(win)
    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\"."
    lb.slide = True
    lb.style = ("slide_short")
    lb.size_hint_align = (0.0, 0.5)
    gd.pack(lb, 5, 50, 90, 15)
    lb.show()

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

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

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

    sl = elementary.Slider(win)
    sl.text = "Slide Duration"
    sl.unit_format = "%1.1f units"
    sl.min_max = (1, 20)
    sl.value = 10
    sl.size_hint_align = (evas.EVAS_HINT_FILL, 0.5)
    sl.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    sl.callback_changed_add(cb_slider_duration, lb)
    gd.pack(sl, 5, 80, 90, 15)
    sl.show()

    win.resize(280, 400)
    win.show()
Exemplo n.º 7
0
def notify_show(bt, win, orient):

    notify = elementary.Notify(win)
    notify.repeat_events_set(False)
    notify.orient_set(elementary.ELM_NOTIFY_ORIENT_CENTER)

    frame = elementary.Frame(win)
    frame.label_set("Graphiques")
    frame.show()

    notify.content_set(frame)

#    tb = elementary.Table(win)
    #tb.homogenous_set(True)
#    tb.show()
#    frame.content_set(tb)

    vbox = elementary.Box(win)
    vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.show()
    frame.content_set(vbox)

    hbox = elementary.Box(win)
    hbox.horizontal_set(True)
    hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    hbox.show()

    frame_data = elementary.Frame(win)
    frame_data.label_set("Données")
    frame_data.show()
    table_data = elementary.Table(win)
    table_data.show()
    frame_data.content_set(table_data)

    x_1 = 0
    y_1 = 0
    for log in LogType.objects.filter(id__gt=8).exclude(nom="maj_stats"):
        check = elementary.Check(win)
        check.label_set(log.description)
        check.callback_changed_add(add_check)
        check.show()
        table_data.pack(check, x_1, y_1, 1, 1)
        if x_1 > 2:
            x_1 = 0
            y_1 += 1
        else:
            x_1 += 1

    frame_type = elementary.Frame(win)
    frame_type.label_set("Type")
    frame_type.show()
    table_type = elementary.Table(win)
    table_type.show()
    frame_type.content_set(table_type)

    rd = elementary.Radio(win)
    rd.state_value_set(0)
    rd.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    rd.size_hint_align_set(evas.EVAS_HINT_FILL, 0.5)
    rd.label_set("entier")
    table_type.pack(rd, 0, 0, 1, 1)
    rd.show()
    rdg = rd

    rd = elementary.Radio(win)
    rd.state_value_set(1)
    rd.label_set("par mois")
    rd.group_add(rdg)
    table_type.pack(rd, 0, 1, 1, 1)
    rd.show()

    rd = elementary.Radio(win)
    rd.state_value_set(2)
    rd.group_add(rdg)
    rd.label_set("par semaine")
    table_type.pack(rd, 1, 0, 1, 1)
    rd.show()

    rd = elementary.Radio(win)
    rd.state_value_set(3)
    rd.group_add(rdg)
    rd.label_set("par année")
    table_type.pack(rd, 1, 1, 1, 1)
    rd.show()

    toggle = elementary.Toggle(win)
    toggle.label_set("Légende")
    toggle.states_labels_set("avec", "sans")
    toggle.show()
    toggle.state_set(True)
    table_type.pack(toggle, 0, 2, 2, 1)

    frame_interval = elementary.Frame(win)
    frame_interval.label_set("Interval")
    frame_interval.show()
    table_interval = elementary.Table(win)
    table_interval.show()
    frame_interval.content_set(table_interval)

    label = elementary.Label(win)
    label.label_set("Début:")
    label.show()
    table_interval.pack(label, 0, 0, 1, 1)

    button = elementary.Button(win)
    button.label_set("31")
    button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
    button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    button.show()
    table_interval.pack(button, 1, 0, 1, 1)

    button = elementary.Button(win)
    button.label_set("Janvier")
    button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
    button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    button.show()
    table_interval.pack(button, 2, 0, 1, 1)

    button = elementary.Button(win)
    button.label_set("2011")
    button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
    button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    button.show()
    table_interval.pack(button, 3, 0, 1, 1)

    label = elementary.Label(win)
    label.label_set("Fin:")
    label.show()
    table_interval.pack(label, 0, 1, 1, 1)

    button = elementary.Button(win)
    button.label_set("31")
    button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
    button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    button.show()
    table_interval.pack(button, 1, 1, 1, 1)

    button = elementary.Button(win)
    button.label_set("Décembre")
    button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
    button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    button.show()
    table_interval.pack(button, 2, 1, 1, 1)

    button = elementary.Button(win)
    button.label_set("2011")
    button.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
    button.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    button.show()
    table_interval.pack(button, 3, 1, 1, 1)

    bt = elementary.Button(win)
    bt.label_set("Afficher")
    bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
    bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    bt.show()
    table_interval.pack(bt, 0, 2, 4, 1)

    hbox.pack_end(frame_data)
    hbox.pack_end(frame_type)
    hbox.pack_end(frame_interval)
    #tb.pack(frame_data, 0, 0, 3, 3)
    #tb.pack(frame_type, 3, 0, 2, 3)
    #tb.pack(frame_interval, 5, 0, 2, 3)

    vbox.pack_end(hbox)

#    frame_image = elementary.Frame(win)
#    frame_image.label_set("Interval")
#    frame_image.show()
#    table_interval = elementary.Table(win)
#    table_interval.show()
#    frame_interval.content_set(table_interval)

#    box_image = elementary.Box(win)
#    box_image.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
#    box_image.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    #win.resize_object_add(box0)
#    box_image.show()
#    frame_image.content_set(box_image)

#    bg = elementary.Background(win)
#    #frame_image.resize_object_add(bg)
#    bg.file_set("/tmp/ca_par_jour.png")
#    bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
#    bg.show()
#    frame_image.content_set(bg)

    image = elementary.Image(win)
#    #image.size_set(300, 500)
    #image.resize(600, 400)
    image.file_set("ca_par_jour.png")
#    #image.size_hint_aspect_set(evas.EVAS_ASPECT_CONTROL_BOTH, 1, 1)
    image.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    image.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
#    #icon.scale_set(0, 0)
#    #win.resize_object_add(icon)
#    tb.pack(image, 0, 3, 7, 3)
    image.show()
    vbox.pack_end(image)
#    box_image.pack_end(image)

    #tb.pack(box_image, 0, 3, 7, 3)

    sp = elementary.Separator(win)
    sp.horizontal_set(True)
    sp.show()
    #tb.pack(sp, 0, 6, 7, 1)
    vbox.pack_end(sp)

    bt = elementary.Button(win)
    bt.label_set("Retour")
    bt.callback_clicked_add(notify_close, notify)
    bt.size_hint_weight_set(evas.EVAS_HINT_EXPAND, 0.0)
    bt.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    bt.show()
    #tb.pack(bt, 0, 7, 7, 1)
    vbox.pack_end(bt)

    notify.show()
Exemplo n.º 8
0
def fileselector_clicked(obj, item=None):
    win = elementary.Window("fileselector", elementary.ELM_WIN_BASIC)
    win.title_set("File selector test")
    win.autodel_set(True)

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    vbox = elementary.Box(win)
    win.resize_object_add(vbox)
    vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.show()

    fs = elementary.Fileselector(win)
    fs.is_save_set(True)
    fs.expandable_set(False)
    fs.folder_only_set(False)
    fs.path_set(os.getenv("HOME"))
    fs.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    fs.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    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)
    vbox.pack_end(fs)
    fs.show()

    sep = elementary.Separator(win)
    sep.horizontal_set(True)
    vbox.pack_end(sep)
    sep.show()

    hbox = elementary.Box(win)
    hbox.horizontal_set(True)
    vbox.pack_end(hbox)
    hbox.show()

    ck = elementary.Check(win)
    ck.text_set("is_save")
    ck.state_set(fs.is_save)
    ck.callback_changed_add(ck_cb_is_save, fs)
    hbox.pack_end(ck)
    ck.show()

    ck = elementary.Check(win)
    ck.text_set("folder_only")
    ck.state_set(fs.folder_only)
    ck.callback_changed_add(ck_cb_folder_only, fs)
    hbox.pack_end(ck)
    ck.show()

    ck = elementary.Check(win)
    ck.text_set("expandable")
    ck.state_set(fs.expandable)
    ck.callback_changed_add(ck_cb_expandable, fs)
    hbox.pack_end(ck)
    ck.show()

    ck = elementary.Check(win)
    ck.text_set("buttons")
    ck.state_set(fs.buttons_ok_cancel)
    ck.callback_changed_add(ck_cb_buttons, fs)
    hbox.pack_end(ck)
    ck.show()

    hbox = elementary.Box(win)
    hbox.horizontal_set(True)
    vbox.pack_end(hbox)
    hbox.show()

    bt = elementary.Button(win)
    bt.text_set("selected_get")
    bt.callback_clicked_add(bt_cb_sel_get, fs)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text_set("path_get")
    bt.callback_clicked_add(bt_cb_path_get, fs)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text_set("mode cycle")
    bt.callback_clicked_add(bt_cb_mode_cycle, fs)
    hbox.pack_end(bt)
    bt.show()

    win.resize(240, 350)
    win.show()
Exemplo n.º 9
0
def fileselector_entry_clicked(obj, item=None):
    win = elementary.Window("fileselector", elementary.ELM_WIN_BASIC)
    win.title_set("File selector test")
    win.autodel_set(True)

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    vbox = elementary.Box(win)
    win.resize_object_add(vbox)
    vbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.show()

    fse = elementary.FileselectorEntry(win)
    fse.text_set("Select a file")
    fse.inwin_mode_set(False)
    fse.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    fse.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.pack_end(fse)
    fse.show()

    sep = elementary.Separator(win)
    sep.horizontal_set(True)
    vbox.pack_end(sep)
    sep.show()

    hbox = elementary.Box(win)
    hbox.horizontal_set(True)
    hbox.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.pack_end(hbox)
    hbox.show()

    ck = elementary.Check(win)
    ck.text_set("inwin")
    ck.state_set(fse.inwin_mode)
    ck.callback_changed_add(ck_entry_cb_inwin, fse)
    hbox.pack_end(ck)
    ck.show()

    ck = elementary.Check(win)
    ck.text_set("folder_only")
    ck.state_set(fse.folder_only)
    ck.callback_changed_add(ck_entry_cb_folder_only, fse)
    hbox.pack_end(ck)
    ck.show()

    ck = elementary.Check(win)
    ck.text_set("is_save")
    ck.state_set(fse.is_save)
    ck.callback_changed_add(ck_entry_cb_is_save, fse)
    hbox.pack_end(ck)
    ck.show()

    ck = elementary.Check(win)
    ck.text_set("expandable")
    ck.state_set(fse.expandable)
    ck.callback_changed_add(ck_entry_cb_expandable, fse)
    hbox.pack_end(ck)
    ck.show()

    win.resize(240, 150)
    win.show()
Exemplo n.º 10
0
def map_route_clicked(obj):
    win = elementary.Window("maproute", elementary.ELM_WIN_BASIC)
    win.title = "Map Route test"
    win.autodel = True
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    bg = elementary.Background(win)
    win.resize_object_add(bg)
    bg.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    bg.show()

    vbox = elementary.Box(win)
    vbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    vbox.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    win.resize_object_add(vbox)
    vbox.show()

    Map = elementary.Map(win)
    Map.zoom = 2
    Map.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    Map.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    Map.callback_clicked_add(cb_map_clicked)
    Map.callback_tile_load_add(cb_map_load)
    Map.callback_tile_loaded_add(cb_map_load)
    vbox.pack_end(Map)
    Map.show()

    lb = elementary.Label(win)
    lb.text = "load_status: 0 / 0"
    vbox.pack_end(lb)
    lb.show()
    Map.data["lb_load_status"] = lb

    lb = elementary.Label(win)
    lb.text = "First set Start and End point and then click 'Calc Route !'"
    vbox.pack_end(lb)
    lb.show()
    Map.data["lb_distance"] = lb

    # info
    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

    # route
    ho = elementary.Hoversel(win)
    ho.hover_parent_set(win)
    type = elementary.ELM_MAP_SOURCE_TYPE_ROUTE
    ho.text_set("Routes: %s" % (Map.source_get(type)))
    for src in Map.sources_get(type):
        ho.item_add(src)
    ho.callback_selected_add(cb_hovsel_selected, Map, type, "Routes")
    hbox.pack_end(ho)
    ho.show()

    sep = elementary.Separator(win)
    sep.show()
    hbox.pack_end(sep)

    bt = elementary.Button(win)
    bt.text = "GOTO"
    bt.callback_clicked_add(cb_btn_goto, Map)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text = "Calc Route !"
    bt.callback_clicked_add(cb_btn_calc_route, Map)
    hbox.pack_end(bt)
    bt.show()

    bt = elementary.Button(win)
    bt.text = "clear route overlays"
    bt.callback_clicked_add(cb_btn_clear_overlays, Map)
    hbox.pack_end(bt)
    bt.show()

    # names
    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

    ho = elementary.Hoversel(win)
    ho.hover_parent_set(win)
    type = elementary.ELM_MAP_SOURCE_TYPE_NAME
    ho.text_set("Names: %s" % (Map.source_get(type)))
    for src in Map.sources_get(type):
        ho.item_add(src)
    ho.callback_selected_add(cb_hovsel_selected, Map, type, "Names")
    hbox.pack_end(ho)
    ho.show()

    en = elementary.Entry(win)
    en.scrollable = True
    en.single_line = True
    en.text = "type an address here"
    en.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    en.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    hbox.pack_end(en)
    en.show()

    bt = elementary.Button(win)
    bt.text = "Search Address !"
    bt.callback_clicked_add(cb_btn_search_name, Map, en)
    hbox.pack_end(bt)
    bt.show()

    hbox = elementary.Box(win)
    hbox.horizontal = True
    hbox.size_hint_weight = (evas.EVAS_HINT_EXPAND, 0.0)
    hbox.size_hint_align = (evas.EVAS_HINT_FILL, 0.0)
    vbox.pack_end(hbox)
    hbox.show()

    en = elementary.Entry(win)
    en.scrollable = True
    en.single_line = True
    en.disabled = True
    en.text = "place the start point and press the button"
    en.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
    en.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
    hbox.pack_end(en)
    en.show()

    bt = elementary.Button(win)
    bt.text = "Search start point Region"
    bt.callback_clicked_add(cb_btn_search_region, Map, en)
    hbox.pack_start(bt)
    bt.show()

    win.resize(600, 600)
    win.show()