当前位置: 首页>>代码示例>>Python>>正文


Python Entry.cursor_selection_begin方法代码示例

本文整理汇总了Python中efl.elementary.entry.Entry.cursor_selection_begin方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.cursor_selection_begin方法的具体用法?Python Entry.cursor_selection_begin怎么用?Python Entry.cursor_selection_begin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在efl.elementary.entry.Entry的用法示例。


在下文中一共展示了Entry.cursor_selection_begin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _task_edit_start

# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import cursor_selection_begin [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()
开发者ID:mwarchulinski,项目名称:edone,代码行数:26,代码来源:gui.py

示例2: CommandOutputEntry

# 需要导入模块: from efl.elementary.entry import Entry [as 别名]
# 或者: from efl.elementary.entry.Entry import cursor_selection_begin [as 别名]
class CommandOutputEntry(Table):
    def __init__(self, parent, min_size=(0,0)):
        Table.__init__(self, parent, size_hint_expand=EXPAND_BOTH, 
                       size_hint_fill=FILL_BOTH)
        
        self._entry = Entry(self, scrollable=True, editable=False,
                            line_wrap=ELM_WRAP_NONE, 
                            size_hint_expand=EXPAND_BOTH, 
                            size_hint_fill=FILL_BOTH)

        self._wheel = Progressbar(self, style='wheel', pulse_mode=True,
                                  size_hint_expand=EXPAND_BOTH)

        self._rect = Rectangle(self.evas, size_hint_min=min_size,
                               size_hint_expand=EXPAND_BOTH, color=(0,0,0,0))

        self.pack(self._entry, 0, 0, 1, 1)
        self.pack(self._rect,  0, 0, 1, 1)
        self.pack(self._wheel, 0, 0, 1, 1)

        self._last_was_carriage = False
        self._entry.show()
        self._rect.show()
        self.show()

    @property
    def text(self):
        return self._entry.text
    @text.setter
    def text(self, text):
        self._entry.text = text

    def pulse_start(self):
        self._rect.repeat_events = False
        self._wheel.pulse(True)
        self._wheel.show()

    def pulse_stop(self):
        self._rect.repeat_events = True
        self._wheel.pulse(False)
        self._wheel.hide()

    def successfull(self):
        self._entry.entry_append('<success>Operation successfully completed.</success><br>')
    
    def failure(self):
        self._entry.entry_append('<failure>Error! Something goes wrong.</failure><br>')
    
    def error_set(self, text):
        self._entry.text = '<failure>Error:</failure><br>%s' % text

    def append_raw(self, line, sep=None):
        if self._last_was_carriage is True:
            self._entry.cursor_selection_begin()
            self._entry.cursor_line_end_set()
            self._entry.cursor_selection_end()
            self._entry.entry_insert('')
        if sep == '\n':
            self._entry.entry_append(line + '<br>')
            self._entry.cursor_end_set()
            self._last_was_carriage = False
        elif sep == '\r':
            self._entry.entry_append(line)
            self._last_was_carriage = True
        else:
            self._entry.entry_append(line)
            self._last_was_carriage = False
开发者ID:DaveMDS,项目名称:egitu,代码行数:69,代码来源:utils.py


注:本文中的efl.elementary.entry.Entry.cursor_selection_begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。