本文整理汇总了Python中efl.elementary.entry.Entry类的典型用法代码示例。如果您正苦于以下问题:Python Entry类的具体用法?Python Entry怎么用?Python Entry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Entry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: gesture_layer_clicked
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()
示例2: __init__
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
示例3: __init__
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()
示例4: __init__
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()
示例5: _gl_content_get
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
示例6: __init__
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()
示例7: __init__
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)
示例8: __init__
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()
示例9: select_torrent
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()
示例10: newFile
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)
示例11: __init__
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)
示例12: __init__
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()
示例13: entryInit
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)
示例14: entry_clicked
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()
示例15: __init__
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()