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): editor.error_message('Can\'t summon because %s is not in shared path %s.' % (path, G.PROJECT_PATH)) return share = editor.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)
def user_y_or_n(self, context, prompt, affirmation_txt, cb): """@returns True/False""" return cb(editor.ok_cancel_dialog(prompt))
def ok_cancel_dialog(self, msg, cb=None): res = editor.ok_cancel_dialog(msg) return (cb and cb(res) or res)