本文整理汇总了Python中efl.elementary.entry.Entry.focus_set方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.focus_set方法的具体用法?Python Entry.focus_set怎么用?Python Entry.focus_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类efl.elementary.entry.Entry
的用法示例。
在下文中一共展示了Entry.focus_set方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: entry_clicked
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import focus_set [as 别名]
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()
示例2: FileSelector
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import focus_set [as 别名]
#.........这里部分代码省略.........
def removeButtonPressed(self, btn):
toRemove = "file://%s%s"%(self.filepathEntry.text, self.selectedFolder.text)
bks = self.getGTKBookmarks()
bks.remove(toRemove)
with open(os.path.expanduser('~/.config/gtk-3.0/bookmarks'),'w') as f:
for b in bks:
bName = b.split("/")[-1]
b = b.replace(" ", "%20")
f.write( b + " " + bName + "\n" )
self.bookmarksList.clear()
self.populateBookmarks()
self.addButton.disabled = False
self.removeButton.disabled = True
def setMode(self, ourMode):
self.mode = ourMode.lower()
self.actionButton.text = "%s "%ourMode
self.actionIcon.standard_set("document-%s"%ourMode.lower())
if self.mode != "save":
self.createFolderButton.hide()
else:
self.createFolderButton.show()
def eventsCb(self, obj, src, event_type, event):
if event.modifier_is_set("Control") and event_type == EVAS_CALLBACK_KEY_DOWN:
if event.key.lower() == "l":
self.filepathEntry.focus_set(True)
self.filepathEntry.cursor_end_set()
def toggleHiddenButtonPressed(self, btn):
self.showHidden = not self.showHidden
self.populateFiles(self.filepathEntry.text)
def toggleHidden(self):
self.showHidden = not self.showHidden
self.populateFiles(self.filepathEntry.text)
def callback_cancel_add(self, cb):
self.cancelCallback = cb
def callback_activated_add(self, cb):
self.actionCallback = cb
def callback_directory_open_add(self, cb):
self.directoryChangeCallback = cb
def cancelButtonPressed(self, btn):
if self.cancelCallback:
self.cancelCallback(self)
def actionButtonPressed(self, btn):
if self.actionCallback:
if not self.folderOnly and self.fileEntry.text:
self.actionCallback(self, "%s%s"%(self.filepathEntry.text, self.fileEntry.text))
elif self.folderOnly:
self.actionCallback(self, "%s"%(self.filepathEntry.text))
def fileEntryChanged(self, en):
typed = en.text.split("/")[-1]
示例3: Box
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import focus_set [as 别名]
bx1 = Box(win, size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
size_hint_align=(EVAS_HINT_FILL, 0.0), horizontal=True)
box0.pack_end(bx1)
bx1.show()
lb = Label(win, text="Filter:")
bx1.pack_end(lb)
lb.show()
en = Entry(win, single_line=True, scrollable=True,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
en.part_text_set("guide", "Type widget name here to search.")
en.callback_changed_add(cb_filter, win)
bx1.pack_end(en)
en.show()
en.focus_set(True)
sc = Scroller(win, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH,
bounce=(False, True))
sc.show()
box0.pack_end(sc)
tbx = Box(win, size_hint_weight=(EVAS_HINT_EXPAND, 0.0),
size_hint_align=(EVAS_HINT_FILL, 0.0))
sc.content_set(tbx)
tbx.show()
menu_create(None, win)
win.resize(480, 480)
win.show()
示例4: Interface
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import focus_set [as 别名]
#.........这里部分代码省略.........
self.isSaved = True
self.isNewFile = False
self.confirmPopup = None
self.fileExistsFlag = False
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)
def curChanged(self, entry, label):
# get linear index into current text
index = entry.cursor_pos_get()
# Replace <br /> tag with single char
# to simplify (line, col) calculation
tmp_text = markup_to_utf8(entry.entry_get())
line = tmp_text[:index].count("\n") + 1
col = len(tmp_text[:index].split("\n")[-1]) + 1
# Update label text with line, col
label.text = "Ln {0} Col {1} ".format(line, col)
def textEdited(self, obj):
current_file = self.mainEn.file[0]
current_file = \
os.path.basename(current_file) if \
current_file and not self.isNewFile else \
"Untitled"
self.mainWindow.title = "*%s - ePad" % (current_file)
self.isSaved = False
def newFile(self, obj=None, ignoreSave=False):
if self.newInstance:
# sh does not properly handle space between -d and path
command = "epad -d'{0}'".format(self.lastDir)