本文整理汇总了Python中efl.elementary.entry.Entry.callback_activated_add方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.callback_activated_add方法的具体用法?Python Entry.callback_activated_add怎么用?Python Entry.callback_activated_add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类efl.elementary.entry.Entry
的用法示例。
在下文中一共展示了Entry.callback_activated_add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _task_edit_start
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_activated_add [as 别名]
def _task_edit_start(self, task):
pp = Popup(self.top_widget)
pp.part_text_set('title,text', 'Edit task')
en = Entry(pp, editable=True, single_line=True, scrollable=True,
text=task.raw_txt)
en.callback_activated_add(lambda e: self._task_edit_end(task, en, pp))
en.callback_aborted_add(lambda e: pp.delete())
pp.part_content_set('default', en)
b = Button(pp, text='Cancel')
b.callback_clicked_add(lambda b: pp.delete())
pp.part_content_set('button1', b)
b = Button(pp, text='Accept')
b.callback_clicked_add(lambda b: self._task_edit_end(task, en, pp))
pp.part_content_set('button2', b)
pp.show()
en.cursor_begin_set()
en.cursor_selection_begin()
en.cursor_end_set()
en.cursor_selection_end()
示例2: web_clicked
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_activated_add [as 别名]
def web_clicked(obj):
if not elementary.need_web():
print("EFL-webkit not available!")
return
win = StandardWindow("web", "Web", autodel=True, size=(800, 600))
if obj is None:
win.callback_delete_request_add(lambda o: elementary.exit())
vbx = Box(win, size_hint_weight=EXPAND_BOTH)
win.resize_object_add(vbx)
vbx.show()
web = Web(win, url="http://enlightenment.org/",
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
size_hint_min=(100, 100))
vbx.pack_end(web)
web.show()
# Debug:
def dbg(*args):
print(("DEBUG: %s" % args[-1], " ".join(repr(x) for x in args[1:-1])))
web.callback_link_hover_in_add(dbg, "link in")
web.callback_link_hover_out_add(dbg, "link out")
web.callback_uri_changed_add(dbg, "uri")
web.callback_title_changed_add(dbg, "title")
web.callback_load_finished_add(dbg, "load finished")
web.callback_load_finished_add(dbg, "load error")
web.callback_load_progress_add(dbg, "load progress")
web.callback_load_provisional_add(dbg, "load provisional")
web.callback_load_started_add(dbg, "load started")
# JS debug to console:
def console_msg(obj, msg, line, src):
print(("CONSOLE: %s:%d %r" % (src, line, msg)))
web.console_message_hook_set(console_msg)
# navigation bar:
hbx = Box(win, horizontal=True, size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_HORIZ)
vbx.pack_start(hbx)
hbx.show()
bt = Button(win, text="Back")
bt.callback_clicked_add(lambda x: web.back())
hbx.pack_end(bt)
bt.show()
bt = Button(win, text="Forward")
bt.callback_clicked_add(lambda x: web.forward())
hbx.pack_end(bt)
bt.show()
bt = Button(win, text="Reload")
bt.callback_clicked_add(lambda x: web.reload())
hbx.pack_end(bt)
bt.show()
bt = Button(win, text="Stop")
bt.callback_clicked_add(lambda x: web.stop())
hbx.pack_end(bt)
bt.show()
en = Entry(win, scrollable=True, editable=True, single_line=True,
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
hbx.pack_end(en)
en.show()
# Sync navigation entry and current URI
def do_change_uri(en):
web.uri = en.entry
def did_change_uri(web, uri, en):
en.entry = uri
en.callback_activated_add(do_change_uri)
web.callback_uri_changed_add(did_change_uri, en)
# Sync title
def did_change_title(web, title, win):
win.title_set("Web - %s" % title)
web.callback_title_changed_add(did_change_title, win)
win.show()
示例3: EmbeddedTerminal
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_activated_add [as 别名]
class EmbeddedTerminal(Box):
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
def changedCb(self, obj):
obj.cursor_end_set()
def enterPressed(self, btn):
if not self.cmd_exe:
self.runCommand(self.inPut.text)
self.inPut.text = ""
else:
ourResult = self.cmd_exe.send("%s\n" % self.inPut.text)
self.inPut.text = ""
def runCommand(self, command, done_cb=None):
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)
self.done_cb = done_cb
def command_started(self, cmd, event, *args, **kwargs):
self.outPut.entry_append("---------------------------------")
self.outPut.entry_append("<br>")
def received_data(self, cmd, event, *args, **kwargs):
self.outPut.entry_append("%s" % event.data)
self.outPut.entry_append("<br>")
def received_error(self, cmd, event, *args, **kwargs):
self.outPut.entry_append("Error: %s" % event.data)
def command_done(self, cmd, event, *args, **kwargs):
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()
示例4: FileSelector
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_activated_add [as 别名]
class FileSelector(Box):
def __init__(self, parent_widget, defaultPath="", defaultPopulate=True, *args, **kwargs):
Box.__init__(self, parent_widget, *args, **kwargs)
self.cancelCallback = None
self.actionCallback = None
self.directoryChangeCallback = None
self.threadedFunction = ThreadedFunction()
self._timer = ecore.Timer(0.02, self.populateFile)
#Watch key presses for ctrl+l to select entry
parent_widget.elm_event_callback_add(self.eventsCb)
self.selectedFolder = None
self.showHidden = False
self.currentDirectory = None
self.focusedEntry = None
self.folderOnly = False
self.sortReverse = False
self.addingHidden = False
self.pendingFiles = deque()
self.currentSubFolders = []
self.currentFiles = []
#Mode should be "save" or "load"
self.mode = "save"
self.home = os.path.expanduser("~")
self.root = "/"
#Label+Entry for File Name
self.filenameBox = Box(self, size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_HORIZ)
self.filenameBox.horizontal = True
self.filenameBox.show()
fileLabel = Label(self, size_hint_weight=(0.15, EVAS_HINT_EXPAND),
size_hint_align=FILL_HORIZ)
fileLabel.text = "Filename:"
fileLabel.show()
self.fileEntry = Entry(self, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ)
self.fileEntry.single_line_set(True)
self.fileEntry.scrollable_set(True)
self.fileEntry.callback_changed_user_add(self.fileEntryChanged)
self.fileEntry.show()
self.filenameBox.pack_end(fileLabel)
self.filenameBox.pack_end(self.fileEntry)
sep = Separator(self, size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_HORIZ)
sep.horizontal_set(True)
sep.show()
#Label+Entry for File Path
self.filepathBox = Box(self, size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_HORIZ)
self.filepathBox.horizontal = True
self.filepathBox.show()
fileLabel = Label(self, size_hint_weight=(0.15, EVAS_HINT_EXPAND),
size_hint_align=FILL_HORIZ)
fileLabel.text = "Current Folder:"
fileLabel.show()
self.filepathEntry = Entry(self, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ)
self.filepathEntry.single_line_set(True)
self.filepathEntry.scrollable_set(True)
self.filepathEntry.callback_changed_user_add(self.fileEntryChanged)
self.filepathEntry.callback_unfocused_add(self.filepathEditDone)
self.filepathEntry.callback_activated_add(self.filepathEditDone)
#Wish this worked. Doesn't seem to do anything
#self.filepathEntry.input_hint_set(ELM_INPUT_HINT_AUTO_COMPLETE)
if defaultPath and os.path.isdir(defaultPath):
startPath = defaultPath
else:
startPath = self.home
self.filepathEntry.show()
self.filepathBox.pack_end(fileLabel)
self.filepathBox.pack_end(self.filepathEntry)
self.autocompleteHover = Hoversel(self, hover_parent=self)
self.autocompleteHover.callback_selected_add(self.autocompleteSelected)
#self.autocompleteHover.show()
self.fileSelectorBox = Panes(self, content_left_size=0.3,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
self.fileSelectorBox.show()
"""Bookmarks Box contains:
- Button - Up Arrow
- List - Home/Root/GTK bookmarks
- Box
#.........这里部分代码省略.........
示例5: findWin
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_activated_add [as 别名]
class findWin(Window):
def __init__(self):
# Dialog Window Basics
self.findDialog = Window("find", ELM_WIN_DIALOG_BASIC)
self.findDialog.callback_delete_request_add(self.closeFind)
# Set Window Icon
# Icons work in ubuntu min everything compiled
# but not bodhi rc3
icon = Icon(self.findDialog,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
icon.standard_set('edit-find-replace')
icon.show()
self.findDialog.icon_object_set(icon.object_get())
# Set Dialog background
background = Background(self.findDialog, size_hint_weight=EXPAND_BOTH)
self.findDialog.resize_object_add(background)
background.show()
# Main box to hold shit
mainBox = Box(self.findDialog, size_hint_weight=EXPAND_BOTH)
self.findDialog.resize_object_add(mainBox)
mainBox.show()
# Search Section
# Horizontal Box to hold search stuff
seachBox = Box(self.findDialog, horizontal=True,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH, padding=PADDING)
seachBox.show()
mainBox.pack_end(seachBox)
# Label for search entry
seachLabel = Label(self.findDialog, text="Search for:",
size_hint_weight=EXPAND_NONE,
size_hint_align=FILL_HORIZ)
seachBox.pack_end(seachLabel)
seachLabel.show()
# Search Entry
self.sent = Entry(self.findDialog, scrollable=True, single_line=True,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_HORIZ)
self.sent.callback_activated_add(self.find) # Enter activates find fn
self.sent.show()
seachBox.pack_end(self.sent)
# Check boxs for Search Options
# FIXME: add callbacks These states should be in config file
caseCk = Check(self.findDialog, text="Case sensitive",
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ, state=CASE_SENSITIVE)
caseCk.callback_changed_add(self.ckCase)
caseCk.show()
mainBox.pack_end(caseCk)
wordCk = Check(self.findDialog, text="Match only a whole word",
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ, state=WHOLE_WORD)
wordCk.callback_changed_add(self.ckWord)
wordCk.show()
mainBox.pack_end(wordCk)
# Dialog Buttons
# Horizontal Box for Dialog Buttons
buttonBox = Box(self.findDialog, horizontal=True,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH, padding=PADDING)
buttonBox.size_hint_weight_set(EVAS_HINT_EXPAND, 0.0)
buttonBox.show()
mainBox.pack_end(buttonBox)
# Cancel Button
cancelBtn = Button(self.findDialog, text="Cancel",
size_hint_weight=EXPAND_NONE)
cancelBtn.callback_clicked_add(self.closeFind)
cancelBtn.show()
buttonBox.pack_end(cancelBtn)
# Ok Button
okBtn = Button(self.findDialog, text=" Find ",
size_hint_weight=EXPAND_NONE)
okBtn.callback_clicked_add(self.find)
okBtn.show()
buttonBox.pack_end(okBtn)
# Ensure the min height
self.findDialog.resize(300, 1)
self.findDialog.show()
def find(self, obj):
print(self.sent.entry_get())
elementary.exit()
def closeFind(self, obj=False, trash=False):
elementary.exit()
def launch(self, startingFile=False):
self.findDialog.show()
def ckCase(self, obj):
global CASE_SENSITIVE
CASE_SENSITIVE = not CASE_SENSITIVE
print("CASE_SENSITIVE = {0}".format(CASE_SENSITIVE))
#.........这里部分代码省略.........