本文整理汇总了Python中sublime.status_message函数的典型用法代码示例。如果您正苦于以下问题:Python status_message函数的具体用法?Python status_message怎么用?Python status_message使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了status_message函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: WarnUser
def WarnUser(message):
perforce_settings = sublime.load_settings('Perforce.sublime-settings')
if(perforce_settings.get('perforce_warnings_enabled')):
if(perforce_settings.get('perforce_log_warnings_to_status')):
sublime.status_message("Perforce [warning]: {0}".format(message))
else:
print("Perforce [warning]: {0}".format(message))
示例2: run_command
def run_command(self, command, callback=None, show_status=True, filter_empty_args=True, no_save=False, **kwargs):
if filter_empty_args:
command = [arg for arg in command if arg]
if "working_dir" not in kwargs:
kwargs["working_dir"] = self.get_working_dir()
if (
"fallback_encoding" not in kwargs
and self.active_view()
and self.active_view().settings().get("fallback_encoding")
):
kwargs["fallback_encoding"] = (
self.active_view().settings().get("fallback_encoding").rpartition("(")[2].rpartition(")")[0]
)
s = sublime.load_settings("Git.sublime-settings")
if s.get("save_first") and self.active_view() and self.active_view().is_dirty() and not no_save:
self.active_view().run_command("save")
if command[0] == "git" and s.get("git_command"):
command[0] = s.get("git_command")
if command[0] == "git-flow" and s.get("git_flow_command"):
command[0] = s.get("git_flow_command")
if not callback:
callback = self.generic_done
thread = CommandThread(command, callback, **kwargs)
thread.start()
if show_status:
message = kwargs.get("status_message", False) or " ".join(command)
sublime.status_message(message)
示例3: run
def run(self, dirs):
if sublime.ok_cancel_dialog("Delete Folder?", "Delete"):
try:
for d in dirs:
send2trash.send2trash(d)
except:
sublime.status_message("Unable to delete folder")
示例4: run_command
def run_command(self, command, callback=None, show_status=True,
filter_empty_args=True, no_save=False, **kwargs):
if filter_empty_args:
command = [arg for arg in command if arg]
if 'working_dir' not in kwargs:
kwargs['working_dir'] = self.get_working_dir()
if 'fallback_encoding' not in kwargs and self.active_view() and self.active_view().settings().get('fallback_encoding'):
kwargs['fallback_encoding'] = self.active_view().settings().get('fallback_encoding').rpartition('(')[2].rpartition(')')[0]
s = sublime.load_settings("Git.sublime-settings")
if s.get('save_first') and self.active_view() and self.active_view().is_dirty() and not no_save:
self.active_view().run_command('save')
if command[0] == 'git' and s.get('git_command'):
command[0] = s.get('git_command')
if command[0] == 'git-flow' and s.get('git_flow_command'):
command[0] = s.get('git_flow_command')
if not callback:
callback = self.generic_done
thread = CommandThread(command, callback, **kwargs)
thread.start()
if show_status:
message = kwargs.get('status_message', False) or ' '.join(command)
sublime.status_message(message)
示例5: run_async
def run_async(self):
short_hash = self.get_selected_short_hash()
if not short_hash:
return
if self.interface.entries[-1].short_hash == short_hash:
sublime.status_message("Unable to move last commit down.")
return
commit_chain = [
self.ChangeTemplate(orig_hash=entry.long_hash,
move=entry.short_hash == short_hash,
do_commit=True,
msg=entry.raw_body,
datetime=entry.datetime,
author="{} <{}>".format(entry.author, entry.email))
for entry in self.interface.entries
]
# Take the change to move and swap it with the one following.
for idx, commit in enumerate(commit_chain):
if commit.move:
commit_chain[idx], commit_chain[idx+1] = commit_chain[idx+1], commit_chain[idx]
break
try:
self.make_changes(commit_chain)
except:
sublime.message_dialog("Unable to move commit, most likely due to a conflict.")
示例6: plugin_loaded
def plugin_loaded():
if DEBUG:
UTC_TIME = datetime.utcnow()
PYTHON = sys.version_info[:3]
VERSION = sublime.version()
PLATFORM = sublime.platform()
ARCH = sublime.arch()
PACKAGE = sublime.packages_path()
INSTALL = sublime.installed_packages_path()
message = (
'Jekyll debugging mode enabled...\n'
'\tUTC Time: {time}\n'
'\tSystem Python: {python}\n'
'\tSystem Platform: {plat}\n'
'\tSystem Architecture: {arch}\n'
'\tSublime Version: {ver}\n'
'\tSublime Packages Path: {package}\n'
'\tSublime Installed Packages Path: {install}\n'
).format(time=UTC_TIME, python=PYTHON, plat=PLATFORM, arch=ARCH,
ver=VERSION, package=PACKAGE, install=INSTALL)
sublime.status_message('Jekyll: Debugging enabled...')
debug('Plugin successfully loaded.', prefix='\n\nJekyll', level='info')
debug(message, prefix='Jekyll', level='info')
示例7: on_done_filename
def on_done_filename(self, value):
self.filename = value
# get selected text, or the whole file if nothing selected
if all([region.empty() for region in self.view.sel()]):
text = self.view.substr(sublime.Region(0, self.view.size()))
else:
text = "\n".join([self.view.substr(region) for region in self.view.sel()])
try:
gist = self.gistapi.create_gist(description=self.description,
filename=self.filename,
content=text,
public=self.public)
self.view.settings().set('gist', gist)
sublime.set_clipboard(gist["html_url"])
sublime.status_message(self.MSG_SUCCESS)
except GitHubApi.UnauthorizedException:
# clear out the bad token so we can reset it
self.settings.set("github_token", "")
sublime.save_settings("GitHub.sublime-settings")
sublime.error_message(self.ERR_UNAUTHORIZED_TOKEN)
sublime.set_timeout(self.get_username, 50)
except GitHubApi.UnknownException as e:
sublime.error_message(e.message)
except GitHubApi.ConnectionException as e:
sublime.error_message(e.message)
示例8: on_filename
def on_filename(filename):
if filename:
text = self.view.substr(sublime.Region(0, self.view.size()))
changes = {filename: {'content': text}}
new_gist = update_gist(gist['url'], changes)
gistify_view(self.view, new_gist, filename)
sublime.status_message("File added to Gist")
示例9: run
def run(self, **args):
config = getPrefs(args["cmd"])
if config != None:
if (len(config) > 0):
if args.get("batch", False) == True or (config.get("debug", None) != None and "all" in config["debug"] or "a" in config["debug"]):
args["cmd"] = [config["compiler"], config["filedir"]]
if config.get("scripts", None) != None:
if config["filedir"] == config["scripts"]:
if USER_SETTINGS.get("confirm_dangerous_batch_compilations", True) == True:
if not sublime.ok_cancel_dialog("Are you sure you want to batch compile all script sources in \"%s\"?\n\nThis folder may contain script sources that are supplied with Creation Kit and are a part of the base game. Compiling said script sources could lead to unintended behavior if they have been modified." % config["filedir"]):
return
else:
args["cmd"] = [config["compiler"], config["filename"]]
args["cmd"].append("-f=%s" % config["flags"])
args["cmd"].append("-i=%s" % config["import"])
args["cmd"].append("-o=%s" % config["output"])
for debugarg in config["debug"]:
if debugarg.startswith("-"):
args["cmd"].append("%s" % debugarg)
else:
args["cmd"].append("-%s" % debugarg)
if args.get("batch", False) == True:
if config.get("debug", None) != None or ("all" not in config["debug"] and "a" not in config["debug"]):
args["cmd"].append("-all")
del args["batch"]
args["working_dir"] = os.path.dirname(config["compiler"])
self.window.run_command("exec", args)
else:
sublime.status_message("No configuration for %s" % os.path.dirname(args["cmd"]))
示例10: on_gist_filename
def on_gist_filename(filename):
# We need to figure out the filenames. Right now, the following logic is used:
# If there's only 1 selection, just pass whatever the user typed to Github. It'll rename empty files for us.
# If there are multiple selections and user entered a filename, rename the files from foo.js to
# foo (1).js, foo (2).js, etc.
# If there are multiple selections and user didn't enter anything, post the files as
# $SyntaxName 1, $SyntaxName 2, etc.
if len(region_data) == 1:
gist_data = {filename: region_data[0]}
else:
if filename:
(namepart, extpart) = os.path.splitext(filename)
make_filename = lambda num: "%s (%d)%s" % (namepart, num, extpart)
else:
syntax_name, _ = os.path.splitext(os.path.basename(self.view.settings().get('syntax')))
make_filename = lambda num: "%s %d" % (syntax_name, num)
gist_data = dict((make_filename(idx), data) for idx, data in enumerate(region_data, 1))
gist = create_gist(self.public, description, gist_data)
gist_html_url = gist['html_url']
sublime.set_clipboard(gist_html_url)
sublime.status_message("%s Gist: %s" % (self.mode(), gist_html_url))
if gistify:
gistify_view(self.view, gist, gist['files'].keys()[0])
示例11: run
def run(self, edit, command, options=None, text=None, separator=None):
try:
cmd = Command.create(command, options)
if cmd:
items = None
if text: items = text.split(separator)
cmd.init(self.view, items)
regions = []
sel = self.view.sel()
last_region = None
for region in sel:
if cmd.has_next():
value = cmd.next()
if value is not None:
self.view.replace(edit, region, value)
regions.append(region)
else:
break
for region in regions:
sel.subtract(region)
else:
sublime.status_message("Command not found: " + cmd)
except ValueError:
sublime.status_message("Error while executing Text Pastry, canceled")
pass
示例12: handle_threads
def handle_threads(self, edit, threads, offset=0, i=0, dir=1):
next_threads = []
for thread in threads:
if thread.is_alive():
next_threads.append(thread)
continue
if thread.result == False:
continue
offset = self.replace(edit, thread, offset)
threads = next_threads
if len(threads):
# This animates a little activity indicator in the status area
before = i % 8
after = (7) - before
if not after:
dir = -1
if not before:
dir = 1
i += dir
self.view.set_status('bitly', 'Bitly [%s=%s]' % (' ' * before, ' ' * after))
sublime.set_timeout(lambda: self.handle_threads(edit, threads, offset, i, dir), 100)
return
self.view.end_edit(edit)
self.view.erase_status('bitly')
matches = len(self.urls)
sublime.status_message('Bitly successfully run on %s selection%s' % (matches, '' if matches == 1 else 's'))
示例13: on_post_save
def on_post_save(self, view):
dir = view.window().folders()
title = "ThinkPHP-CLI.html"
title2 = "ThinkPHP-Queryer"
content = view.substr(sublime.Region(0, view.size()))
global seperator
if dir == []:
if view.file_name().find(title) != -1:
sublime.status_message('Please open a folder')
else:
if view.file_name().find(title) != -1:
query = content.split(seperator)
cmd = query[0]
command_text = ['php', dir[0] + os.sep + 'index.php', cmd]
thread = cli(command_text,view,dir[0])
thread.start()
ThreadProgress(thread, 'Is excuting', 'cli excuted')
if view.file_name().find(title2) != -1:
sql = content
if sql == '':
sublime.status_message('Pls input correct sql')
else:
command_text = 'php "' + packages_path + os.sep + 'command.php" "query"'
cloums = os.popen(command_text)
data = cloums.read()
self.window = view.window()
show_outpanel(self, 'ThinkPHP-Queryer', data , True)
示例14: run
def run(self, edit):
paths = getPaths(self)
if len(paths[2]) != 0 and len(paths[3]) != 0:
command = ['/Users/kyleg/bin/push', paths[2]]
simpleShellExecute(command, paths[3])
sublime.status_message("Pushed %s from %s" % (paths[2], paths[3]))
示例15: run
def run(self, *args, **kwargs):
try:
# The first folder needs to be the Laravel Project
self.PROJECT_PATH = self.window.folders()[0]
artisan_path = os.path.join(self.PROJECT_PATH, self.artisan_path)
self.args = [self.php_path, artisan_path]
if os.path.isfile("%s" % artisan_path):
self.command = kwargs.get('command', None)
if self.command == 'serveStop':
plat = platform.system()
if plat == 'Windows':
self.command = 'taskkill /F /IM php.exe'
else:
self.command = 'killall php'
self.args = []
else:
self.args = [self.php_path, artisan_path]
self.fill_in_accept = kwargs.get('fill_in', False)
self.fill_in_label = kwargs.get('fill_in_lable', 'Enter the resource name')
self.fields_accept = kwargs.get('fields', False)
self.fields_label = kwargs.get('fields_label', 'Enter the fields')
if self.command is None:
self.window.show_input_panel('Command name w/o args:', '', self.on_command_custom, None, None)
else:
self.on_command(self.command)
else:
sublime.status_message("Artisan not found")
except IndexError:
sublime.status_message("Please open a Laravel Project")