Exemple #1
0
def grid_clicked(obj):
    win = StandardWindow("grid", "Grid test", autodel=True, size=(480, 480))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    gd = Grid(win, size=(100, 100), size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(gd)
    gd.show()

    en = Entry(win, scrollable=True, text="Entry text 2", single_line=True)
    gd.pack(en, 60, 20, 30, 10)
    en.show()

    bt = Button(win, text="Next API function", disabled=True)
    gd.pack(bt, 30, 0, 40, 10)
    bt.disabled = True
    bt.show()

    bt = Button(win, text="Button")
    gd.pack(bt, 0, 0, 20, 20)
    bt.show()

    bt = Button(win, text="Button")
    gd.pack(bt, 10, 10, 40, 20)
    bt.show()

    bt = Button(win, text="Button")
    gd.pack(bt, 10, 30, 20, 50)
    bt.show()

    bt = Button(win, text="Button")
    gd.pack(bt, 80, 80, 20, 20)
    bt.show()

    bt = Button(win, text="Change")
    bt.callback_clicked_add(cb_change)
    gd.pack(bt, 40, 40, 20, 20)
    bt.show()

    re = Rectangle(win.evas, color=(128, 0, 0, 128))
    gd.pack(re, 40, 70, 20, 10)
    re.show()

    re = Rectangle(win.evas, color=(0, 128, 0, 128))
    gd.pack(re, 60, 70, 10, 10)
    re.show()

    re = Rectangle(win.evas, color=(0, 0, 128, 128))
    gd.pack(re, 40, 80, 10, 10)
    re.show()

    re = Rectangle(win.evas, color=(128, 0, 128, 128))
    gd.pack(re, 50, 80, 10, 10)
    re.show()

    re = Rectangle(win.evas, color=(128, 64, 0, 128))
    gd.pack(re, 60, 80, 10, 10)
    re.show()

    win.show()
Exemple #2
0
    def __init__(self, parent, commit, show_full_msg=False):
        self.commit = commit

        Table.__init__(self, parent,  padding=(5,5))
        self.show()

        pic = GravatarPict(self)
        pic.size_hint_align = 0.0, 0.0
        pic.email_set(commit.author_email)
        self.pack(pic, 0, 0, 1, 1)
        pic.show()

        if commit.committer and commit.committer != commit.author:
            committed = '<name>Committed by:</name> <b>{}</b><br>'.format(
                        commit.committer)
        else:
            committed = ''
        text = '<name>{}</name>  <b>{}</b>  {}<br>{}<br>{}'.format(
                commit.sha[:9], commit.author, format_date(commit.commit_date), 
                committed, utf8_to_markup(commit.title))
        if show_full_msg:
            text += '<br><br>{}'.format(utf8_to_markup(commit.message))
        en = Entry(self, text=text, line_wrap=ELM_WRAP_NONE,
                   size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.pack(en, 1, 0, 1, 1)
        en.show()
Exemple #3
0
    def __init__(self, cmd, exec_cb):
        DialogWindow.__init__(self, _app_instance.win, 'egitu-review',
                              'Git Command Review', autodel=True, size=(300,50))

        # main table (inside a padding frame)
        fr = Frame(self, style='default', text='Command to execute',
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        self.resize_object_add(fr)
        fr.show()

        tb = Table(self, padding=(6,6),
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        fr.content = tb
        tb.show()

        # cmd entry
        en = Entry(self, single_line=True, scrollable=True, 
                   text=utf8_to_markup(cmd),
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        tb.pack(en, 0, 0, 2, 1)
        en.show()

        # buttons
        bt = Button(self, text='Close', size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ)
        bt.callback_clicked_add(lambda b: self.delete())
        tb.pack(bt, 0, 1, 1, 1)
        bt.show()

        bt = Button(self, text='Execute', size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_HORIZ)
        bt.callback_clicked_add(self._exec_clicked_cb, en, exec_cb)
        tb.pack(bt, 1, 1, 1, 1)
        bt.show()

        #
        self.show()
Exemple #4
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 = SafeIcon(self, 'go-down')
        ic.size_hint_min = 16, 16 # 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 #5
0
    def __init__(self, parent):
        InnerWindow.__init__(self, parent)

        vbox = Box(self)
        vbox.show()
        self.content = vbox

        title = Label(self, scale=2.0, text='Edone %s' % VERSION)
        title.show()
        vbox.pack_end(title)

        en = Entry(self, text=INFO, editable=False, scrollable=True,
                   size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        en.show()
        vbox.pack_end(en)

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

        close = Button(self, text='Close')
        close.callback_clicked_add(lambda b: self.delete())
        close.show()
        vbox.pack_end(close)

        self.activate()
 def __init__(self, cmd):
     self.cmd = cmd
     self.cmd_exe = None
     
     win = self.win = Window("ecore-ex", ELM_WIN_DIALOG_BASIC)
     win.title = "Ecore Example"
     win.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
     win.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
     win.resize(300, 200)
     win.callback_delete_request_add(lambda o: elementary.exit())
     win.show()
     win.activate()
     
     self.sendEntry = Entry(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     self.sendEntry.show()
     
     self.sendButton = Button(win, size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=FILL_HORIZ)
     self.sendButton.text = "Send!"
     self.sendButton.callback_pressed_add(self.sendPressed)
     self.sendButton.show()
     
     box = Box(win, size_hint_weight=EXPAND_HORIZ,
                        size_hint_align=FILL_HORIZ)
     box.pack_end(self.sendEntry)
     box.pack_end(self.sendButton)
     box.show()
     
     win.resize_object_add(box)
     
     self.run_command(cmd)
Exemple #7
0
 def buildSubs(self):
     self.subWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300))
     self.subWin.title = "Life Tracker Assignment"
     bg = Background(self.subWin, size_hint_weight=EXPAND_BOTH)
     bg.show()
     self.subWin.resize_object_add(bg)
     self.subWin.callback_delete_request_add(lambda o: elm.exit())
     self.ourWin = Window("lifetracker", ELM_WIN_DIALOG_BASIC, self, size=(300, 300))
     self.ourWin.title = "Life Tracker Key Strokes"
     bg = Background(self.ourWin, size_hint_weight=EXPAND_BOTH)
     bg.show()
     self.ourWin.resize_object_add(bg)
     self.ourWin.callback_delete_request_add(lambda o: elm.exit())
     self.ourWin.elm_event_callback_add(self.eventsCb)
     
     self.ourLife = ourLabel = Entry(self.ourWin, editable=False)
     ourLabel.size_hint_weight = EXPAND_BOTH
     ourLabel.size_hint_align = FILL_BOTH
     ourLabel.text_style_user_push("DEFAULT='font_size=20'")
     ourLabel.text = "Up and Down for Their Life, Left and Right for Mine"
     ourLabel.show()
     
     self.ourEntry = ourEntry = Entry(self.subWin)
     ourEntry.size_hint_weight = EXPAND_HORIZ
     ourEntry.size_hint_align = (-1, 0)
     ourEntry.single_line_set(True)
     ourEntry.text_style_user_push("DEFAULT='font_size=50'")
     ourEntry.callback_activated_add(self.ourLifeUpdate)
     ourEntry.text = "20"
     ourEntry.show()
     
     self.theirEntry = theirEntry = Entry(self.subWin)
     theirEntry.size_hint_weight = EXPAND_HORIZ
     theirEntry.size_hint_align = (-1, 0)
     theirEntry.single_line_set(True)
     theirEntry.text_style_user_push("DEFAULT='font_size=50'")
     theirEntry.callback_activated_add(self.theirLifeUpdate)
     theirEntry.text = "20"
     theirEntry.show()
     
     resetBtn = Button(self.subWin)
     resetBtn.text = "Reset life totals"
     resetBtn.callback_pressed_add(self.resetLifeTotals)
     resetBtn.show()
     
     entryBox = Box(self.subWin)
     entryBox.size_hint_weight = EXPAND_HORIZ
     entryBox.pack_end(ourEntry)
     entryBox.pack_end(theirEntry)
     entryBox.pack_end(resetBtn)
     entryBox.show()
     
     self.ourWin.resize_object_add(ourLabel)
     self.subWin.resize_object_add(entryBox)
     
     self.ourWin.show()
     self.subWin.show()
     
     self.ourWin.center(True, True)
     self.subWin.center(True, True)
Exemple #8
0
    def newFile(self, obj=None, ignoreSave=False):
        if self.isSaved == True or ignoreSave == True:
            trans = Transit()
            trans.object_add(self.mainEn)
            trans.auto_reverse = True

            trans.effect_wipe_add(ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE,
                                  ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT)

            trans.duration = 0.5
            trans.go()

            time.sleep(0.5)

            self.mainWindow.title_set("Untitlted - ePad")
            self.mainEn.delete()
            self.mainEn = Entry(self.mainWindow,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
            self.mainEn.callback_changed_user_add(self.textEdited)
            self.mainEn.scrollable_set(
                True)  # creates scrollbars rather than enlarge window
            self.mainEn.line_wrap_set(
                False)  # does not allow line wrap (can be changed by user)
            self.mainEn.autosave_set(False)  # set to false to reduce disk I/O
            self.mainEn.elm_event_callback_add(self.eventsCb)
            self.mainEn.markup_filter_append(self.textFilter)
            self.mainEn.show()

            self.mainBox.pack_end(self.mainEn)

            self.isNewFile = True
        elif self.confirmPopup == None:
            self.confirmSave(self.newFile)
def gesture_layer_clicked(obj):
    w = 480
    h = 800

    win = Window("gesture-layer", ELM_WIN_BASIC, title="Gesture Layer",
        autodel=True, size=(w, h))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    photos = []

    photos.append(photo_object_add(win, None,
        os.path.join(img_path, "pol_sky.png"), 200, 200, 365, 400, 0))
    photos.append(photo_object_add(win, None,
        os.path.join(img_path, "pol_twofish.png"), 40, 300, 365, 400, 45))

    en = Entry(win, line_wrap=ELM_WRAP_MIXED)
    en.text = "You can use whatever object you want, even entries like this."

    postit = Layout(win,
        file=(os.path.join(script_path, "postit_ent.edj"), "main"))
    postit.part_content_set("ent", en)

    photos.append(photo_object_add(win, postit, None, 50, 50, 382, 400, 355))

    win.show()
Exemple #10
0
 def __init__(self, parent):
     self.task = None
     Entry.__init__(self, parent, scrollable=True, disabled=True,
                    size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     self.part_text_set('guide', self.GUIDE1)
     self.callback_clicked_add(self._clicked_cb)
     self.callback_unfocused_add(self._unfocused_cb)
     self.show()
Exemple #11
0
 def _gl_content_get(self, gl, part, commit):
     if part == 'elm.swallow.icon':
         return SafeIcon(gl, 'git-commit')
     else:
         en = Entry(gl, editable=False, single_line=True,
                    text='<name>{}</>'.format(commit.sha_short))
         # en.tooltip_window_mode = True  # TODO why this fail??
         en.tooltip_content_cb_set(self._tooltip_content_cb, commit)
         return en
Exemple #12
0
    def __init__(self, parent, app, branch):
        self.app = app
        self.branch = branch

        Popup.__init__(self, parent)
        self.part_text_set("title,text", "Delete branch")
        self.part_content_set("title,icon", Icon(self, standard="user-trash"))

        # main vertical box
        box = Box(self)
        self.content = box
        box.show()

        # sep
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        box.pack_end(sep)
        sep.show()

        # label
        en = Entry(
            self,
            editable=False,
            text="%s<br><br><hilight>%s</hilight><br>" % ("Are you sure you want to delete this branch?", branch.name),
            size_hint_expand=EXPAND_BOTH,
            size_hint_fill=FILL_BOTH,
        )
        box.pack_end(en)
        en.show()

        # force checkbox
        ck = Check(
            self,
            text="Force delete (even if not fully merged)",
            size_hint_expand=EXPAND_BOTH,
            size_hint_align=(0.0, 0.5),
        )
        box.pack_end(ck)
        ck.show()
        self.force_chk = ck

        # buttons
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
        box.pack_end(sep)
        sep.show()

        bt = Button(self, text="Cancel")
        bt.callback_clicked_add(lambda b: self.delete())
        self.part_content_set("button1", bt)
        bt.show()

        bt = Button(self, text="Delete branch")
        bt.callback_clicked_add(self._delete_btn_cb)
        self.part_content_set("button2", bt)
        bt.show()

        #
        self.show()
Exemple #13
0
 def __init__(self, win):
     self.win = win
     Entry.__init__(self, win, single_line=True,
                    size_hint_weight=EXPAND_HORIZ,
                    size_hint_align=FILL_HORIZ)
     self.callback_clicked_add(self._click_cb)
     self.callback_activated_add(self._done_cb, save=True)
     self.callback_unfocused_add(self._done_cb, save=False)
     self.callback_aborted_add(self._done_cb, save=False)
     self.go_passive()
Exemple #14
0
    def select_torrent(self):
        sel = Fileselector(self.win)
        sel.expandable = False
        sel.path_set(os.path.expanduser("~"))
        sel.size_hint_weight_set(1.0, 1.0)
        sel.size_hint_align_set(-1.0, -1.0)
        sel.show()

        sf = Frame(self.win)
        sf.size_hint_weight_set(1.0, 1.0)
        sf.size_hint_align_set(-1.0, -1.0)
        sf.text = "Select torrent file"
        sf.content = sel
        sf.show()

        magnet = Entry(self.win)
        magnet.single_line = True
        magnet.scrollable = True
        if hasattr(magnet, "cnp_selection_get"):
            magnet.cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD,
                                     ELM_SEL_FORMAT_TEXT)
        else:
            import pyperclip
            t = pyperclip.paste()
            if t is not None and t.startswith("magnet:"):
                magnet.entry = t
        magnet.show()

        mf = Frame(self.win)
        mf.size_hint_weight_set(1.0, 0.0)
        mf.size_hint_align_set(-1.0, 0.0)
        mf.text = "Or enter magnet URI here"
        mf.content = magnet
        mf.show()

        mbtn = Button(self.win)
        mbtn.text = "Done"
        mbtn.show()
        mbox = Box(self.win)
        mbox.size_hint_weight_set(1.0, 0.0)
        mbox.size_hint_align_set(-1.0, 0.0)
        mbox.horizontal = True
        mbox.pack_end(mf)
        mbox.pack_end(mbtn)
        mbox.show()

        box = Box(self.win)
        box.size_hint_weight = (1.0, 1.0)
        box.size_hint_align = (-1.0, -1.0)
        box.pack_end(sf)
        box.pack_end(mbox)
        box.show()

        inwin = InnerWindow(self.win)
        inwin.content = box
        sel.callback_done_add(self.add_torrent_cb)
        sel.callback_done_add(lambda x, y: inwin.delete())
        mbtn.callback_clicked_add(self.add_magnet_uri_cb, magnet)
        mbtn.callback_clicked_add(lambda x: inwin.delete())
        inwin.activate()
Exemple #15
0
    def __init__(self, repo, win):
        self.repo = repo
        self.win = win
        self.confirmed = False

        StandardWindow.__init__(self, 'Egitu', 'Egitu', autodel=True)

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

        # title
        en = Entry(self, editable=False,
                   text='<title><align=center>Commit changes</align></title>',
                   size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
        vbox.pack_end(en)
        en.show()

        panes = Panes(self, content_left_size = 0.2, horizontal=True,
                      size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        vbox.pack_end(panes)
        panes.show()
        
        # message entry
        en = Entry(self, editable=True, scrollable=True,
                   size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        en.part_text_set('guide', 'Enter commit message here')
        panes.part_content_set("left", en)
        en.show()
        self.msg_entry = en

        # diff entry
        self.diff_entry = DiffedEntry(self)
        panes.part_content_set("right", self.diff_entry)
        self.diff_entry.show()

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

        bt = Button(self, text="Cancel")
        bt.callback_clicked_add(lambda b: self.delete())
        hbox.pack_end(bt)
        bt.show()

        bt = Button(self, text="Commit")
        bt.callback_clicked_add(self.commit_button_cb)
        hbox.pack_end(bt)
        bt.show()

        # show the window and give focus to the editable entry
        self.size = 500, 500
        self.show()
        en.focus = True

        # load the diff
        repo.request_diff(self.diff_done_cb, only_staged=True)
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()
Exemple #17
0
 def __init__(self, app):
     self.app = app
     Entry.__init__(self, app.win, single_line=True,
                    text='No repository loaded',
                    size_hint_weight=EXPAND_HORIZ,
                    size_hint_align=FILL_HORIZ)
     self.callback_clicked_add(self._click_cb)
     self.callback_activated_add(self._done_cb, save=True)
     self.callback_unfocused_add(self._done_cb, save=False)
     self.callback_aborted_add(self._done_cb, save=False)
     self.go_passive()
Exemple #18
0
 def entryInit(self):
     self.mainEn = Entry(self.mainWindow,
                         scrollable=True,
                         line_wrap=self.wordwrap,
                         autosave=False,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
     self.mainEn.callback_changed_user_add(self.textEdited)
     self.mainEn.elm_event_callback_add(self.eventsCb)
     # self.mainEn.markup_filter_append(self.textFilter)
     self.mainEn.show()
     self.mainBox.pack_end(self.mainEn)
    def select_torrent(self):
        sel = Fileselector(self.win)
        sel.expandable = False
        sel.path_set(os.path.expanduser("~"))
        sel.size_hint_weight_set(1.0, 1.0)
        sel.size_hint_align_set(-1.0, -1.0)
        sel.show()

        sf = Frame(self.win)
        sf.size_hint_weight_set(1.0, 1.0)
        sf.size_hint_align_set(-1.0, -1.0)
        sf.text = "Select torrent file"
        sf.content = sel
        sf.show()

        magnet = Entry(self.win)
        magnet.single_line = True
        magnet.scrollable = True
        if hasattr(magnet, "cnp_selection_get"):
            magnet.cnp_selection_get(ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT)
        else:
            import pyperclip
            t = pyperclip.paste()
            if t is not None and t.startswith("magnet:"):
                    magnet.entry = t
        magnet.show()

        mf = Frame(self.win)
        mf.size_hint_weight_set(1.0, 0.0)
        mf.size_hint_align_set(-1.0, 0.0)
        mf.text = "Or enter magnet URI here"
        mf.content = magnet
        mf.show()

        mbtn = Button(self.win)
        mbtn.text = "Done"
        mbtn.show()
        mbox = Box(self.win)
        mbox.size_hint_weight_set(1.0, 0.0)
        mbox.size_hint_align_set(-1.0, 0.0)
        mbox.horizontal = True
        mbox.pack_end(mf)
        mbox.pack_end(mbtn)
        mbox.show()

        box = Box(self.win)
        box.size_hint_weight = (1.0, 1.0)
        box.size_hint_align = (-1.0, -1.0)
        box.pack_end(sf)
        box.pack_end(mbox)
        box.show()

        inwin = InnerWindow(self.win)
        inwin.content = box
        sel.callback_done_add(self.add_torrent_cb)
        sel.callback_done_add(lambda x, y: inwin.delete())
        mbtn.callback_clicked_add(self.add_magnet_uri_cb, magnet)
        mbtn.callback_clicked_add(lambda x: inwin.delete())
        inwin.activate()
Exemple #20
0
    def entryInit(self):
        self.mainEn = Entry(self.mainWindow, scrollable=True,
                            line_wrap=self.wordwrap, autosave=False,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.mainEn.callback_changed_user_add(self.textEdited)
        self.mainEn.elm_event_callback_add(self.eventsCb)
        self.mainEn.callback_clicked_add(resetCloseMenuCount)
        # delete line lable if it exist so we can create and add new one
        #    Later need to rethink logic here
        try:
            self.line_label.delete()
        except AttributeError:
            pass
        # Add label to show current cursor position
        if SHOW_POS:
            self.line_label = Label(self.mainWindow,
                                    size_hint_weight=EXPAND_HORIZ,
                                    size_hint_align=ALIGN_RIGHT)

            self.mainEn.callback_cursor_changed_add(self.curChanged,
                                                    self.line_label)
            self.curChanged(self.mainEn, self.line_label)
            self.line_label.show()
            self.mainBox.pack_end(self.line_label)
        # self.mainEn.markup_filter_append(self.textFilter)

        self.mainEn.show()
        self.mainEn.focus_set(True)
        try:
            self.mainBox.pack_before(self.mainEn, self.line_label)
        except AttributeError:
            # line_label has not been initialized on first run
            #   Should have better logic on all this
            self.mainBox.pack_end(self.mainEn)
Exemple #21
0
    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()
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.ourList = ourList = List(self,
                                      size_hint_weight=EXPAND_BOTH,
                                      size_hint_align=FILL_BOTH)

        self.keys = []

        ourList.go()
        ourList.show()

        self.ourItems = []

        sframe = Frame(self,
                       size_hint_weight=EXPAND_HORIZ,
                       size_hint_align=FILL_HORIZ)
        sframe.text = "Search"
        self.search = search = Entry(self)
        search.single_line = True
        search.callback_changed_add(self.searchChange)
        sframe.content = search
        search.show()
        sframe.show()

        self.pack_end(ourList)
        self.pack_end(sframe)
Exemple #23
0
    def newFile( self , obj=None, ignoreSave=False ):
        if self.isSaved == True or ignoreSave == True:
            trans = Transit()
            trans.object_add(self.mainEn)
            trans.auto_reverse = True

            trans.effect_wipe_add(
                ELM_TRANSIT_EFFECT_WIPE_TYPE_HIDE,
                ELM_TRANSIT_EFFECT_WIPE_DIR_RIGHT)

            trans.duration = 0.5
            trans.go()
            
            time.sleep(0.5)

            self.mainWindow.title_set("Untitlted - ePad")
            self.mainEn.delete()
            self.mainEn = Entry(self.mainWindow, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
            self.mainEn.callback_changed_user_add(self.textEdited)
            self.mainEn.scrollable_set(True) # creates scrollbars rather than enlarge window
            self.mainEn.line_wrap_set(False) # does not allow line wrap (can be changed by user)
            self.mainEn.autosave_set(False) # set to false to reduce disk I/O
            self.mainEn.elm_event_callback_add(self.eventsCb)
            self.mainEn.markup_filter_append(self.textFilter)
            self.mainEn.show()
            
            self.mainBox.pack_end(self.mainEn)

            self.isNewFile = True
        elif self.confirmPopup == None:
            self.confirmSave(self.newFile)
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 __init__(self, parent_widget, titles=None, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.outPut = Entry(self,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.outPut.editable_set(False)
        self.outPut.scrollable_set(True)
        self.outPut.callback_changed_add(self.changedCb)
        self.outPut.show()

        frame = Frame(self,
                      size_hint_weight=EXPAND_HORIZ,
                      size_hint_align=FILL_HORIZ)
        frame.text = "Input:"
        frame.autocollapse_set(True)
        frame.collapse_go(True)
        frame.show()

        bx = Box(self,
                 size_hint_weight=EXPAND_HORIZ,
                 size_hint_align=FILL_HORIZ)
        bx.horizontal = True
        bx.show()

        frame.content = bx

        self.inPut = Entry(self,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.inPut.single_line_set(True)
        self.inPut.callback_activated_add(self.enterPressed)
        self.inPut.show()

        enterButton = Button(self)
        enterButton.text = "Execute"
        enterButton.callback_pressed_add(self.enterPressed)
        enterButton.show()

        bx.pack_end(self.inPut)
        bx.pack_end(enterButton)

        self.pack_end(self.outPut)
        self.pack_end(frame)

        self.cmd_exe = None
        self.done_cb = None
Exemple #26
0
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.output = Entry(self,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.output.editable_set(False)
        self.output.scrollable_set(True)
        self.output.callback_changed_add(self.cb_changed)
        self.output.show()

        frame = Frame(self,
                      size_hint_weight=EXPAND_HORIZ,
                      size_hint_align=FILL_HORIZ)
        frame.text = 'Input:'
        frame.autocollapse_set(True)
        frame.collapse_go(True)
        frame.show()

        hbx = Box(self,
                  size_hint_weight=EXPAND_HORIZ,
                  size_hint_align=FILL_HORIZ)
        hbx.horizontal = True
        hbx.show()

        frame.content = hbx

        self.input = Entry(self,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.input.single_line_set(True)
        self.input.callback_activated_add(self.cb_enter)
        self.input.show()

        enter_btn = Button(self)
        enter_btn.text = 'Execute'
        enter_btn.callback_pressed_add(self.cb_enter)
        enter_btn.show()

        hbx.pack_end(self.input)
        hbx.pack_end(enter_btn)

        self.pack_end(self.output)
        self.pack_end(frame)

        self.cmd_exe = None
        self.done_cb = None
Exemple #27
0
    def __init__(self, parent, app):
        self.app = app

        Popup.__init__(self, parent)
        self.part_text_set('title,text', 'Save current status')
        self.part_content_set('title,icon', SafeIcon(self, 'git-stash'))

        # main vertical box
        box = Box(self, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        self.content = box
        box.show()

        # separator
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
        box.pack_end(sep)
        sep.show()

        # description
        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        en.part_text_set('guide', 'Stash description (or empty for the default)')
        en.text = 'WIP on ' + app.repo.status.head_describe
        box.pack_end(en)
        en.show()

        # include untracked
        ck = Check(self, text='Include untracked files', state=True,
                   size_hint_expand=EXPAND_HORIZ, size_hint_align=(0.0,0.5))
        box.pack_end(ck)
        ck.show()

        # separator
        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
        box.pack_end(sep)
        sep.show()

        # buttons
        bt = Button(self, text='Close')
        bt.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', bt)
        bt.show()

        bt = Button(self, text='Stash', content=SafeIcon(self, 'git-stash'))
        bt.callback_clicked_add(self._stash_clicked_cb, en, ck)
        self.part_content_set('button2', bt)
        bt.show()

        # focus to the entry and show
        en.select_all()
        en.focus = True
        self.show()
def focus3_clicked(obj, item=None):
    win = StandardWindow("focus3", "Focus 3", autodel=True, size=(320, 480))

    win.focus_highlight_enabled = True

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

    en = Entry(win, scrollable=True, single_line=True, text="An entry",
               size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    en.callback_focused_add(_focused_cb)
    en.callback_unfocused_add(_unfocused_cb)
    bx.pack_end(en)
    en.show()

    bt = Button(win, text="Add", focus_allow=False,
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_add_cb, win, bx)
    bx.pack_end(bt)
    bt.show()

    bt = Button(win, text="Del", focus_allow=False,
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_del_cb, bx)
    bx.pack_end(bt)
    bt.show()

    bt = Button(win, text="hide", focus_allow=False,
                size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_hide_cb)
    bx.pack_end(bt)
    bt.show()

    win.show()
def _add_cb(bt, win, bx):
    en = Entry(win, scrollable=True, single_line=True, text="An entry",
               size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
    en.callback_focused_add(_focused_cb)
    en.callback_unfocused_add(_unfocused_cb)
    bx.pack_start(en)
    en.show()
    def signal_clicked_cb(self, gl, item):
        pp = Popup(self._parent)
        pp.part_text_set('title,text', 'Signal content')

        en = Entry(self, text=prettify_if_needed(item.data['args']))
        en.size_hint_weight = EVAS_HINT_EXPAND, EVAS_HINT_EXPAND
        en.size_hint_align = EVAS_HINT_FILL, EVAS_HINT_FILL
        en.size_hint_min = 800, 800  # TODO: this should be respected :/
        en.editable = False
        en.scrollable = True
        pp.content = en

        bt = Button(pp, text="Close")
        bt.callback_clicked_add(lambda b: pp.delete())
        pp.part_content_set('button2', bt)

        def prettify_clicked_cb(chk):
            options.pretty_output = chk.state
            en.text = prettify_if_needed(item.data['args'])

        ck = Check(pp, text="Prettify")
        ck.state = options.pretty_output
        ck.callback_changed_add(prettify_clicked_cb)
        pp.part_content_set('button1', ck)

        pp.show()
Exemple #31
0
def _add_cb(bt, win, bx):
    en = Entry(win,
               scrollable=True,
               single_line=True,
               text="An entry",
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ)
    en.callback_focused_add(_focused_cb)
    en.callback_unfocused_add(_unfocused_cb)
    bx.pack_start(en)
    en.show()
Exemple #32
0
 def entryInit(self):
     self.mainEn = Entry(self.mainWindow, scrollable=True,
                         line_wrap=self.wordwrap, autosave=False,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
     self.mainEn.callback_changed_user_add(self.textEdited)
     self.mainEn.elm_event_callback_add(self.eventsCb)
     # self.mainEn.markup_filter_append(self.textFilter)
     self.mainEn.show()
     self.mainBox.pack_end(self.mainEn)
def cursor_clicked(obj, item=None):
    win = StandardWindow("cursors", "Cursors", autodel=True, size=(320, 480))
    win.autodel_set(True)

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

    ck = Clock(win, cursor="clock")
    bx.pack_end(ck)
    ck.show()

    bt = Button(win, text="Coffee Mug", cursor="coffee_mug")
    bx.pack_end(bt)
    bt.show()

    bt = Button(win, text="Cursor unset", cursor="bogosity")
    bt.cursor_unset()
    bx.pack_end(bt)
    bt.show()

    lst = List(win,
               size_hint_weight=EXPAND_BOTH,
               size_hint_align=FILL_BOTH,
               cursor="watch")
    lst.item_append("watch over list")
    lst.item_append("watch over list")
    bx.pack_end(lst)
    lst.go()
    lst.show()

    en = Entry(win,
               scrollable=True,
               single_line=True,
               entry="Xterm cursor",
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ,
               cursor="xterm")
    bx.pack_end(en)
    en.show()

    win.show()
Exemple #34
0
    def __init__(self, parent, title=None, msg=None, ok_cb=None):
        Popup.__init__(self, parent)
        self.part_text_set('title,text', title or 'Are you sure?')

        en = Entry(self, scrollable=False, editable=False,
                   text=msg or 'Please confirm',
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        self.content = en
        en.show()

        b = Button(self, text='Cancel')
        b.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', b)
        b.show()
        
        b = Button(self, text='Yes, do it!')
        b.callback_clicked_add(self._confirmed_cb, ok_cb)
        self.part_content_set('button2', b)
        b.show()

        self.show()
 def __init__(self, rent):
     Box.__init__(self, rent)
     self.parent = rent
     
     #This appears on the button in the main swmai window
     self.name = "Light DM"
     #The section in the main window the button is added to
     self.section = "System Settings"
     #Search terms that this module should appear for
     self.searchData = ["lightdm", "autologin", "login", "display"]
     #Command line argument to open this module directly
     self.launchArg = "--lightdm"
     #Should be none by default. This value is used internally by swami
     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('video-display')
     self.icon.show()
     
     self.mainBox = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
     self.mainBox.show()
     
     self.config = {}
     
     with open(LightDMConf) as f:
         for line in f:
             #Sections start with [ - such as [SeatDefaults]
             if line[0] != "[":
                 setting, value = line.replace("\n", "").split("=")
                 
                 e = Entry(self)
                 e.single_line_set(True)
                 e.text = value
                 e.show()
                 
                 f = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
                 f.text = setting
                 f.content = e
                 f.show()
                 
                 self.mainBox.pack_end(f)
                 
                 self.config[setting] = f
     
     buttonBox = Box(self, size_hint_weight = EXPAND_HORIZ, size_hint_align = FILL_BOTH)
     buttonBox.horizontal = True
     
     buttonSave = StandardButton(self, "Save Changes", "ok", self.savePressed)
     buttonSave.show()
     
     buttonReturn = StandardButton(self, "Back", "go-previous", self.returnPressed)
     buttonReturn.show()
     
     buttonBox.pack_end(buttonSave)
     buttonBox.pack_end(buttonReturn)
     buttonBox.show()
     
     self.pack_end(self.mainBox)
     self.pack_end(buttonBox)
Exemple #36
0
def cnp_clicked(obj):
    win = StandardWindow("copypaste", "CopyPaste", autodel=True)
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

    gd = Grid(win, size=(100, 100), size_hint_weight=EXPAND_BOTH)
    win.resize_object_add(gd)
    gd.show()

    en = Entry(win, scrollable=True, line_wrap=ELM_WRAP_CHAR,
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        text="Elementary provides ")
    gd.pack(en, 10, 10, 60, 30)
    en.show()

    bt = Button(win, text="Copy from left entry")
    bt.callback_clicked_add(bt_copy_clicked, en)
    gd.pack(bt, 70, 10, 22, 30)
    bt.show()

    bt = Button(win, text="Clear clipboard")
    bt.callback_clicked_add(bt_clear_clicked, en)
    gd.pack(bt, 70, 70, 22, 20)
    bt.show()

    en = Entry(win, scrollable=True, line_wrap=ELM_WRAP_CHAR,
        size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        text="rich copying and pasting functionality,")
    gd.pack(en, 10, 40, 60, 30)
    en.show()

    bt = Button(win, text="Paste to left entry")
    bt.callback_clicked_add(bt_paste_clicked, en)
    gd.pack(bt, 70, 40, 22, 30)
    bt.show()

    lb = Label(win, text="<b>Clipboard:</b>", size_hint_weight=(0.0, 0.0),
        size_hint_align=FILL_BOTH)
    gd.pack(lb, 10, 70, 60, 10)
    lb.show()

    global glb
    glb = Label(win, text="", size_hint_weight=(0.0, 0.0),
        size_hint_align=FILL_BOTH)
    gd.pack(glb, 10, 80, 60, 10)
    glb.show()

    win.size = 480, 200
    win.show()
    def __init__(self, parent_widget, titles=None, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.outPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.outPut.editable_set(False)
        self.outPut.scrollable_set(True)
        self.outPut.callback_changed_add(self.changedCb)
        self.outPut.show()

        frame = Frame(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
        frame.text = "Input:"
        frame.autocollapse_set(True)
        frame.collapse_go(True)
        frame.show()

        bx = Box(self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
        bx.horizontal = True
        bx.show()

        frame.content = bx

        self.inPut = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.inPut.single_line_set(True)
        self.inPut.callback_activated_add(self.enterPressed)
        self.inPut.show()

        enterButton = Button(self)
        enterButton.text = "Execute"
        enterButton.callback_pressed_add(self.enterPressed)
        enterButton.show()

        bx.pack_end(self.inPut)
        bx.pack_end(enterButton)

        self.pack_end(self.outPut)
        self.pack_end(frame)

        self.cmd_exe = None
        self.done_cb = None
Exemple #38
0
def focus3_clicked(obj, item=None):
    win = StandardWindow("focus3", "Focus 3", autodel=True, size=(320, 480))

    win.focus_highlight_enabled = True

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

    en = Entry(win,
               scrollable=True,
               single_line=True,
               text="An entry",
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ)
    en.callback_focused_add(_focused_cb)
    en.callback_unfocused_add(_unfocused_cb)
    bx.pack_end(en)
    en.show()

    bt = Button(win,
                text="Add",
                focus_allow=False,
                size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_add_cb, win, bx)
    bx.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="Del",
                focus_allow=False,
                size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_del_cb, bx)
    bx.pack_end(bt)
    bt.show()

    bt = Button(win,
                text="hide",
                focus_allow=False,
                size_hint_weight=EXPAND_HORIZ,
                size_hint_align=FILL_HORIZ)
    bt.callback_clicked_add(_hide_cb)
    bx.pack_end(bt)
    bt.show()

    win.show()
Exemple #39
0
def gesture_layer_clicked(obj):
    w = 480
    h = 800

    win = Window("gesture-layer",
                 ELM_WIN_BASIC,
                 title="Gesture Layer",
                 autodel=True,
                 size=(w, h))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    photos = []

    photos.append(
        photo_object_add(win, None, os.path.join(img_path, "pol_sky.png"), 200,
                         200, 365, 400, 0))
    photos.append(
        photo_object_add(win, None, os.path.join(img_path, "pol_twofish.png"),
                         40, 300, 365, 400, 45))

    en = Entry(win, line_wrap=ELM_WRAP_MIXED)
    en.text = "You can use whatever object you want, even entries like this."

    postit = Layout(win,
                    file=(os.path.join(script_path, "postit_ent.edj"), "main"))
    postit.part_content_set("ent", en)

    photos.append(photo_object_add(win, postit, None, 50, 50, 382, 400, 355))

    win.show()
Exemple #40
0
    def __init__(self, parent, app):
        self.app = app
        self.commit = None
        self.win = parent

        Table.__init__(self, parent,  padding=(5,5))
        self.show()

        # description entry
        self.entry = Entry(self, text='Unknown', line_wrap=ELM_WRAP_MIXED,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH,
                           editable=False)
        self.pack(self.entry, 0, 0, 1, 1)
        self.entry.show()

        # gravatar picture
        self.picture = GravatarPict(self)
        self.picture.size_hint_align = 1.0, 0.0
        self.picture.show()
        self.pack(self.picture, 1, 0, 1, 1)

        # action buttons box
        self.action_box = Box(self, horizontal=True,
                              size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=(1.0, 1.0))
        self.pack(self.action_box, 0, 1, 2, 1)
        self.action_box.show()

        # panes
        panes = Panes(self, content_left_size = 0.3, horizontal=True,
                      size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.pack(panes, 0, 2, 2, 1)
        panes.show()

        # file list
        self.itc = GenlistItemClass(item_style='default',
                                    text_get_func=self._gl_text_get,
                                    content_get_func=self._gl_content_get)
        self.diff_list = Genlist(self, homogeneous=True, mode=ELM_LIST_COMPRESS,
                                 select_mode=ELM_OBJECT_SELECT_MODE_ALWAYS,
                                 size_hint_weight=EXPAND_BOTH,
                                 size_hint_align=FILL_BOTH)
        self.diff_list.callback_selected_add(self._list_selected_cb)
        panes.part_content_set('left', self.diff_list)

        # diff entry
        self.diff_entry = DiffedEntry(self)
        panes.part_content_set('right', self.diff_entry)
Exemple #41
0
    def buildDetailsWin(self):
        self.updateText = Entry(self,
                                size_hint_weight=EXPAND_BOTH,
                                size_hint_align=FILL_BOTH)
        self.updateText.editable_set(False)
        self.updateText.scrollable_set(True)
        self.updateText.show()

        closebtn = Button(self)
        closebtn.text_set("Done")
        closebtn.callback_pressed_add(self.innerWinHide)
        closebtn.show()

        box = Box(self,
                  size_hint_weight=EXPAND_BOTH,
                  size_hint_align=FILL_BOTH)
        box.pack_end(self.updateText)
        box.pack_end(closebtn)
        box.show()

        self.innerWin = InnerWindow(self,
                                    size_hint_weight=EXPAND_BOTH,
                                    size_hint_align=FILL_HORIZ)
        self.innerWin.content_set(box)
def cursor_clicked(obj, item=None):
    win = StandardWindow("cursors", "Cursors", autodel=True, size=(320,480))
    win.autodel_set(True)

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

    ck = Clock(win, cursor="clock")
    bx.pack_end(ck)
    ck.show()

    bt = Button(win, text="Coffee Mug", cursor="coffee_mug")
    bx.pack_end(bt)
    bt.show()

    bt = Button(win, text="Cursor unset", cursor="bogosity")
    bt.cursor_unset()
    bx.pack_end(bt)
    bt.show()

    lst = List(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
        cursor="watch")
    lst.item_append("watch over list")
    lst.item_append("watch over list")
    bx.pack_end(lst)
    lst.go()
    lst.show()

    en = Entry(win, scrollable=True, single_line=True, entry="Xterm cursor",
        size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ,
        cursor="xterm")
    bx.pack_end(en)
    en.show()

    win.show()
Exemple #43
0
    def __init__(self):
        """Creates the window and its contents.

        :attribute memory: The first operand.
        :attribute operand: The operand to join the both values.
        :attribute field: The input/display field.
        :attribute table: Formatting table holding the buttons.
        """
        # Create mathematical attributes.
        self.memory = ''
        self.operand = None
        self.display_is_result = False
        # Create the main window.
	self.window = StandardWindow("eCalculate", "eCalculate", autodel=True, size=(300, 300))
        # Create box that holds all GUI elements.
        box = Box(self.window, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.window.resize_object_add(box)
        box.show()
        # Create Input field.
        self.field = Entry(self.window, single_line=True,
                           size_hint_weight=EXPAND_HORIZONTAL,
                           size_hint_align=FILL_HORIZONTAL)
        self.field.markup_filter_append(self.filter_markup)
        box.pack_end(self.field)
        self.field.show()
        # Create table holding the buttons.
        self.table = Table(self.window, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        box.pack_end(self.table)
        self.table.show()
        # Create buttons.
        self.add_button(x=0, y=2, text='1', char='1') 
        self.add_button(x=1, y=2, text='2', char='2') 
        self.add_button(x=2, y=2, text='3', char='3') 
        self.add_button(x=0, y=1, text='4', char='4') 
        self.add_button(x=1, y=1, text='5', char='5') 
        self.add_button(x=2, y=1, text='6', char='6') 
        self.add_button(x=0, y=0, text='7', char='7') 
        self.add_button(x=1, y=0, text='8', char='8') 
        self.add_button(x=2, y=0, text='9', char='9') 
        self.add_button(x=0, y=3, text='0', char='0') 
        self.add_button(x=4, y=0, text='÷', char='/') 
        self.add_button(x=4, y=1, text='×', char='*') 
        self.add_button(x=4, y=2, text='−', char='-') 
        self.add_button(x=4, y=3, text='+', char='+') 
        self.add_button(x=2, y=3, text='=', char='=')
        self.add_button(x=1, y=3, text='.', char='.')
        # Finally show the window.
        self.window.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()
Exemple #45
0
    def __init__(self, parent, repo):
        self.repo = repo
        self.commit = None
        self.win = parent

        Table.__init__(self, parent,  padding=(5,5))
        self.show()

        # gravatar picture
        self.picture = GravatarPict(self)
        self.picture.size_hint_align = 0.0, 0.0
        self.picture.show()
        self.pack(self.picture, 0, 0, 1, 2)

        # description entry
        self.entry = Entry(self, text="Unknown", line_wrap=ELM_WRAP_MIXED,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH,
                           editable=False)
        self.pack(self.entry, 1, 0, 1, 1)
        self.entry.show()

        # action buttons box
        self.action_box = Box(self, horizontal=True,
                              size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=(0.98, 0.98))
        self.pack(self.action_box, 1, 1, 1, 1)
        self.action_box.show()

        # panes
        panes = Panes(self, content_left_size = 0.3, horizontal=True,
                      size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.pack(panes, 0, 2, 2, 1)
        panes.show()

        # file list
        self.diff_list = List(self, size_hint_weight=EXPAND_BOTH,
                                    size_hint_align=FILL_BOTH)
        self.diff_list.callback_selected_add(self.change_selected_cb)
        panes.part_content_set("left", self.diff_list)

        # diff entry
        self.diff_entry = DiffedEntry(self)
        panes.part_content_set("right", self.diff_entry)
Exemple #46
0
    def __init__(self, parent, done_cb, title, text=None, guide=None, not_empty=True):
        self.done_cb = done_cb

        Popup.__init__(self, parent)
        self.part_text_set('title,text', title)

        box = Box(self, padding=(0,4))
        self.content = box
        box.show()

        if text:
            lb = Label(self, text=text)
            box.pack_end(lb)
            lb.show()

        en = Entry(self, single_line=True, scrollable=True,
                   size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
        if guide is not None:
            en.part_text_set('guide', guide)
        box.pack_end(en)
        en.show()

        sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_HORIZ)
        box.pack_end(sep)
        sep.show()

        b = Button(self, text='Cancel')
        b.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', b)
        b.show()
        
        b = Button(self, text='OK', disabled=not_empty)
        b.callback_clicked_add(self._confirmed_cb, en, done_cb)
        self.part_content_set('button2', b)
        b.show()

        if not_empty is True:
            en.callback_changed_user_add(self._entry_changed, b)

        en.focus = True
        self.show()
Exemple #47
0
    def __init__(self, parent):
        Popup.__init__(self, parent)

        self.part_text_set("title,text", "Document is encrypted")

        e = self.e = Entry(self, password=True)
        e.part_text_set("guide", "Enter Password")
        self.content_set(e)
        e.show()

        okb = Button(self, text="OK")
        self.part_content_set("button1", okb)
        okb.callback_clicked_add(lambda x: self.okcb())
        okb.show()

        canb = Button(self, text="Cancel")
        self.part_content_set("button2", canb)
        canb.callback_clicked_add(lambda x: self.delete())
        canb.show()

        self.show()
class ourCommand(object):
    def __init__(self, cmd):
        self.cmd = cmd
        self.cmd_exe = None
        
        win = self.win = Window("ecore-ex", ELM_WIN_DIALOG_BASIC)
        win.title = "Ecore Example"
        win.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
        win.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
        win.resize(300, 200)
        win.callback_delete_request_add(lambda o: elementary.exit())
        win.show()
        win.activate()
        
        self.sendEntry = Entry(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
        self.sendEntry.show()
        
        self.sendButton = Button(win, size_hint_weight=EXPAND_HORIZ,
                              size_hint_align=FILL_HORIZ)
        self.sendButton.text = "Send!"
        self.sendButton.callback_pressed_add(self.sendPressed)
        self.sendButton.show()
        
        box = Box(win, size_hint_weight=EXPAND_HORIZ,
                           size_hint_align=FILL_HORIZ)
        box.pack_end(self.sendEntry)
        box.pack_end(self.sendButton)
        box.show()
        
        win.resize_object_add(box)
        
        self.run_command(cmd)
    
    def sendPressed(self, btn):
        print "Sending Data: %s"%(self.sendEntry.text)
        if self.cmd_exe:
            ourResult = self.cmd_exe.send("%s\n"%self.sendEntry.text)
            print("Send Success: %s"%ourResult)
        self.sendEntry.text = ""
        
    def run_command(self, command):
        self.cmd_exe = cmd = ecore.Exe(
            command,
            ecore.ECORE_EXE_PIPE_READ |
            ecore.ECORE_EXE_PIPE_ERROR |
            ecore.ECORE_EXE_PIPE_WRITE
        )
        cmd.on_add_event_add(self.command_started)
        cmd.on_data_event_add(self.received_data)
        cmd.on_error_event_add(self.received_error)
        cmd.on_del_event_add(self.command_done)
        
    def command_started(self, cmd, event, *args, **kwargs):
        print("Command started.\n")

    def received_data(self, cmd, event, *args, **kwargs):
        print("Output: %s"%event.data)

    def received_error(self, cmd, event, *args, **kwargs):
        print("Error: %s" % event.data)

    def command_done(self, cmd, event, *args, **kwargs):
        print("Command done.")
        elementary.exit()
Exemple #49
0
    def __init__(self, parent, session):
        PreferencesDialog.__init__(self, "Session")

        # TODO: Construct and populate this with an Idler

        self.session = session

        widgets = {}

        elm_conf = Configuration()

        s = session.settings()

        t = Table(self,
                  padding=(5, 5),
                  homogeneous=True,
                  size_hint_align=FILL_BOTH)
        self.box.pack_end(t)
        t.show()

        i = 0

        INT_MIN = -2147483648
        INT_MAX = 2147483647

        scale = elm_conf.scale

        for k in dir(s):
            if k.startswith("__"): continue
            try:
                a = getattr(s, k)
                if isinstance(a, lt.disk_cache_algo_t):
                    w = Spinner(t)
                    w.size_hint_align = FILL_HORIZ
                    # XXX: lt-rb python bindings don't have all values.
                    w.min_max = 0, 2  #len(lt.disk_cache_algo_t.values.keys())
                    for name, val in lt.disk_cache_algo_t.names.items():
                        w.special_value_add(val, name)
                    w.value = a
                elif isinstance(a, bool):
                    w = Check(t)
                    w.size_hint_align = 1.0, 0.0
                    w.style = "toggle"
                    w.state = a
                elif isinstance(a, int):
                    w = Spinner(t)
                    w.size_hint_align = FILL_HORIZ
                    w.min_max = INT_MIN, INT_MAX
                    w.value = a
                elif isinstance(a, float):
                    w = Slider(t)
                    w.size_hint_align = FILL_HORIZ
                    w.size_hint_weight = EXPAND_HORIZ
                    w.unit_format = "%1.2f"
                    if k.startswith("peer_turnover"):
                        w.min_max = 0.0, 1.0
                    else:
                        w.min_max = 0.0, 20.0
                    w.value = a
                elif k == "peer_tos":
                    # XXX: This is an int pair in libtorrent,
                    #      which doesn't have a python equivalent.
                    continue
                elif k == "user_agent":
                    w = Entry(t)
                    w.size_hint_align = 1.0, 0.0
                    w.size_hint_weight = EXPAND_HORIZ
                    w.single_line = True
                    w.editable = False
                    w.entry = cgi.escape(a)
                else:
                    w = Entry(t)
                    w.part_text_set("guide", "Enter here")
                    w.size_hint_align = FILL_HORIZ
                    w.size_hint_weight = EXPAND_HORIZ
                    w.single_line = True
                    w.entry = cgi.escape(a)
                l = Label(t)
                l.text = k.replace("_", " ").capitalize()
                l.size_hint_align = 0.0, 0.0
                l.size_hint_weight = EXPAND_HORIZ
                l.show()
                t.pack(l, 0, i, 1, 1)
                #w.size_hint_min = scale * 150, scale * 25
                t.pack(w, 1, i, 1, 1)
                w.show()
                widgets[k] = w
                i += 1
            except TypeError:
                pass  #print("Error {}".format(k))

        save_btn = Button(self)
        save_btn.text = "Apply session settings"
        save_btn.callback_clicked_add(self.apply_settings, widgets, session)
        save_btn.show()
        self.box.pack_end(save_btn)
def map_clicked(obj):
    win = StandardWindow("map", "Map test", autodel=True, size=(600, 600))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    map_obj = Map(win, zoom=2)
    map_obj.size_hint_weight = EXPAND_BOTH
    map_obj.size_hint_align = FILL_BOTH
    map_obj.callback_tile_load_add(cb_map_load)
    map_obj.callback_tile_loaded_add(cb_map_load)
    map_obj.event_callback_add(EVAS_CALLBACK_MOUSE_DOWN, cb_map_mouse_down)
    vbox.pack_end(map_obj)
    map_obj.show()

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

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

    bt = Button(win, text="Goto")
    bt.callback_clicked_add(cb_btn_goto, map_obj)
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win, text="Zoom +")
    bt.callback_clicked_add(cb_btn_zoom, map_obj, 1)
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win, text="Zoom -")
    bt.callback_clicked_add(cb_btn_zoom, map_obj, -1)
    hbox.pack_end(bt)
    bt.show()

    sl = Slider(win, text="Rotation:", min_max=(0, 360), value=0,
        indicator_format="%3.0f")
    sl.callback_changed_add(cb_slider_rot, map_obj)
    hbox.pack_end(sl)
    sl.show()

    src_type = ELM_MAP_SOURCE_TYPE_TILE
    ho = Hoversel(win, hover_parent=win,
                  text="Tiles: %s" % (map_obj.source_get(src_type)))
    for src in map_obj.sources_get(src_type):
        ho.item_add(src)
    ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Tiles")
    hbox.pack_end(ho)
    ho.show()

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

    ck = Check(win, text="wheel_disabled")
    ck.callback_changed_add(lambda bt: map_obj.wheel_disabled_set(bt.state))
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="paused")
    ck.callback_changed_add(lambda bt: map_obj.paused_set(bt.state))
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="hide overlays")
    ck.callback_changed_add(cb_chk_overlays_hidden, map_obj)
    hbox.pack_end(ck)
    ck.show()

    ck = Check(win, text="pause overlays")
    ck.callback_changed_add(cb_chk_overlays_paused, map_obj)
    hbox.pack_end(ck)
    ck.show()

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

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

    src_type = ELM_MAP_SOURCE_TYPE_ROUTE
    ho = Hoversel(win, hover_parent=win,
                  text="Routes: %s" % (map_obj.source_get(src_type)))
    for src in map_obj.sources_get(src_type):
        ho.item_add(src)
    ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Routes")
    hbox.pack_end(ho)
    ho.show()

    lb = Label(win, text="Set Start and End point to calculate route")
    hbox.pack_end(lb)
    lb.show()
    map_obj.data["lb_distance"] = lb

    bt = Button(win, text="Calc route")
    bt.callback_clicked_add(cb_btn_calc_route, map_obj)
    hbox.pack_end(bt)
    bt.show()

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

    hbox = Box(win, horizontal=True)
    hbox.size_hint_weight = EXPAND_HORIZ
    hbox.size_hint_align = FILL_HORIZ
    vbox.pack_end(hbox)
    hbox.show()
    
    src_type = ELM_MAP_SOURCE_TYPE_NAME
    ho = Hoversel(win, hover_parent=win,
                  text="Names: %s" % (map_obj.source_get(src_type)))
    for src in map_obj.sources_get(src_type):
        ho.item_add(src)
    ho.callback_selected_add(cb_hovsel_selected, map_obj, src_type, "Names")
    hbox.pack_end(ho)
    ho.show()

    en = Entry(win, scrollable=True, text="type an address here")
    en.size_hint_weight = EXPAND_BOTH
    en.size_hint_align = FILL_BOTH
    en.single_line = True
    hbox.pack_end(en)
    en.show()

    bt = Button(win, text="Search address")
    bt.callback_clicked_add(cb_btn_search_name, map_obj, en)
    hbox.pack_end(bt)
    bt.show()

    bt = Button(win, text="Search start point")
    bt.callback_clicked_add(cb_btn_search_region, map_obj, en)
    hbox.pack_end(bt)
    bt.show()


    print_map_info(map_obj)
    win.show()
    def __init__(self, parent, h):
        if not h.is_valid():
            Information(parent.win, "Invalid torrent handle.")
            return

        if not h.has_metadata():
            Information(parent.win, "Torrent contains no metadata.")
            return

        i = h.get_torrent_info()

        InnerWindow.__init__(self, parent.win)

        box = Box(self)
        box.size_hint_align = -1.0, -1.0
        box.size_hint_weight = 1.0, 1.0

        tname = Label(self)
        tname.size_hint_align = -1.0, 0.5
        tname.line_wrap = ELM_WRAP_CHAR
        tname.ellipsis = True
        tname.text = "{}".format(cgi.escape(i.name()))
        tname.show()
        box.pack_end(tname)

        for func in i.comment, i.creation_date, i.creator:
            try:
                w = func()
            except Exception as e:
                log.debug(e)
            else:
                if w:
                    f = Frame(self)
                    f.size_hint_align = -1.0, 0.0
                    f.text = func.__name__.replace("_", " ").capitalize()
                    l = Label(self)
                    l.ellipsis = True
                    l.text = cgi.escape(str(w))
                    l.show()
                    f.content = l
                    f.show()
                    box.pack_end(f)

        tpriv = Check(self)
        tpriv.size_hint_align = 0.0, 0.0
        tpriv.text = "Private"
        tpriv.tooltip_text_set("Whether this torrent is private.<br> \
            i.e., it should not be distributed on the trackerless network<br> \
            (the kademlia DHT).")
        tpriv.disabled = True
        tpriv.state = i.priv()

        magnet_uri = lt.make_magnet_uri(h)

        f = Frame(self)
        f.size_hint_align = -1.0, 0.0
        f.text = "Magnet URI"
        me_box = Box(self)
        me_box.horizontal = True
        me = Entry(self)
        me.size_hint_align = -1.0, 0.0
        me.size_hint_weight = 1.0, 0.0
        #me.editable = False
        me.entry = magnet_uri
        me_box.pack_end(me)
        me.show()
        me_btn = Button(self)
        me_btn.text = "Copy"
        if hasattr(me, "cnp_selection_set"):
            me_btn.callback_clicked_add(
                lambda x: me.top_widget.cnp_selection_set(
                    ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT, me.text))
        else:
            import pyperclip
            me_btn.callback_clicked_add(lambda x: pyperclip.copy(magnet_uri))
        me_btn.show()
        me_box.pack_end(me_btn)
        me_box.show()
        f.content = me_box
        f.show()
        box.pack_end(f)

        fl_btn = Button(self)
        fl_btn.text = "Files ->"
        fl_btn.callback_clicked_add(self.file_list_cb, h)

        xbtn = Button(self)
        xbtn.text_set("Close")
        xbtn.callback_clicked_add(lambda x: self.delete())

        for w in tpriv, fl_btn, xbtn:
            w.show()
            box.pack_end(w)

        box.show()

        nf = self.nf = Naviframe(self)
        nf.item_simple_push(box)

        self.content_set(nf)
        self.activate()
Exemple #52
0
    def __init__(self, rent):
        Box.__init__(self, rent)
        self.parent = rent

        #This appears on the button in the main swmai window
        self.name = "Startup Applications"
        #The section in the main window the button is added to
        self.section = "Applications"
        #Search terms that this module should appear for
        self.searchData = ["startup", "command", "applications", "apps"]
        #Command line argument to open this module directly
        self.launchArg = "--startupapps"
        #Should be none by default. This value is used internally by swami
        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('system-run')
        self.icon.show()

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

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

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

        buttonFlip = StandardButton(self, "Startup Commands",
                                    "preferences-system", self.flipPressed)
        buttonFlip.show()

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

        buttonBox.pack_end(buttonApply)
        buttonBox.pack_end(buttonFlip)
        buttonBox.pack_end(buttonReturn)
        buttonBox.show()

        startupApplications = []

        with open(StartupApplicationsFile, "a+") as startupFile:
            for line in startupFile:
                startupApplications.append(line.rstrip())

        desktopFiles = []

        for ourPath in ApplicationPaths:
            desktopFiles += [
                os.path.join(dp, f) for dp, dn, filenames in os.walk(ourPath)
                for f in filenames if os.path.splitext(f)[1] == '.desktop'
            ]

        self.startupList = startupList = List(self,
                                              size_hint_weight=EXPAND_BOTH,
                                              size_hint_align=FILL_BOTH)

        self.applicationsList = applicationsList = SearchableList(
            self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)

        startupToAdd = []
        applicationsToAdd = []

        for d in desktopFiles:
            if os.access(d, os.R_OK):
                with open(d) as desktopFile:
                    fileName = d.split("/")[-1]
                    icon = None
                    for line in desktopFile:
                        if line[:5] == "Name=":
                            name = line[5:][:-1]

                        if line[:5] == "Icon=":
                            icon = line[5:].strip()

                    try:
                        iconObj = Icon(self,
                                       standard=icon,
                                       size_hint_weight=EXPAND_BOTH,
                                       size_hint_align=FILL_BOTH)
                    except:
                        iconObj = Icon(self,
                                       standard="preferences-system",
                                       size_hint_weight=EXPAND_BOTH,
                                       size_hint_align=FILL_BOTH)
                        icon = None

                    if fileName in startupApplications:
                        startupToAdd.append([name, iconObj, fileName, icon])
                    else:
                        applicationsToAdd.append(
                            [name, iconObj, fileName, icon])
            else:
                # Broken link or file problem, inform user
                print "Swami IOError: [Errno 2] No such file or directory: {0}".format(
                    d)

        startupToAdd.sort()
        applicationsToAdd.sort()

        for s in startupToAdd:
            ourItem = startupList.item_append(s[0], s[1])
            ourItem.data["file"] = s[2]
            ourItem.data["icon"] = s[3]
            #ourItem.append_to(startupList)
            #startupList.item_append(ourItem)

        for a in applicationsToAdd:
            ourItem = applicationsList.item_append(a[0], a[1])
            ourItem.data["file"] = a[2]
            ourItem.data["icon"] = a[3]
            #ourItem.append_to(applicationsList.ourList)
            #applicationsList.item_append(a[0], a[1])

        startupList.callback_clicked_double_add(self.startupAppRemove)
        applicationsList.callback_clicked_double_add(self.startupAppAdd)

        startupList.go()
        startupList.show()
        applicationsList.show()

        startupFrame = Frame(self,
                             size_hint_weight=EXPAND_BOTH,
                             size_hint_align=FILL_BOTH)
        startupFrame.text = "Startup Applications"
        startupFrame.content_set(startupList)
        startupFrame.show()

        otherFrame = Frame(self,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        otherFrame.text = "Other Applications"
        otherFrame.content_set(applicationsList)
        otherFrame.show()

        self.mainBox.pack_end(startupFrame)
        self.mainBox.pack_end(otherFrame)

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

        self.commandsList = commandsList = List(self,
                                                size_hint_weight=EXPAND_BOTH,
                                                size_hint_align=FILL_BOTH)

        with open(StartupCommandsFile, "a+") as scf:
            for line in scf:
                if line.rstrip()[-3:] == "| \\":
                    commandsList.item_append(line.rstrip()[:-3])
                else:
                    commandsList.item_append(line.rstrip())

        commandsList.callback_clicked_right_add(self.commandRightClicked)

        commandsList.go()
        commandsList.show()

        commandBox = Box(self,
                         size_hint_weight=EXPAND_HORIZ,
                         size_hint_align=(1, 0.5))
        commandBox.horizontal = True
        commandBox.show()

        self.newCommandEntry = newCommandEntry = Entry(
            self, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
        newCommandEntry.single_line = True
        newCommandEntry.text = "<i>Type command here</i>"
        newCommandEntry.data["default text"] = True
        newCommandEntry.callback_clicked_add(self.entryClicked)
        newCommandEntry.show()

        newCommandButton = StandardButton(self, "Add Command", "add",
                                          self.newCmdPressed)
        newCommandButton.show()

        delCommandButton = StandardButton(self, "Delete Command", "exit",
                                          self.delCmdPressed)
        delCommandButton.show()

        commandBox.pack_end(newCommandButton)
        commandBox.pack_end(delCommandButton)

        newCommandFrame = Frame(self,
                                size_hint_weight=EXPAND_HORIZ,
                                size_hint_align=FILL_BOTH)
        newCommandFrame.text = "Add Startup Command:"
        newCommandFrame.content_set(newCommandEntry)
        newCommandFrame.show()

        self.backBox.pack_end(commandsList)
        self.backBox.pack_end(newCommandFrame)
        self.backBox.pack_end(commandBox)

        self.flip = Flip(self,
                         size_hint_weight=EXPAND_BOTH,
                         size_hint_align=FILL_BOTH)
        self.flip.part_content_set("front", self.mainBox)
        self.flip.part_content_set("back", self.backBox)
        self.flip.show()

        self.pack_end(self.flip)
        self.pack_end(buttonBox)
Exemple #53
0
def tooltip_clicked(obj):
    win = StandardWindow("tooltips", "Tooltips", autodel=True, size=(400, 500))
    if obj is None:
        win.callback_delete_request_add(lambda o: elementary.exit())

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

    tb = Toolbar(win,
                 homogeneous=False,
                 size_hint_weight=EXPAND_HORIZ,
                 size_hint_align=FILL_HORIZ)
    bx.pack_end(tb)
    tb.show()

    ti = tb.item_append("folder-new", "Open", None, None)
    ti.tooltip_text_set("Opens a file")

    ti = tb.item_append("clock", "Icon", None, None)
    ti.tooltip_content_cb_set(_tt_item_icon, None)
    ti.tooltip_style_set("transparent")

    bt = Button(win, text="Simple text tooltip")
    bt.tooltip_text_set("Simple text tooltip")
    bx.pack_end(bt)
    bt.show()

    def _tt_text_replace(obj, data):
        value = data.get("value")
        if not value:
            value = 1
        obj.tooltip_text_set("count=%d" % value)
        value += 1
        data["value"] = value

    bt = Button(win, text="Simple text tooltip, click to change")
    bt.tooltip_text_set("Initial")
    data = dict()
    bt.callback_clicked_add(_tt_text_replace, data)
    bx.pack_end(bt)
    bt.show()

    def _tt_text_replace_timer_cb(obj, data):
        _tt_text_replace(obj, data)
        return True

    def _tt_text_replace_timed(obj, data, *args, **kargs):
        timer = data.get("timer")
        if timer:
            timer.delete()
            del data["timer"]
            obj.text_set("Simple text tooltip, click to start changed timed")
            return
        data["timer"] = Timer(1.5, _tt_text_replace_timer_cb, obj, data)
        obj.text_set("Simple text tooltip, click to stop changed timed")

    bt = Button(win, text="Simple text tooltip, click to start changed timed")
    bt.tooltip_text_set("Initial")
    data = dict()
    bt.callback_clicked_add(_tt_text_replace_timed, data)
    bx.pack_end(bt)
    bt.show()
    bt.on_del_add(_tt_timer_del, data)

    bt = Button(win, text="Icon tooltip")
    bt.tooltip_content_cb_set(_tt_icon, None)
    bx.pack_end(bt)
    bt.show()

    def _tt_icon_replace_timer_cb(obj, data):
        value = data.get("value")
        data["value"] = not value
        if value:
            obj.tooltip_content_cb_set(_tt_icon)
        else:
            obj.tooltip_content_cb_set(_tt_icon2)
        return True

    def _tt_icon_replace_timed(obj, data, *args, **kargs):
        timer = data.get("timer")
        if timer:
            timer.delete()
            del data["timer"]
            obj.text_set("Icon tooltip, click to start changed timed")
            return
        data["timer"] = timer_add(1.5, _tt_icon_replace_timer_cb, obj, data)
        obj.text_set("Icon tooltip, click to stop changed timed")

    bt = Button(win, text="Icon tooltip, click to start changed timed")
    bt.tooltip_content_cb_set(_tt_icon)
    data = dict()
    bt.callback_clicked_add(_tt_icon_replace_timed, data)
    bx.pack_end(bt)
    bt.show()
    bt.on_del_add(_tt_timer_del, data)

    bt = Button(win, text="Transparent Icon tooltip")
    bt.tooltip_content_cb_set(_tt_icon, None)
    bt.tooltip_style_set("transparent")
    bx.pack_end(bt)
    bt.show()

    def _tt_style_replace_timer_cb(obj, data):
        value = data.get("value")
        data["value"] = not value
        if value:
            obj.tooltip_style_set()
        else:
            obj.tooltip_style_set("transparent")
        return True

    def _tt_style_replace_timed(obj, data, *args, **kargs):
        timer = data.get("timer")
        if timer:
            timer.delete()
            del data["timer"]
            obj.text_set("Icon tooltip style, click to start changed timed")
            return
        data["timer"] = timer_add(1.5, _tt_style_replace_timer_cb, obj, data)
        obj.text_set("Icon tooltip, click to stop changed timed")

    bt = Button(win, text="Icon tooltip style, click to start changed timed")
    bt.tooltip_content_cb_set(_tt_icon, None)
    data = dict()
    bt.callback_clicked_add(_tt_style_replace_timed, data)
    bx.pack_end(bt)
    bt.show()
    bt.on_del_add(_tt_timer_del, data)

    def _tt_visible_lock_toggle(obj, data, *args, **kargs):
        value = data.get("value")
        data["value"] = not value
        if value:
            obj.text_set("Unlocked tooltip visibility")
            obj.tooltip_hide()
        else:
            obj.text_set("Locked tooltip visibility")
            obj.tooltip_show()

    bt = Button(win, text="Unlocked tooltip visibility")
    bt.tooltip_text_set(
        "This tooltip is unlocked visible,<br> click the button to lock!")
    data = dict()
    bt.callback_clicked_add(_tt_visible_lock_toggle, data)
    bx.pack_end(bt)
    bt.show()

    def _tt_move_freeze_toggle(obj, *args, **kargs):
        if obj.tooltip_move_freeze_get():
            obj.text_set("Unfreezed tooltip movement")
            obj.tooltip_move_freeze_pop()
        else:
            obj.text_set("Freezed tooltip movement")
            obj.tooltip_move_freeze_push()

    bt = Button(win, text="Freezed tooltip movement")
    bt.tooltip_text_set(
        "This tooltip has freezed movement,<br> click the button to unfreeze!")
    bt.tooltip_move_freeze_push()
    bt.callback_clicked_add(_tt_move_freeze_toggle)
    bx.pack_end(bt)
    bt.show()

    en = Entry(win,
               scrollable=True,
               single_line=True,
               entry="Hello, some scrolled entry here!",
               size_hint_weight=EXPAND_HORIZ,
               size_hint_align=FILL_HORIZ)
    en.tooltip_text_set("Type something here!")
    bx.pack_end(en)
    en.show()

    lst = List(win,
               size_hint_weight=EXPAND_BOTH,
               size_hint_align=FILL_BOTH,
               size_hint_min=(100, 100))
    li = lst.item_append("Hello")
    li.tooltip_text_set("Something useful here?")
    li = lst.item_append("Icon Tooltip")
    li.tooltip_content_cb_set(_tt_item_icon, None)
    bx.pack_end(lst)
    lst.go()
    lst.show()

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.resize(400, 200)
        self.show()
Exemple #55
0
class EmbeddedTerminal(Box):
    '''Embedded Terminal class.'''
    def __init__(self, parent_widget, *args, **kwargs):
        Box.__init__(self, parent_widget, *args, **kwargs)

        self.output = Entry(self,
                            size_hint_weight=EXPAND_BOTH,
                            size_hint_align=FILL_BOTH)
        self.output.editable_set(False)
        self.output.scrollable_set(True)
        self.output.callback_changed_add(self.cb_changed)
        self.output.show()

        frame = Frame(self,
                      size_hint_weight=EXPAND_HORIZ,
                      size_hint_align=FILL_HORIZ)
        frame.text = 'Input:'
        frame.autocollapse_set(True)
        frame.collapse_go(True)
        frame.show()

        hbx = Box(self,
                  size_hint_weight=EXPAND_HORIZ,
                  size_hint_align=FILL_HORIZ)
        hbx.horizontal = True
        hbx.show()

        frame.content = hbx

        self.input = Entry(self,
                           size_hint_weight=EXPAND_BOTH,
                           size_hint_align=FILL_BOTH)
        self.input.single_line_set(True)
        self.input.callback_activated_add(self.cb_enter)
        self.input.show()

        enter_btn = Button(self)
        enter_btn.text = 'Execute'
        enter_btn.callback_pressed_add(self.cb_enter)
        enter_btn.show()

        hbx.pack_end(self.input)
        hbx.pack_end(enter_btn)

        self.pack_end(self.output)
        self.pack_end(frame)

        self.cmd_exe = None
        self.done_cb = None

    # pylint: disable=no-self-use
    def cb_changed(self, obj):
        '''Output changed, move cursor'''
        obj.cursor_end_set()

    def cb_enter(self, btn):
        '''Enter pressed on input'''
        if not self.cmd_exe:
            self.run_cmd(self.input.text)
            self.input.text = ''
        else:
            self.cmd_exe.send(f'{self.input.text}\n')
            self.input.text = ''

    def run_cmd(self, command, done_cb=None):
        '''Run command capture ouput'''
        command = markup_to_utf8(command)
        # pylint: disable=c-extension-no-member
        self.cmd_exe = cmd = ecore.Exe(
            command, ecore.ECORE_EXE_PIPE_READ | ecore.ECORE_EXE_PIPE_ERROR
            | ecore.ECORE_EXE_PIPE_WRITE)
        cmd.on_add_event_add(self.cb_started)
        cmd.on_data_event_add(self.cb_data)
        cmd.on_error_event_add(self.cb_error)
        cmd.on_del_event_add(self.cb_done)

        self.done_cb = done_cb

    def cb_started(self, cmd, event, *args, **kwargs):
        '''Command start'''
        self.output.entry_append('---------------------------------')
        self.output.entry_append('<br>')

    def cb_data(self, cmd, event, *args, **kwargs):
        '''Stdout callback'''
        self.output.entry_append(f'{event.data}')
        self.output.entry_append('<br>')

    def cb_error(self, cmd, event, *args, **kwargs):
        '''Stderr callback'''
        self.output.entry_append(f'Error: {event.data}')

    def cb_done(self, cmd, event, *args, **kwargs):
        '''Command finished callback'''
        self.output.entry_append('---------------------------------')
        self.output.entry_append('<br>')
        self.cmd_exe = None
        if self.done_cb:
            if callable(self.done_cb):
                self.done_cb()
Exemple #56
0
 def __init__(self, canvas, *args, **kwargs):
     Entry.__init__(self, canvas, *args, **kwargs)
     self.scrollable = True
Exemple #57
0
    def __init__(self, parent, method):
        Popup.__init__(self, parent)
        self._method = method
        self._param_entry = None
        self._return_entry = None

        # title
        self.part_text_set('title,text', 'Method: %s()' % method.name)
        self.show()

        # content is vbox
        vbox = Box(parent)
        vbox.show()
        self.content = vbox

        # params label + entry
        if len(method.params) > 0:
            label = Label(parent)
            label.size_hint_align = 0.0, 0.5
            label.text = 'Params: ' + method.params_str
            label.show()
            vbox.pack_end(label)

            en = Entry(parent)
            self._param_entry = en
            en.editable = True
            en.scrollable = True
            en.single_line = True
            en.entry = ''
            en.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
            en.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
            en.show()
            vbox.pack_end(en)

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

        # returns label + entry
        label = Label(parent)
        label.size_hint_align = 0.0, 0.5
        label.text = 'Returns: '
        label.text += method.returns_str if method.returns_str else 'None'
        label.show()
        vbox.pack_end(label)

        en = Entry(parent)
        self._return_entry = en
        en.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
        en.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
        en.editable = False
        en.scrollable = True
        en.disabled = True
        en.single_line = True  # TODO this is wrong, but the only way to show the entry :/
        en.entry = '<br> <br> <br>'
        en.show()
        vbox.pack_end(en)

        # pretty print check button
        def pretty_output_clicked_cb(chk):
            options.pretty_output = chk.state

        ch = Check(parent)
        ch.size_hint_align = 0.0, 0.5
        ch.text = "Prettify output (loosing type infos)"
        ch.state = options.pretty_output
        ch.callback_changed_add(pretty_output_clicked_cb)
        ch.show()
        vbox.pack_end(ch)

        # popup buttons
        btn = Button(parent)
        btn.text = 'Close'
        btn.callback_clicked_add(lambda b: self.delete())
        self.part_content_set('button1', btn)

        btn = Button(parent)
        btn.text = 'Clear output'
        btn.callback_clicked_add(lambda b: self._return_entry.entry_set(''))
        self.part_content_set('button2', btn)

        btn = Button(parent)
        btn.text = 'Run method'
        btn.callback_clicked_add(self.run_clicked_cb)
        self.part_content_set('button3', btn)
Exemple #58
0
    def __init__(self,
                 command=None,
                 win=None,
                 start_callback=None,
                 end_callback=None,
                 *args,
                 **kwargs):
        if not win:
            nowindow = True
            win = self.win = Window("esudo", ELM_WIN_DIALOG_BASIC)
            win.title = "eSudo"
            win.borderless = True
            win.size_hint_weight = evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND
            win.size_hint_align = evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL
            win.resize(300, 200)
            win.callback_delete_request_add(lambda o: elementary.exit())
            win.layer_set(11)
            #~ win.fullscreen = True
            win.show()
            win.activate()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        self.iw = iw = InnerWindow(win)
        iw.content = bz
        iw.show()
        iw.activate()
        if self.cmd:
            en.focus = True
def calendar2_clicked(obj, item=None):
    weekdays = [
        "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday",
        "Saturday"
    ]

    win = StandardWindow("calendar2", "Calendar 2", autodel=True)

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

    bxh = Box(bx,
              horizontal=True,
              size_hint_weight=EXPAND_BOTH,
              size_hint_align=FILL_BOTH)
    bxh.show()
    bx.pack_end(bxh)

    # Wide cal
    cal = Calendar(bx,
                   size_hint_weight=EXPAND_BOTH,
                   size_hint_align=FILL_BOTH,
                   weekdays_names=weekdays,
                   first_day_of_week=ELM_DAY_SATURDAY,
                   interval=0.4,
                   min_max_year=(2010, 2020))
    cal.show()
    bx.pack_end(cal)

    # Top left cal
    cal2 = Calendar(bxh,
                    size_hint_weight=EXPAND_BOTH,
                    size_hint_align=FILL_BOTH,
                    select_mode=ELM_CALENDAR_SELECT_MODE_NONE)
    cal2.show()
    bxh.pack_end(cal2)

    # Top right cal
    cal3 = Calendar(bxh,
                    size_hint_weight=EXPAND_BOTH,
                    size_hint_align=FILL_BOTH)

    selected_time = datetime.now() + timedelta(34)
    cal3.selected_time = selected_time

    selected_time = datetime.now() + timedelta(1)
    cal3.mark_add("checked", selected_time, ELM_CALENDAR_UNIQUE)

    del (cal3.marks)
    selected_time = datetime.now()
    cal3.mark_add("checked", selected_time, ELM_CALENDAR_DAILY)
    cal3.mark_add("holiday", selected_time, ELM_CALENDAR_DAILY)
    cal3.marks_draw()
    cal3.show()
    bxh.pack_end(cal3)

    en = Entry(win,
               size_hint_weight=EXPAND_BOTH,
               size_hint_align=FILL_BOTH,
               editable=False)
    en.show()
    bx.pack_end(en)
    win.show()

    cal3.min_max_year = (-1, -1)

    # TODO: cal.format_function_set(format_month_year)

    selected_time = datetime.now() + timedelta(4)
    cal.mark_add("holiday", selected_time, ELM_CALENDAR_ANNUALLY)

    selected_time = datetime.now() + timedelta(1)
    cal.mark_add("checked", selected_time, ELM_CALENDAR_UNIQUE)

    selected_time = datetime.now() - timedelta(363)
    cal.mark_add("checked", selected_time, ELM_CALENDAR_MONTHLY)

    selected_time = datetime.now() - timedelta(5)
    mark = cal.mark_add("holiday", selected_time, ELM_CALENDAR_WEEKLY)

    selected_time = datetime.now() + timedelta(1)
    cal.mark_add("holiday", selected_time, ELM_CALENDAR_WEEKLY)

    mark.delete()
    cal.marks_draw()

    print_cal_info(cal, en)
    cal.callback_changed_add(print_cal_info_cb, en)