本文整理汇总了Python中sublime.active_window函数的典型用法代码示例。如果您正苦于以下问题:Python active_window函数的具体用法?Python active_window怎么用?Python active_window使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了active_window函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: find_declaration
def find_declaration(data):
data = data['Data']
fname = data['File']
row = data['Line'] + 1
col = data['Column'] + 1
encoded = "{0}:{1}:{2}".format(fname, row, col)
sublime.active_window().open_file(encoded, sublime.ENCODED_POSITION)
开发者ID:ChrisDobby,项目名称:fsharpbinding,代码行数:7,代码来源:project.py
示例2: run
def run(self):
sublime.active_window().run_command(
'open_dir',
{
'dir': self.templates_path_string()
}
)
开发者ID:nighthawk,项目名称:sublime-jekyll,代码行数:7,代码来源:jekyll.py
示例3: handler
def handler(self, name, data):
if name == 'create_user':
del data['name']
try:
floorc = BASE_FLOORC + '\n'.join(['%s %s' % (k, v) for k, v in data.items()]) + '\n'
with open(G.FLOORC_PATH, 'wb') as floorc_fd:
floorc_fd.write(floorc.encode('utf-8'))
utils.reload_settings()
if False in [bool(x) for x in (G.USERNAME, G.API_KEY, G.SECRET)]:
sublime.message_dialog('Something went wrong. You will need to sign up for an account to use Floobits.')
api.send_error({'message': 'No username or secret'})
else:
p = os.path.join(G.BASE_DIR, 'welcome.md')
with open(p, 'wb') as fd:
text = welcome_text % (G.USERNAME, self.host)
fd.write(text.encode('utf-8'))
d = utils.get_persistent_data()
d['auto_generated_account'] = True
utils.update_persistent_data(d)
G.AUTO_GENERATED_ACCOUNT = True
sublime.active_window().open_file(p)
except Exception as e:
msg.error(e)
try:
d = utils.get_persistent_data()
d['disable_account_creation'] = True
utils.update_persistent_data(d)
finally:
self.stop()
开发者ID:chenkaigithub,项目名称:floobits-sublime,代码行数:29,代码来源:agent_connection.py
示例4: run
def run(self):
user_settings = os.path.join(
sublime.packages_path(),
"User",
"LaTeXTools.sublime-settings"
)
load_default = False
if not os.path.exists(user_settings):
migrate = sublime.ok_cancel_dialog(
'You do not currently have a personalized '
'LaTeXTools.sublime-settings file.\n\n'
'Create a copy of the default settings file in '
'your User directory?'
)
if migrate:
sublime.active_window().run_command('latextools_migrate')
else:
load_default = True
self.view = sublime.active_window().open_file(user_settings)
if load_default:
sublime.set_timeout(self.set_content, 1)
开发者ID:SublimeText,项目名称:LaTeXTools,代码行数:25,代码来源:latextools_default_settings.py
示例5: run
def run(self, edit, event):
if self.symbol_details:
view_path = self.symbol_details[0]
focus_region = self.symbol_details[1]
# collapse the region to a single point, the region start
focus_region = sublime.Region(focus_region.begin(), focus_region.begin())
# get the view with this path
view = sublime.active_window().find_open_file(view_path)
if view:
self.showSymbol(view, focus_region)
else:
# weird issue, but unless we open the file with 'ENCODED_POSITION' it won't scroll afterwards
# https://github.com/SublimeTextIssues/Core/issues/538
view = sublime.active_window().open_file("%s:%d:%d" % (view_path, 1, 0), sublime.ENCODED_POSITION)
def viewLoadedTimeout():
# we can run methods only on loaded views
if not view.is_loading():
self.showSymbol(view, focus_region)
else:
sublime.set_timeout(viewLoadedTimeout, 100)
# open is asynchronous, wait for a bit and then try to focus
sublime.set_timeout(viewLoadedTimeout, 100)
开发者ID:michalisb,项目名称:Assembly-RGBDS,代码行数:25,代码来源:show_definition.py
示例6: createWindowWithText
def createWindowWithText(self, textToDisplay, fileType, showResultInSameFile):
if not(showResultInSameFile):
view = sublime.active_window().new_file()
openedNewView = True
else:
view = self.findHttpResponseView()
openedNewView = False
if view is None:
view = sublime.active_window().new_file()
openedNewView = True
edit = view.begin_edit()
if not(openedNewView):
view.insert(edit, 0, "\n\n\n")
view.insert(edit, 0, textToDisplay)
view.end_edit(edit)
view.set_scratch(True)
view.set_read_only(False)
view.set_name("http response")
if fileType == HttpRequester.FILE_TYPE_HTML:
view.set_syntax_file("Packages/HTML/HTML.tmLanguage")
if fileType == HttpRequester.FILE_TYPE_JSON:
view.set_syntax_file("Packages/JavaScript/JSON.tmLanguage")
if fileType == HttpRequester.FILE_TYPE_XML:
view.set_syntax_file("Packages/XML/XML.tmLanguage")
return view.id()
开发者ID:Mondego,项目名称:pyreco,代码行数:28,代码来源:allPythonContent.py
示例7: on_list_selected_done
def on_list_selected_done(self, picked):
if picked == -1:
self.view.sel().clear()
for each in self.return_to:
self.view.sel().add(each)
self.view.show(self.view.sel())
else:
titles = self.get_comment_titles()
title = titles[picked]
row = title['line']
point = self.view.text_point(row, 0)
line_region = self.view.line(point)
# Reference the 'text' within the line only
text = title['text']
text = re.escape(text)
text = text.replace('\>', '>') # ">" does not work when escaped
text_region = self.view.find(text, line_region.a)
# view.rowcol() returns a zero based line number
line = int(title['line'])+1
# Use goto_line to move the document then highlight
if sublime.active_window().active_view():
sublime.active_window().active_view().run_command(
"goto_line", {"line": line}
)
self.view.sel().clear()
self.view.sel().add(text_region)
开发者ID:kizza,项目名称:Table-of-comments,代码行数:27,代码来源:tableofcomments.py
示例8: handle_result
def handle_result(self, cmd, outfile, retCode, output):
if retCode:
if output:
sublime.error_message(' '.join(cmd) + '\r\n\r\n' + output.decode('utf-8'))
else:
if self.get_setting('open_file'):
sublime.active_window().open_file(outfile)
开发者ID:tssajo,项目名称:Minify,代码行数:7,代码来源:Minify.py
示例9: run
def run(self, edit):
# print("test = " + str(Settings.get("test", "default")))
# print("Active window - " + sublime.active_window().project_file_name())
# deleteAllServers()
# loc = "http://localhost:62562/ready"
# print("Connecting to: " + loc)
# proxies={'http':None}
# # print(urllib.request.FancyURLopener({}).open(loc).read())
# # print(urllib.request.urlopen(loc, proxies={}).read())
# proxy_handler = urllib.request.ProxyHandler({})
# opener = urllib.request.build_opener(proxy_handler)
# opener.open('http://localhost:62562/ready')
# print(str(opener.open(loc)))
# print(str(opener.open(loc).read()))
# print(urllib.request.urlopen(loc, proxies={}).read())
window = sublime.active_window()
pt = window.create_output_panel("paneltest")
pt.set_read_only(False)
# edit = pt.begin_edit()
pt.insert(edit, pt.size(), "Writing...2")
pt.set_read_only(True)
# pt.end_edit(edit)
window.run_command("show_panel", {"panel": "output.paneltest"})
window = sublime.active_window()
开发者ID:kracejic,项目名称:cppinabox,代码行数:26,代码来源:cppinabox.py
示例10: connection_error
def connection_error(message):
"""
Template for showing error message on connection error/loss.
Keyword arguments:
message -- Exception/reason of connection error/loss.
"""
sublime.error_message("Please restart Xdebug debugging session.\nDisconnected from Xdebug debugger engine.\n" + message)
info("Connection lost with debugger engine.")
debug(message)
# Reset connection
try:
S.SESSION.clear()
except:
pass
finally:
S.SESSION = None
S.SESSION_BUSY = False
S.BREAKPOINT_EXCEPTION = None
S.BREAKPOINT_ROW = None
S.BREAKPOINT_RUN = None
S.CONTEXT_DATA.clear()
async_session = SocketHandler(ACTION_WATCH)
async_session.start()
# Reset layout
sublime.active_window().run_command('xdebug_layout')
# Render breakpoint markers
render_regions()
开发者ID:brownoxford,项目名称:SublimeTextXdebug,代码行数:28,代码来源:session.py
示例11: packagesComplete
def packagesComplete(data):
global INSTALLED_PACKAGES, DEFAULT_PACKAGES
INSTALLED_PACKAGES = data["installed_packages"]
DEFAULT_PACKAGES = data["default_packages"]
installed_menu = {
"selected_index": 1,
"items": [["Back", "Back to previous menu"]],
"actions": [
{
"name": "package_manager"
}
]
}
# Installed packages
install_update = False
for package in getInstalledPackages():
install_update = True
installed_menu["actions"].append({"command": "javatar_install", "args": {"installtype": "uninstall_package", "name": package["name"], "filename": package["path"]}})
installed_menu["items"].append([package["name"], "Installed (" + toReadableSize(package["path"]) + ")."])
if install_update:
installed_menu["selected_index"] = 2
sublime.active_window().run_command("javatar", {"replaceMenu": {
"name": "uninstall_packages",
"menu": installed_menu
}})
from .javatar_updater import updatePackages
updatePackages()
开发者ID:xiamizy,项目名称:Javatar,代码行数:29,代码来源:javatar_collections.py
示例12: get_target_ros_path
def get_target_ros_path(user_query=True):
ros_path_settings = sublime.load_settings(ROS_PATH_KEY)
path = ros_path_settings.get("path", "")
if path == "" and user_query:
sublime.message_dialog(MESSAGE_NO_KEY)
sublime.active_window().show_input_panel("Target ROS path:", "", save_ros_target_path, None, None)
return path
开发者ID:mstaflex,项目名称:sublime_tweaks,代码行数:7,代码来源:ros_distribute.py
示例13: on_ch_settings_change
def on_ch_settings_change(self):
sets = sublime.load_settings(settings_file)
enabled = sets.get("enabled")
if enabled != self.settings["enabled"]:
self.settings["enabled"] = enabled
if not enabled:
self.do_disable()
else:
self.do_enable()
style = sets.get("style")
if style != self.settings["style"]:
self.settings["style"] = style
self.on_selection_modified(sublime.active_window().active_view())
ha_style = sets.get("ha_style")
if ha_style != self.settings["ha_style"]:
self.settings["ha_style"] = ha_style
self.on_activated(sublime.active_window().active_view())
icons_all = sets.get("icons_all")
if icons_all != self.settings["icons_all"]:
self.settings["icons_all"] = icons_all
self.on_activated(sublime.active_window().active_view())
icons = sets.get("icons")
if icons != self.settings["icons"]:
self.settings["icons"] = icons
self.on_selection_modified(sublime.active_window().active_view())
color_formats = sets.get("color_formats")
if color_formats != self.settings["color_formats"]:
self.settings["color_formats"] = color_formats
self.settings["color_fmts"] = list(map(get_format, color_formats))
开发者ID:rocknrollMarc,项目名称:Sublime-Text-2,代码行数:35,代码来源:ColorHighlighter.py
示例14: run
def run(self, edit):
search_text = ''
s = OnlineSearcher()
for selection in self.view.sel():
search_text = self.view.substr(selection)
sublime.active_window().show_input_panel('Search online for', search_text,s.search, None, None)
开发者ID:rajeshvaya,项目名称:sublime-online-searcher,代码行数:7,代码来源:OnlineSearch.py
示例15: on_open_declaration
def on_open_declaration(location):
"""Call this callback when link to type is clicked in info popup.
Opens location with type declaration
"""
sublime.active_window().open_file(location, sublime.ENCODED_POSITION)
开发者ID:niosus,项目名称:EasyClangComplete,代码行数:7,代码来源:EasyClangComplete.py
示例16: on_done
def on_done( self , inp, cur_type ) :
fn = self.classpath;
parts = inp.split(".")
pack = []
while( len(parts) > 0 ):
p = parts.pop(0)
fn = os.path.join( fn , p )
if hxsrctools.is_type.match( p ) :
cl = p
break;
else :
pack.append(p)
if len(parts) > 0 :
cl = parts[0]
fn += ".hx"
src = "\npackage " + ".".join(pack) + ";\n\n"+cur_type+" "+cl+" "
if cur_type == "typedef" :
src += "= "
src += "{\n\n\t\n\n}"
current_create_type_info[fn] = src
sublime.active_window().open_file( fn )
开发者ID:frabbit,项目名称:haxe-sublime2-bundle,代码行数:31,代码来源:commands.py
示例17: run
def run(self, edit, template):
window = sublime.active_window()
view = self.view
# Path variables
folders = window.folders()
filename = view.file_name()
if (len(folders) > 0):
folder = folders[0] + '/'
filename = filename.replace(folder, '')
namespaces = Utils().get_psr4_namespaces()
if namespaces:
for namespace, folder in namespaces.items():
dirname = os.path.dirname(filename)
print(folder, dirname)
if dirname.startswith(folder):
# Now extract the namespace and classname
namespace = dirname.replace(folder, namespace).rstrip("\\")
classname = os.path.basename(filename).replace('.php', '')
xml = ElementTree.parse(template)
snippet = xml.getroot().find('content').text
sublime.active_window().run_command('insert_snippet', dict(contents=snippet, NAMESPACE=namespace, CLASSNAME=classname))
开发者ID:MrAtiebatie,项目名称:SublimeBasic,代码行数:25,代码来源:InsertFileTemplateCommand.py
示例18: run
def run(self, edit):
global Sockets, Infos, Cursors, OCursors, Started
def onDone(message):
global Sockets, Infos, Cursors, Started
try:
Host, Port = message.split(':', 1)
Port = int(Port)
Sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
Infos.append(self.view)
Cursors.append(list(self.view.sel()))
OCursors.append([])
try:
Sock.connect((Host, Port))
Sockets.append(Sock)
if not Started:
Started = True
sublime.set_timeout_async(Loop, 0)
except:
sublime.error_message('Unable to connect.')
except:
sublime.error_message('Please enter hostname:port.')
sublime.active_window().show_input_panel('Hostname:port', '', onDone, None, None)
开发者ID:Prince-Leto,项目名称:ProjetReseau,代码行数:27,代码来源:LISS.py
示例19: _get_cache
def _get_cache():
if _ST3:
cache_path = os.path.normpath(
os.path.join(sublime.cache_path(), "LaTeXTools"))
else:
cache_path = os.path.normpath(
os.path.join(sublime.packages_path(), "User"))
pkg_cache_file = os.path.normpath(
os.path.join(cache_path, 'pkg_cache.cache'
if _ST3 else 'latextools_pkg_cache.cache'))
cache = None
if not os.path.exists(pkg_cache_file):
gen_cache = sublime.ok_cancel_dialog(
"Cache files for installed packages, "
"classes and bibliographystyles do not exists, "
"would you like to generate it? After generating complete, "
"please re-run this completion action!"
)
if gen_cache:
sublime.active_window().run_command("latex_gen_pkg_cache")
else:
with open(pkg_cache_file) as f:
cache = json.load(f)
return cache
开发者ID:pantheras,项目名称:LaTeXTools,代码行数:27,代码来源:latex_input_completions.py
示例20: run
def run(self, should_split_view):
pfe_settings.set('should_split_view', should_split_view)
current_file = sublime.active_window().active_view().file_name()
schema = sublime.active_window().active_view().file_name().split('/').pop(-2)
file_name = sublime.active_window().active_view().file_name().split('/').pop()
if (schema == "testing") or (schema == "public"):
if schema == "testing":
new_file = "../"+"public" + "/" + file_name[5:]
else:
new_file = "../"+"testing" + "/" + "test_" + file_name
else:
if(file_name.startswith("test_")):
print(file_name)
new_file = "../" + schema.rstrip("testing").rstrip("_") + "/" + file_name[5:]
else:
new_file = "../" + schema + "_testing" + "/" + "test_" + file_name
if self.window.find_open_file(new_file):
if should_split_view is True:
self.split_view()
self.window.open_file(new_file)
else:
self.window.show_input_panel("file_name:",
new_file,
self.on_done, None, None)
开发者ID:barkingfoodog,项目名称:pfe,代码行数:25,代码来源:postgresql_function_editor.py
注:本文中的sublime.active_window函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论