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


Python sublime.set_clipboard方法代码示例

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


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

示例1: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def run(self, *args, **kwargs):
        view = sublime.active_window().active_view()

        #settings = sublime.load_settings('KSP.sublime-settings')
        #scheme_file = settings.get('color_scheme', 'Packages/SublimeKSP/KScript Light.tmTheme')
        scheme_file = 'Packages/SublimeKSP/KScript Light.tmTheme'
        plist = readPlistFromBytes(sublime.load_binary_resource(scheme_file))

        result = ['[pre]']
        start, end = view.sel()[0].a, view.sel()[0].b
        if start == end:
            start, end = 0, view.size()
        for a, b, scopes in get_ranges(view.scope_name(i) for i in range(start, end)):
            result.append(self.apply_style(scopes, plist, view.substr(sublime.Region(start+a, start+b))))
        result.append('[/pre]')
        sublime.set_clipboard(''.join(result)) 
开发者ID:nojanath,项目名称:SublimeKSP,代码行数:18,代码来源:bbcode.py

示例2: action_result

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def action_result(action):
    global result_js
    global region_selected
  
    view = sublime.active_window().active_view()
    sel = region_selected
    str_selected = view.substr(sel).strip()
  
    if action == "copy_to_clipboard" :
      sublime.set_clipboard(result_js)
  
    elif action == "replace_text" :
      view.run_command("replace_text")
  
    elif action == "view_result_formatted":
      view.run_command("view_result_formatted")
  
    view.hide_popup()
    result_js = "" 
开发者ID:pichillilorenzo,项目名称:JavaScript-Completions,代码行数:21,代码来源:_generated_2018_02_11_at_20_21_24.py

示例3: click

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def click(self, text: str):
		values = [
			ui.InputListItem(lambda: sublime.set_clipboard(text), "Copy"),
		]
		for match in url_matching_regex.findall(text):
			values.insert(0, ui.InputListItem(lambda: webbrowser.open_new_tab(match[0]), "Open"))

		if self.clicked_menu:
			values[0].run()
			self.clicked_menu.cancel()
			return

		values[0].text += "\t Click again to select"

		self.clicked_menu = ui.InputList(values, text).run()
		await self.clicked_menu
		self.clicked_menu = None 
开发者ID:daveleroy,项目名称:sublime_debugger,代码行数:19,代码来源:terminal.py

示例4: _insert_snippet

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def _insert_snippet(window: sublime.Window, snippet: dict):
		content = json.dumps(snippet, indent="\t")
		content = content.replace('\\\\', '\\') # remove json encoded \ ...
		project = window.project_file_name()
		if project:
			view = await core.sublime_open_file_async(window, project)
			region = view.find('''"\s*debug.configurations\s*"\s*:\s*\[''', 0)
			view.sel().clear()
			view.sel().add(sublime.Region(region.b, region.b))
			view.run_command('insert', {
				'characters': '\n'
			})
			view.run_command('insert_snippet', {
				'contents': content + ','
			})
		else:
			sublime.set_clipboard(content)
			core.display('Unable to insert configuration into sublime-project file: Copied to clipboard instead') 
开发者ID:daveleroy,项目名称:sublime_debugger,代码行数:20,代码来源:adapter.py

示例5: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def run(self, edit):
        # Get selected region or use line that cursor is on if nothing is
        # selected
        selected_region = self.view.sel()[0]
        if selected_region.empty():
            selected_region = self.view.line(selected_region)

        # Clean the selected text and move it into clipboard
        selected_text = self.view.substr(selected_region)
        selected_lines = selected_text.split("\n")
        clean_contents_to_copy = ""
        for line in selected_lines:
            clean_contents_to_copy = clean_contents_to_copy + line.rstrip() + "\n"

        sublime.set_clipboard(clean_contents_to_copy[:-1]) 
开发者ID:Wramberg,项目名称:TerminalView,代码行数:17,代码来源:sublime_terminal_buffer.py

示例6: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def run(self, edit):
        full_path = self.view.file_name()
        if full_path != None:
            str_list = full_path.split(baseutil.get_slash())
            file_name = str(str_list[-1])
            sublime.set_clipboard(file_name)
            sublime.status_message("Copy File Name : %s " % file_name) 
开发者ID:exiahuang,项目名称:SalesforceXyTools,代码行数:9,代码来源:main.py

示例7: clear_clipboard

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def clear_clipboard(view, password):
    if sublime.get_clipboard() == password:
        sublime.set_clipboard('')
        view.window().status_message('Network Tech: Password cleared from clipboard') 
开发者ID:heyglen,项目名称:network_tech,代码行数:6,代码来源:commands.py

