Skip to content

Commit

Permalink
made CSS for popup templates theme agnostic, resolves #595
Browse files Browse the repository at this point in the history
  • Loading branch information
DamnWidget committed Jan 21, 2017
1 parent 442b217 commit ab2fad5
Show file tree
Hide file tree
Showing 11 changed files with 44 additions and 60 deletions.
8 changes: 4 additions & 4 deletions Anaconda.sublime-settings
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
runs in a ST3 installation equal to or newer than build 3070, it
can be configured to show tooltips for documentation and signatures.
The options below set how the tooltip is shown. Set the theme
as dark if you are using a dark theme or light if you are using
a light one.
The options below set how the tooltip looks.
*/
"anaconda_tooltip_theme": "dark", // possible options: "light" or "dark"
"anaconda_tooltip_theme": "popup",

/*
If you set the following option as true, anaconda will display the
Expand Down Expand Up @@ -648,3 +646,5 @@
*/
"auto_unload_conflictive_plugins": true
}

// vim: set ft=javascript:
2 changes: 1 addition & 1 deletion anaconda_lib/linting/anaconda_pylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def parse_errors(self):
for error in data.splitlines():
if '************* Module ' in error:
_, module = error.split('************* Module ')
if not module in self.filename:
if module not in self.filename:
continue
else:
offset = None
Expand Down
2 changes: 1 addition & 1 deletion anaconda_lib/tooltips.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def _generate(self, tooltip: str, content: Dict[str, str]) -> Union[Dict[str, st

try:
t = self.theme
theme = self.themes[t] if t in self.themes else self.themes['dark']
theme = self.themes[t] if t in self.themes else self.themes['popup'] # noqa
context = {'css': theme}
context.update(content)
data = self.tooltips[tooltip].safe_substitute(context)
Expand Down
6 changes: 3 additions & 3 deletions commands/doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def run(self, edit: sublime.Edit) -> None:
except Exception as error:
print(error)
else:
if (get_settings(self.view, 'enable_docstrings_tooltip', False)
and int(sublime.version()) >= 3070):
if get_settings(self.view, 'enable_docstrings_tooltip', False) \
and int(sublime.version()) >= 3070:
self.print_popup(edit)
else:
self.print_doc(edit)
Expand Down Expand Up @@ -90,7 +90,7 @@ def print_popup(self, edit) -> None:
docstring = ''.join(dlines[1:])
content = {'name': name, 'content': docstring}
self.documentation = None
css = get_settings(self.view, 'anaconda_tooltip_theme', 'dark')
css = get_settings(self.view, 'anaconda_tooltip_theme', 'popup')
Tooltip(css).show_tooltip(
self.view, 'doc', content, partial(self.print_doc, edit))

Expand Down
19 changes: 0 additions & 19 deletions css/dark.css

This file was deleted.

24 changes: 0 additions & 24 deletions css/light.css

This file was deleted.

21 changes: 21 additions & 0 deletions css/popup.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
html, body { padding: 0; margin: 0; }

div.anaconda {
background-color: color(var(--background) blend(gray 80%));
display: block;
padding: 0.5rem;
}

.anaconda h3 {
font-weight: bold;
font-size: 1.05rem;
}

.anaconda .signature {
font-weight: bold;
}

.anaconda .doc_signature {
font-weight: bold;
font-size: 1.05em;
}
2 changes: 1 addition & 1 deletion listeners/signatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def _show_popup(self, view: sublime.View) -> None:
content = {'signature': self.signature, 'doc': self.doc}
display_tooltip = 'signature_doc'

css = get_settings(view, 'anaconda_tooltip_theme', 'dark')
css = get_settings(view, 'anaconda_tooltip_theme', 'popup')
Tooltip(css).show_tooltip(
view, display_tooltip, content, partial(self._show_status, view))

Expand Down
8 changes: 5 additions & 3 deletions templates/tooltips/doc.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<div class="doc">
<h3>Docstring for <em>${name}</em>:</h3>
<p class="content">${content}</p>
<div class="anaconda">
<div class="doc">
<h3>Docstring for <em>${name}</em>:</h3>
<p class="content">${content}</p>
</div>
</div>
4 changes: 3 additions & 1 deletion templates/tooltips/signature.tpl
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
<div class="signature">${content}</div>
<div class="anaconda">
<div class="signature">${content}</div>
</div>
8 changes: 5 additions & 3 deletions templates/tooltips/signature_doc.tpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
<div class="doc_signature">${signature}</div>
<div class="doc_signature_doc">
<p class="content">${doc}</p>
<div class="anaconda">
<div class="doc_signature">${signature}</div>
<div class="doc_signature_doc">
<p class="content">${doc}</p>
</div>
</div>

0 comments on commit ab2fad5

Please sign in to comment.