Exemple #1
0
    def content_get(self, obj, part, data):
        checked = data[1]

        # "edit" EDC layout is like below. each part is swallow part.
        # the existing item is swllowed to elm.swallow.edit.content part.
        # --------------------------------------------------------------------
        # | elm.edit.icon.1 | elm.swallow.decorate.content | elm.edit.icon,2 |
        # --------------------------------------------------------------------

        if part == "elm.swallow.end":
            ic = Icon(obj,
                      file=os.path.join(img_path, "bubble.png"),
                      size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
            return ic
        elif part == "elm.edit.icon.1":
            ck = Check(obj, state=checked, propagate_events=False)
            ck.show()
            return ck
        elif part == "elm.edit.icon.2":
            icn = Icon(obj,
                       file=os.path.join(img_path, "icon_06.png"),
                       propagate_events=False,
                       size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
            icn.callback_clicked_add(edit_icon_clicked_cb, data)
            return icn
        else:
            return
    def content_get(self, obj, part, data):
        checked = data[1]

        # "edit" EDC layout is like below. each part is swallow part.
        # the existing item is swllowed to elm.swallow.edit.content part.
        # --------------------------------------------------------------------
        # | elm.edit.icon.1 | elm.swallow.decorate.content | elm.edit.icon,2 |
        # --------------------------------------------------------------------

        if part == "elm.swallow.end":
            ic = Icon(obj, file=os.path.join(img_path, "bubble.png"),
                size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
            return ic
        elif part == "elm.edit.icon.1":
            ck = Check(obj, state=checked, propagate_events=False)
            ck.show()
            return ck
        elif part == "elm.edit.icon.2":
            icn = Icon(obj, file=os.path.join(img_path, "icon_06.png"),
                propagate_events=False,
                size_hint_aspect=(EVAS_ASPECT_CONTROL_VERTICAL, 1, 1))
            icn.callback_clicked_add(edit_icon_clicked_cb, data)
            return icn
        else:
            return
Exemple #3
0
    def __init__(self, parent, text=None, icon=None):
        Entry.__init__(self, parent, scrollable=True, single_line=True,
                       size_hint_expand=EXPAND_BOTH,
                       size_hint_fill=FILL_BOTH)
        self.show()
        if text: self.text = text
        if icon: self.icon = icon

        ic = Icon(self, standard='arrow-down')
        ic.size_hint_min = 20, 20 # TODO file a bug for elm on phab
        ic.callback_clicked_add(self.activate)
        self.part_content_set('end', ic)

        self._itc = GenlistItemClass(item_style='default',
                                     text_get_func=self._gl_text_get,
                                     content_get_func=self._gl_content_get)
        self._list = Genlist(self)
        self._list.callback_selected_add(self._list_selected_cb)

        self._hover = Hover(self.parent, target=self)

        self._bg = Background(self, size_hint_expand=EXPAND_BOTH, 
                        size_hint_fill=FILL_BOTH)

        fr = Frame(self, style='pad_medium',
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        fr.content = self._list
        fr.show()

        self._table = Table(self, size_hint_expand=EXPAND_BOTH, 
                      size_hint_fill=FILL_BOTH)
        self._table.pack(self._bg, 0, 0, 1, 1)
        self._table.pack(fr, 0, 0, 1, 1)

        self._selected_func = None
Exemple #4
0
 def go_active(self):
     self.orig_text = self.text
     self.focus = False
     self.editable = True
     self.scrollable = True
     self.text_style_user_push("DEFAULT='font_size=18'")
     self.tooltip_unset()
     ic = Icon(self, standard='close', size_hint_min=(20,20))
     ic.callback_clicked_add(self._done_cb, False)
     self.part_content_set('end', ic)
     self.focus = True
Exemple #5
0
    def update_ui(self, listing_in_progress=False):
        box = self.header_box
        box.clear()
        ui_disabled = True

        # file listing in progress
        if listing_in_progress:
            spin = Progressbar(box, style='wheel', pulse_mode=True)
            spin.pulse(True)
            spin.show()
            box.pack_end(spin)

            lb = Label(box, text=_('Reading archive, please wait...'),
                       size_hint_weight=EXPAND_HORIZ,
                       size_hint_align=(0.0, 0.5))
            lb.show()
            box.pack_end(lb)

        # or header button
        else:
            if self.app.file_name is None:
                txt = _('No archive loaded, click to choose a file')
            else:
                ui_disabled = False
                txt = _('<b>Archive:</b> %s') % \
                      (os.path.basename(self.app.file_name))

            lb = Label(box, text='<align=left>%s</align>' % txt)
            bt = Button(box, content=lb, size_hint_weight=EXPAND_HORIZ,
                        size_hint_fill=FILL_HORIZ)
            bt.callback_clicked_add(lambda b: \
                        FileSelectorInwin(self, _('Choose an archive'),
                                          self._archive_selected_cb,
                                          path=os.getcwd()))
            box.pack_end(bt)
            bt.show()

        # always show the about button
        sep = Separator(box)
        box.pack_end(sep)
        sep.show()

        ic = Icon(box, standard='dialog-info', size_hint_min=(24,24))
        ic.callback_clicked_add(lambda i: InfoWin(self))
        box.pack_end(ic)
        ic.show()

        for widget in (self.extract_btn, self.fsb,
                       self.create_folder_chk, self.del_chk):
            widget.disabled = ui_disabled

        self.update_fsb_label()
def entry_scrolled_clicked(obj, item = None):
    #static Elm_Entry_Filter_Accept_Set digits_filter_data, digits_filter_data2;
    #static Elm_Entry_Filter_Limit_Size limit_filter_data, limit_filter_data2;


    win = StandardWindow("entry-scrolled", "Entry Scrolled", autodel=True,
        size=(320, 300))

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

    # disabled entry
    en = ScrollableEntry(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_HORIZ, policy=SCROLL_POLICY_OFF,
        text="Disabled entry", single_line=True, disabled=True)
    en.show()
    bx.pack_end(en)

    # password entry
    en = ScrollableEntry(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_HORIZ, policy=SCROLL_POLICY_OFF,
        password=True, single_line=True, text="Access denied, give up!",
        disabled=True)
    en.show()
    bx.pack_end(en)

    # multi-line disable entry
    en = ScrollableEntry(win, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH, policy=SCROLL_POLICY_ON,
        disabled=True)
    en.context_menu_item_add("Hello")
    en.context_menu_item_add("World")
    en.text = "Multi-line disabled entry widget :)<br/>"\
        "We can use markup <b>like this</> for styling and<br/>"\
        "formatting <em>like this</>, as well as<br/>"\
        "<a href=X><link>links in the text</></a>,"\
        "but it won't be editable or clickable."
    en.show()
    bx.pack_end(en)

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

    # Single line selected entry
    en = ScrollableEntry(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_HORIZ, text="This is a single line",
        policy=SCROLL_POLICY_OFF, single_line=True)
    en.select_all()
    en.show()
    bx.pack_end(en)

    # Filter test
    en = ScrollableEntry(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_HORIZ, text="Filter test",
        policy=SCROLL_POLICY_OFF, single_line=True)
    en.show()
    bx.pack_end(en)

    en.markup_filter_append(my_filter, "test")

    # # Only digits entry
    # en = ScrollableEntry(win)
    # en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
    # en.size_hint_align = EVAS_HINT_FILL, 0.5
    # en.text = "01234"
    # en.scrollbar_policy = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
    # en.single_line = True
    # en.show()
    # bx.pack_end(en)

    # digits_filter_data.accepted = "0123456789"
    # digits_filter_data.rejected = NULL
    # en.markup_filter_append(elm_entry_filter_accept_set, digits_filter_data)

    # # No digits entry
    # en = ScrollableEntry(win)
    # en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
    # en.size_hint_align = EVAS_HINT_FILL, 0.5
    # en.text = "No numbers here"
    # en.scrollbar_policy = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
    # en.single_line = True
    # en.show()
    # bx.pack_end(en)

    # digits_filter_data2.accepted = NULL
    # digits_filter_data2.rejected = "0123456789"
    # en.markup_filter_append(elm_entry_filter_accept_set, digits_filter_data2)

    # # Size limited entry
    # en = ScrollableEntry(win)
    # en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
    # en.size_hint_align = EVAS_HINT_FILL, 0.5
    # en.text = "Just 20 chars"
    # en.scrollbar_policy = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
    # en.single_line = True
    # en.show()
    # bx.pack_end(en)

    # limit_filter_data.max_char_count = 20
    # limit_filter_data.max_byte_count = 0
    # en.markup_filter_append(elm_entry_filter_limit_size, limit_filter_data)

    # # Byte size limited entry
    # en = ScrollableEntry(win)
    # en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
    # en.size_hint_align = EVAS_HINT_FILL, 0.5
    # en.text = "And now only 30 bytes"
    # en.policy = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
    # en.single_line = True
    # en.show()
    # bx.pack_end(en)

    # limit_filter_data2.max_char_count = 0
    # limit_filter_data2.max_byte_count = 30
    # en.markup_filter_append(elm_entry_filter_limit_size, limit_filter_data2)

    # Single line password entry
    en_p = ScrollableEntry(win, size_hint_weight=EXPAND_HORIZ,
        size_hint_align=FILL_HORIZ, policy=SCROLL_POLICY_OFF,
        text="Password here", single_line=True, password=True)
    en_p.show()
    bx.pack_end(en_p)

    # entry with icon/end widgets
    en = ScrollableEntry(win, policy=SCROLL_POLICY_OFF,
        single_line=True, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH, text="entry with icon and end objects")
    bt = Icon(win, standard="home", size_hint_min=(48, 48),
        color=(128, 0, 0, 128))
    bt.show()
    en.part_content_set("icon", bt)
    bt = Icon(win, standard="delete", size_hint_min=(48, 48),
        color=(128, 0, 0, 128))
    bt.show()
    en.part_content_set("end", bt)
    en.show()
    bx.pack_end(en)

    # markup entry
    en = ScrollableEntry(win, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH, policy=SCROLL_POLICY_ON)
    en.text = "This is an entry widget in this window that<br/>"\
        "uses markup <b>like this</> for styling and<br/>"\
        "formatting <em>like this</>, as well as<br/>"\
        "<a href=X><link>links in the text</></a>, so enter text<br/>"\
        "in here to edit it. By them way, links are<br/>"\
        "called <a href=anc-02>Anchors</a> so you will need<br/>"\
        "to refer to them this way. At the end here is a really long "\
        "line to test line wrapping to see if it works. But just in "\
        "case this line is not long enough I will add more here to "\
        "really test it out, as Elementary really needs some "\
        "good testing to see if entry widgets work as advertised."
    en.callback_anchor_clicked_add(scrolled_anchor_test, en)
    en.show()
    bx.pack_end(en)

    bx2 = Box(win, horizontal=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, propagate_events=False,
        focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_1, en)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win, text="Print", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ, propagate_events=False,
        focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_2, en)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win, text="Print pwd", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ, propagate_events=False,
        focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_5, en_p)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win, text="Selection", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ, propagate_events=False,
        focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_3, en)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win, text="Insert", size_hint_align=FILL_BOTH,
        size_hint_weight=EXPAND_HORIZ, propagate_events=False,
        focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_4, en)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    win.focus_set(True)
    win.show()
