Style fixes

This commit is contained in:
Florian Bruhin 2014-02-24 16:47:32 +01:00
parent 265d8b7580
commit 4b3ae3f013
4 changed files with 54 additions and 44 deletions

View File

@ -20,12 +20,14 @@
import shlex import shlex
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject
from PyQt5.QtWebKitWidgets import QWebPage
import qutebrowser.config.config as config import qutebrowser.config.config as config
import qutebrowser.commands.utils as cmdutils import qutebrowser.commands.utils as cmdutils
from qutebrowser.commands.exceptions import (ArgumentCountError, from qutebrowser.commands.exceptions import (ArgumentCountError,
NoSuchCommandError) NoSuchCommandError)
class SearchParser(QObject): class SearchParser(QObject):
"""Parse qutebrowser searches. """Parse qutebrowser searches.

View File

@ -50,6 +50,8 @@ def init(confdir):
class ConfigStructure: class ConfigStructure:
"""Contains the structure of the config file."""
def __init__(self): def __init__(self):
self.config = OrderedDict([ self.config = OrderedDict([
('general', KeyValueSection( ('general', KeyValueSection(

View File

@ -17,15 +17,17 @@
"""Setting options used for qutebrowser.""" """Setting options used for qutebrowser."""
from qutebrowser.config.templates import * import qutebrowser.config.templates as template
class ShowCompletion(BoolSettingValue):
class ShowCompletion(template.BoolSettingValue):
"""Whether to show the autocompletion window or not.""" """Whether to show the autocompletion window or not."""
default = "true" default = "true"
class CompletionHeight(SettingValue):
class CompletionHeight(template.SettingValue):
"""The height of the completion, in px or as percentage of the window.""" """The height of the completion, in px or as percentage of the window."""
@ -48,28 +50,28 @@ class CompletionHeight(SettingValue):
return intval > 0 return intval > 0
class IgnoreCase(BoolSettingValue): class IgnoreCase(template.BoolSettingValue):
"""Whether to do case-insensitive searching.""" """Whether to do case-insensitive searching."""
default = "true" default = "true"
class WrapSearch(BoolSettingValue): class WrapSearch(template.BoolSettingValue):
"""Whether to wrap search to the top when arriving at the end.""" """Whether to wrap search to the top when arriving at the end."""
default = "true" default = "true"
class StartPage(ListSettingValue): class StartPage(template.ListSettingValue):
"""The default page(s) to open at the start, separated with commas.""" """The default page(s) to open at the start, separated with commas."""
default = "http://www.duckduckgo.com/" default = "http://www.duckduckgo.com/"
class AutoSearch(BoolSettingValue): class AutoSearch(template.BoolSettingValue):
"""Whether to start a search when something else than an URL is entered.""" """Whether to start a search when something else than an URL is entered."""
@ -94,14 +96,14 @@ class AutoSearch(BoolSettingValue):
return "false" return "false"
class ZoomLevels(IntListSettingValue): class ZoomLevels(template.IntListSettingValue):
"""The available zoom levels, separated by commas.""" """The available zoom levels, separated by commas."""
default = "25,33,50,67,75,90,100,110,125,150,175,200,250,300,400,500" default = "25,33,50,67,75,90,100,110,125,150,175,200,250,300,400,500"
class DefaultZoom(IntSettingValue): class DefaultZoom(template.IntSettingValue):
"""The default zoom level.""" """The default zoom level."""
@ -110,28 +112,28 @@ class DefaultZoom(IntSettingValue):
default = "100" default = "100"
class Movable(BoolSettingValue): class Movable(template.BoolSettingValue):
"""Whether tabs should be movable.""" """Whether tabs should be movable."""
default = "true" default = "true"
class CloseButtons(BoolSettingValue): class CloseButtons(template.BoolSettingValue):
"""Whether tabs should have close-buttons.""" """Whether tabs should have close-buttons."""
default = "false" default = "false"
class ScrollButtons(BoolSettingValue): class ScrollButtons(template.BoolSettingValue):
"""Whether there should be scroll buttons if there are too many tabs.""" """Whether there should be scroll buttons if there are too many tabs."""
default = "true" default = "true"
class Position(SettingValue): class Position(template.SettingValue):
"""The position of the tab bar.""" """The position of the tab bar."""
@ -139,7 +141,7 @@ class Position(SettingValue):
default = "north" default = "north"
class SelectOnRemove(SettingValue): class SelectOnRemove(template.SettingValue):
"""Which tab to select when the focused tab is removed.""" """Which tab to select when the focused tab is removed."""
@ -149,7 +151,7 @@ class SelectOnRemove(SettingValue):
default = "previous" default = "previous"
class LastClose(SettingValue): class LastClose(template.SettingValue):
"""Behaviour when the last tab is closed.""" """Behaviour when the last tab is closed."""
@ -160,7 +162,8 @@ class LastClose(SettingValue):
### FIXME what to do with list-style sections? ### FIXME what to do with list-style sections?
class SearchEngine(SettingValue):
class SearchEngine(template.SettingValue):
"""A search engine setting.""" """A search engine setting."""
@ -168,21 +171,21 @@ class SearchEngine(SettingValue):
return "{}" in value return "{}" in value
class CompletionFgColor(ColorSettingValue): class CompletionFgColor(template.ColorSettingValue):
"""Text color of the completion widget.""" """Text color of the completion widget."""
default = "#333333" default = "#333333"
class CompletionItemBgColor(ColorSettingValue): class CompletionItemBgColor(template.ColorSettingValue):
"""Background color of completion widget items.""" """Background color of completion widget items."""
default = "white" default = "white"
class CompletionCategoryBgColor(ColorSettingValue): class CompletionCategoryBgColor(template.ColorSettingValue):
"""Background color of the completion widget category headers.""" """Background color of the completion widget category headers."""
@ -190,154 +193,154 @@ class CompletionCategoryBgColor(ColorSettingValue):
"x1:0, y1:0, x2:0, y2:1, stop:0 #e4e4e4, stop:1 #dbdbdb") "x1:0, y1:0, x2:0, y2:1, stop:0 #e4e4e4, stop:1 #dbdbdb")
class CompletionCategoryTopBorderColor(ColorSettingValue): class CompletionCategoryTopBorderColor(template.ColorSettingValue):
"""Top border color of the completion widget category headers.""" """Top border color of the completion widget category headers."""
default = "#808080" default = "#808080"
class CompletionCategoryBottomBorderColor(ColorSettingValue): class CompletionCategoryBottomBorderColor(template.ColorSettingValue):
"""Bottom border color of the completion widget category headers.""" """Bottom border color of the completion widget category headers."""
default = "#bbbbbb" default = "#bbbbbb"
class CompletionItemSelectedFgColor(ColorSettingValue): class CompletionItemSelectedFgColor(template.ColorSettingValue):
"""Foreground color of the selected completion item.""" """Foreground color of the selected completion item."""
default = "#333333" default = "#333333"
class CompletionItemSelectedBgColor(ColorSettingValue): class CompletionItemSelectedBgColor(template.ColorSettingValue):
"""Background color of the selected completion item.""" """Background color of the selected completion item."""
default = "#ffec8b" default = "#ffec8b"
class CompletionItemSelectedTopBorderColor(ColorSettingValue): class CompletionItemSelectedTopBorderColor(template.ColorSettingValue):
"""Top border color of the selected completion item.""" """Top border color of the selected completion item."""
default = "#f2f2c0" default = "#f2f2c0"
class CompletionItemSelectedBottomBorderColor(ColorSettingValue): class CompletionItemSelectedBottomBorderColor(template.ColorSettingValue):
"""Bottom border color of the selected completion item.""" """Bottom border color of the selected completion item."""
default = "#ffec8b" default = "#ffec8b"
class CompletionMatchFgColor(ColorSettingValue): class CompletionMatchFgColor(template.ColorSettingValue):
"""Foreground color of the matched text in the completion.""" """Foreground color of the matched text in the completion."""
default = "red" default = "red"
class StatusbarBgColor(ColorSettingValue): class StatusbarBgColor(template.ColorSettingValue):
"""Background color of the statusbar.""" """Background color of the statusbar."""
default = "black" default = "black"
class StatusbarFgColor(ColorSettingValue): class StatusbarFgColor(template.ColorSettingValue):
"""Foreground color of the statusbar.""" """Foreground color of the statusbar."""
default = "white" default = "white"
class StatusbarFgErrorColor(ColorSettingValue): class StatusbarFgErrorColor(template.ColorSettingValue):
"""Foreground color of the statusbar if there was an error.""" """Foreground color of the statusbar if there was an error."""
default = "${statusbar.fg}" default = "${statusbar.fg}"
class StatusbarBgErrorColor(ColorSettingValue): class StatusbarBgErrorColor(template.ColorSettingValue):
"""Background color of the statusbar if there was an error.""" """Background color of the statusbar if there was an error."""
default = "red" default = "red"
class StatusbarProgressBgColor(ColorSettingValue): class StatusbarProgressBgColor(template.ColorSettingValue):
"""Background color of the progress bar.""" """Background color of the progress bar."""
default = "white" default = "white"
class StatusbarUrlFgColor(ColorSettingValue): class StatusbarUrlFgColor(template.ColorSettingValue):
"""Default foreground color of the URL in the statusbar.""" """Default foreground color of the URL in the statusbar."""
default = "${statusbar.fg}" default = "${statusbar.fg}"
class StatusbarUrlSuccessFgColor(ColorSettingValue): class StatusbarUrlSuccessFgColor(template.ColorSettingValue):
"""Foreground color of the URL in the statusbar on successful load.""" """Foreground color of the URL in the statusbar on successful load."""
default = "lime" default = "lime"
class StatusbarUrlErrorFgColor(ColorSettingValue): class StatusbarUrlErrorFgColor(template.ColorSettingValue):
"""Foreground color of the URL in the statusbar on error.""" """Foreground color of the URL in the statusbar on error."""
default = "orange" default = "orange"
class StatusbarUrlWarnFgColor(ColorSettingValue): class StatusbarUrlWarnFgColor(template.ColorSettingValue):
"""Foreground color of the URL in the statusbar when there's a warning.""" """Foreground color of the URL in the statusbar when there's a warning."""
default = "yellow" default = "yellow"
class StatusbarUrlHoverFgColor(ColorSettingValue): class StatusbarUrlHoverFgColor(template.ColorSettingValue):
"""Foreground color of the URL in the statusbar for hovered links.""" """Foreground color of the URL in the statusbar for hovered links."""
default = "aqua" default = "aqua"
class TabFgColor(ColorSettingValue): class TabFgColor(template.ColorSettingValue):
"""Foreground color of the tabbar.""" """Foreground color of the tabbar."""
default = "white" default = "white"
class TabBgColor(ColorSettingValue): class TabBgColor(template.ColorSettingValue):
"""Background color of the tabbar.""" """Background color of the tabbar."""
default = "grey" default = "grey"
class TabSelectedBgColor(ColorSettingValue): class TabSelectedBgColor(template.ColorSettingValue):
"""Background color of the tabbar for the selected tab.""" """Background color of the tabbar for the selected tab."""
default = "black" default = "black"
class TabSeperatorColor(ColorSettingValue): class TabSeperatorColor(template.ColorSettingValue):
"""Color for the tab seperator.""" """Color for the tab seperator."""
default = "white" default = "white"
class MonospaceFonts(FontSettingValue): class MonospaceFonts(template.FontSettingValue):
"""Default monospace fonts.""" """Default monospace fonts."""
@ -346,21 +349,21 @@ class MonospaceFonts(FontSettingValue):
'"Courier New", Courier, monospace, Fixed, Terminal') '"Courier New", Courier, monospace, Fixed, Terminal')
class CompletionFont(FontSettingValue): class CompletionFont(template.FontSettingValue):
"""Font used in the completion widget.""" """Font used in the completion widget."""
default = "8pt ${_monospace}" default = "8pt ${_monospace}"
class TabbarFont(FontSettingValue): class TabbarFont(template.FontSettingValue):
"""Font used in the tabbar.""" """Font used in the tabbar."""
default = "8pt ${_monospace}" default = "8pt ${_monospace}"
class StatusbarFont(FontSettingValue): class StatusbarFont(template.FontSettingValue):
"""Font used in the statusbar.""" """Font used in the statusbar."""

View File

@ -19,6 +19,7 @@
import qutebrowser.commands.utils as cmdutils import qutebrowser.commands.utils as cmdutils
class SettingValue: class SettingValue:
"""Base class for settings. The docstring is used as a description.""" """Base class for settings. The docstring is used as a description."""
@ -68,9 +69,11 @@ class SettingValue:
else: else:
raise NotImplementedError raise NotImplementedError
class BoolSettingValue(SettingValue): class BoolSettingValue(SettingValue):
"""Base class for a boolean setting.""" """Base class for a boolean setting."""
values = ['true', 'false'] values = ['true', 'false']
# Taken from configparser # Taken from configparser