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


Python View.get_text方法代码示例

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


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

示例1: tick

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import get_text [as 别名]
    def tick(self):
        reported = set()
        while self.views_changed:
            v, buf = self.views_changed.pop()
            if not self.joined_workspace:
                msg.debug('Not connected. Discarding view change.')
                continue
            if 'patch' not in G.PERMS:
                continue
            if 'buf' not in buf:
                msg.debug('No data for buf ', buf['id'], ' ', buf['path'], ' yet. Skipping sending patch')
                continue
            view = View(v, buf)
            if view.is_loading():
                msg.debug('View for buf ', buf['id'], ' is not ready. Ignoring change event')
                continue
            if view.native_id in reported:
                continue
            reported.add(view.native_id)
            patch = utils.FlooPatch(view.get_text(), buf)
            # Update the current copy of the buffer
            buf['buf'] = patch.current
            buf['md5'] = patch.md5_after
            self.send(patch.to_json())

        reported = set()

        self._status_timeout += 1
        if self._status_timeout > (2000 / G.TICK_TIME):
            self.update_status_msg()
开发者ID:cc7768,项目名称:secret-computing-machine,代码行数:32,代码来源:sublime_connection.py

示例2: tick

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import get_text [as 别名]
    def tick(self):
        reported = set()
        while self.views_changed:
            v, buf = self.views_changed.pop()
            if not G.JOINED_WORKSPACE:
                msg.debug("Not connected. Discarding view change.")
                continue
            if "patch" not in G.PERMS:
                continue
            if "buf" not in buf:
                msg.debug("No data for buf %s %s yet. Skipping sending patch" % (buf["id"], buf["path"]))
                continue
            view = View(v, buf)
            if view.is_loading():
                msg.debug("View for buf %s is not ready. Ignoring change event" % buf["id"])
                continue
            if view.native_id in reported:
                continue
            reported.add(view.native_id)
            patch = utils.FlooPatch(view.get_text(), buf)
            # Update the current copy of the buffer
            buf["buf"] = patch.current
            buf["md5"] = hashlib.md5(patch.current.encode("utf-8")).hexdigest()
            self.send(patch.to_json())

        reported = set()
        while self.selection_changed:
            v, buf, summon = self.selection_changed.pop()

            if not G.JOINED_WORKSPACE:
                msg.debug("Not connected. Discarding selection change.")
                continue
            # consume highlight events to avoid leak
            if "highlight" not in G.PERMS:
                continue

            view = View(v, buf)
            vb_id = view.native_id
            if vb_id in reported:
                continue

            reported.add(vb_id)
            highlight_json = {
                "id": buf["id"],
                "name": "highlight",
                "ranges": view.get_selections(),
                "ping": summon,
                "summon": summon,
            }
            self.send(highlight_json)

        self._status_timeout += 1
        if self._status_timeout > (2000 / G.TICK_TIME):
            editor.status_message("Connected to %s/%s" % (self.owner, self.workspace))
            self._status_timeout = 0
开发者ID:johnirvinestiamba,项目名称:floobits-sublime,代码行数:57,代码来源:sublime_connection.py

示例3: tick

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import get_text [as 别名]
    def tick(self):
        reported = set()
        while self.views_changed:
            v, buf = self.views_changed.pop()
            if not G.AGENT or not G.AGENT.joined_workspace:
                msg.debug('Not connected. Discarding view change.')
                continue
            if 'patch' not in G.PERMS:
                continue
            if 'buf' not in buf:
                msg.debug('No data for buf %s %s yet. Skipping sending patch' % (buf['id'], buf['path']))
                continue
            view = View(v)
            if view.is_loading():
                msg.debug('View for buf %s is not ready. Ignoring change event' % buf['id'])
                continue
            if view.native_id in reported:
                continue
            reported.add(view.native_id)
            patch = utils.FlooPatch(view.get_text(), buf)
            # Update the current copy of the buffer
            buf['buf'] = patch.current
            buf['md5'] = hashlib.md5(patch.current.encode('utf-8')).hexdigest()
            if not patch.to_json():
                msg.debug('Attempted to send None patch %s' % patch)
                return
            msg.debug('Sending a patch %s' % patch.to_json())
            self.send(patch.to_json())

        reported = set()
        while self.selection_changed:
            v, buf, summon = self.selection_changed.pop()

            if not G.AGENT or not G.AGENT.joined_workspace:
                msg.debug('Not connected. Discarding selection change.')
                continue
            # consume highlight events to avoid leak
            if 'highlight' not in G.PERMS:
                continue

            view = View(v)
            vb_id = view.native_id
            if vb_id in reported:
                continue

            reported.add(vb_id)
            highlight_json = {
                'id': buf['id'],
                'name': 'highlight',
                'ranges': view.get_selections(),
                'ping': summon,
                'summon': summon,
            }
            self.send(highlight_json)
开发者ID:intelliHugh,项目名称:floobits-neovim,代码行数:56,代码来源:vim_handler.py

示例4: tick

# 需要导入模块: from view import View [as 别名]
# 或者: from view.View import get_text [as 别名]
    def tick(self):
        if 'patch' not in G.PERMS:
            self.views_changed = []
        elif not self.joined_workspace:
            msg.debug('Not connected. Discarding view change.')
            self.views_changed = []
        else:
            reported = set()
            to_send = []
            while self.views_changed:
                name, v, buf = self.views_changed.pop()
                if 'buf' not in buf:
                    msg.debug('No data for buf ', buf['id'], ' ', buf['path'], ' yet. Skipping sending patch')
                    continue
                view = View(v, buf)
                if view.is_loading():
                    msg.debug('View for buf ', buf['id'], ' is not ready. Ignoring change event.')
                    continue
                if view.native_id in reported:
                    continue
                reported.add((name, view.native_id))
                if name == 'patch':
                    patch = utils.FlooPatch(view.get_text(), buf)
                    # Update the current copy of the buffer
                    buf['buf'] = patch.current
                    buf['md5'] = patch.md5_after
                    self.send(patch.to_json())
                    continue
                if name == 'saved':
                    to_send.append({'name': 'saved', 'id': buf['id']})
                    continue
                msg.warn('Discarding unknown event in views_changed:', name)

            for s in to_send:
                self.send(s)

        self._status_timeout += 1
        if self._status_timeout > (2000 / G.TICK_TIME):
            self.update_status_msg()
开发者ID:PengCoX,项目名称:Oh-My-Sublime,代码行数:41,代码来源:sublime_connection.py


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