Ejemplo n.º 1
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()
Ejemplo n.º 2
0
    def __init__(self,
                 parent_widget,
                 *args,
                 titles=None,
                 initial_sort=0,
                 ascending=True,
                 **kwargs):
        Scroller.__init__(self, parent_widget, *args, **kwargs)
        self.policy_set(ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF)

        self.main_box = Box(self,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.main_box.show()

        self.header = titles
        self.sort_column = initial_sort
        self.sort_column_ascending = ascending

        self.rows = []
        self.header_row = []

        header = Panes(self,
                       size_hint_weight=EXPAND_HORIZ,
                       size_hint_align=FILL_HORIZ)
        header.callback_unpress_add(self.cb_resize_pane)
        header.show()

        list_pane = Panes(self,
                          size_hint_weight=EXPAND_BOTH,
                          size_hint_align=FILL_BOTH)
        list_pane.callback_unpress_add(self.cb_resize_pane)
        list_pane.style_set("flush")
        list_pane.show()

        header.data["related"] = list_pane
        list_pane.data["related"] = header

        self.scroller = Scroller(self,
                                 size_hint_weight=EXPAND_BOTH,
                                 size_hint_align=FILL_BOTH)
        self.scroller.policy_set(ELM_SCROLLER_POLICY_OFF,
                                 ELM_SCROLLER_POLICY_AUTO)
        self.scroller.content = list_pane
        self.scroller.show()

        self.headers = []
        self.headers.append(header)
        self.list_panes = []
        self.list_panes.append(list_pane)
        self.lists = []

        if titles is not None:
            self.header_row_pack(titles)

        self.main_box.pack_end(header)
        self.main_box.pack_end(self.scroller)

        self.content = self.main_box
        self.show()
Ejemplo n.º 3
0
def thumb_clicked(obj):
    if not elementary.need_ethumb():
        print("Ethumb not available!")
        return

    images = ("panel_01.jpg", "plant_01.jpg", "rock_01.jpg", "rock_02.jpg",
              "sky_01.jpg", "sky_02.jpg", "sky_03.jpg", "sky_04.jpg",
              "wood_01.jpg", "mystrale.jpg", "mystrale_2.jpg")

    win = StandardWindow("thumb", "Thumb", autodel=True, size=(600, 600))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    tb = Table(win, size_hint_weight=EXPAND_BOTH)

    n = 0
    for j in range(12):
        for i in range(12):
            n = (n + 1) % 11
            th = Thumb(win,
                       file=os.path.join(img_path, images[n]),
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH,
                       editable=True)
            tb.pack(th, i, j, 1, 1)
            th.show()

    sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb)
    win.resize_object_add(sc)

    tb.show()
    sc.show()

    win.show()
