本文整理汇总了Python中efl.elementary.entry.Entry.callback_changed_user_add方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.callback_changed_user_add方法的具体用法?Python Entry.callback_changed_user_add怎么用?Python Entry.callback_changed_user_add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类efl.elementary.entry.Entry
的用法示例。
在下文中一共展示了Entry.callback_changed_user_add方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_user_add [as 别名]
def __init__(self, parent, repo):
self.repo = repo
Popup.__init__(self, parent)
self.part_text_set("title,text", "Add remote")
tb = Table(self, padding=(3, 3), size_hint_expand=EXPAND_BOTH)
self.content = tb
tb.show()
# name
lb = Label(tb, text="Name")
tb.pack(lb, 0, 0, 1, 1)
lb.show()
en = Entry(
tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH
)
en.part_text_set("guide", "Name for the new remote")
en.callback_changed_user_add(lambda e: self.err_unset())
tb.pack(en, 1, 0, 1, 1)
en.show()
self.name_entry = en
# url
lb = Label(tb, text="URL")
tb.pack(lb, 0, 1, 1, 1)
lb.show()
en = Entry(
tb, editable=True, single_line=True, scrollable=True, size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH
)
en.part_text_set("guide", "git://git.example.com/repo.git")
en.callback_changed_user_add(lambda e: self.err_unset())
tb.pack(en, 1, 1, 1, 1)
en.show()
self.url_entry = en
# error label
lb = Label(tb, text="", size_hint_expand=EXPAND_HORIZ)
tb.pack(lb, 0, 2, 2, 1)
lb.show()
self.error_label = lb
# buttons
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="Add remote")
bt.callback_clicked_add(self._add_btn_cb)
self.part_content_set("button2", bt)
bt.show()
self.show()
示例2: __init__
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_user_add [as 别名]
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()
示例3: __init__
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_user_add [as 别名]
def __init__(self, app):
self.app = app
DialogWindow.__init__(self, app.win, 'egitu-remotes', 'Remotes',
autodel=True, size=(600,400))
# main vertical box (inside a padding frame)
fr = Frame(self, style='pad_medium', size_hint_weight=EXPAND_BOTH)
self.resize_object_add(fr)
fr.show()
box = Box(fr, padding=(6,6))
fr.content = box
box.show()
# panes
panes = Panes(box, content_left_size=0.25,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box.pack_end(panes)
panes.show()
### remotes List (on the left)
li = List(panes)
li.callback_selected_add(self._list_selected_cb)
panes.part_content_set('left', li)
li.show()
self.remotes_list = li
### remote info (on the right)
tb = Table(self, padding=(4, 4))
panes.part_content_set('right', tb)
tb.show()
# url
lb = Label(self, text='URL', size_hint_align=(0.0,0.5))
tb.pack(lb, 0, 0, 1, 1)
lb.show()
en = Entry(self, single_line=True, scrollable=True,
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
en.callback_changed_user_add(lambda e: \
setattr(self.save_url_btn, 'disabled', False))
tb.pack(en, 1, 0, 1, 1)
en.show()
self.url_entry = en
# fetch
lb = Label(self, text='Fetch', size_hint_align=(0.0,0.5))
tb.pack(lb, 0, 1, 1, 1)
lb.show()
en = Entry(self, single_line=True, scrollable=True, editable=False,
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
tb.pack(en, 1, 1, 1, 1)
en.show()
self.fetch_entry = en
# save button
bt = Button(self, text='Save', disabled=True,
size_hint_expand=EXPAND_VERT, size_hint_fill=FILL_VERT)
bt.callback_clicked_add(self._save_url_clicked_cb)
tb.pack(bt, 2, 0, 1, 1)
bt.show()
self.save_url_btn = bt
# big info entry
en = Entry(panes, scrollable=True, editable=False,
line_wrap=ELM_WRAP_NONE,
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
en.callback_clicked_add(self._info_clicked_cb)
tb.pack(en, 0, 2, 3, 1)
en.show()
self.info_entry = en
### buttons bar
hbox = Box(box, horizontal=True,
size_hint_expand=EXPAND_HORIZ, size_hint_fill=FILL_BOTH)
box.pack_end(hbox)
hbox.show()
bt = Button(hbox, text='Add')
bt.callback_clicked_add(lambda b: RemoteAddPopup(self, self.app.repo))
hbox.pack_end(bt)
bt.show()
bt = Button(hbox, text='Remove')
bt.callback_clicked_add(self._remove_btn_cb)
hbox.pack_end(bt)
bt.show()
bt = Button(hbox, text='Refresh')
bt.callback_clicked_add(lambda b: self.restart_dialog())
hbox.pack_end(bt)
bt.show()
sep = Separator(hbox, size_hint_expand=EXPAND_HORIZ)
hbox.pack_end(sep)
bt = Button(hbox, text='Close')
bt.callback_clicked_add(lambda b: self.delete())
#.........这里部分代码省略.........
示例4: Interface
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_user_add [as 别名]
class Interface(object):
def __init__( self ):
self.mainWindow = StandardWindow("epad", "Untitled - ePad", size=(600, 400))
self.mainWindow.callback_delete_request_add(self.closeChecks)
self.mainWindow.elm_event_callback_add(self.eventsCb)
icon = Icon(self.mainWindow)
icon.size_hint_weight_set(EVAS_HINT_EXPAND, EVAS_HINT_EXPAND)
icon.size_hint_align_set(EVAS_HINT_FILL, EVAS_HINT_FILL)
icon.standard_set('accessories-text-editor') # assumes image icon is in local dir, may need to change later
icon.show()
self.mainWindow.icon_object_set(icon.object_get())
self.mainBox = Box(self.mainWindow, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
self.mainBox.show()
self.mainTb = Toolbar(self.mainWindow, homogeneous=False, size_hint_weight=(0.0, 0.0), size_hint_align=(EVAS_HINT_FILL, 0.0))
self.mainTb.menu_parent = self.mainWindow
self.mainTb.item_append("document-new", "New", self.newPress)
self.mainTb.item_append("document-open", "Open", self.openPress)
self.mainTb.item_append("document-save", "Save", self.savePress)
self.mainTb.item_append("document-save-as", "Save As", self.saveAsPress)
# -- Edit Dropdown Menu --
tb_it = self.mainTb.item_append("edit", "Edit")
tb_it.menu = True
menu = tb_it.menu
menu.item_add(None, "Copy", "edit-copy", self.copyPress)
menu.item_add(None, "Paste", "edit-paste", self.pastePress)
menu.item_add(None, "Cut", "edit-cut", self.cutPress)
menu.item_separator_add()
menu.item_add(None, "Select All", "edit-select-all", self.selectAllPress)
# -----------------------
# self.mainTb.item_append("settings", "Options", self.optionsPress)
self.mainTb.item_append("dialog-information", "About", self.aboutPress)
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.mainTb.show()
self.mainBox.pack_end(self.mainTb)
self.mainBox.pack_end(self.mainEn)
#Build our file selector for saving/loading files
self.fileBox = Box(self.mainWindow, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
self.fileBox.show()
self.fileLabel = Label(self.mainWindow, size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_BOTH)
self.fileLabel.text = ""
self.fileLabel.show()
self.fileSelector = Fileselector(self.mainWindow, is_save=False, expandable=False, folder_only=False,
path=os.getenv("HOME"), size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.fileSelector.callback_done_add(self.fileSelected)
#self.fileSelector.callback_selected_add(fs_cb_selected, win)
#self.fileSelector.callback_directory_open_add(fs_cb_directory_open, win)
self.fileSelector.show()
self.fileBox.pack_end(self.fileLabel)
self.fileBox.pack_end(self.fileSelector)
# the flip object has the file selector on one side and the GUI on the other
self.flip = Flip(self.mainWindow, 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.fileBox)
self.mainWindow.resize_object_add(self.flip)
self.flip.show()
self.isSaved = True
self.isNewFile = False
self.confirmPopup = None
def newPress( self, obj, it ):
self.newFile()
it.selected_set(False)
def openPress( self, obj, it ):
self.openFile()
it.selected_set(False)
def savePress( self, obj, it ):
self.saveFile()
it.selected_set(False)
def saveAsPress( self, obj, it ):
self.saveAs()
it.selected_set(False)
def optionsPress( self, obj, it ):
it.selected_set(False)
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_user_add [as 别名]
def __init__(self, parent, app):
self.app = app
Popup.__init__(self, parent)
self.part_text_set('title,text', 'Create tag')
self.part_content_set('title,icon', Icon(self, standard='git-tag'))
# main vertical box
tb = Table(self, padding=(4,4),
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
self.content = tb
tb.show()
# sep
sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
tb.pack(sep, 0, 0, 2, 1)
sep.show()
# tag name
en = Entry(self, single_line=True, scrollable=True,
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
en.part_text_set('guide', 'Type the tag name, ex: v1.15.0')
en.callback_changed_user_add(self._something_changed_cb)
tb.pack(en, 0, 1, 2, 1)
en.show()
self.name_entry = en
# annotated or light
rdg = Radio(self, state_value=1, value=1, text='Annotated',
size_hint_expand=EXPAND_BOTH)
rdg.callback_changed_add(self._annotated_radio_changed_cb)
rdg.callback_changed_add(self._something_changed_cb)
tb.pack(rdg, 0, 2, 1, 1)
rdg.show()
self.annotated_radio = rdg
rd = Radio(self, state_value=0, text='Lightweight',
size_hint_expand=EXPAND_BOTH)
rd.callback_changed_add(self._annotated_radio_changed_cb)
rd.callback_changed_add(self._something_changed_cb)
rd.group_add(rdg)
tb.pack(rd, 1, 2, 1, 1)
rd.show()
# message entry
en = Entry(self, scrollable=True,
size_hint_expand=EXPAND_BOTH, size_hint_fill=FILL_BOTH)
en.part_text_set('guide', 'Type a message for the tag')
en.callback_changed_user_add(self._something_changed_cb)
r = Rectangle(self.evas, size_hint_min=(200,150),
size_hint_expand=EXPAND_BOTH)
tb.pack(r, 0, 3, 2, 1)
tb.pack(en, 0, 3, 2, 1)
en.show()
self.msg_entry = en
# buttons
sep = Separator(self, horizontal=True, size_hint_expand=EXPAND_BOTH)
tb.pack(sep, 0, 4, 2, 1)
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='Create', disabled=True,
content=Icon(self, standard='git-tag'))
bt.callback_clicked_add(self._create_clicked_cb)
self.part_content_set('button2', bt)
bt.show()
self.create_btn = bt
#
self.name_entry.focus = True
self.show()
示例6: Interface
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_user_add [as 别名]
class Interface(object):
def __init__(self):
self.mainWindow = StandardWindow("epad", "Untitled - ePad",
size=(600, 400))
self.mainWindow.callback_delete_request_add(self.closeChecks)
self.mainWindow.elm_event_callback_add(self.eventsCb)
icon = Icon(self.mainWindow,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
icon.standard_set('accessories-text-editor')
icon.show()
self.mainWindow.icon_object_set(icon.object_get())
self.mainBox = Box(self.mainWindow,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.mainBox.show()
self.mainTb = ePadToolbar(self, self.mainWindow)
self.mainTb.show()
self.mainBox.pack_end(self.mainTb)
# Initialize Text entry box
print("Word wrap Initialized: {0}".format(self.wordwrap))
self.entryInit()
# 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.curChanged(self.mainEn, self.line_label)
self.line_label.show()
self.mainBox.pack_end(self.line_label)
self.mainEn.callback_cursor_changed_add(self.curChanged,
self.line_label)
# Build our file selector for saving/loading files
self.fileBox = Box(self.mainWindow,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.fileBox.show()
self.fileLabel = Label(self.mainWindow,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH, text="")
self.fileLabel.show()
self.fileSelector = Fileselector(self.mainWindow, is_save=False,
expandable=False, folder_only=False,
path=os.getenv("HOME"),
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.fileSelector.callback_done_add(self.fileSelected)
self.fileSelector.show()
self.fileBox.pack_end(self.fileLabel)
self.fileBox.pack_end(self.fileSelector)
# Flip object has the file selector on one side
# and the GUI on the other
self.flip = Flip(self.mainWindow, 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.fileBox)
self.mainWindow.resize_object_add(self.flip)
self.flip.show()
self.isSaved = True
self.isNewFile = False
self.confirmPopup = None
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 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 = entry.entry_get().replace("<br/>", "\n")
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 \
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_user_add [as 别名]
def __init__(self):
# main widget 'pointers'
self.tasks_list = None
self.filters = None
self.task_note = None
self.search_entry = None
self.main_panes = None
# the window
StandardWindow.__init__(self, "edone", "Edone")
self.callback_delete_request_add(lambda o: self.safe_quit())
# self.focus_highlight_enabled = True
# main vertical box
vbox = Box(self, size_hint_weight=EXPAND_BOTH)
self.resize_object_add(vbox)
vbox.show()
### Header ###
hbox1 = Box(vbox, horizontal=True)
fr = Frame(vbox, style='outdent_bottom', content=hbox1,
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
vbox.pack_end(fr)
fr.show()
# menu button
m = OptionsMenu(hbox1)
hbox1.pack_end(m)
m.show()
# new task button
b = Button(hbox1, text='New Task', focus_allow=False)
b.content = Icon(hbox1, standard='add')
b.callback_clicked_add(lambda b: self.task_add())
hbox1.pack_end(b)
b.show()
# title
title = Label(hbox1, text="Getting Things Done", scale=2.0,
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
hbox1.pack_end(title)
title.show()
# search entry
en = Entry(hbox1, single_line=True, scrollable=True,
size_hint_weight=EXPAND_HORIZ, size_hint_align=FILL_HORIZ)
en.part_text_set('guide', 'search')
en.callback_changed_user_add(self._search_changed_user_cb)
en.content_set('end', Icon(en, standard='find', size_hint_min=(20,20)))
hbox1.pack_end(en)
en.show()
self.search_entry = en
### Main horizontal box ###
hbox = Box(vbox, horizontal=True,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
vbox.pack_end(hbox)
hbox.show()
# the filters box widget (inside a padding frame)
self.filters = Filters(hbox)
fr = Frame(hbox, style='pad_medium', content=self.filters,
size_hint_weight=EXPAND_VERT, size_hint_align=FILL_VERT)
hbox.pack_end(fr)
fr.show()
### the main panes (horiz or vert)
panes = Panes(hbox, horizontal=not options.horiz_layout,
content_left_min_relative_size=0.3,
content_right_min_relative_size=0.1,
size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
panes.content_left_size = 1.0
hbox.pack_end(panes)
panes.show()
self.main_panes = panes
### the tasks list ###
self.tasks_list = TasksList(panes)
panes.part_content_set("left", self.tasks_list)
### the single task view ###
self.task_note = TaskNote(panes)
panes.part_content_set("right", self.task_note)
# show the window
self.resize(800, 600)
self.show()
示例8: FileSelector
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_user_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
#.........这里部分代码省略.........
示例9: Interface
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import callback_changed_user_add [as 别名]
class Interface(object):
def __init__(self):
self.mainWindow = StandardWindow("epad", "Untitled - ePad",
size=(600, 400))
self.mainWindow.callback_delete_request_add(self.closeChecks)
self.mainWindow.elm_event_callback_add(self.eventsCb)
icon = Icon(self.mainWindow,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
icon.standard_set('accessories-text-editor')
icon.show()
self.mainWindow.icon_object_set(icon.object_get())
self.mainBox = Box(self.mainWindow,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.mainBox.show()
self.newInstance = NEW_INSTANCE
self.mainTb = ePadToolbar(self, self.mainWindow)
self.mainTb.focus_allow = False
self.mainTb.show()
self.mainBox.pack_end(self.mainTb)
# Root User Notification
if os.geteuid() == 0:
printErr("Caution: Root User")
if NOTIFY_ROOT:
notifyBox = Box(self.mainWindow, horizontal=True)
notifyBox.show()
notify = Notify(self.mainWindow, size_hint_weight=EXPAND_BOTH,
align=(ELM_NOTIFY_ALIGN_FILL, 0.0),
content=notifyBox)
notifyLabel = Label(self.mainWindow)
notifyLabel.text = "<b><i>Root User</i></b>"
notifyBox.pack_end(notifyLabel)
notifyLabel.show()
self.mainBox.pack_end(notifyBox)
self.about = aboutWin(self, self.mainWindow)
self.about.hide()
# Initialize Text entry box and line label
# FIXME: self.wordwrap initialized by ePadToolbar
print("Word wrap Initialized: {0}".format(self.wordwrap))
self.entryInit()
# Build our file selector for saving/loading files
self.fileBox = Box(self.mainWindow,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.fileBox.show()
self.fileLabel = Label(self.mainWindow,
size_hint_weight=EXPAND_HORIZ,
size_hint_align=FILL_BOTH, text="")
self.fileLabel.show()
self.lastDir = os.getenv("HOME")
self.fileSelector = Fileselector(self.mainWindow, is_save=False,
expandable=False, folder_only=False,
hidden_visible=SHOW_HIDDEN,
path=self.lastDir,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_BOTH)
self.fileSelector.callback_done_add(self.fileSelected)
self.fileSelector.callback_activated_add(self.fileSelected)
self.fileSelector.callback_directory_open_add(self.updateLastDir)
self.fileSelector.path_set(os.getcwd())
self.fileSelector.show()
self.fileBox.pack_end(self.fileLabel)
self.fileBox.pack_end(self.fileSelector)
# Flip object has the file selector on one side
# and the GUI on the other
self.flip = Flip(self.mainWindow, 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.fileBox)
self.mainWindow.resize_object_add(self.flip)
self.flip.show()
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
#.........这里部分代码省略.........