本文整理汇总了Python中qutebrowser.utils.utils.interpolate_color函数的典型用法代码示例。如果您正苦于以下问题:Python interpolate_color函数的具体用法?Python interpolate_color怎么用?Python interpolate_color使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了interpolate_color函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_valid_percentages_hsv
def test_valid_percentages_hsv(self):
"""Test 0% and 100% in the HSV colorspace."""
white = utils.interpolate_color(self.white, self.black, 0, QColor.Hsv)
black = utils.interpolate_color(self.white, self.black, 100,
QColor.Hsv)
self.assertEqual(Color(white), self.white)
self.assertEqual(Color(black), self.black)
开发者ID:larryhynes,项目名称:qutebrowser,代码行数:7,代码来源:test_utils.py
示例2: test_valid_percentages_hsl
def test_valid_percentages_hsl(self):
"""Test 0% and 100% in the HSL colorspace."""
white = utils.interpolate_color(self.white, self.black, 0, QColor.Hsl)
black = utils.interpolate_color(self.white, self.black, 100,
QColor.Hsl)
assert Color(white) == self.white
assert Color(black) == self.black
开发者ID:andor44,项目名称:qutebrowser,代码行数:7,代码来源:test_utils.py
示例3: test_interpolation_hsv
def test_interpolation_hsv(self):
"""Test an interpolation in the HSV colorspace."""
start = Color()
stop = Color()
start.setHsv(0, 40, 100)
stop.setHsv(0, 20, 200)
color = utils.interpolate_color(start, stop, 50, QColor.Hsv)
expected = Color()
expected.setHsv(0, 30, 150)
self.assertEqual(Color(color), expected)
开发者ID:larryhynes,项目名称:qutebrowser,代码行数:10,代码来源:test_utils.py
示例4: bg_color
def bg_color(self):
"""Background color to be shown."""
start = config.get('colors', 'downloads.bg.start')
stop = config.get('colors', 'downloads.bg.stop')
system = config.get('colors', 'downloads.bg.system')
if self._percentage() is None:
return start
else:
return utils.interpolate_color(start, stop, self._percentage(),
system)
开发者ID:har5ha,项目名称:qutebrowser,代码行数:10,代码来源:downloads.py
示例5: test_interpolation_hsl
def test_interpolation_hsl(self):
"""Test an interpolation in the HSL colorspace."""
start = Color()
stop = Color()
start.setHsl(0, 40, 100)
stop.setHsl(0, 20, 200)
color = utils.interpolate_color(start, stop, 50, QColor.Hsl)
expected = Color()
expected.setHsl(0, 30, 150)
assert Color(color) == expected
开发者ID:andor44,项目名称:qutebrowser,代码行数:10,代码来源:test_utils.py
示例6: on_load_progress
def on_load_progress(self, tab, perc):
"""Adjust tab indicator on load progress."""
try:
idx = self.indexOf(tab)
except RuntimeError:
# We can get signals for tabs we already deleted...
return
start = config.get('colors', 'tabs.indicator.start')
stop = config.get('colors', 'tabs.indicator.stop')
system = config.get('colors', 'tabs.indicator.system')
color = utils.interpolate_color(start, stop, perc, system)
self.tabBar().set_tab_indicator_color(idx, color)
开发者ID:HalosGhost,项目名称:qutebrowser,代码行数:12,代码来源:tabbedbrowser.py
示例7: bg_color
def bg_color(self):
"""Background color to be shown."""
start = config.get('colors', 'downloads.bg.start')
stop = config.get('colors', 'downloads.bg.stop')
system = config.get('colors', 'downloads.bg.system')
error = config.get('colors', 'downloads.bg.error')
if self.error_msg is not None:
assert not self.successful
return error
elif self.stats.percentage() is None:
return start
else:
return utils.interpolate_color(
start, stop, self.stats.percentage(), system)
开发者ID:xetch,项目名称:qutebrowser,代码行数:14,代码来源:downloads.py
示例8: on_load_progress
def on_load_progress(self, tab, perc):
"""Adjust tab indicator on load progress."""
try:
idx = self._tab_index(tab)
except TabDeletedError:
# We can get signals for tabs we already deleted...
return
start = config.get('colors', 'tabs.indicator.start')
stop = config.get('colors', 'tabs.indicator.stop')
system = config.get('colors', 'tabs.indicator.system')
color = utils.interpolate_color(start, stop, perc, system)
self.set_tab_indicator_color(idx, color)
self.update_tab_title(idx)
if idx == self.currentIndex():
self.update_window_title()
开发者ID:nicoddemus,项目名称:qutebrowser,代码行数:15,代码来源:tabbedbrowser.py
示例9: on_load_finished
def on_load_finished(self, tab, ok):
"""Adjust tab indicator when loading finished."""
try:
idx = self.indexOf(tab)
except RuntimeError:
# We can get signals for tabs we already deleted...
return
if ok:
start = config.get('colors', 'tab.indicator.start')
stop = config.get('colors', 'tab.indicator.stop')
system = config.get('colors', 'tab.indicator.system')
color = utils.interpolate_color(start, stop, 100, system)
else:
color = config.get('colors', 'tab.indicator.error')
self.tabBar().set_tab_indicator_color(idx, color)
开发者ID:anweshknayak,项目名称:qutebrowser,代码行数:15,代码来源:tabbedbrowser.py
示例10: on_load_finished
def on_load_finished(self, tab, ok):
"""Adjust tab indicator when loading finished."""
try:
idx = self._tab_index(tab)
except TabDeletedError:
# We can get signals for tabs we already deleted...
return
if ok:
start = config.get('colors', 'tabs.indicator.start')
stop = config.get('colors', 'tabs.indicator.stop')
system = config.get('colors', 'tabs.indicator.system')
color = utils.interpolate_color(start, stop, 100, system)
else:
color = config.get('colors', 'tabs.indicator.error')
self.set_tab_indicator_color(idx, color)
self.update_tab_title(idx)
if idx == self.currentIndex():
self.update_window_title()
开发者ID:nicoddemus,项目名称:qutebrowser,代码行数:18,代码来源:tabbedbrowser.py
示例11: on_load_finished
def on_load_finished(self, tab, ok):
"""Adjust tab indicator when loading finished."""
try:
idx = self._tab_index(tab)
except TabDeletedError:
# We can get signals for tabs we already deleted...
return
if ok:
start = config.val.colors.tabs.indicator.start
stop = config.val.colors.tabs.indicator.stop
system = config.val.colors.tabs.indicator.system
color = utils.interpolate_color(start, stop, 100, system)
else:
color = config.val.colors.tabs.indicator.error
self.widget.set_tab_indicator_color(idx, color)
self.widget.update_tab_title(idx)
if idx == self.widget.currentIndex():
self._update_window_title()
tab.handle_auto_insert_mode(ok)
开发者ID:mehak,项目名称:qutebrowser,代码行数:19,代码来源:tabbedbrowser.py
示例12: on_load_finished
def on_load_finished(self, tab):
"""Adjust tab indicator when loading finished.
We don't take loadFinished's ok argument here as it always seems to be
true when the QWebPage has an ErrorPageExtension implemented.
See https://github.com/The-Compiler/qutebrowser/issues/84
"""
try:
idx = self.indexOf(tab)
except RuntimeError:
# We can get signals for tabs we already deleted...
return
if tab.page().error_occured:
color = config.get('colors', 'tabs.indicator.error')
else:
start = config.get('colors', 'tabs.indicator.start')
stop = config.get('colors', 'tabs.indicator.stop')
system = config.get('colors', 'tabs.indicator.system')
color = utils.interpolate_color(start, stop, 100, system)
self.tabBar().set_tab_indicator_color(idx, color)
开发者ID:HalosGhost,项目名称:qutebrowser,代码行数:20,代码来源:tabbedbrowser.py
示例13: get_status_color
def get_status_color(self, position):
"""Choose an appropriate color for presenting the download's status.
Args:
position: The color type requested, can be 'fg' or 'bg'.
"""
# pylint: disable=bad-config-call
# WORKAROUND for https://bitbucket.org/logilab/astroid/issue/104/
assert position in ("fg", "bg")
start = config.get('colors', 'downloads.{}.start'.format(position))
stop = config.get('colors', 'downloads.{}.stop'.format(position))
system = config.get('colors', 'downloads.{}.system'.format(position))
error = config.get('colors', 'downloads.{}.error'.format(position))
if self.error_msg is not None:
assert not self.successful
return error
elif self.stats.percentage() is None:
return start
else:
return utils.interpolate_color(
start, stop, self.stats.percentage(), system)
开发者ID:a2batic,项目名称:qutebrowser,代码行数:21,代码来源:downloads.py
示例14: get_status_color
def get_status_color(self, position):
"""Choose an appropriate color for presenting the download's status.
Args:
position: The color type requested, can be 'fg' or 'bg'.
"""
assert position in ["fg", "bg"]
# pylint: disable=bad-config-option
start = getattr(config.val.colors.downloads.start, position)
stop = getattr(config.val.colors.downloads.stop, position)
system = getattr(config.val.colors.downloads.system, position)
error = getattr(config.val.colors.downloads.error, position)
# pylint: enable=bad-config-option
if self.error_msg is not None:
assert not self.successful
return error
elif self.stats.percentage() is None:
return start
else:
return utils.interpolate_color(start, stop,
self.stats.percentage(), system)
开发者ID:swalladge,项目名称:qutebrowser,代码行数:21,代码来源:downloads.py
示例15: on_load_finished
def on_load_finished(self, tab):
"""Adjust tab indicator when loading finished.
We don't take loadFinished's ok argument here as it always seems to be
true when the QWebPage has an ErrorPageExtension implemented.
See https://github.com/The-Compiler/qutebrowser/issues/84
"""
try:
idx = self._tab_index(tab)
except TabDeletedError:
# We can get signals for tabs we already deleted...
return
if tab.page().error_occurred:
color = config.get("colors", "tabs.indicator.error")
else:
start = config.get("colors", "tabs.indicator.start")
stop = config.get("colors", "tabs.indicator.stop")
system = config.get("colors", "tabs.indicator.system")
color = utils.interpolate_color(start, stop, 100, system)
self.set_tab_indicator_color(idx, color)
self.update_tab_title(idx)
if idx == self.currentIndex():
self.update_window_title()
开发者ID:rumpelsepp,项目名称:qutebrowser,代码行数:23,代码来源:tabbedbrowser.py
示例16: test_invalid_percentage
def test_invalid_percentage(self):
"""Test an invalid percentage."""
with pytest.raises(ValueError):
utils.interpolate_color(self.white, self.white, -1)
with pytest.raises(ValueError):
utils.interpolate_color(self.white, self.white, 101)
开发者ID:andor44,项目名称:qutebrowser,代码行数:6,代码来源:test_utils.py
示例17: test_invalid_colorspace
def test_invalid_colorspace(self):
"""Test an invalid colorspace."""
with pytest.raises(ValueError):
utils.interpolate_color(self.white, self.black, 10, QColor.Cmyk)
开发者ID:andor44,项目名称:qutebrowser,代码行数:4,代码来源:test_utils.py
示例18: test_invalid_end
def test_invalid_end(self):
"""Test an invalid end color."""
with pytest.raises(qtutils.QtValueError):
utils.interpolate_color(self.white, Color(), 0)
开发者ID:andor44,项目名称:qutebrowser,代码行数:4,代码来源:test_utils.py
示例19: test_invalid_start
def test_invalid_start(self):
"""Test an invalid start color."""
with pytest.raises(qtutils.QtValueError):
utils.interpolate_color(Color(), self.white, 0)
开发者ID:andor44,项目名称:qutebrowser,代码行数:4,代码来源:test_utils.py
示例20: test_interpolation_rgb
def test_interpolation_rgb(self):
"""Test an interpolation in the RGB colorspace."""
color = utils.interpolate_color(Color(0, 40, 100), Color(0, 20, 200),
50, QColor.Rgb)
assert Color(color) == Color(0, 30, 150)
开发者ID:andor44,项目名称:qutebrowser,代码行数:5,代码来源:test_utils.py
注:本文中的qutebrowser.utils.utils.interpolate_color函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论