Merge branch 'neeasade-master'
This commit is contained in:
commit
66e0812ab6
@ -35,6 +35,12 @@ Added
|
|||||||
instance.
|
instance.
|
||||||
- New setting `statusbar.url.fg.success.https` to set the foreground color for
|
- New setting `statusbar.url.fg.success.https` to set the foreground color for
|
||||||
the URL when a page was loaded via HTTPS.
|
the URL when a page was loaded via HTTPS.
|
||||||
|
- The scrollbar in the completion is now styled, and the following new options
|
||||||
|
got added:
|
||||||
|
* `completion -> scrollbar-width`
|
||||||
|
* `completion -> scrollbar-padding`
|
||||||
|
* `colors -> completion.scrollbar.fg`
|
||||||
|
* `colors -> completion.scrollbar.bg`
|
||||||
|
|
||||||
Changed
|
Changed
|
||||||
~~~~~~~
|
~~~~~~~
|
||||||
|
@ -144,10 +144,10 @@ Contributors, sorted by the number of commits in descending order:
|
|||||||
* Claude
|
* Claude
|
||||||
* Lamar Pavel
|
* Lamar Pavel
|
||||||
* Daniel
|
* Daniel
|
||||||
|
* Nathan Isom
|
||||||
* Austin Anderson
|
* Austin Anderson
|
||||||
* Artur Shaik
|
* Artur Shaik
|
||||||
* Thorsten Wißmann
|
* Thorsten Wißmann
|
||||||
* Nathan Isom
|
|
||||||
* Alexey "Averrin" Nabrodov
|
* Alexey "Averrin" Nabrodov
|
||||||
* meles5
|
* meles5
|
||||||
* ZDarian
|
* ZDarian
|
||||||
|
@ -78,6 +78,8 @@
|
|||||||
|<<completion-web-history-max-items,web-history-max-items>>|How many URLs to show in the web history.
|
|<<completion-web-history-max-items,web-history-max-items>>|How many URLs to show in the web history.
|
||||||
|<<completion-quick-complete,quick-complete>>|Whether to move on to the next part when there's only one possible completion left.
|
|<<completion-quick-complete,quick-complete>>|Whether to move on to the next part when there's only one possible completion left.
|
||||||
|<<completion-shrink,shrink>>|Whether to shrink the completion to be smaller than the configured size if there are no scrollbars.
|
|<<completion-shrink,shrink>>|Whether to shrink the completion to be smaller than the configured size if there are no scrollbars.
|
||||||
|
|<<completion-scrollbar-width,scrollbar-width>>|Width of the scrollbar in the completion window (in px).
|
||||||
|
|<<completion-scrollbar-padding,scrollbar-padding>>|Padding of scrollbar handle in completion window (in px).
|
||||||
|==============
|
|==============
|
||||||
|
|
||||||
.Quick reference for section ``input''
|
.Quick reference for section ``input''
|
||||||
@ -196,6 +198,8 @@
|
|||||||
|<<colors-completion.item.selected.border.top,completion.item.selected.border.top>>|Top border color of the completion widget category headers.
|
|<<colors-completion.item.selected.border.top,completion.item.selected.border.top>>|Top border color of the completion widget category headers.
|
||||||
|<<colors-completion.item.selected.border.bottom,completion.item.selected.border.bottom>>|Bottom border color of the selected completion item.
|
|<<colors-completion.item.selected.border.bottom,completion.item.selected.border.bottom>>|Bottom border color of the selected completion item.
|
||||||
|<<colors-completion.match.fg,completion.match.fg>>|Foreground color of the matched text in the completion.
|
|<<colors-completion.match.fg,completion.match.fg>>|Foreground color of the matched text in the completion.
|
||||||
|
|<<colors-completion.scrollbar.fg,completion.scrollbar.fg>>|Color of the scrollbar handle in completion view.
|
||||||
|
|<<colors-completion.scrollbar.bg,completion.scrollbar.bg>>|Color of the scrollbar in completion view
|
||||||
|<<colors-statusbar.fg,statusbar.fg>>|Foreground color of the statusbar.
|
|<<colors-statusbar.fg,statusbar.fg>>|Foreground color of the statusbar.
|
||||||
|<<colors-statusbar.bg,statusbar.bg>>|Background color of the statusbar.
|
|<<colors-statusbar.bg,statusbar.bg>>|Background color of the statusbar.
|
||||||
|<<colors-statusbar.fg.error,statusbar.fg.error>>|Foreground color of the statusbar if there was an error.
|
|<<colors-statusbar.fg.error,statusbar.fg.error>>|Foreground color of the statusbar if there was an error.
|
||||||
@ -833,6 +837,18 @@ Valid values:
|
|||||||
|
|
||||||
Default: +pass:[false]+
|
Default: +pass:[false]+
|
||||||
|
|
||||||
|
[[completion-scrollbar-width]]
|
||||||
|
=== scrollbar-width
|
||||||
|
Width of the scrollbar in the completion window (in px).
|
||||||
|
|
||||||
|
Default: +pass:[12]+
|
||||||
|
|
||||||
|
[[completion-scrollbar-padding]]
|
||||||
|
=== scrollbar-padding
|
||||||
|
Padding of scrollbar handle in completion window (in px).
|
||||||
|
|
||||||
|
Default: +pass:[2]+
|
||||||
|
|
||||||
== input
|
== input
|
||||||
Options related to input modes.
|
Options related to input modes.
|
||||||
|
|
||||||
@ -1655,6 +1671,18 @@ Foreground color of the matched text in the completion.
|
|||||||
|
|
||||||
Default: +pass:[#ff4444]+
|
Default: +pass:[#ff4444]+
|
||||||
|
|
||||||
|
[[colors-completion.scrollbar.fg]]
|
||||||
|
=== completion.scrollbar.fg
|
||||||
|
Color of the scrollbar handle in completion view.
|
||||||
|
|
||||||
|
Default: +pass:[${completion.fg}]+
|
||||||
|
|
||||||
|
[[colors-completion.scrollbar.bg]]
|
||||||
|
=== completion.scrollbar.bg
|
||||||
|
Color of the scrollbar in completion view
|
||||||
|
|
||||||
|
Default: +pass:[${completion.bg}]+
|
||||||
|
|
||||||
[[colors-statusbar.fg]]
|
[[colors-statusbar.fg]]
|
||||||
=== statusbar.fg
|
=== statusbar.fg
|
||||||
Foreground color of the statusbar.
|
Foreground color of the statusbar.
|
||||||
|
@ -81,10 +81,24 @@ class CompletionView(QTreeView):
|
|||||||
QTreeView:item::hover {
|
QTreeView:item::hover {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
"""
|
|
||||||
|
|
||||||
# FIXME style scrollbar
|
QTreeView QScrollBar {
|
||||||
# https://github.com/The-Compiler/qutebrowser/issues/117
|
width: {{ config.get('completion', 'scrollbar-width') }}px;
|
||||||
|
background: {{ color['completion.scrollbar.bg'] }};
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView QScrollBar::handle {
|
||||||
|
background: {{ color['completion.scrollbar.fg'] }};
|
||||||
|
border: {{ config.get('completion', 'scrollbar-padding') }}px solid
|
||||||
|
{{ color['completion.scrollbar.bg'] }};
|
||||||
|
min-height: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QTreeView QScrollBar::sub-line, QScrollBar::add-line {
|
||||||
|
border: none;
|
||||||
|
background: none;
|
||||||
|
}
|
||||||
|
"""
|
||||||
|
|
||||||
resize_completion = pyqtSignal()
|
resize_completion = pyqtSignal()
|
||||||
|
|
||||||
|
@ -414,6 +414,14 @@ def data(readonly=False):
|
|||||||
"Whether to shrink the completion to be smaller than the "
|
"Whether to shrink the completion to be smaller than the "
|
||||||
"configured size if there are no scrollbars."),
|
"configured size if there are no scrollbars."),
|
||||||
|
|
||||||
|
('scrollbar-width',
|
||||||
|
SettingValue(typ.Int(minval=0), '12'),
|
||||||
|
"Width of the scrollbar in the completion window (in px)."),
|
||||||
|
|
||||||
|
('scrollbar-padding',
|
||||||
|
SettingValue(typ.Int(minval=0), '2'),
|
||||||
|
"Padding of scrollbar handle in completion window (in px)."),
|
||||||
|
|
||||||
readonly=readonly
|
readonly=readonly
|
||||||
)),
|
)),
|
||||||
|
|
||||||
@ -872,6 +880,14 @@ def data(readonly=False):
|
|||||||
SettingValue(typ.QssColor(), '#ff4444'),
|
SettingValue(typ.QssColor(), '#ff4444'),
|
||||||
"Foreground color of the matched text in the completion."),
|
"Foreground color of the matched text in the completion."),
|
||||||
|
|
||||||
|
('completion.scrollbar.fg',
|
||||||
|
SettingValue(typ.QssColor(), '${completion.fg}'),
|
||||||
|
"Color of the scrollbar handle in completion view."),
|
||||||
|
|
||||||
|
('completion.scrollbar.bg',
|
||||||
|
SettingValue(typ.QssColor(), '${completion.bg}'),
|
||||||
|
"Color of the scrollbar in completion view"),
|
||||||
|
|
||||||
('statusbar.fg',
|
('statusbar.fg',
|
||||||
SettingValue(typ.QssColor(), 'white'),
|
SettingValue(typ.QssColor(), 'white'),
|
||||||
"Foreground color of the statusbar."),
|
"Foreground color of the statusbar."),
|
||||||
|
@ -42,7 +42,8 @@ def get_stylesheet(template_str):
|
|||||||
"""
|
"""
|
||||||
colordict = ColorDict(config.section('colors'))
|
colordict = ColorDict(config.section('colors'))
|
||||||
template = jinja2.Template(template_str)
|
template = jinja2.Template(template_str)
|
||||||
return template.render(color=colordict, font=config.section('fonts'))
|
return template.render(color=colordict, font=config.section('fonts'),
|
||||||
|
config=objreg.get('config'))
|
||||||
|
|
||||||
|
|
||||||
def set_register_stylesheet(obj):
|
def set_register_stylesheet(obj):
|
||||||
|
@ -27,15 +27,25 @@ from PyQt5.QtGui import QColor
|
|||||||
from qutebrowser.config import style
|
from qutebrowser.config import style
|
||||||
|
|
||||||
|
|
||||||
def test_get_stylesheet(config_stub):
|
@pytest.mark.parametrize('template, expected', [
|
||||||
|
("{{ color['completion.bg'] }}", "black"),
|
||||||
|
("{{ color['completion.fg'] }}", "red"),
|
||||||
|
("{{ font['completion'] }}", "foo"),
|
||||||
|
("{{ config.get('foo', 'bar') }}", "baz"),
|
||||||
|
])
|
||||||
|
def test_get_stylesheet(config_stub, template, expected):
|
||||||
config_stub.data = {
|
config_stub.data = {
|
||||||
'colors': {'completion.bg': 'black'},
|
'colors': {
|
||||||
'fonts': {'completion': 'foo'},
|
'completion.bg': 'black',
|
||||||
|
'completion.fg': 'red',
|
||||||
|
},
|
||||||
|
'fonts': {
|
||||||
|
'completion': 'foo',
|
||||||
|
},
|
||||||
'foo': {'bar': 'baz'},
|
'foo': {'bar': 'baz'},
|
||||||
}
|
}
|
||||||
template = "{{ color['completion.bg'] }}\n{{ font['completion'] }}"
|
|
||||||
rendered = style.get_stylesheet(template)
|
rendered = style.get_stylesheet(template)
|
||||||
assert rendered == 'black\nfoo'
|
assert rendered == expected
|
||||||
|
|
||||||
|
|
||||||
class Obj(QObject):
|
class Obj(QObject):
|
||||||
@ -105,5 +115,3 @@ class TestColorDict:
|
|||||||
d['foo'] = QColor()
|
d['foo'] = QColor()
|
||||||
with pytest.raises(TypeError):
|
with pytest.raises(TypeError):
|
||||||
d['foo'] # pylint: disable=pointless-statement
|
d['foo'] # pylint: disable=pointless-statement
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user