本文整理汇总了Python中sublime.error_message方法的典型用法代码示例。如果您正苦于以下问题:Python sublime.error_message方法的具体用法?Python sublime.error_message怎么用?Python sublime.error_message使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sublime
的用法示例。
在下文中一共展示了sublime.error_message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def run(self):
# Reload settings
settings.load()
# Ensure git executable is available
if not self.git_executable_available():
sublime.error_message(msgs.get('git_executable_not_found'))
return
self.git_repo = self.determine_git_repo()
if not self.git_repo:
sublime.status_message(msgs.get('no_git_repo_found'))
return
conflict_files = self.get_conflict_files()
if not conflict_files:
sublime.status_message(msgs.get('no_conflict_files_found', self.git_repo))
return
self.show_quickpanel_selection(conflict_files)
示例2: _on_done
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def _on_done(self, which, value):
value = value.strip()
if not value:
return
fqn = join(self.path, value)
if exists(fqn):
sublime.error_message('{} already exists'.format(fqn))
return
if which == 'directory':
os.makedirs(fqn)
else:
open(fqn, 'wb')
self.view.run_command('dired_refresh', {'goto': value})
示例3: _move
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def _move(self, path):
if path == self.path:
return
files = self.get_marked() or self.get_selected()
if not isabs(path):
path = join(self.path, path)
if not isdir(path):
sublime.error_message('Not a valid directory: {}'.format(path))
return
# Move all items into the target directory. If the target directory was also selected,
# ignore it.
files = self.get_marked() or self.get_selected()
path = normpath(path)
for filename in files:
fqn = normpath(join(self.path, filename))
if fqn != path:
shutil.move(fqn, path)
self.view.run_command('dired_refresh')
示例4: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def run(self, **kwargs):
"""Exec the command with virtualenv.
If a virtualenv is active and valid update the build parameters
as needed and call the built-in command.
Else, if no virtualenv is active, do nothing and call the built-in
command.
Else, if the active virtualenv is invalid or corrupt display an error
message and cancel execution.
"""
try:
venv = self.get_virtualenv(validate=True, **kwargs)
except InvalidVirtualenv as error:
sublime.error_message(str(error) + " Execution cancelled!")
else:
if venv:
kwargs = self.update_exec_kwargs(venv, **kwargs)
logger.info("Command executed with virtualenv \"{}\".".format(venv))
super(VirtualenvExecCommand, self).run(**kwargs)
示例5: add_directory
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def add_directory(self, directory):
"""Add given directory to the list.
If the path is not a directory show error dialog.
"""
if not directory:
return
directory = os.path.expanduser(os.path.normpath(directory))
if not os.path.isdir(directory):
sublime.error_message("\"{}\" is not a directory.".format(directory))
return
directories = self.virtualenv_directories
directories.append(directory)
settings().set('virtualenv_directories', directories)
settings.save()
示例6: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def run(self, edit):
currentfile = self.view.file_name()
if currentfile is None:
sublime.error_message(constants.NOT_SAVED)
return
is_mxs = _is_maxscriptfile(currentfile)
is_python = _is_pythonfile(currentfile)
if is_mxs:
cmd = 'fileIn @"{0}"\r\n'.format(currentfile)
_send_cmd_to_max(cmd)
elif is_python:
cmd = 'python.executeFile @"{0}"\r\n'.format(currentfile)
_send_cmd_to_max(cmd)
else:
sublime.error_message(constants.NO_SUPPORTED_FILE)
示例7: on_done
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def on_done(self, value):
value = value.strip()
if not value:
return False
fqn = join(self.path, value)
if exists(fqn):
sublime.error_message(u'{0} already exists'.format(fqn))
return False
if self.which == 'directory':
os.makedirs(fqn)
else:
with open(fqn, 'wb'):
pass
if self.refresh: # user press enter
emit_event(u'watch_view', self.view.id(), plugin=u'FileBrowserWFS')
self.view.run_command('dired_refresh', {'goto': fqn})
# user press ctrl+enter, no refresh
return fqn
示例8: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def run(self, edit):
self.which = self.view.settings().get('which', '')
if not self.which:
return sublime.error_message('oops, does not work!')
self.refresh = False
value = self.view.substr(Region(0, self.view.size()))
fqn = self.on_done(value)
if not fqn:
return sublime.status_message('oops, does not work!')
sublime.active_window().run_command('hide_panel', {'cancel': True})
dired_view = sublime.active_window().active_view()
if dired_view.settings().has('dired_path'):
self.refresh = True
if self.which == 'directory':
dired_view.settings().set('dired_path', fqn + os.sep)
else:
sublime.active_window().open_file(fqn)
if self.refresh:
emit_event(u'watch_view', dired_view.id(), plugin=u'FileBrowserWFS')
dired_view.run_command('dired_refresh', {'goto': fqn})
示例9: calc_width
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def calc_width(view):
'''
return float width, which must be
0.0 < width < 1.0 (other values acceptable, but cause unfriendly layout)
used in show.show() and "dired_select" command with other_group=True
'''
width = view.settings().get('dired_width', 0.3)
if isinstance(width, float):
width -= width//1 # must be less than 1
elif isinstance(width, int if ST3 else long): # assume it is pixels
wport = view.viewport_extent()[0]
width = 1 - round((wport - width) / wport, 2)
if width >= 1:
width = 0.9
else:
sublime.error_message(u'FileBrowser:\n\ndired_width set to '
u'unacceptable type "%s", please change it.\n\n'
u'Fallback to default 0.3 for now.' % type(width))
width = 0.3
return width or 0.1 # avoid 0.0
示例10: start_server
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def start_server(project):
if not tern_command: return None
if time.time() - project.last_failed < 30: return None
env = None
if platform.system() == "Darwin":
env = os.environ.copy()
env["PATH"] += ":/usr/local/bin"
proc = subprocess.Popen(tern_command + tern_arguments, cwd=project.dir, env=env,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, shell=windows)
output = ""
while True:
line = proc.stdout.readline().decode("utf-8")
if not line:
sublime.error_message("Failed to start server" + (output and ":\n" + output))
project.last_failed = time.time()
return None
match = re.match("Listening on port (\\d+)", line)
if match:
project.proc = proc
return int(match.group(1))
else:
output += line
示例11: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def run(self, edit, **args):
data = run_command(self.view, {"type": "definition", "lineCharPositions": True})
if data is None: return
file = data.get("file", None)
if file is not None:
# Found an actual definition
row, col = self.view.rowcol(self.view.sel()[0].b)
cur_pos = self.view.file_name() + ":" + str(row + 1) + ":" + str(col + 1)
jump_stack.append(cur_pos)
if len(jump_stack) > 50: jump_stack.pop(0)
real_file = (os.path.join(get_pfile(self.view).project.dir, file) +
":" + str(data["start"]["line"] + 1) + ":" + str(data["start"]["ch"] + 1))
sublime.active_window().open_file(real_file, sublime.ENCODED_POSITION)
else:
url = data.get("url", None)
if url is None:
sublime.error_message("Could not find a definition")
else:
webbrowser.open(url)
示例12: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def run(self, edit):
self.settings = sublime.load_settings(SETTINGS)
self.hound_url = self.settings.get("hound_url").rstrip("/")
self.github_base_url = self.settings.get("github_base_url")
self.exclude_repos = set(self.settings.get("exclude_repos", []))
self.custom_headers = self.settings.get("custom_headers", {})
self.debug = self.settings.get("debug", False)
if self.debug:
logger.setLevel(logging.DEBUG)
http.client.HTTPConnection.debuglevel = 1
else:
http.client.HTTPConnection.debuglevel = 0
if self.hound_url == "" or self.github_base_url == "":
self.settings.set("hound_url", self.hound_url)
self.settings.set("github_base_url", self.github_base_url)
sublime.save_settings(self.SETTINGS) # save them so we have something to edit
sublime.error_message("Please set your hound_url and github_base_url.")
self.open_settings()
return
示例13: run
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def run(self,edit):
setvars()
server=settings.get("Server")
startCmd = ["hugo", "server"]
if server["THEME_FLAG"]:
startCmd = startCmd + ["--theme={}".format(server["THEME"])]
if server["DRAFTS_FLAG"]:
startCmd = startCmd + ["--buildDrafts"]
startCmd = startCmd + ["--watch", "--port={}".format(server["PORT"])]
try:
out=subprocess.Popen(startCmd,stderr=subprocess.STDOUT,universal_newlines=True)
sublime.status_message('Server Started: {}'.format(startCmd))
except:
sublime.error_message("Error starting server")
示例14: exec_node
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def exec_node(self, folder_path, node_command_args) :
os.chdir(folder_path)
from node.main import NodeJS
node = NodeJS()
animation_loader = AnimationLoader(["[= ]", "[ = ]", "[ = ]", "[ = ]", "[ =]", "[ = ]", "[ = ]", "[ = ]"], 0.067, "Generating docs ")
interval_animation = RepeatedTimer(animation_loader.sec, animation_loader.animate)
result = node.execute("jsdoc", node_command_args, is_from_bin=True)
if not result[0] :
sublime.error_message(result[1])
elif result[1].startswith("There are no input files to process") :
sublime.error_message(result[1])
animation_loader.on_complete()
interval_animation.stop()
示例15: ensureDaemonIsRunning
# 需要导入模块: import sublime [as 别名]
# 或者: from sublime import error_message [as 别名]
def ensureDaemonIsRunning(self):
if not self.interop.isConnected():
try:
path = getFusePathFromSettings()
start_daemon = [path, "daemon", "-b"]
log().info("Calling subprocess '%s'", str(start_daemon))
if os.name == "nt":
CREATE_NO_WINDOW = 0x08000000
subprocess.check_output(start_daemon, creationflags=CREATE_NO_WINDOW, stderr=subprocess.STDOUT)
else:
subprocess.check_output(start_daemon, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError as e:
log().error("Fuse returned exit status " + str(e.returncode) + ". Output was '" + e.output.decode("utf-8") + "'.")
error_message("Error starting Fuse:\n\n" + e.output.decode("utf-8"))
return
except:
log().error("Fuse not found: " + traceback.format_exc())
gFuse.showFuseNotFound()
return