Exemple #1
0
 def buildSubs(self):
     self.subWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300))
     self.subWin.title = "Life Tracker Assignment"
     bg = Background(self.subWin, size_hint_weight=EXPAND_BOTH)
     bg.show()
     self.subWin.resize_object_add(bg)
     self.subWin.callback_delete_request_add(lambda o: elm.exit())
     self.ourWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300))
     self.ourWin.title = "Life Tracker Key Strokes"
     bg = Background(self.ourWin, size_hint_weight=EXPAND_BOTH)
     bg.show()
     self.ourWin.resize_object_add(bg)
     self.ourWin.callback_delete_request_add(lambda o: elm.exit())
     self.ourWin.elm_event_callback_add(self.eventsCb)
     
     self.ourLife = ourLabel = Entry(self.ourWin, editable=False)
     ourLabel.size_hint_weight = EXPAND_BOTH
     ourLabel.size_hint_align = FILL_BOTH
     ourLabel.text_style_user_push("DEFAULT='font_size=20'")
     ourLabel.text = "Up and Down for Their Life, Left and Right for Mine"
     ourLabel.show()
     
     self.ourEntry = ourEntry = Entry(self.subWin)
     ourEntry.size_hint_weight = EXPAND_HORIZ
     ourEntry.size_hint_align = (-1, 0)
     ourEntry.single_line_set(True)
     ourEntry.text_style_user_push("DEFAULT='font_size=50'")
     ourEntry.callback_activated_add(self.ourLifeUpdate)
     ourEntry.text = "20"
     ourEntry.show()
     
     self.theirEntry = theirEntry = Entry(self.subWin)
     theirEntry.size_hint_weight = EXPAND_HORIZ
     theirEntry.size_hint_align = (-1, 0)
     theirEntry.single_line_set(True)
     theirEntry.text_style_user_push("DEFAULT='font_size=50'")
     theirEntry.callback_activated_add(self.theirLifeUpdate)
     theirEntry.text = "20"
     theirEntry.show()
     
     resetBtn = Button(self.subWin)
     resetBtn.text = "Reset life totals"
     resetBtn.callback_pressed_add(self.resetLifeTotals)
     resetBtn.show()
     
     entryBox = Box(self.subWin)
     entryBox.size_hint_weight = EXPAND_HORIZ
     entryBox.pack_end(ourEntry)
     entryBox.pack_end(theirEntry)
     entryBox.pack_end(resetBtn)
     entryBox.show()
     
     self.ourWin.resize_object_add(ourLabel)
     self.subWin.resize_object_add(entryBox)
     
     self.ourWin.show()
     self.subWin.show()
     
     self.ourWin.center(True, True)
     self.subWin.center(True, True)
