Skip to content

Commit

Permalink
Update changes.py to latest
Browse files Browse the repository at this point in the history
  • Loading branch information
facelessuser committed Aug 22, 2016
1 parent 9c9c77a commit 6e7d48d
Showing 1 changed file with 20 additions and 13 deletions.
33 changes: 20 additions & 13 deletions changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,31 @@ class ScopeHunterChangesCommand(sublime_plugin.WindowCommand):

def run(self):
"""Show the changelog in a new view."""
import mdpopups
try:
import mdpopups
has_phantom_support = (mdpopups.version() >= (1, 10, 0)) and (int(sublime.version()) >= 3118)
except Exception:
has_phantom_support = False

text = sublime.load_resource('Packages/ScopeHunter/CHANGES.md')
view = self.window.new_file()
view.set_name('ScopeHunter - Changelog')
view.settings().set('gutter', False)
html = '<div class="scope-hunter">%s</div>' % mdpopups.md2html(view, text)
mdpopups.add_phantom(view, 'changelog', sublime.Region(0), html, sublime.LAYOUT_INLINE, css=CSS)
if has_phantom_support:
mdpopups.add_phantom(
view,
'changelog',
sublime.Region(0),
text,
sublime.LAYOUT_INLINE,
wrapper_class="scope-hunter",
css=CSS
)
else:
view.run_command('insert', {"characters": text})
view.set_read_only(True)
view.set_scratch(True)

def is_enabled(self):
"""Check if is enabled."""
try:
import mdpopups
except Exception:
return False

return (mdpopups.version() >= (1, 7, 3)) and (int(sublime.version()) >= 3118)

is_visible = is_enabled
def on_navigate(self, href):
"""Open links."""
webbrowser.open_new_tab(href)

0 comments on commit 6e7d48d

Please sign in to comment.