本文整理汇总了Python中sublime.windows函数的典型用法代码示例。如果您正苦于以下问题:Python windows函数的具体用法?Python windows怎么用?Python windows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了windows函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: run
def run(self):
windows = sublime.windows()
active_window = sublime.active_window()
for window in sublime.windows():
if active_window != window:
window.run_command('close_window')
开发者ID:Kl0tl,项目名称:sublime,代码行数:7,代码来源:CloseOtherWindowsCommand.py
示例2: on_input
def on_input(self, input):
view = self.window.active_view()
settings = view.settings()
haxelib_path = settings.get("haxelib_path", "haxelib")
is_module = self.mode == 'module'
files_to_open = []
old = to_disk_path_form(self.classpath, self.option, is_module)
new = to_disk_path_form(self.classpath, input, is_module)
if self.mode == 'module':
for w in sublime.windows():
for v in w.views():
if v.file_name() == old:
w.focus_view(v)
w.run_command('close')
files_to_open.append(new)
elif self.mode == 'package':
for w in sublime.windows():
for v in w.views():
if old in v.file_name():
relpath = os.path.relpath(v.file_name(), old)
files_to_open.append(os.path.join(new, relpath))
w.focus_view(v)
w.run_command('close')
res, err = runcmd([
haxelib_path, 'run', 'refactor', '-vv', 'rename',
self.classpath, old, new], '')
print('\nRefactor:\n' + res)
for f in files_to_open:
self.window.open_file(f)
开发者ID:MattTuttle,项目名称:haxe-sublime2-bundle,代码行数:33,代码来源:haxe_refactor.py
示例3: __init__
def __init__(self, is_logging_enabled=False):
#api not tested so no token loaded
if not TodoistAPI.APIOK:
TodoistAPI.APITOKEN=settings.get('token');
super(TodoistAPI, self).__init__(
api_url="https://api.todoist.com/API",
api_token=TodoistAPI.APITOKEN);
self.logging_enabled=is_logging_enabled;
self.project="Inbox"
if len(sublime.windows())>0:
self.project=sublime.windows()[0].folders()[0];
self.logfile=open(sublime.packages_path() + "\\SimpleTodo\\todoisthandler.messages", "w");
#if true automatically adds a new project if one cannot be found
#else it will add to the inbox
self.auto_add_project=True;
self.log("TodoistAPI handler added for:%s\ncurrent project:%s\n" %(self.api_token, self.project));
开发者ID:SherrodJmsGitHub,项目名称:packages,代码行数:25,代码来源:todoist.py
示例4: on_load
def on_load(self, view):
if view.file_name():
window = view.window()
windows = sublime.windows()
transient = window is None
if transient or len(windows) == 1:
pass
elif sublime.load_settings("Side Bar Folders.sublime-settings").get(
"open_files_in_folder_window", False
):
path = normalize(view.file_name())
if op.exists(path):
folders = window.folders()
for item in folders:
if path.startswith(normalize(item)): # already in best window
return
for _window in sublime.windows():
if _window.id() != window.id():
folders = _window.folders()
for item in folders:
if path.startswith(
normalize(item)
): # moving to best window
window.run_command("close")
_view = _window.open_file(path)
self.focus_view(_view)
return
开发者ID:titoBouzout,项目名称:SideBarFolders,代码行数:27,代码来源:OpenFilesInFolderWindow.py
示例5: jump_to_stack_frame
def jump_to_stack_frame(idx):
if idx>=0:
file_path = err['stack'][idx]['path']
lineno = err['stack'][idx]['line']
parent_win = sublime.active_window()
print [w for w in sublime.windows() for v in w.views() if v.id()==task_id.view]
for win in (w for w in sublime.windows() for v in w.views() if v.id()==task_id.view):
match = [v for v in win.views() if v.file_name()==file_path]
if match:
view = match[0]
view.settings().set('shebang.goto',idx)
if view.id()==sublime.active_window().active_view().id():
self.flash_errors(view)
else:
win.open_file(file_path)
return
else:
parent_win = win
view = parent_win.open_file("%s:%i"%(file_path, lineno), sublime.ENCODED_POSITION)
stack = [ (f['path']==file_path and f['line']) for f in err['stack']]
view.settings().set('shebang.goto', idx)
view.settings().set('shebang.stacktrace', {"task":[task_id.path, task_id.view],
"gen":err['gen'],
"stack":stack,
"depth":idx})
sublime.active_window().show_quick_panel(ui, jump_to_stack_frame)
开发者ID:samizdatco,项目名称:sublime-text-shebang,代码行数:27,代码来源:format.py
示例6: on_close
def on_close(self, view):
# get version via api change
sv = 2
if hasattr(sublime.Window,"lookup_symbol_in_index"):
sv = 3
if len(sublime.windows()) == 1 and len(sublime.windows()[0].views()) == [43,1,1,0][sv]:
sublime.windows()[0].new_file()
开发者ID:vprimachenko,项目名称:Sublime2KeepOpen,代码行数:8,代码来源:keepOpen.py
示例7: update_folders
def update_folders():
folders = list(set([norm_path(folder) for w in sublime.windows() for folder in w.folders() if folder and not should_exclude(norm_path(folder))]))
_folders = []
for folder in folders:
_folders = deduplicate_crawl_folders(_folders, folder)
_folders.sort()
Pref.updated_folders = _folders
Pref.updated_files = [norm_path(v.file_name()) for w in sublime.windows() for v in w.views() if v.file_name() and is_javascript_file(v.file_name()) and not should_exclude(norm_path(v.file_name()))]
开发者ID:Jiliac,项目名称:SublimePackages,代码行数:8,代码来源:mysign.py
示例8: output_win
def output_win(self):
if self._frame is None or self._frame not in (w.id() for w in sublime.windows()):
before = set([w.id() for w in sublime.windows()])
sublime.run_command("new_window")
after = set([w.id() for w in sublime.windows()])
self._frame = after.difference(before).pop()
for win in sublime.windows():
if win.id() == self._frame:
return win
开发者ID:samizdatco,项目名称:sublime-text-shebang,代码行数:10,代码来源:mux.py
示例9: hijack_window
def hijack_window():
'''Execute on loading plugin or on new window open;
allow to open FB automatically in ST3
'''
settings = sublime.load_settings('dired.sublime-settings')
command = settings.get("dired_hijack_new_window")
if command:
if command == "jump_list":
sublime.set_timeout(lambda: sublime.windows()[-1].run_command("dired_jump_list"), 1)
else:
sublime.set_timeout(lambda: sublime.windows()[-1].run_command("dired", {"immediate": True}), 1)
开发者ID:aziz,项目名称:SublimeFileBrowser,代码行数:11,代码来源:common.py
示例10: plugin_loaded
def plugin_loaded():
rm_in = open(path.join(root_dir, 'system_settings.json'))
sys_settings = sublime.decode_value(rm_in.read())
rm_in.close()
if not sys_settings['is_init']:
sys_settings['is_init'] = True
rm_out = open(path.join(root_dir, 'system_settings.json'), 'w')
rm_out.write(sublime.encode_value(sys_settings))
rm_out.close()
sublime.windows()[0].open_file(path.join(root_dir, 'Docs/Docs-EN.md'))
开发者ID:Jatana,项目名称:FastOlympicCoding,代码行数:11,代码来源:Engine.py
示例11: init_
def init_(self):
# ST BUG https://github.com/SublimeTextIssues/Core/issues/5
# the application is not sending on_load when opening/restoring a window,
# then there is this hack which will simulate or synthesize an on_load when you open the application
# since this is just a hack, there is a terrible noticeable delay, which just sucks
self.on_load(sublime.active_window().active_view())
for window in sublime.windows():
for view in reversed(window.views()):
self.on_load(view)
for window in sublime.windows():
self.on_load(window.active_view())
self.restore_scroll(window.active_view())
开发者ID:psistorma,项目名称:PrivateSublimeSettings,代码行数:12,代码来源:BufferScroll.py
示例12: is_visible
def is_visible(self, source = "active_window"):
result = False
if (source in self.source_options):
if (source == 'active_window'):
result = len(self.window.views()) > 0
elif (source == 'all_windows'):
if (len(sublime.windows()) > 1):
view_count = 0
for w in sublime.windows():
view_count += len(w.views())
if view_count > 0:
break
result = (view_count > 0)
return result
开发者ID:kbaskett248,项目名称:sublist-open-files,代码行数:14,代码来源:ListOpenFiles.py
示例13: settings_changed
def settings_changed():
for window in sublime.windows():
for view in window.views():
linter = select_linter(view)
if (linter):
reload_settings(view)
开发者ID:BaNkIck,项目名称:dotfiles,代码行数:7,代码来源:SublimeLinter.py
示例14: focus_view
def focus_view(view):
# looks like view.window() is broken in ST2,
# use another way to find parent window
for w in sublime.windows():
for v in w.views():
if v.id() == view.id():
return w.focus_view(v)
开发者ID:archerchiu,项目名称:livestyle-sublime,代码行数:7,代码来源:livestyle.py
示例15: get_output_view
def get_output_view(tag, strategy, name, switch_to, fallback_window):
"""
Retrieves an output using the given strategy, window, and views.
"""
window_list = sublime.windows()
# Console Strategy
if strategy == 'console':
show_view(fallback_window, fallback_window.active_view(), True)
return fallback_window.get_output_panel(tag)
# Grouped strategy
if strategy == 'grouped':
for window in window_list:
view_list = window.views()
for view in view_list:
if view.settings().get('output_tag') == tag:
if switch_to:
show_view(window, view, False)
return window, view
if (strategy == 'separate') or (strategy == 'grouped'):
w = sublime.active_window()
v = w.active_view()
result = fallback_window.new_file()
result.set_name(name)
result.set_scratch(True)
result.settings().set('output_tag', tag)
if switch_to:
show_view(fallback_window, result, False)
else:
show_view(w, v, False)
return fallback_window, result
开发者ID:apense,项目名称:NimLime,代码行数:34,代码来源:misc.py
示例16: init
def init(self):
if self.inited:
return
sets = sublime.load_settings(settings_file)
if get_version() < 3000:
if sets.get("ha_style").startswith("underlined"):
sets.set("ha_style", "outlined")
if sets.get("icons"):
sets.set("icons", False)
if sets.get("icons_all"):
sets.set("icons_all", False)
sublime.save_settings(settings_file)
for k in ["enabled", "style", "ha_style", "icons_all", "icons", "color_formats"]:
self.settings[k] = sets.get(k)
self.settings["color_fmts"] = list(map(get_format, self.settings["color_formats"]))
sets.clear_on_change("ColorHighlighter")
sets.add_on_change("ColorHighlighter", lambda: self.on_ch_settings_change())
sets = sublime.load_settings("Preferences.sublime-settings")
self.settings["color_scheme"] = sets.get("color_scheme")
sets.clear_on_change("ColorHighlighter")
sets.add_on_change("ColorHighlighter", lambda: self.on_g_settings_change())
self.inited = True
for w in sublime.windows():
for v in w.views():
self.init_view(v)
开发者ID:rocknrollMarc,项目名称:Sublime-Text-2,代码行数:34,代码来源:ColorHighlighter.py
示例17: run
def run(self, url=None):
# Can't remember why doing this ?
window = sorted(sublime.windows(), key=lambda w: w.id())[0] #suself.window
txmt = url.startswith('txmt')
p = urlparse('http' + url[4:])
query = dict(parse_qsl(p.query))
if txmt:
url = query.get('url')
if url: f = unquote(urlparse(url).path)
else: f = window.active_view().file_name()
f += ':%(line)s:%(column)s' % query
else:
f = unquote(p.path)
@on_load(f, window)
def do(view):
if txmt: return
for cmd, args in loadsj(query.get('commands', '[]')):
if window:
if DEBUG:
# Formatted like sublime.log_commands(True)
print 'command: %s' % encode_for_command_line(cmd, args)
# Bug: command can't be unicode
window.run_command(cmd.encode('utf8'), args)
################################################################################
开发者ID:Metrakit,项目名称:sublime-protocol,代码行数:33,代码来源:createsblmlink.py
示例18: view_for_buffer_id
def view_for_buffer_id(buf_id):
for w in sublime.windows():
for v in w.views():
if str(v.buffer_id()) == buf_id:
return v
return None
开发者ID:benmccormick,项目名称:sublime-tern,代码行数:7,代码来源:tern.py
示例19: get_results_window
def get_results_window(self):
for window in sublime.windows():
for view in window.views():
if view.settings().get('parent_file') == self.current_file:
return view
window = sublime.active_window()
view = window.new_file()
view.set_syntax_file(sublime.packages_path() + '/RunInScratch/run_in_scratch.tmlanguage')
view.settings().set('parent_file', self.current_file)
view.settings().set('word_wrap', True)
window.run_command("set_layout",
{
"cols": [0.0, 0.65, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
})
view.set_name('Results of %s' % (self.tab_name))
view.settings().set("RunInScratch", True)
window.run_command("move_to_group", {"group": 1})
window.run_command("focus_group", {"group": 0})
view.set_scratch(True)
return view
开发者ID:ryecroft,项目名称:RunInScratch,代码行数:29,代码来源:RunInScratch.py
示例20: get_directories
def get_directories():
'''Get Open Directories in Sublime'''
dic = {}
# retrieve all Sublime windows
windows = sublime.windows()
for w in windows:
# and retrieve all unique directory path
fs = w.folders()
for f in fs:
key = f.split(os.path.sep)[-1]
if dic.has_key(key):
if dic[key] is f:
continue
else:
loop = True
num = 0
while(loop):
num += 1
k = key + " " + str(num)
if dic.has_key(k):
if dic[k] is f:
loop = False
break
else:
dic[k] = f
loop = False
break
else:
dic[key] = f
return dic
开发者ID:jasondavis,项目名称:SublimeServer,代码行数:30,代码来源:SublimeServer.py
注:本文中的sublime.windows函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论