本文整理汇总了Python中efl.elementary.entry.Entry.editable_set方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.editable_set方法的具体用法?Python Entry.editable_set怎么用?Python Entry.editable_set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类efl.elementary.entry.Entry
的用法示例。
在下文中一共展示了Entry.editable_set方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: EmbeddedTerminal
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import editable_set [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()
示例2: MainWin
# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import editable_set [as 别名]
class MainWin(StandardWindow):
def __init__(self, app):
# create the main window
StandardWindow.__init__(self, "eepdater", "eepDater - System Updater",
autodel=True, size=(320, 320))
self.callback_delete_request_add(lambda o: elementary.exit())
self.app = app
icon = Icon(self)
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('software-center')
icon.show()
self.icon_object_set(icon.object_get())
# build the two main boxes
self.mainBox = self.buildMainBox()
self.loadBox = self.buildLoadBox()
# build the information details inwin object
self.buildDetailsWin()
# the flip object has the load screen on one side and the GUI on the other
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.loadBox)
self.resize_object_add(self.flip)
self.flip.show()
# show the window
self.show()
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 innerWinShow(self, obj=False):
self.innerWin.show()
self.innerWin.activate()
def innerWinHide(self, obj=False):
self.innerWin.hide()
def buildLoadBox(self):
# build the load label
loadLable = Label(self, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ)
loadLable.text = "<b>Processing</b>"
loadLable.show()
# build the spinning wheel
wheel = Progressbar(self, pulse_mode=True,
size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ)
wheel.pulse(True)
wheel.show()
detailsbtn = Button(self, style="anchor")
detailsbtn.text_set("Details")
detailsbtn.callback_pressed_add(self.innerWinShow)
detailsbtn.show()
# build the status label
self.statusLabel = Label(self, size_hint_weight=EXPAND_BOTH,
size_hint_align=FILL_HORIZ)
self.statusLabel.show()
# put all the built objects in a vertical box
box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH)
box.pack_end(loadLable)
box.pack_end(wheel)
box.pack_end(self.statusLabel)
box.pack_end(detailsbtn)
box.show()
return box
def buildMainBox(self):
# build our toolbar
self.mainTb = Toolbar(self, homogeneous=False,
size_hint_weight=(0.0, 0.0),
size_hint_align=(EVAS_HINT_FILL, 0.0))
self.mainTb.item_append("remove", "Clear", self.clearPressed)
#.........这里部分代码省略.........