def inlined_add(parent):
    win = Window("inlined",
                 ELM_WIN_INLINED_IMAGE,
                 parent,
                 pos=(10, 100),
                 size=(150, 70))

    bg = Background(win, color=(110, 210, 120), size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    bx = Box(win,
             size_hint_weight=EXPAND_HORIZ,
             size_hint_align=(EVAS_HINT_FILL, 0.0))
    bx.show()

    lb = LOG(win, "ELM_WIN_INLINED_IMAGE")
    bx.pack_end(lb)

    lb = LOG(win, "Profile: <b>N/A</b>")
    bx.pack_end(lb)
    win.data["lb"] = lb

    win.inlined_image_object.pos = 10, 100
    win.inlined_image_object.size = 150, 70

    win.callback_profile_changed_add(win_profile_changed_cb)
    win.show()

    return win
Exemple #3
0
    def __init__(self, done_cb):
        SCALE = elm_conf.scale

        super(Fs, self).__init__("fileselector",
                                 ELM_WIN_DIALOG_BASIC,
                                 title="Select file",
                                 size=(400 * SCALE, 400 * SCALE),
                                 autodel=True)

        bg = Background(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(bg)
        bg.show()

        fs = Fileselector(self,
                          size_hint_weight=EXPAND_BOTH,
                          size_hint_align=FILL_BOTH,
                          is_save=False,
                          expandable=False,
                          path=os.path.expanduser("~"))
        self.resize_object_add(fs)
        fs.mime_types_filter_append([
            "application/pdf",
        ], "pdf")
        fs.mime_types_filter_append([
            "*",
        ], "all")
        fs.callback_done_add(lambda x, y: done_cb(y))
        fs.callback_done_add(lambda x, y: self.delete())
        fs.show()
        self.show()
Exemple #4
0
    def __init__(self, title):

        elm_conf = Configuration()
        scale = elm_conf.scale

        Window.__init__(self, title, ELM_WIN_BASIC, title=title, autodel=True)

        self.size = scale * 480, scale * 320

        bg = Background(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(bg)
        bg.show()

        # bt = Button(self, text="Close")
        # bt.callback_clicked_add(lambda b: self.delete())

        self.scroller = Scroller(self,
                                 policy=SCROLL_BOTH,
                                 size_hint_weight=EXPAND_BOTH,
                                 size_hint_align=FILL_BOTH)
        self.resize_object_add(self.scroller)
        self.scroller.show()

        self.box = Box(self)
        self.box.size_hint_weight = EXPAND_BOTH
        self.scroller.content = self.box

        self.show()
def bg_plain_clicked(obj, item=None):
    win = Window("bg plain",
                 ELM_WIN_BASIC,
                 title="Bg Plain",
                 autodel=True,
                 size=(320, 320))

    bg = Background(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    win.show()
Exemple #6
0
    def __init__(self):
        StandardWindow.__init__(self, "efl-dbus-spy",
                                "EFL DBus Spy - Espionage")

        self.autodel_set(True)
        self.callback_delete_request_add(lambda o: elm.exit())

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

        box = Box(self)
        self.resize_object_add(box)
        box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
        box.show()

        flip = FlipSelector(self)
        flip.item_append("Session Bus", self.flip_selected_cb, session_bus)
        flip.item_append("System Bus", self.flip_selected_cb, system_bus)
        box.pack_end(flip)
        flip.show()

        panes = Panes(self)
        panes.size_hint_weight = (evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND)
        panes.size_hint_align = (evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL)
        # panes.content_left_size = 0.333
        # panes.fixed = True
        box.pack_end(panes)
        panes.show()

        self.names_list = NamesList(self)
        panes.part_content_set("left", self.names_list)
        self.names_list.show()

        self.detail_list = DetailList(self)
        panes.part_content_set("right", self.detail_list)
        self.detail_list.show()

        self.resize(700, 500)
        self.show()
def bg_image_clicked(obj, item=None):
    win = Window("bg-image",
                 ELM_WIN_BASIC,
                 title="Bg Image",
                 autodel=True,
                 size=(320, 320),
                 size_hint_min=(160, 160),
                 size_hint_max=(320, 320))

    bg = Background(win,
                    file=ic_file,
                    option=ELM_BG_OPTION_SCALE,
                    size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

    win.show()

    (filename, group) = bg.file_get()
    print(("Background image: '%s'  group: '%s'" % (filename, group)))
    print(("Option: %d" % (bg.option_get())))
def socket_add(name):
    win = Window("socket image", ELM_WIN_SOCKET_IMAGE)

    try:
        win.socket_listen(name, 0, False)
    except RuntimeError:
        print("No socket")
        win.delete()
        return None
    else:
        win.autodel = True

        bg = Background(win,
                        color=(80, 110, 205),
                        size_hint_weight=EXPAND_BOTH)
        win.resize_object_add(bg)
        bg.show()

        bx = Box(win,
                 size_hint_weight=EXPAND_HORIZ,
                 size_hint_align=(EVAS_HINT_FILL, 0.0))
        bx.show()

        lb = LOG(win, "ELM_WIN_SOCKET_IMAGE")
        bx.pack_end(lb)

        lb = LOG(win, "Profile: <b>N/A</b>")
        bx.pack_end(lb)
        win.data["lb"] = lb

        inlined_add(win)

        win.move(0, 0)
        win.resize(150, 200)

        win.callback_profile_changed_add(win_profile_changed_cb)
        win.show()
        return win
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 genlist2_clicked(obj, item=None):
    win = Window("Genlist",
                 ELM_WIN_BASIC,
                 title="Genlist test 2",
                 autodel=True,
                 size=(320, 320))

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

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

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

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

    gl.item_append(itc1, 1001, func=gl_item_sel)
    gl.item_append(itc1, 1002, func=gl_item_sel)
    gl.item_append(itc1, 1003, func=gl_item_sel)
    gl.item_append(itc1, 1004, func=gl_item_sel)
    gl.item_append(itc1, 1005, func=gl_item_sel)
    gl.item_append(itc1, 1006, func=gl_item_sel)
    gl.item_append(itc1, 1007, func=gl_item_sel)

    bx.pack_end(gl)

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

    def my_gl_first(bt, gl):
        gli = gl.first_item
        if gli:
            gli.show()
            gli.selected = True

    bt = Button(win,
                text="/\\",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_first, gl)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_last(bt, gl):
        gli = gl.last_item_get()
        if gli:
            gli.show()
            gli.selected = True

    bt = Button(win,
                text="\\/",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_last, gl)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_disable(bt, gl):
        gli = gl.selected_item
        if gli:
            gli.disabled = True
            gli.selected = False
            gli.update()
        else:
            print("no item selected")

    bt = Button(win,
                text="#",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_disable, gl)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_update_all(bt, gl):
        gli = gl.first_item_get()
        i = 0
        while gli:
            gli.update()
            print(i)
            i = i + 1
            gli = gli.next_get()

    bt = Button(win,
                text="U",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_update_all, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

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

    def my_gl_clear(bt, gl):
        gl.clear()

    bt = Button(win,
                text="X",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_clear, gl)
    bx2.pack_end(bt)
    bt.show()

    class MyGlAdd:
        i = 0

    def my_gl_add(bt, gl, itc1):
        gl.item_append(itc1, MyGlAdd.i, func=gl_item_sel)
        MyGlAdd.i = MyGlAdd.i + 1

    bt = Button(win,
                text="+",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_add, gl, itc1)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_del(bt, gl):
        gli = gl.selected_item_get()
        if gli:
            gli.delete()
        else:
            print("no item selected")

    bt = Button(win,
                text="-",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_del, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

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

    class MyGlInsertBefore:
        i = 0

    def my_gl_insert_before(bt, gl, itc1):
        gli = gl.selected_item_get()
        if gli:
            gl.item_insert_before(itc1,
                                  MyGlInsertBefore.i,
                                  gli,
                                  func=gl_item_sel)
            MyGlInsertBefore.i = MyGlInsertBefore.i + 1
        else:
            print("no item selected")

    bt = Button(win,
                text="+ before",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_insert_before, gl, itc1)
    bx2.pack_end(bt)
    bt.show()

    class MyGlInsertAfter:
        i = 0

    def my_gl_insert_after(bt, gl, itc1):
        gli = gl.selected_item_get()
        if gli:
            gl.item_insert_after(itc1,
                                 MyGlInsertAfter.i,
                                 gli,
                                 func=gl_item_sel)
            MyGlInsertAfter.i = MyGlInsertAfter.i + 1
        else:
            print("no item selected")

    bt = Button(win,
                text="+ after",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_insert_after, gl, itc1)
    bx2.pack_end(bt)
    bt.show()

    def my_gl_flush(bt, gl):
        def my_gl_flush_delay():
            cache_all_flush()

        Timer(1.2, my_gl_flush_delay)

    bt = Button(win,
                text="Flush",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(my_gl_flush, gl)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    win.show()
def window_states_clicked(obj):
    win = Window("window-states",
                 ELM_WIN_BASIC,
                 title="Window States test",
                 autodel=True,
                 size=(280, 400))
    win.callback_moved_add(cb_win_moved)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    print(win.available_profiles)

    bg = Background(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(bg)
    bg.show()

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

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

    for state in [True, False]:
        bt = Button(win,
                    text="Alpha " + ("On" if state else "Off"),
                    size_hint_align=FILL_HORIZ,
                    size_hint_weight=EXPAND_HORIZ)
        bt.callback_clicked_add(cb_alpha, win, bg, state)
        hbox.pack_end(bt)
        bt.show()

    for state in [True, False]:
        bt = Button(win,
                    text="FS " + ("On" if state else "Off"),
                    size_hint_align=FILL_HORIZ,
                    size_hint_weight=EXPAND_HORIZ)
        bt.callback_clicked_add(cb_fullscreen, win, state)
        hbox.pack_end(bt)
        bt.show()

    sl = Slider(win,
                text="Visual test",
                indicator_format="%3.0f",
                min_max=(50, 150),
                value=50,
                inverted=True,
                size_hint_weight=EXPAND_BOTH,
                size_hint_align=(0.5, EVAS_HINT_FILL))
    vbox.pack_end(sl)
    sl.show()

    ck = Check(win, text="Resize on rotate", size_hint_align=(0.0, 0.0))
    vbox.pack_end(ck)
    ck.show()

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

    for rot in [0, 90, 180, 270]:
        bt = Button(win,
                    text="Rot " + str(rot),
                    size_hint_align=FILL_HORIZ,
                    size_hint_weight=EXPAND_HORIZ)
        bt.callback_clicked_add(cb_rot, win, ck, rot)
        hbox.pack_end(bt)
        bt.show()

    win.show()
Exemple #12
0
    def __init__(self,
                 parent,
                 title='About',
                 standardicon='dialog-information',
                 version='N/A',
                 authors='No One',
                 licen='GPL',
                 webaddress='',
                 info='Something, something, turtles'):

        if AboutWindow.__initialized:
            raise InstanceError(
                "You can't create more than 1 instance of AboutWindow")
        AboutWindow.__initialized = True
        self.parent = parent
        Window.__init__(self, title, ELM_WIN_DIALOG_BASIC, autodel=True)
        self.callback_delete_request_add(self.cb_close)
        background = Background(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(background)
        background.show()

        frame = Frame(self,
                      style='pad_large',
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
        self.resize_object_add(frame)
        frame.show()

        hbox = Box(self, horizontal=True, padding=(12, 12))
        frame.content = hbox
        hbox.show()

        vbox = Box(self,
                   align=(0.0, 0.0),
                   padding=(6, 6),
                   size_hint_weight=EXPAND_VERT,
                   size_hint_align=FILL_VERT)
        hbox.pack_end(vbox)
        vbox.show()

        # icon + version
        icon = Icon(self, size_hint_min=(64, 64))
        icon.standard_set(standardicon)
        vbox.pack_end(icon)
        icon.show()

        ver_lb = Label(self, text=f'Version: {version}')
        vbox.pack_end(ver_lb)
        ver_lb.show()

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

        # buttons
        btn = Button(self, text=(title), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: self.entry.text_set(info))
        vbox.pack_end(btn)
        btn.show()

        btn = Button(self, text=('Website'), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: xdg_open(webaddress))
        vbox.pack_end(btn)
        btn.show()

        btn = Button(self, text=('Authors'), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: self.entry.text_set(authors))
        vbox.pack_end(btn)
        btn.show()

        btn = Button(self, text=('License'), size_hint_align=FILL_HORIZ)
        btn.callback_clicked_add(lambda b: self.entry.text_set(licen))
        vbox.pack_end(btn)
        btn.show()

        # main text
        self.entry = Entry(self,
                           editable=False,
                           scrollable=True,
                           text=info,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.entry.callback_anchor_clicked_add(lambda e, i: xdg_open(i.name))
        hbox.pack_end(self.entry)
        self.entry.show()

        self.resize(400, 200)
        self.show()
def list2_clicked(obj, item=None):
    win = Window("list-2",
                 ELM_WIN_BASIC,
                 title="List 2",
                 autodel=True,
                 size=(320, 320))

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

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

    li = List(win,
              size_hint_align=FILL_BOTH,
              size_hint_weight=EXPAND_BOTH,
              mode=ELM_LIST_LIMIT)

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

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

    bx2 = Box(win, horizontal=True)

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

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

    li.item_append("are", bx2)

    li.item_append("you")
    li.item_append("doing")
    li.item_append("out")
    li.item_append("there")
    li.item_append("today")
    li.item_append("?")
    li.item_append("Here")
    li.item_append("are")
    li.item_append("some")
    li.item_append("more")
    li.item_append("items")
    li.item_append("Longer label.")

    li.go()

    bx.pack_end(li)
    li.show()

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

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

    bx.pack_end(bx2)
    bx2.show()

    win.show()
    def __init__(self, parent, title="About", standardicon="dialog-information", \
                        version="N/A", authors="No One", \
                        licen="GPL", webaddress="", info="Something, something, turtles"):
        Window.__init__(self, title, ELM_WIN_DIALOG_BASIC, autodel=True)

        background = Background(self, size_hint_weight=EXPAND_BOTH)
        self.resize_object_add(background)
        background.show()

        fr = Frame(self,
                   style='pad_large',
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH)
        self.resize_object_add(fr)
        fr.show()

        hbox = Box(self, horizontal=True, padding=(12, 12))
        fr.content = hbox
        hbox.show()

        vbox = Box(self,
                   align=(0.0, 0.0),
                   padding=(6, 6),
                   size_hint_weight=EXPAND_VERT,
                   size_hint_align=FILL_VERT)
        hbox.pack_end(vbox)
        vbox.show()

        # icon + version
        ic = Icon(self, size_hint_min=(64, 64))
        ic.standard_set(standardicon)
        vbox.pack_end(ic)
        ic.show()

        lb = Label(self, text=('Version: %s') % version)
        vbox.pack_end(lb)
        lb.show()

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

        # buttons
        bt = Button(self, text=(title), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(info))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=('Website'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: xdg_open(webaddress))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=('Authors'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(authors))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=('License'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(licen))
        vbox.pack_end(bt)
        bt.show()

        # main text
        self.entry = Entry(self,
                           editable=False,
                           scrollable=True,
                           text=info,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.entry.callback_anchor_clicked_add(lambda e, i: xdg_open(i.name))
        hbox.pack_end(self.entry)
        self.entry.show()

        self.resize(400, 200)
        self.show()
def scroller_clicked(obj):
    win = StandardWindow("scroller", "Scroller", autodel=True, size=(320, 320))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    tb = Table(win, size_hint_weight=EXPAND_BOTH)

    img = ["panel_01.jpg",
           "plant_01.jpg",
           "rock_01.jpg",
           "rock_02.jpg",
           "sky_01.jpg",
           "sky_02.jpg",
           "sky_03.jpg",
           "sky_04.jpg",
           "wood_01.jpg"]

    n = 0
    for j in range(12):
        for i in range(12):
            bg2 = Background(win, file=os.path.join(img_path, img[n]),
                size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
                size_hint_min=(318, 318))

            n = n + 1
            if n >= 9:
                n = 0
            tb.pack(bg2, i, j, 1, 1)
            bg2.show()

    sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb,
        page_relative=(1.0, 1.0))
    sc.callback_edge_top_add(cb_edges, "top")
    sc.callback_edge_bottom_add(cb_edges, "bottom")
    sc.callback_edge_left_add(cb_edges, "left")
    sc.callback_edge_right_add(cb_edges, "right")
    sc.callback_scroll_drag_start_add(cb_drags, "start")
    sc.callback_scroll_drag_stop_add(cb_drags, "stop")
    sc.callback_scroll_anim_start_add(cb_anims, "start")
    sc.callback_scroll_anim_stop_add(cb_anims, "stop")
    win.resize_object_add(sc)

    tb.show()

    sc.show()

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

    bt = Button(win, text="to 300 300", size_hint_weight=EXPAND_BOTH,
        size_hint_align=(0.1, 0.1))
    bt.callback_clicked_add(my_scroller_go_300_300, sc)
    tb2.pack(bt, 0, 0, 1, 1)
    bt.show()

    bt = Button(win, text="to 900 300", size_hint_weight=EXPAND_BOTH,
        size_hint_align=(0.9, 0.1))
    bt.callback_clicked_add(my_scroller_go_900_300, sc)
    tb2.pack(bt, 1, 0, 1, 1)
    bt.show()

    bt = Button(win, text="to 300 900", size_hint_weight=EXPAND_BOTH,
        size_hint_align=(0.1, 0.9))
    bt.callback_clicked_add(my_scroller_go_300_900, sc)
    tb2.pack(bt, 0, 1, 1, 1)
    bt.show()

    bt = Button(win, text="to 900 900", size_hint_weight=EXPAND_BOTH,
        size_hint_align=(0.9, 0.9))
    bt.callback_clicked_add(my_scroller_go_900_900, sc)
    tb2.pack(bt, 1, 1, 1, 1)
    bt.show()

    tb2.show()

    win.show()
Exemple #16
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 #17
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 #18
0
    def __init__(self,
                 command=None,
                 win=None,
                 start_callback=None,
                 end_callback=None,
                 *args,
                 **kwargs):
        if not win:
            nowindow = True
            win = self.win = Window("esudo", ELM_WIN_DIALOG_BASIC)
            win.title = "eSudo"
            win.borderless = True
            win.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
            win.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
            win.resize(300, 200)
            win.callback_delete_request_add(lambda o: elementary.exit())
            win.layer_set(11)
            #~ win.fullscreen = True
            win.show()
            win.activate()

            bg = Background(win)
            bg.size_hint_weight = 1.0, 1.0
            win.resize_object_add(bg)
            bg.show()

            self.embedded = False
        else:
            nowindow = False
            self.embedded = True

        self.cmd = command
        self.start_cb = start_callback if callable(start_callback) else None
        self.end_cb = end_callback if callable(end_callback) else None
        self.args = args
        self.kwargs = kwargs

        #--------eSudo Window
        bz = Box(win)
        if nowindow:
            bz.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
        else:
            bz.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
        bz.size_hint_align = evas.EVAS_HINT_FILL, 0.0
        bz.show()

        if nowindow:
            lbl = Label(win)
            lbl.style = "marker"
            lbl.color = 170, 170, 170, 255
            lbl.size_hint_align = 0.5, 0.0
            lbl.scale = 2.0
            lbl.text = "<b>eSudo</b>"
            bz.pack_end(lbl)
            lbl.show()

            sep = Separator(win)
            sep.horizontal = True
            bz.pack_end(sep)
            sep.show()

        fr = Frame(win)
        fr.text = "Command:"
        fr.size_hint_align = evas.EVAS_HINT_FILL, 0.0
        bz.pack_end(fr)
        fr.show()

        if nowindow:
            sep = Separator(win)
            sep.horizontal = True
            bz.pack_end(sep)
            sep.show()

        self.cmdline = cmdline = Entry(win)
        cmdline.elm_event_callback_add(self.entry_event)
        cmdline.single_line = True
        if self.cmd:
            cmdline.text = self.cmd
            cmdline.editable = False
        fr.content = cmdline
        cmdline.scrollable_set(True)
        cmdline.show()

        if nowindow:
            fr = Frame(win)
            fr.text = "Password:"******"<b>Password:</b>"
            lb.size_hint_align = 0.0, 0.5
            bz1.pack_end(lb)
            lb.show()

        en = self.en = Entry(win)
        en.name = "password"
        en.elm_event_callback_add(self.entry_event)
        en.single_line = True
        en.password = True
        en.show()

        if nowindow:
            fr.content = en
        else:
            bz1.pack_end(en)

        sep = Separator(win)
        sep.horizontal = True
        bz.pack_end(sep)
        sep.show()

        btnb = Box(win)
        btnb.horizontal = True
        btnb.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
        btnb.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
        bz.pack_end(btnb)
        btnb.show()

        bt = Button(win)
        bt.text = "Cancel"
        bt.callback_clicked_add(self.esudo_cancel, en)
        bt.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
        bt.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
        btnb.pack_end(bt)
        bt.show()

        bt = Button(win)
        bt.text = "OK"
        bt.callback_clicked_add(self.password_check, en)
        bt.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
        bt.size_hint_weight = evas.EVAS_HINT_EXPAND, 0.0
        btnb.pack_end(bt)
        bt.show()

        self.iw = iw = InnerWindow(win)
        iw.content = bz
        iw.show()
        iw.activate()
        if self.cmd:
            en.focus = True
def mapbuf_clicked(obj, item=None):
    global mb_list

    win = Window("mapbuf",
                 ELM_WIN_BASIC,
                 title="Mapbuf test",
                 autodel=True,
                 size=(480, 600))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

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

    # launcher
    sc = Scroller(win,
                  bounce=(True, False),
                  policy=SCROLL_POLICY_OFF,
                  size_hint_align=FILL_BOTH,
                  size_hint_weight=EXPAND_BOTH)
    vbox.pack_end(sc)

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

    for k in range(8):
        tb = Table(win,
                   size_hint_align=ALIGN_CENTER,
                   size_hint_weight=(0.0, 0.0))
        tb.show()

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (464, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 1, 0, 5, 1)

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (464, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 1, 11, 5, 1)

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (4, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 0, 1, 1, 10)

        pad = Rectangle(win.evas, color=(255, 255, 0, 255))
        pad.size_hint_min = (4, 4)
        pad.size_hint_weight = (0.0, 0.0)
        pad.size_hint_align = (EVAS_HINT_FILL, EVAS_HINT_FILL)
        pad.show()
        tb.pack(pad, 6, 1, 1, 10)

        mb = Mapbuf(win, content=tb)
        mb.point_color_set(k % 4, 255, 0, 0, 255)
        mb_list.append(mb)
        bx.pack_end(mb)
        mb.show()

        n = m = 0
        for j in range(5):
            for i in range(5):
                ic = Icon(win,
                          scale=0.5,
                          file=os.path.join(img_path, "icon_%02d.png" % (n)),
                          resizable=(False, False),
                          size_hint_weight=EXPAND_BOTH,
                          size_hint_align=ALIGN_CENTER)
                tb.pack(ic, 1 + i, 1 + (j * 2), 1, 1)
                ic.show()

                lb = Label(win, style="marker", text=names[m])
                tb.pack(lb, 1 + i, 1 + (j * 2) + 1, 1, 1)
                lb.show()

                n = n + 1 if n < 23 else 0
                m = m + 1 if m < 15 else 0

    sc.content = bx
    sc.page_relative_set(1.0, 1.0)
    sc.show()

    # controls
    hbox = Box(win,
               horizontal=True,
               homogeneous=True,
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ)
    vbox.pack_start(hbox)
    hbox.show()

    ck = Check(win, text="Map", state=False)
    ck.callback_changed_add(cb_ck_map)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="Alpha", state=True)
    ck.callback_changed_add(cb_ck_alpha)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="Smooth", state=True)
    ck.callback_changed_add(cb_ck_smooth)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="FS", state=False)
    ck.callback_changed_add(cb_ck_fs, win)
    hbox.pack_end(ck)
    ck.show()

    bt = Button(win,
                text="Close",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(cb_btn_close, win)
    hbox.pack_end(bt)
    bt.show()

    win.show()