示例8: result_handler

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def result_handler(view, encoded_password, decoded_password, index):
    if index is RESULTS.cancel:
        return
    elif index is RESULTS.display:
        message = 'Encoded: {}\nDecoded: {}'.format(encoded_password, decoded_password)
        sublime.message_dialog(message)
    elif index is RESULTS.clipboard:
        sublime.set_clipboard(decoded_password)
        sublime.set_timeout_async(
            functools.partial(clear_clipboard, view, decoded_password),
            10000
        ) 
开发者ID:heyglen,项目名称:network_tech,代码行数:14,代码来源:commands.py

示例9: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def run(self, edit):
        suggested_setting = self._build_suggested_setting()

        if not suggested_setting:
            sublime.set_clipboard('Unable to create syntax setting')
        else:
            sublime.set_clipboard(suggested_setting) 
开发者ID:reywood,项目名称:sublime-project-specific-syntax,代码行数:9,代码来源:project_syntax.py

示例10: create

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def create(data):
        try:
            g = gist.Gist(
                token=settings.get('access_token'),
                http_proxy=settings.get('http_proxy'),
                https_proxy=settings.get('https_proxy')
            ).create(data)
            msg = (
                'Sync Settings:\n\n'
                'Your gist `{}` was created successfully\n\n'
                'Do you want to overwrite the current `gist_id` property with the created gist?'
            )
            answer = sublime.yes_no_cancel_dialog(msg.format(g['id']))
            if answer == sublime.DIALOG_NO:
                sublime.set_clipboard(g['id'])
                sublime.status_message('Sync Settings: the created gist`s id, has been copied to clipboard')
            if answer == sublime.DIALOG_YES:
                commit = g['history'][0]
                settings.update('gist_id', g['id'])
                version.update_config_file({
                    'hash': commit['version'],
                    'created_at': commit['committed_at'],
                })
                sublime.status_message('Sync Settings: gist created')
        except gist.NotFoundError as e:
            msg = (
                'Sync Settings:\n\n'
                'Apparently the token was not created with gist scope enabled.\n\n'
                'Please, check your token or create a new one.\n\n'
                'more info: https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/'
            )
            sublime.message_dialog(msg.format(str(e)))
        except Exception as e:
            logger.exception(e)
            sublime.message_dialog('Sync Settings:\n\n{}'.format(str(e))) 
开发者ID:mfuentesg,项目名称:SyncSettings,代码行数:37,代码来源:create_and_upload.py

示例11: copy

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def copy(el):
    return sublime.set_clipboard(el) 
开发者ID:math2001,项目名称:FileManager,代码行数:4,代码来源:sublimefunctions.py

示例12: on_phantom_close

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def on_phantom_close(self, href):
        href_parts = href.split("-")

        if len(href_parts) > 1:
            intent = href_parts[0]
            sha = href_parts[1]
            # The SHA output by git-blame may have a leading caret to indicate
            # that it is a "boundary commit". That useful information has
            # already been shown in the phantom, so strip it before going on to
            # use the SHA programmatically.
            sha = sha.strip("^")

            if intent == "copy":
                sublime.set_clipboard(sha)
                sublime.status_message("Git SHA copied to clipboard")
            elif intent == "show":
                try:
                    desc = self.get_commit(sha, self.view.file_name())
                except Exception as e:
                    communicate_error(e)
                    return

                buf = self.view.window().new_file()
                buf.run_command(
                    "blame_insert_commit_description",
                    {"desc": desc, "scratch_view_name": "commit " + sha},
                )
            else:
                self.view.erase_phantoms("git-blame")
        else:
            self.view.erase_phantoms("git-blame")

    # ------------------------------------------------------------ 
开发者ID:frou,项目名称:st3-gitblame,代码行数:35,代码来源:blame.py

示例13: copy_sha

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def copy_sha(self):
        sublime.set_clipboard(self.git("rev-parse", self._commit_hash).strip()) 
开发者ID:timbrel,项目名称:GitSavvy,代码行数:4,代码来源:log.py

示例14: copy_sha

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def copy_sha(self, commit_hash):
        sublime.set_clipboard(self.git("rev-parse", commit_hash).strip()) 
开发者ID:timbrel,项目名称:GitSavvy,代码行数:4,代码来源:log_graph.py

示例15: run

# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import set_clipboard [as 别名]
def run(self):
        sublime.active_window ().run_command ("copy")
        sublime.set_clipboard (re.sub (r"^\s*[0-9]+.", "",
            sublime.get_clipboard (), flags=re.MULTILINE)) 
开发者ID:STealthy-and-haSTy,项目名称:SublimeScraps,代码行数:6,代码来源:find_results_copy.py


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