def entry_anchor_clicked(obj, item=None):
    win = StandardWindow("entry",
                         "Entry Anchor",
                         autodel=True,
                         size=(400, 400))

    box = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(box)

    entry = Entry(win, anchor_hover_style="popout", anchor_hover_parent=win)
    entry.text = "<a href=url:http://www.enlightenment.org/>Enlightenment</a>"
    entry.callback_anchor_clicked_add(anchor_clicked)
    entry.callback_anchor_hover_opened_add(anchor_hover_opened)
    entry.show()

    frame = Frame(win,
                  size_hint_align=FILL_BOTH,
                  text="Entry test",
                  content=entry)
    frame.show()

    box.pack_end(frame)
    box.show()

    win.show()
def entry_clicked(obj, item=None):
    win = StandardWindow("entry", "Entry", autodel=True)

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

    en = Entry(win, line_wrap=False, size_hint_weight=EXPAND_BOTH,
        size_hint_align=FILL_BOTH)
    en.entry_set("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 the way, links are<br>"
                 "called <a href=anc-02>Anchors</a> so you will need<br>"
                 "to refer to them this way.")
    en.callback_anchor_clicked_add(my_entry_anchor_test, en)
    bx.pack_end(en)
    en.show()

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

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

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

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

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

    bx.pack_end(bx2)
    bx2.show()

    en.focus_set(True)
    win.show()
def entry_anchor_clicked(obj, item=None):
    win = StandardWindow("entry", "Entry Anchor", autodel=True, size=(400,400))

    box = Box(win, size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(box)

    entry = Entry(win, anchor_hover_style="popout", anchor_hover_parent=win)
    entry.text = "<a href=url:http://www.enlightenment.org/>Enlightenment</a>"
    entry.callback_anchor_clicked_add(anchor_clicked)
    entry.callback_anchor_hover_opened_add(anchor_hover_opened)
    entry.show()

    frame = Frame(win, size_hint_align=FILL_BOTH, text="Entry test",
        content=entry)
    frame.show()

    box.pack_end(frame)
    box.show()

    win.show()
示例#4
0
文件: utils.py 项目: DaveMDS/egitu
class AboutWin(DialogWindow):
    def __init__(self, parent):
        DialogWindow.__init__(self, parent, 'egitu-info', 'Egitu',
                              autodel=True)

        fr = Frame(self, style='pad_large', size_hint_expand=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_expand=EXPAND_VERT, size_hint_fill=FILL_VERT)
        hbox.pack_end(vbox)
        vbox.show()

        # icon + version
        ic = SafeIcon(self, 'egitu', size_hint_min=(64,64))
        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='Egitu', size_hint_fill=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(HOMEPAGE))
        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(LICENSE))
        vbox.pack_end(bt)
        bt.show()

        # main text
        self.entry = Entry(self, editable=False, scrollable=True, text=INFO,
                           size_hint_expand=EXPAND_BOTH, size_hint_fill=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()
class AboutWindow(Window):
    __initialized = False

    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

        Window.__init__(self, title, ELM_WIN_DIALOG_BASIC, autodel=True)
        self.callback_delete_request_add(self.close_inst)
        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 close_inst(self, obj):
        AboutWindow.__initialized = False
示例#6
0
文件: gui.py 项目: lonid/epack
class InfoWin(DialogWindow):
    def __init__(self, parent):
        DialogWindow.__init__(self, parent, 'epack-info', 'Epack', autodel=True)

        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, standard='epack', size_hint_min=(64,64))
        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=_('Epack'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(utils.INFO))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=_('Website'),size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: utils.xdg_open(utils.GITHUB))
        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(utils.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(utils.LICENSE))
        vbox.pack_end(bt)
        bt.show()

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

        self.resize(400, 200)
        self.show()
示例#7
0
class AboutWindow(Window):
    '''
    A standardized About Window Class for EFL
    '''
    __initialized = False

    # pylint: disable=too-many-arguments, too-many-locals, too-many-statements
    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()

    # pylint: disable=no-self-use
    def cb_close(self, obj):
        '''Callback on close'''
        AboutWindow.__initialized = False
def entry_clicked(obj, item=None):
    win = StandardWindow("entry", "Entry", autodel=True)

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

    en = Entry(win,
               line_wrap=False,
               size_hint_weight=EXPAND_BOTH,
               size_hint_align=FILL_BOTH)
    en.entry_set("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 the way, links are<br>"
                 "called <a href=anc-02>Anchors</a> so you will need<br>"
                 "to refer to them this way.")
    en.callback_anchor_clicked_add(my_entry_anchor_test, en)
    bx.pack_end(en)
    en.show()

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

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

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

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

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

    bx.pack_end(bx2)
    bx2.show()

    en.focus_set(True)
    win.show()
示例#9
0
class InfoWin(DialogWindow):
    def __init__(self, parent):
        DialogWindow.__init__(self,
                              parent,
                              'epack-info',
                              'Epack',
                              autodel=True)

        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 = SafeIcon(self, 'epack', size_hint_min=(64, 64))
        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=_('Epack'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.entry.text_set(utils.INFO))
        vbox.pack_end(bt)
        bt.show()

        bt = Button(self, text=_('Website'), size_hint_align=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: utils.xdg_open(utils.GITHUB))
        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(utils.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(utils.LICENSE))
        vbox.pack_end(bt)
        bt.show()

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

        self.resize(400, 200)
        self.show()
class AboutWindow(Window):
    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()