Ejemplo n.º 4
0
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.tabs = []
        self.current = None
        self.tab_changed_cb = None
        self.close_cb = None
        self.empty_cb = None

        self.scr = Scroller(self,
                            size_hint_weight=EXPAND_HORIZ,
                            size_hint_align=FILL_BOTH)
        self.scr.content_min_limit(False, True)

        self.button_bx = Box(self.scr,
                             size_hint_weight=EXPAND_HORIZ,
                             align=ALIGN_LEFT)
        self.button_bx.horizontal = True
        self.button_bx.show()

        self.scr.content = self.button_bx
        self.scr.show()

        self.nav_fr = Naviframe(self,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
        self.nav_fr.show()

        self.pack_end(self.scr)
        self.pack_end(self.nav_fr)
Ejemplo n.º 5
0
    def buildMainBox(self):
        # build our toolbar
        self.mainTb = Toolbar(self,
                              homogeneous=False,
                              size_hint_weight=(0.0, 0.0),
                              size_hint_align=(EVAS_HINT_FILL, 0.0))
        self.mainTb.item_append("remove", "Clear", self.clearPressed)
        self.mainTb.item_append("system-run", "Select All",
                                self.selectAllPressed)
        self.mainTb.item_append("view-refresh", "Refresh", self.refreshPressed)
        self.mainTb.item_append("info", "Log", self.detailsPressed)
        self.mainTb.item_append("ok", "Apply", self.installUpdatesPressed)
        self.mainTb.show()

        # build our sortable list that displays packages that need updates
        titles = [("Upgrade", True), ("Package", True), ("Installed", True),
                  ("Available", True)]
        scr = Scroller(self,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)
        self.packageList = sl.SortedList(scr,
                                         titles=titles,
                                         homogeneous=False,
                                         size_hint_weight=EXPAND_HORIZ)
        scr.content = self.packageList
        scr.show()

        # build the label that shows the package's description
        self.currentDescription = Label(self, size_hint_weight=FILL_BOTH)
        self.currentDescription.text = "Select a package for information"
        self.currentDescription.line_wrap_set(True)
        self.currentDescription.show()

        self.desFrame = Frame(self,
                              size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=FILL_HORIZ)
        self.desFrame.text = "Description"
        self.desFrame.content = self.currentDescription
        self.desFrame.show()

        # add all of our objects to the box
        box = Box(self,
                  size_hint_weight=EXPAND_BOTH,
                  size_hint_align=FILL_BOTH)
        box.pack_end(self.mainTb)
        box.pack_end(scr)
        box.pack_end(self.desFrame)
        box.show()

        return box
Ejemplo n.º 6
0
def cb_item5(li, item):
    box = Box(li, size_hint_min=(150, 150))

    sc = Scroller(li, bounce=(False, True), size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_BOTH)
    sc.show()

    bt = Button(li, text="Enlightenment", size_hint_min=(140, 140))

    sc.content = bt
    box.pack_end(sc)

    cp = Ctxpopup(li, content = box)
    (x, y) = li.evas.pointer_canvas_xy_get()
    cp.move(x, y)
    cp.show()
    def __init__(self,
                 parent_widget,
                 *args,
                 titles=None,
                 initial_sort=0,
                 ascending=True,
                 **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.header = titles
        self.sort_column = initial_sort
        self.sort_column_ascending = ascending

        self.rows = []
        self.header_row = []
        self.header_box = Box(self,
                              size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=FILL_HORIZ)
        self.header_box.horizontal = True
        self.header_box.show()

        scr = Scroller(self,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)

        self.list_box = Box(self,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.list_box.horizontal = True
        self.list_box.show()

        scr.policy_set(ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_ON)
        scr.content = self.list_box
        scr.show()

        self.lists = []

        self.pack_end(self.header_box)
        self.pack_end(scr)
        self.show()

        if titles is not None:
            self.header_row_pack(titles)
Ejemplo n.º 8
0
def cb_item6(li, item):
    box = Box(li, size_hint_min=(200, 150))

    sc = Scroller(li, bounce=(False, True), size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_BOTH)
    sc.show()

    bt = Button(li, text="Ctxpop will be on the top of layer",
        size_hint_min=(190, 140))
    bt.callback_clicked_add(cb_btn)

    sc.content = bt
    box.pack_end(sc)

    cp = Ctxpopup(li, content=box)
    cp.callback_dismissed_add(cb_dismissed)
    (x, y) = li.evas.pointer_canvas_xy_get()
    cp.move(x, y)
    cp.show()
    bt.data["ctxpopup"] = cp
Ejemplo n.º 9
0
    def __init__(self, parent_widget, add_tab=False, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self._dict = OrderedDict()

        # Tabs
        scr = self._scr = Scroller(
            self,
            size_hint_weight=EXPAND_HORIZ,
            size_hint_align=FILL_BOTH,
            policy=(ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF),
            movement_block=ELM_SCROLLER_MOVEMENT_BLOCK_VERTICAL)
        scr.content_min_limit(False, True)

        tb = self._tabBox = Box(self._scr,
                                size_hint_weight=EXPAND_HORIZ,
                                align=ALIGN_LEFT,
                                horizontal=True)
        tb.show()

        self._addTab = None
        if add_tab:
            at = self._addTab = Button(self._tabBox, style="anchor")
            at.content = Icon(self._addTab, standard="list-add")
            at.callback_clicked_add(
                lambda x: self.callback_call("tabs,add,clicked"))
            self._tabBox.pack_end(self._addTab)
            at.show()

        scr.content = self._tabBox
        scr.show()

        # Contents
        nf = self._nf = Naviframe(self,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=FILL_BOTH)
        nf.callback_transition_finished_add(self._nfit_shown)
        nf.show()

        self.pack_end(scr)
        self.pack_end(nf)
Ejemplo n.º 10
0
def photo_clicked(obj):
    win = StandardWindow("photo", "Photo test", autodel=True, size=(300, 300))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    elementary.need_ethumb()

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

    sc = Scroller(win, size_hint_weight=EXPAND_BOTH, content=tb)
    win.resize_object_add(sc)
    sc.show()

    n = 0
    for j in range(12):
        for i in range(12):
            ph = Photo(win,
                       aspect_fixed=False,
                       size=80,
                       editable=True,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)
            name = os.path.join(img_path, images[n])
            n += 1
            if n >= 9: n = 0
            if n == 8:
                ph.thumb = name
            else:
                ph.file = name
            if n in [2, 3]:
                ph.fill_inside = True
                ph.style = "shadow"

            tb.pack(ph, i, j, 1, 1)
            ph.show()

    win.show()
Ejemplo n.º 11
0
    bx1.pack_end(lb)
    lb.show()

    en = Entry(win,
               single_line=True,
               scrollable=True,
               size_hint_weight=EXPAND_BOTH,
               size_hint_align=FILL_BOTH)
    en.part_text_set("guide", "Type widget name here to search.")
    en.callback_changed_add(cb_filter, win)
    bx1.pack_end(en)
    en.show()
    en.focus_set(True)

    sc = Scroller(win,
                  size_hint_weight=EXPAND_BOTH,
                  size_hint_align=FILL_BOTH,
                  bounce=(False, True))
    sc.show()
    box0.pack_end(sc)

    tbx = Box(win,
              size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
              size_hint_align=(EVAS_HINT_FILL, 0.0))
    sc.content_set(tbx)
    tbx.show()

    menu_create(None, win)

    win.resize(480, 480)
    win.show()
    elementary.run()
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()
Ejemplo n.º 13
0
def config_clicked(obj, data=None):
    siname = "_TestConfigSocketImage_"

    win = StandardWindow("config",
                         "Configuration",
                         autodel=True,
                         size=(400, 500))
    global ad
    ad = App_Data()
    win.data["ad"] = ad
    ad.win = win
    ad.profiles = elm_conf.profile_list

    bx = Box(win, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
    sc = Scroller(win,
                  content=bx,
                  bounce=(False, True),
                  size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(sc)

    fr, bx2 = FRAME(win, bx, "Current window profile")
    # TODO: Add this code
    #ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win));
    #supported = ecore_evas_window_profile_supported_get(ee);
    supported = True
    buf = "Virtual desktop window profile support: <b>{0}</b>".format(
        "Yes" if supported else "No")
    lb = LOG(win, buf)
    bx2.pack_end(lb)

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

    lb = LOG(win, "<br/>Window profile")
    bx2.pack_end(lb)
    ad.curr.rdg = radio_add(win, bx2)

    bt = Button(win, text="Set")
    bt.callback_clicked_add(bt_profile_set, win)
    bx2.pack_end(bt)
    bt.show()

    lb = LOG(win, "Window available profiles")
    bx2.pack_end(lb)
    ad.curr.cks = check_add(win, bx2)

    bt = Button(win, text="Set")
    bt.callback_clicked_add(bt_available_profiles_set, win)
    bx2.pack_end(bt)
    bt.show()

    fr, bx2 = FRAME(win, bx, "Socket")
    if socket_add(siname):
        lb = LOG(win, "Starting socket image.")
        bx2.pack_end(lb)
    else:
        lb = LOG(
            win, "Failed to create socket.<br/>Please check whether another "
            "test configuration window is<br/>already running and providing "
            "socket image.")
        bx2.pack_end(lb)

    fr, bx2 = FRAME(win, bx, "Plug")
    if not plug_add(win, bx2, siname):
        lb = LOG(win, "Failed to connect to server.")
        bx2.pack_end(lb)

    fr, bx2 = FRAME(win, bx, "Create new window with profile")
    lb = LOG(win, "Window profile")
    bx2.pack_end(lb)
    ad.new.rdg = radio_add(win, bx2)

    lb = LOG(win, "Window available profiles")
    bx2.pack_end(lb)
    ad.new.cks = check_add(win, bx2)

    bt = Button(win, text="Create")
    bt.callback_clicked_add(bt_win_add, win)
    bx2.pack_end(bt)
    bt.show()

    win.callback_profile_changed_add(win_profile_changed_cb)
    win.callback_delete_request_add(win_del_cb)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    if data:
        if data.available_profiles:
            win.available_profiles = data.available_profiles
        if data.profile:
            win.profile = data.profile

        profile_update(win)

    bx.show()
    sc.show()

    win.show()
Ejemplo n.º 14
0
    def __init__(self, parent, path, pos=None, zoom=1.0):
        self.doc_path = path
        self._zoom = zoom
        self.doc_pos = pos
        self.pages = []
        self.doc = None
        self.doc_title = os.path.splitext(os.path.basename(path))[0]
        self.visible_pages = []

        super(Document, self).__init__(parent,
                                       size_hint_weight=EXPAND_BOTH,
                                       size_hint_align=FILL_BOTH)

        scr = self.scr = Scroller(self,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=FILL_BOTH)
        scr.callback_scroll_add(self._scrolled)
        self.pack(scr, 0, 0, 4, 1)
        scr.show()

        box = self.page_box = Box(scr,
                                  size_hint_weight=EXPAND_BOTH,
                                  size_hint_align=(0.5, 0.0))
        scr.content = box

        self.on_resize_add(self._resized)

        btn = Button(self, text="Toggle outlines", size_hint_align=ALIGN_LEFT)
        btn.callback_clicked_add(lambda x: self.ol_p.toggle())
        self.pack(btn, 0, 1, 1, 1)
        btn.show()

        spn = self.spn = Spinner(self,
                                 round=1.0,
                                 size_hint_weight=EXPAND_HORIZ,
                                 size_hint_align=FILL_HORIZ)
        spn.special_value_add(1, "First")
        spn.editable = True
        self.pack(spn, 1, 1, 1, 1)
        spn.show()

        btn = Button(self,
                     text="show page",
                     size_hint_weight=EXPAND_HORIZ,
                     size_hint_align=ALIGN_LEFT)
        btn.callback_clicked_add(self._show_page_cb, spn)
        self.pack(btn, 2, 1, 1, 1)
        btn.show()

        menu = Menu(self.top_widget)
        menu.item_add(None, "Zoom In", "zoom-in", lambda x, y: self.zoom_in())
        menu.item_add(None, "Zoom Out", "zoom-out",
                      lambda x, y: self.zoom_out())
        menu.item_add(None, "Zoom 1:1", "zoom-original",
                      lambda x, y: self.zoom_orig())
        menu.item_add(None, "Zoom Fit", "zoom-fit-best",
                      lambda x, y: self.zoom_fit())

        def z_clicked(btn):
            x, y = btn.evas.pointer_canvas_xy_get()
            menu.move(x, y)
            menu.show()

        zlbl = self.zlbl = Button(self,
                                  text="%1.0f %%" % (self.zoom * 100.0),
                                  size_hint_weight=EXPAND_HORIZ,
                                  size_hint_align=ALIGN_RIGHT)
        zlbl.callback_clicked_add(z_clicked)
        self.pack(zlbl, 3, 1, 1, 1)
        zlbl.show()

        n = self.page_notify = Notify(scr, align=(0.02, 0.02))
        b = Box(n, horizontal=True, padding=(6, 0))
        n.content = b

        n = self.load_notify = Notify(scr, align=(0.98, 0.98))
        pb = Progressbar(n, pulse_mode=True, style="wheel")
        n.content = pb
        pb.pulse(True)
        n.show()

        p = self.ol_p = Panel(
            self,
            orient=ELM_PANEL_ORIENT_LEFT,
            size_hint_weight=EXPAND_BOTH,
            size_hint_align=FILL_BOTH,
        )  #scrollable=True, scrollable_content_size=0.35)
        p.hidden = True
        scr.on_move_add(lambda x: p.move(*x.pos))
        scr.on_resize_add(lambda x: p.resize(x.size[0] * 0.35, x.size[1]))

        ol_gl = self.ol_gl = Genlist(p,
                                     size_hint_weight=EXPAND_BOTH,
                                     size_hint_align=FILL_BOTH,
                                     mode=ELM_LIST_COMPRESS,
                                     homogeneous=True,
                                     select_mode=ELM_OBJECT_SELECT_MODE_ALWAYS)
        p.content = ol_gl

        ol_gl.callback_contract_request_add(self._gl_contract_req)
        ol_gl.callback_contracted_add(self._gl_contracted)
        ol_gl.callback_expand_request_add(self._gl_expand_req)
        ol_gl.callback_expanded_add(self._gl_expanded)
        ol_gl.show()

        p.show()
        self.show()

        def read_worker():
            t1 = self.t1 = time.clock()
            try:
                self.doc = PyPDF2.PdfFileReader(path)
                self.page_count = self.doc.getNumPages()
            except Exception as e:
                log.exception("Document could not be opened because: %r", e)
                self.doc = None
                self.display_error(e)
                return
            t2 = time.clock()
            log.info("Reading the doc took: %f", t2 - t1)

        t = Thread(target=read_worker)
        t.daemon = True
        t.start()

        def worker_check(t):
            if t.is_alive():
                return True
            elif self.doc and self.page_count:
                spn.special_value_add(self.page_count, "Last")
                spn.min_max = (1, self.page_count)

                if self.doc.isEncrypted:
                    PasswordPrompt(self)
                    return False

                self.metadata_read()
                self.populate_pages()
                return False

        timer = Timer(0.2, worker_check, t)
        self.parent.callback_delete_request_add(lambda x: timer.delete())
Ejemplo n.º 15
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent

        self.name = "Theme Selector"
        self.section = "Appearance"
        self.searchData = [
            "theme", "gtk", "elementary", "elm", "gnome", "appearance", "look"
        ]
        self.launchArg = "--theme"
        self.button = None

        self.icon = Icon(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.icon.standard_set('preferences-desktop-theme')
        self.icon.show()

        self.foundThemes = []

        self.currentPreview = None
        self.selectedTheme = None

        self.previewBox = previewBox = Scroller(self,
                                                size_hint_weight=EXPAND_BOTH,
                                                size_hint_align=FILL_BOTH)
        previewBox.show()

        self.themeList = List(self,
                              size_hint_weight=(0.35, 1.0),
                              size_hint_align=FILL_BOTH,
                              mode=ELM_LIST_COMPRESS)
        #Adds themes in the ThemePaths to the list for selection
        self.populateThemes()
        self.themeList.go()
        self.themeList.show()

        themeBox = Box(self,
                       size_hint_weight=EXPAND_BOTH,
                       size_hint_align=FILL_BOTH)
        themeBox.horizontal_set(True)
        themeBox.pack_end(self.themeList)
        themeBox.pack_end(self.previewBox)
        themeBox.show()

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

        #need to do this to shutdown threading for the file selector
        self.parent.callback_delete_request_add(self.shutDownFS)

        fs.callback_activated_add(self.fileSelected)

        # Flip object has the file selector on one side
        #   and the GUI on the other
        self.flip = Flip(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", themeBox)
        self.flip.part_content_set("back", self.fs)
        self.flip.show()

        fs.callback_cancel_add(
            lambda o: self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS))

        #self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS)

        self.mainBox = Box(self,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.mainBox.pack_end(self.flip)
        self.mainBox.show()

        buttonBox = Box(self,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH)
        buttonBox.horizontal = True

        buttonApply = StandardButton(self, "Apply Selected", "ok",
                                     self.applyPressed)
        buttonApply.show()

        buttonWeb = StandardButton(self, "Get Themes", "applications-internet",
                                   self.webPressed)
        buttonWeb.show()

        #buttonGTK = StandardButton(self, "GTK Theme", "preferences-desktop-gnome", self.gtkPressed)
        #buttonGTK.show()

        #buttonElm = StandardButton(self, "Elementary Theme", "", self.elmPressed)
        #buttonElm.show()

        buttonImport = StandardButton(self, "Import Theme",
                                      "preferences-desktop-theme",
                                      self.importPressed)
        buttonImport.show()

        buttonReturn = StandardButton(self, "Back", "go-previous",
                                      self.returnPressed)
        buttonReturn.show()

        buttonBox.pack_end(buttonApply)
        buttonBox.pack_end(buttonWeb)
        #buttonBox.pack_end(buttonGTK)
        #buttonBox.pack_end(buttonElm)
        buttonBox.pack_end(buttonImport)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()

        self.pack_end(self.mainBox)
        self.pack_end(buttonBox)
Ejemplo n.º 16
0
def multibuttonentry_clicked(obj, item=None):
    win = StandardWindow("multibuttonentry",
                         "MultiButtonEntry test",
                         autodel=True,
                         size=(320, 320))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    mbe = MultiButtonEntry(win,
                           size_hint_align=FILL_BOTH,
                           size_hint_weight=EXPAND_BOTH,
                           text="To: ")
    mbe.callback_item_selected_add(cb_item_selected)
    mbe.part_text_set("guide", "Tap to add recipient")
    mbe.filter_append(cb_filter1)
    mbe.show()

    sc = Scroller(win,
                  bounce=(False, True),
                  policy=SCROLL_POLICY_VERT,
                  size_hint_align=FILL_BOTH,
                  size_hint_weight=EXPAND_BOTH,
                  content=mbe)
    vbox.pack_end(sc)
    sc.show()

    print(mbe.entry)

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

    bt = Button(win,
                text="item_append",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(cb_btn_item_append, mbe)
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="item_prepend",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(cb_btn_item_prepend, mbe)
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="item_insert_after",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(cb_btn_item_insert_after, mbe)
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="item_insert_before",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(cb_btn_item_insert_before, mbe)
    hbox.pack_end(bt)
    bt.show()

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

    bt = Button(win,
                text="delete selected item",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(lambda btn: mbe.selected_item.delete())
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="clear",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(lambda bt: mbe.clear())
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="clear2",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(cb_btn_clear2, mbe)
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="toggle expand",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(
        lambda btn: mbe.expanded_set(not mbe.expanded_get()))
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="print",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(cb_print, mbe)
    hbox.pack_end(bt)
    bt.show()

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

    bt = Button(win,
                text="Change format function",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(
        lambda b: mbe.format_function_set(custom_format_func))
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="Unset format function",
                size_hint_align=FILL_HORIZ,
                size_hint_weight=EXPAND_HORIZ)
    bt.callback_clicked_add(lambda b: mbe.format_function_set(None))
    hbox.pack_end(bt)
    bt.show()

    mbe.focus = True

    win.show()
Ejemplo n.º 17
0
    def __init__(self, windowGrid, name):
        offset = 0
        if (name == 'Yau'):
            offset = 50

        self.BaseBox = Box(windowGrid,
                           size_hint_weight=(EVAS_HINT_EXPAND,
                                             EVAS_HINT_EXPAND),
                           size_hint_align=(EVAS_HINT_FILL, EVAS_HINT_FILL))
        windowGrid.pack(self.BaseBox, offset, 0, 50, 100)
        self.BaseBox.show()

        self.frame = Frame(self.BaseBox,
                           size_hint_weight=(EVAS_HINT_EXPAND,
                                             EVAS_HINT_EXPAND),
                           size_hint_align=(EVAS_HINT_FILL, EVAS_HINT_FILL),
                           text=name)
        self.BaseBox.pack_end(self.frame)
        self.frame.show()

        self.FrameBox = Box(self.BaseBox,
                            size_hint_weight=(EVAS_HINT_EXPAND,
                                              EVAS_HINT_EXPAND),
                            size_hint_align=(EVAS_HINT_FILL, EVAS_HINT_FILL))
        self.frame.content_set(self.FrameBox)
        self.FrameBox.show()

        self.FrameCheck = Check(self.BaseBox,
                                size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                size_hint_align=(EVAS_HINT_FILL, 0.5),
                                text="{0} Frame Check".format(name))
        self.FrameBox.pack_end(self.FrameCheck)
        self.FrameCheck.show()

        self.FrameSeparator = Separator(self.BaseBox,
                                        horizontal=True,
                                        size_hint_weight=(EVAS_HINT_EXPAND,
                                                          0.0),
                                        size_hint_align=(EVAS_HINT_FILL, 0.5))
        self.FrameBox.pack_end(self.FrameSeparator)
        self.FrameSeparator.show()

        self.FrameScroller = Scroller(
            self.BaseBox,
            content_min_limit=(True, False),
            size_hint_weight=(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND),
            size_hint_align=(EVAS_HINT_FILL, EVAS_HINT_FILL),
            scrollbar_policy=(ELM_SCROLLER_POLICY_OFF,
                              ELM_SCROLLER_POLICY_OFF))
        self.FrameBox.pack_end(self.FrameScroller)
        self.FrameScroller.show()

        self.FrameTable = Table(self.BaseBox,
                                size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                size_hint_align=(EVAS_HINT_FILL, 0.0))
        self.FrameScroller.content_set(self.FrameTable)
        self.FrameTable.show()

        self.BaseLabel = Label(self.FrameTable,
                               size_hint_weight=(0.0, 0.0),
                               size_hint_align=(0.0, 0.5),
                               text="Base:")
        self.FrameTable.pack(self.BaseLabel, 0, 0, 1, 1)
        self.BaseLabel.show()

        self.BaseEntry = Entry(self.FrameTable,
                               size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                               size_hint_align=(EVAS_HINT_FILL, 0.5),
                               single_line=True,
                               scrollable=True,
                               text="")
        self.FrameTable.pack(self.BaseEntry, 1, 0, 1, 1)
        self.BaseEntry.show()

        self.SecretLabel = Label(self.FrameTable,
                                 size_hint_weight=(0.0, 0.0),
                                 size_hint_align=(0.0, 0.5),
                                 text="Secret:")
        self.FrameTable.pack(self.SecretLabel, 2, 0, 1, 1)
        self.SecretLabel.show()

        self.SecretEntry = Entry(self.FrameTable,
                                 size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                 size_hint_align=(EVAS_HINT_FILL, 0.5),
                                 single_line=True,
                                 scrollable=True,
                                 text="")
        self.FrameTable.pack(self.SecretEntry, 3, 0, 1, 1)
        self.SecretEntry.show()

        self.SignalLabel = Label(self.FrameTable,
                                 size_hint_weight=(0.0, 0.0),
                                 size_hint_align=(0.0, 0.5),
                                 text="Signal:")
        self.FrameTable.pack(self.SignalLabel, 4, 0, 1, 1)
        self.SignalLabel.show()

        self.SignalEntry = Entry(self.FrameTable,
                                 size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                 size_hint_align=(EVAS_HINT_FILL, 0.5),
                                 single_line=True,
                                 scrollable=True,
                                 text="")
        self.FrameTable.pack(self.SignalEntry, 5, 0, 1, 1)
        self.SignalEntry.show()

        self.ChannelLabel = Label(self.FrameTable,
                                  size_hint_weight=(0.0, 0.0),
                                  size_hint_align=(0.0, 0.5),
                                  text="Channel:")
        self.FrameTable.pack(self.ChannelLabel, 0, 1, 1, 1)
        self.ChannelLabel.show()

        self.ChannelEntry = Entry(self.FrameTable,
                                  size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                  size_hint_align=(EVAS_HINT_FILL, 0.5),
                                  single_line=True,
                                  scrollable=True,
                                  text="")
        self.FrameTable.pack(self.ChannelEntry, 1, 1, 1, 1)
        self.ChannelEntry.show()

        self.PoleLabel = Label(self.FrameTable,
                               size_hint_weight=(0.0, 0.0),
                               size_hint_align=(0.0, 0.5),
                               text="Pole:")
        self.FrameTable.pack(self.PoleLabel, 2, 1, 1, 1)
        self.PoleLabel.show()

        self.PoleEntry = Entry(self.FrameTable,
                               size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                               size_hint_align=(EVAS_HINT_FILL, 0.5),
                               single_line=True,
                               scrollable=True,
                               text="")
        self.FrameTable.pack(self.PoleEntry, 3, 1, 1, 1)
        self.PoleEntry.show()

        self.IdentityLabel = Label(self.FrameTable,
                                   size_hint_weight=(0.0, 0.0),
                                   size_hint_align=(0.0, 0.5),
                                   text="Identity:")
        self.FrameTable.pack(self.IdentityLabel, 4, 1, 1, 1)
        self.IdentityLabel.show()

        self.IdentityEntry = Entry(self.FrameTable,
                                   size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                   size_hint_align=(EVAS_HINT_FILL, 0.5),
                                   single_line=True,
                                   scrollable=True,
                                   text="")
        self.FrameTable.pack(self.IdentityEntry, 5, 1, 1, 1)
        self.IdentityEntry.show()

        self.FoundationLabel = Label(self.FrameTable,
                                     size_hint_weight=(0.0, 0.0),
                                     size_hint_align=(0.0, 0.5),
                                     text="Foundation:")
        self.FrameTable.pack(self.FoundationLabel, 0, 2, 1, 1)
        self.FoundationLabel.show()

        self.FoundationEntry = Entry(self.FrameTable,
                                     size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                     size_hint_align=(EVAS_HINT_FILL, 0.5),
                                     single_line=True,
                                     scrollable=True,
                                     text="")
        self.FrameTable.pack(self.FoundationEntry, 1, 2, 1, 1)
        self.FoundationEntry.show()

        self.ElementLabel = Label(self.FrameTable,
                                  size_hint_weight=(0.0, 0.0),
                                  size_hint_align=(0.0, 0.5),
                                  text="Element:")
        self.FrameTable.pack(self.ElementLabel, 2, 2, 1, 1)
        self.ElementLabel.show()

        self.ElementEntry = Entry(self.FrameTable,
                                  size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                  size_hint_align=(EVAS_HINT_FILL, 0.5),
                                  single_line=True,
                                  scrollable=True,
                                  text="")
        self.FrameTable.pack(self.ElementEntry, 3, 2, 1, 1)
        self.ElementEntry.show()

        self.DynamoLabel = Label(self.FrameTable,
                                 size_hint_weight=(0.0, 0.0),
                                 size_hint_align=(0.0, 0.5),
                                 text="Dynamo:")
        self.FrameTable.pack(self.DynamoLabel, 4, 2, 1, 1)
        self.DynamoLabel.show()

        self.DynamoEntry = Entry(self.FrameTable,
                                 size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                 size_hint_align=(EVAS_HINT_FILL, 0.5),
                                 single_line=True,
                                 scrollable=True,
                                 text="")
        self.FrameTable.pack(self.DynamoEntry, 5, 2, 1, 1)
        self.DynamoEntry.show()

        self.ManifoldLabel = Label(self.FrameTable,
                                   size_hint_weight=(0.0, 0.0),
                                   size_hint_align=(0.0, 0.5),
                                   text="Manifold:")
        self.FrameTable.pack(self.ManifoldLabel, 0, 3, 1, 1)
        self.ManifoldLabel.show()

        self.ManifoldEntry = Entry(self.FrameTable,
                                   size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                   size_hint_align=(EVAS_HINT_FILL, 0.5),
                                   single_line=True,
                                   scrollable=True,
                                   text="")
        self.FrameTable.pack(self.ManifoldEntry, 1, 3, 1, 1)
        self.ManifoldEntry.show()

        self.RingLabel = Label(self.FrameTable,
                               size_hint_weight=(0.0, 0.0),
                               size_hint_align=(0.0, 0.5),
                               text="Ring:")
        self.FrameTable.pack(self.RingLabel, 2, 3, 1, 1)
        self.RingLabel.show()

        self.RingEntry = Entry(self.FrameTable,
                               size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                               size_hint_align=(EVAS_HINT_FILL, 0.5),
                               single_line=True,
                               scrollable=True,
                               text="")
        self.FrameTable.pack(self.RingEntry, 3, 3, 1, 1)
        self.RingEntry.show()

        self.BarnLabel = Label(self.FrameTable,
                               size_hint_weight=(0.0, 0.0),
                               size_hint_align=(0.0, 0.5),
                               text="Barn:")
        self.FrameTable.pack(self.BarnLabel, 4, 3, 1, 1)
        self.BarnLabel.show()

        self.BarnEntry = Entry(self.FrameTable,
                               size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                               size_hint_align=(EVAS_HINT_FILL, 0.5),
                               single_line=True,
                               scrollable=True,
                               text="")
        self.FrameTable.pack(self.BarnEntry, 5, 3, 1, 1)
        self.BarnEntry.show()

        self.VoltpereLabel = Label(self.FrameTable,
                                   size_hint_weight=(0.0, 0.0),
                                   size_hint_align=(0.0, 0.5),
                                   text="Voltpere:")
        self.FrameTable.pack(self.VoltpereLabel, 0, 4, 1, 1)
        self.VoltpereLabel.show()

        self.VoltpereEntry = Entry(self.FrameTable,
                                   size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                   size_hint_align=(EVAS_HINT_FILL, 0.5),
                                   single_line=True,
                                   scrollable=True,
                                   text="")
        self.FrameTable.pack(self.VoltpereEntry, 1, 4, 5, 1)
        self.VoltpereEntry.show()

        self.AmpereLabel = Label(self.FrameTable,
                                 size_hint_weight=(0.0, 0.0),
                                 size_hint_align=(0.0, 0.5),
                                 text="Ampere:")
        self.FrameTable.pack(self.AmpereLabel, 0, 5, 1, 1)
        self.AmpereLabel.show()

        self.AmpereEntry = Entry(self.FrameTable,
                                 size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                 size_hint_align=(EVAS_HINT_FILL, 0.5),
                                 single_line=True,
                                 scrollable=True,
                                 text="")
        self.FrameTable.pack(self.AmpereEntry, 1, 5, 2, 1)
        self.AmpereEntry.show()

        self.HenryLabel = Label(self.FrameTable,
                                size_hint_weight=(0.0, 0.0),
                                size_hint_align=(0.0, 0.5),
                                text="Henry:")
        self.FrameTable.pack(self.HenryLabel, 0, 6, 1, 1)
        self.HenryLabel.show()

        self.HenryEntry = Entry(self.FrameTable,
                                size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                size_hint_align=(EVAS_HINT_FILL, 0.5),
                                single_line=True,
                                scrollable=True,
                                text="")
        self.FrameTable.pack(self.HenryEntry, 1, 6, 2, 1)
        self.HenryEntry.show()

        self.MaxwellLabel = Label(self.FrameTable,
                                  size_hint_weight=(0.0, 0.0),
                                  size_hint_align=(0.0, 0.5),
                                  text="Maxwell:")
        self.FrameTable.pack(self.MaxwellLabel, 0, 7, 1, 1)
        self.MaxwellLabel.show()

        self.MaxwellEntry = Entry(self.FrameTable,
                                  size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                  size_hint_align=(EVAS_HINT_FILL, 0.5),
                                  single_line=True,
                                  scrollable=True,
                                  text="")
        self.FrameTable.pack(self.MaxwellEntry, 1, 7, 2, 1)
        self.MaxwellEntry.show()

        self.FermatLabel = Label(self.FrameTable,
                                 size_hint_weight=(0.0, 0.0),
                                 size_hint_align=(0.0, 0.5),
                                 text="Fermat:")
        self.FrameTable.pack(self.FermatLabel, 0, 8, 1, 1)
        self.FermatLabel.show()

        self.FermatEntry = Entry(self.FrameTable,
                                 size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
                                 size_hint_align=(EVAS_HINT_FILL, 0.5),
                                 single_line=True,
                                 scrollable=True,
                                 text="")
        self.FrameTable.pack(self.FermatEntry, 1, 8, 2, 1)
        self.FermatEntry.show()

        self.PropelButton = Button(self.FrameTable,
                                   size_hint_weight=(0.0, 0.0),
                                   size_hint_align=(0.0, 0.5),
                                   text="Propel")
        self.FrameTable.pack(self.PropelButton, 4, 8, 1, 1)
        self.PropelButton.show()
        self.PropelButton.callback_clicked_add(self.propelClicked)
Ejemplo n.º 18
0
def focus_clicked(obj, item=None):
    win = StandardWindow("focus", "Focus", autodel=True, size=(800, 600))

    win.focus_highlight_enabled = True

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

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

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

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

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

    tbx.pack_end(tbar)
    tbar.show()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    win.show()
Ejemplo n.º 19
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent

        self.name = "Wallpaper"
        self.section = "Appearance"
        self.searchData = ["wallpaper", "appearance", "look"]
        self.launchArg = "--wallpaper"
        self.button = None

        self.icon = Icon(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        #Use FDO icons -> http://standards.freedesktop.org/icon-naming-spec/latest/ar01s04.html
        self.icon.standard_set('wallpaper')
        self.icon.show()

        self.foundWalls = []

        self.currentPreview = None
        self.selectedWall = None

        self.flip = Flip(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)

        wallBox = Box(self.flip,
                      size_hint_weight=EXPAND_BOTH,
                      size_hint_align=FILL_BOTH)
        wallBox.horizontal_set(True)

        self.previewBox = previewBox = Scroller(wallBox,
                                                size_hint_weight=EXPAND_BOTH,
                                                size_hint_align=FILL_BOTH)
        previewBox.show()

        self.wallList = List(self,
                             size_hint_weight=(0.35, 1.0),
                             size_hint_align=FILL_BOTH,
                             mode=ELM_LIST_COMPRESS)
        #Adds walls in the WallPaths to the list for selection
        self.populateWalls()
        self.wallList.go()
        self.wallList.show()

        wallBox.pack_end(self.wallList)
        wallBox.pack_end(self.previewBox)
        wallBox.show()

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

        #need to do this to shutdown threading for the file selector
        self.parent.callback_delete_request_add(self.shutDownFS)

        fs.callback_activated_add(self.fileSelected)

        # Flip object has the file selector on one side
        #   and the GUI on the other
        self.flip.part_content_set("front", wallBox)
        self.flip.part_content_set("back", self.fs)
        self.flip.show()

        fs.callback_cancel_add(
            lambda o: self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS))

        #self.flip.go(ELM_FLIP_ROTATE_YZ_CENTER_AXIS)

        self.mainBox = Box(self,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.mainBox.pack_end(self.flip)
        self.mainBox.show()

        buttonBox = Box(self,
                        size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_BOTH)
        buttonBox.horizontal = True

        buttonApply = StandardButton(self, "Apply Selected", "ok",
                                     self.applyPressed)
        buttonApply.show()

        buttonImport = StandardButton(self, "Import Wallpaper", "wallpaper",
                                      self.importPressed)
        buttonImport.show()

        buttonReturn = StandardButton(self, "Back", "go-previous",
                                      self.returnPressed)
        buttonReturn.show()

        buttonBox.pack_end(buttonApply)
        #buttonBox.pack_end(buttonWeb)
        buttonBox.pack_end(buttonImport)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()

        self.pack_end(self.mainBox)
        self.pack_end(buttonBox)
Ejemplo n.º 20
0
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()