def entry_scrolled_clicked(obj, item=None):
    #static Elm_Entry_Filter_Accept_Set digits_filter_data, digits_filter_data2;
    #static Elm_Entry_Filter_Limit_Size limit_filter_data, limit_filter_data2;

    win = StandardWindow("entry-scrolled",
                         "Entry Scrolled",
                         autodel=True,
                         size=(320, 300))

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

    # disabled entry
    en = ScrollableEntry(win,
                         size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=FILL_HORIZ,
                         policy=SCROLL_POLICY_OFF,
                         text="Disabled entry",
                         single_line=True,
                         disabled=True)
    en.show()
    bx.pack_end(en)

    # password entry
    en = ScrollableEntry(win,
                         size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=FILL_HORIZ,
                         policy=SCROLL_POLICY_OFF,
                         password=True,
                         single_line=True,
                         text="Access denied, give up!",
                         disabled=True)
    en.show()
    bx.pack_end(en)

    # multi-line disable entry
    en = ScrollableEntry(win,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH,
                         policy=SCROLL_POLICY_ON,
                         disabled=True)
    en.context_menu_item_add("Hello")
    en.context_menu_item_add("World")
    en.text = "Multi-line disabled entry widget :)<br/>"\
        "We can use markup <b>like this</> for styling and<br/>"\
        "formatting <em>like this</>, as well as<br/>"\
        "<a href=X><link>links in the text</></a>,"\
        "but it won't be editable or clickable."
    en.show()
    bx.pack_end(en)

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

    # Single line selected entry
    en = ScrollableEntry(win,
                         size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=FILL_HORIZ,
                         text="This is a single line",
                         policy=SCROLL_POLICY_OFF,
                         single_line=True)
    en.select_all()
    en.show()
    bx.pack_end(en)

    # Filter test
    en = ScrollableEntry(win,
                         size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=FILL_HORIZ,
                         text="Filter test",
                         policy=SCROLL_POLICY_OFF,
                         single_line=True)
    en.show()
    bx.pack_end(en)

    en.markup_filter_append(my_filter, "test")

    # # Only digits entry
    # en = ScrollableEntry(win)
    # en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
    # en.size_hint_align = EVAS_HINT_FILL, 0.5
    # en.text = "01234"
    # en.scrollbar_policy = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
    # en.single_line = True
    # en.show()
    # bx.pack_end(en)

    # digits_filter_data.accepted = "0123456789"
    # digits_filter_data.rejected = NULL
    # en.markup_filter_append(elm_entry_filter_accept_set, digits_filter_data)

    # # No digits entry
    # en = ScrollableEntry(win)
    # en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
    # en.size_hint_align = EVAS_HINT_FILL, 0.5
    # en.text = "No numbers here"
    # en.scrollbar_policy = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
    # en.single_line = True
    # en.show()
    # bx.pack_end(en)

    # digits_filter_data2.accepted = NULL
    # digits_filter_data2.rejected = "0123456789"
    # en.markup_filter_append(elm_entry_filter_accept_set, digits_filter_data2)

    # # Size limited entry
    # en = ScrollableEntry(win)
    # en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
    # en.size_hint_align = EVAS_HINT_FILL, 0.5
    # en.text = "Just 20 chars"
    # en.scrollbar_policy = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
    # en.single_line = True
    # en.show()
    # bx.pack_end(en)

    # limit_filter_data.max_char_count = 20
    # limit_filter_data.max_byte_count = 0
    # en.markup_filter_append(elm_entry_filter_limit_size, limit_filter_data)

    # # Byte size limited entry
    # en = ScrollableEntry(win)
    # en.size_hint_weight = EVAS_HINT_EXPAND, 0.0
    # en.size_hint_align = EVAS_HINT_FILL, 0.5
    # en.text = "And now only 30 bytes"
    # en.policy = ELM_SCROLLER_POLICY_OFF, ELM_SCROLLER_POLICY_OFF
    # en.single_line = True
    # en.show()
    # bx.pack_end(en)

    # limit_filter_data2.max_char_count = 0
    # limit_filter_data2.max_byte_count = 30
    # en.markup_filter_append(elm_entry_filter_limit_size, limit_filter_data2)

    # Single line password entry
    en_p = ScrollableEntry(win,
                           size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=FILL_HORIZ,
                           policy=SCROLL_POLICY_OFF,
                           text="Password here",
                           single_line=True,
                           password=True)
    en_p.show()
    bx.pack_end(en_p)

    # entry with icon/end widgets
    en = ScrollableEntry(win,
                         policy=SCROLL_POLICY_OFF,
                         single_line=True,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH,
                         text="entry with icon and end objects")
    bt = Icon(win,
              standard="home",
              size_hint_min=(48, 48),
              color=(128, 0, 0, 128))
    bt.show()
    en.part_content_set("icon", bt)
    bt = Icon(win,
              standard="delete",
              size_hint_min=(48, 48),
              color=(128, 0, 0, 128))
    bt.show()
    en.part_content_set("end", bt)
    en.show()
    bx.pack_end(en)

    # markup entry
    en = ScrollableEntry(win,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH,
                         policy=SCROLL_POLICY_ON)
    en.text = "This is an entry widget in this window that<br/>"\
        "uses markup <b>like this</> for styling and<br/>"\
        "formatting <em>like this</>, as well as<br/>"\
        "<a href=X><link>links in the text</></a>, so enter text<br/>"\
        "in here to edit it. By them way, links are<br/>"\
        "called <a href=anc-02>Anchors</a> so you will need<br/>"\
        "to refer to them this way. At the end here is a really long "\
        "line to test line wrapping to see if it works. But just in "\
        "case this line is not long enough I will add more here to "\
        "really test it out, as Elementary really needs some "\
        "good testing to see if entry widgets work as advertised."
    en.callback_anchor_clicked_add(scrolled_anchor_test, en)
    en.show()
    bx.pack_end(en)

    bx2 = Box(win,
              horizontal=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,
                propagate_events=False,
                focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_1, en)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="Print",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ,
                propagate_events=False,
                focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_2, en)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="Print pwd",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ,
                propagate_events=False,
                focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_5, en_p)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="Selection",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ,
                propagate_events=False,
                focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_3, en)
    bx2.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="Insert",
                size_hint_align=FILL_BOTH,
                size_hint_weight=EXPAND_HORIZ,
                propagate_events=False,
                focus_allow=False)
    bt.callback_clicked_add(scrolled_entry_bt_4, en)
    bx2.pack_end(bt)
    bt.show()

    bx.pack_end(bx2)
    bx2.show()

    win.focus_set(True)
    win.show()