Skip to content

Commit d321952

Browse files
author
Ike Ku
authoredSep 14, 2017
Build 3127 Improvements (#113)
* Title bar and tabs height * File icons as deps * Sidebar row bg * fixup! Sidebar row bg * Sidebar tree selected row contrast * fixup! Sidebar tree selected row contrast * Fix popups * Revert roboto mono as default font * Add A File icon * Update hero
1 parent 714c9bb commit d321952

File tree

377 files changed

+445
-1600
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

377 files changed

+445
-1600
lines changed
 

‎.supports-a-file-icon-customization

Whitespace-only changes.

‎Icons.py

+80
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
"""
2+
A File Icon Installer
3+
"""
4+
5+
import os
6+
import sublime
7+
8+
ICONS_PACKAGE = "A File Icon"
9+
PKGCTRL_SETTINGS = "Package Control.sublime-settings"
10+
11+
THEME_NAME = os.path.splitext(
12+
os.path.basename(os.path.dirname(__file__))
13+
)[0]
14+
15+
MSG = """\
16+
<div id="afi-installer">
17+
<style>
18+
#afi-installer {{
19+
padding: 1rem;
20+
line-height: 1.5;
21+
}}
22+
#afi-installer code {{
23+
background-color: color(var(--background) blend(var(--foreground) 80%));
24+
line-height: 1;
25+
padding: 0.25rem;
26+
}}
27+
#afi-installer a {{
28+
padding: 0;
29+
margin: 0;
30+
}}
31+
</style>
32+
33+
{} requires <code>A File Icon</code> package for enhanced<br>support of
34+
the file-specific icons.
35+
<br><br>Would you like to install it?<br>
36+
<br><a href="install">Install</a> <a href="cancel">Cancel</a>
37+
</div>
38+
""".format(THEME_NAME)
39+
40+
41+
def is_installed():
42+
pkgctrl_settings = sublime.load_settings(PKGCTRL_SETTINGS)
43+
44+
return ICONS_PACKAGE in set(pkgctrl_settings.get("installed_packages", []))
45+
46+
47+
def on_navigate(href):
48+
if href.startswith("install"):
49+
install()
50+
else:
51+
hide()
52+
53+
54+
def install():
55+
print("Installing `{}` ...".format(ICONS_PACKAGE))
56+
sublime.active_window().run_command(
57+
"advanced_install_package", {"packages": ICONS_PACKAGE}
58+
)
59+
hide()
60+
61+
62+
def hide():
63+
sublime.active_window().active_view().hide_popup()
64+
65+
66+
def plugin_loaded():
67+
from package_control import events
68+
69+
if events.install(THEME_NAME) and not is_installed():
70+
window = sublime.active_window()
71+
view = window.active_view()
72+
window.focus_view(view)
73+
row = int(view.rowcol(view.visible_region().a)[0] + 1)
74+
view.show_popup(
75+
MSG,
76+
location=view.text_point(row, 5),
77+
max_width=800,
78+
max_height=800,
79+
on_navigate=on_navigate
80+
)

0 commit comments

Comments
 (0)
Please sign in to comment.