def summon(self, subl_view):
        if 'highlight' not in G.PERMS:
            return
        buf = get_buf(subl_view)
        if buf:
            msg.debug('summoning selection in subl_view ', buf['path'], ', buf id ', buf['id'])
            c = [[x.a, x.b] for x in subl_view.sel()]
            if self.joined_workspace:
                self.send({
                    'id': buf['id'],
                    'name': 'highlight',
                    'ranges': c,
                    'ping': True,
                    'summon': True,
                    'following': False,
                })
            return

        path = subl_view.file_name()
        if not utils.is_shared(path):
            sublime.error_message('Can\'t summon because %s is not in shared path %s.' % (path, G.PROJECT_PATH))
            return
        share = sublime.ok_cancel_dialog('This file isn\'t shared. Would you like to share it?', 'Share')
        if share:
            sel = [[x.a, x.b] for x in subl_view.sel()]
            self.create_buf_cbs[utils.to_rel_path(path)] = lambda buf_id: send_summon(buf_id, sel)
            self.upload(path)
    def summon(self, subl_view):
        if 'highlight' not in G.PERMS:
            return
        buf = get_buf(subl_view)
        if buf:
            msg.debug('summoning selection in subl_view ', buf['path'],
                      ', buf id ', buf['id'])
            c = [[x.a, x.b] for x in subl_view.sel()]
            if self.joined_workspace:
                self.send({
                    'id': buf['id'],
                    'name': 'highlight',
                    'ranges': c,
                    'summon': True,
                    'following': False,
                })
            return

        path = subl_view.file_name()
        if not utils.is_shared(path):
            sublime.error_message(
                'Can\'t summon because %s is not in shared path %s.' %
                (path, G.PROJECT_PATH))
            return
        share = sublime.ok_cancel_dialog(
            'This file isn\'t shared. Would you like to share it?', 'Share')
        if share:
            sel = [[x.a, x.b] for x in subl_view.sel()]
            self.create_buf_cbs[utils.to_rel_path(
                path)] = lambda buf_id: send_summon(buf_id, sel)
            self.upload(path)
 def summon(self, view):
     buf = get_buf(view)
     if buf:
         msg.debug("summoning selection in view %s, buf id %s" % (buf["path"], buf["id"]))
         self.selection_changed.append((view, buf, True))
     else:
         path = view.file_name()
         if not utils.is_shared(path):
             sublime.error_message("Can't summon because %s is not in shared path %s." % (path, G.PROJECT_PATH))
             return
         share = sublime.ok_cancel_dialog("This file isn't shared. Would you like to share it?", "Share")
         if share:
             sel = [[x.a, x.b] for x in view.sel()]
             self.create_buf_cbs[utils.to_rel_path(path)] = lambda buf_id: send_summon(buf_id, sel)
             self.upload(path)
Esempio n. 4
0
 def summon(self, view):
     buf = get_buf(view)
     if buf:
         msg.debug('summoning selection in view %s, buf id %s' %
                   (buf['path'], buf['id']))
         self.selection_changed.append((view, buf, True))
     else:
         path = view.file_name()
         if not utils.is_shared(path):
             sublime.error_message(
                 'Can\'t summon because %s is not in shared path %s.' %
                 (path, G.PROJECT_PATH))
             return
         share = sublime.ok_cancel_dialog(
             'This file isn\'t shared. Would you like to share it?',
             'Share')
         if share:
             sel = [[x.a, x.b] for x in view.sel()]
             self.create_buf_cbs[utils.to_rel_path(
                 path)] = lambda buf_id: send_summon(buf_id, sel)
             self.upload(path)