Import cleanup

This commit is contained in:
Florian Bruhin 2014-02-17 12:23:52 +01:00
parent d5807169d1
commit 966ceba1e6
25 changed files with 156 additions and 135 deletions

View File

@ -1,19 +1,3 @@
"""A vim like browser based on Qt.
Files:
__init__.py - This file.
__main__.py - Entry point for qutebrowser, to use
'python -m qutebrowser'.
app.py - Main qutebrowser application>
simplebrowser.py - Simple browser for testing purposes.
Subpackages:
commands - Handling of commands and key parsing.
utils - Misc utility code.
widgets - Qt widgets displayed on the screen.
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -31,6 +15,22 @@ Subpackages:
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""A vim like browser based on Qt.
Files:
__init__.py - This file.
__main__.py - Entry point for qutebrowser, to use
'python -m qutebrowser'.
app.py - Main qutebrowser application>
simplebrowser.py - Simple browser for testing purposes.
Subpackages:
commands - Handling of commands and key parsing.
utils - Misc utility code.
widgets - Qt widgets displayed on the screen.
"""
import os.path
__version_info__ = (0, 0, 0)

View File

@ -1,4 +1,4 @@
"""Entry point for qutebrowser. Simply execute qutebrowser."""
#!/usr/bin/python
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Entry point for qutebrowser. Simply execute qutebrowser."""
from qutebrowser.app import QuteBrowser
import sys

View File

@ -1,5 +1,3 @@
"""Initialization of qutebrowser and application-wide things."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Initialization of qutebrowser and application-wide things."""
import os
import sys
import logging

View File

@ -1,19 +1,3 @@
"""All command classes.
These are automatically propagated from commands.utils
via inspect.
A command class can set the following properties:
nargs -- Number of arguments. Either a number, '?' (0 or 1), '+' (1 or
more), or '*' (any). Default: 0
name -- The name of the command, or a list of aliases.
split_args -- If arguments should be split or not. Default: True
count -- If the command supports a count. Default: False
hide -- If the command should be hidden in tab completion. Default: False
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -31,6 +15,22 @@ A command class can set the following properties:
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""All command classes.
These are automatically propagated from commands.utils
via inspect.
A command class can set the following properties:
nargs -- Number of arguments. Either a number, '?' (0 or 1), '+' (1 or
more), or '*' (any). Default: 0
name -- The name of the command, or a list of aliases.
split_args -- If arguments should be split or not. Default: True
count -- If the command supports a count. Default: False
hide -- If the command should be hidden in tab completion. Default: False
"""
from qutebrowser.commands.template import Command

View File

@ -1,9 +1,3 @@
"""Exception classes for commands.utils and commands.template.
Defined here to avoid circular dependency hell.
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -21,6 +15,12 @@ Defined here to avoid circular dependency hell.
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Exception classes for commands.utils and commands.template.
Defined here to avoid circular dependency hell.
"""
class NoSuchCommandError(ValueError):

View File

@ -1,5 +1,3 @@
"""Parse keypresses/keychains in the main window."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,10 +15,12 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import logging
import re
"""Parse keypresses/keychains in the main window."""
from PyQt5.QtCore import QObject, pyqtSignal, Qt
import re
import logging
from PyQt5.QtCore import pyqtSignal, Qt, QObject
from PyQt5.QtGui import QKeySequence
from qutebrowser.commands.utils import (CommandParser, ArgumentCountError,

View File

@ -1,5 +1,3 @@
"""Contains the Command class, a skeleton for a command."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,9 +15,11 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Contains the Command class, a skeleton for a command."""
import logging
from PyQt5.QtCore import QObject, pyqtSignal
from PyQt5.QtCore import pyqtSignal, QObject
from qutebrowser.commands.exceptions import ArgumentCountError

View File

@ -1,5 +1,3 @@
"""Contains various command utils, and the CommandParser."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,10 +15,12 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import inspect
import shlex
"""Contains various command utils, and the CommandParser."""
from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal
import shlex
import inspect
from PyQt5.QtCore import pyqtSlot, pyqtSignal, QObject
from PyQt5.QtWebKitWidgets import QWebPage
import qutebrowser.commands.commands

View File

@ -1,5 +1,3 @@
"""A CompletionModel filled with all commands and descriptions."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""A CompletionModel filled with all commands and descriptions."""
from qutebrowser.commands.utils import cmd_dict
from qutebrowser.models.completion import CompletionModel

View File

@ -1,11 +1,3 @@
"""The base completion model for completion in the command line.
Contains:
CompletionModel -- A simple tree model based on Python data.
CompletionItem -- One item in the CompletionModel.
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -23,9 +15,17 @@ Contains:
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""The base completion model for completion in the command line.
Contains:
CompletionModel -- A simple tree model based on Python data.
CompletionItem -- One item in the CompletionModel.
"""
from collections import OrderedDict
from PyQt5.QtCore import QAbstractItemModel, Qt, QModelIndex, QVariant
from PyQt5.QtCore import Qt, QVariant, QAbstractItemModel, QModelIndex
class CompletionModel(QAbstractItemModel):

View File

@ -1,10 +1,3 @@
"""A filtering/sorting base model for completions.
Contains:
CompletionFilterModel -- A QSortFilterProxyModel subclass for completions.
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -22,7 +15,14 @@ Contains:
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
from PyQt5.QtCore import QModelIndex, QSortFilterProxyModel
"""A filtering/sorting base model for completions.
Contains:
CompletionFilterModel -- A QSortFilterProxyModel subclass for completions.
"""
from PyQt5.QtCore import QSortFilterProxyModel, QModelIndex
class CompletionFilterModel(QSortFilterProxyModel):

View File

@ -1,4 +1,4 @@
"""Very simple browser for testing purposes."""
#!/usr/bin/python
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Very simple browser for testing purposes."""
import sys
from PyQt5.QtCore import QUrl

View File

@ -1,5 +1,3 @@
"""Handler functions for different about:... pages."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Handler functions for different about:... pages."""
from qutebrowser.utils.version import version
from qutebrowser.utils.url import is_about_url

View File

@ -1,12 +1,3 @@
"""Configuration storage and config-related utilities.
config -- The main Config object.
colordict -- All configured colors.
default_config -- The default config as dict.
MONOSPACE -- A list of suitable monospace fonts.
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -24,9 +15,18 @@ MONOSPACE -- A list of suitable monospace fonts.
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import os.path
"""Configuration storage and config-related utilities.
config -- The main Config object.
colordict -- All configured colors.
default_config -- The default config as dict.
MONOSPACE -- A list of suitable monospace fonts.
"""
import os
import io
import os.path
import logging
from configparser import ConfigParser, ExtendedInterpolation

View File

@ -1,10 +1,3 @@
"""Fixer to set QT_HARFBUZZ variable.
In its own file so it doesn't include any Qt stuff, because if it did, it
wouldn't work.
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -22,6 +15,13 @@ wouldn't work.
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Fixer to set QT_HARFBUZZ variable.
In its own file so it doesn't include any Qt stuff, because if it did, it
wouldn't work.
"""
import os
import sys

View File

@ -1,5 +1,3 @@
"""Other utilities which don't fit anywhere else."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Other utilities which don't fit anywhere else."""
import os.path
from PyQt5.QtCore import pyqtRemoveInputHook

View File

@ -1,5 +1,3 @@
"""Utilities regarding signals."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,6 +15,8 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Utilities regarding signals."""
import re
import logging
from collections import OrderedDict

View File

@ -1,9 +1,3 @@
"""Qt style to remove Ubuntu focus rectangle uglyness.
We might also use this to do more in the future.
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -21,6 +15,12 @@ We might also use this to do more in the future.
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Qt style to remove Ubuntu focus rectangle uglyness.
We might also use this to do more in the future.
"""
import functools
from PyQt5.QtWidgets import QCommonStyle, QStyle

View File

@ -1,3 +1,20 @@
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
#
# qutebrowser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutebrowser is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Utils regarding URL handling."""
import re

View File

@ -1,10 +1,3 @@
"""The main browser widget.
Defines BrowserTab (our own QWebView subclass) and TabbedBrowser (a TabWidget
containing BrowserTabs).
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -22,22 +15,29 @@ containing BrowserTabs).
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""The main browser widget.
Defines BrowserTab (our own QWebView subclass) and TabbedBrowser (a TabWidget
containing BrowserTabs).
"""
import logging
import functools
import sip
from PyQt5.QtWidgets import QShortcut, QApplication, QSizePolicy
from PyQt5.QtWidgets import QApplication, QShortcut, QSizePolicy
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QEvent
from PyQt5.QtGui import QClipboard
from PyQt5.QtPrintSupport import QPrintPreviewDialog
from PyQt5.QtNetwork import QNetworkReply, QNetworkAccessManager
from PyQt5.QtNetwork import QNetworkAccessManager, QNetworkReply
from PyQt5.QtWebKit import QWebSettings
from PyQt5.QtWebKitWidgets import QWebView, QWebPage
import qutebrowser.utils.about as about
import qutebrowser.utils.url as urlutils
from qutebrowser.widgets.tabbar import TabWidget
from qutebrowser.utils.signals import dbg_signal, SignalCache
from qutebrowser.utils.signals import SignalCache, dbg_signal
from qutebrowser.utils.misc import read_file

View File

@ -1,10 +1,3 @@
"""Completion view for statusbar command section.
Defines a CompletionView which uses CompletionFiterModel and CompletionModel
subclasses to provide completions.
"""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -22,12 +15,19 @@ subclasses to provide completions.
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Completion view for statusbar command section.
Defines a CompletionView which uses CompletionFiterModel and CompletionModel
subclasses to provide completions.
"""
import html
from PyQt5.QtWidgets import (QTreeView, QStyledItemDelegate, QStyle,
QStyleOptionViewItem, QSizePolicy)
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, QRectF, QRect, QPoint, Qt,
QItemSelectionModel, QSize)
from PyQt5.QtWidgets import (QStyle, QStyleOptionViewItem, QTreeView,
QStyledItemDelegate, QSizePolicy)
from PyQt5.QtCore import (pyqtSlot, pyqtSignal, Qt, QRect, QRectF, QPoint,
QSize, QItemSelectionModel)
from PyQt5.QtGui import (QIcon, QPalette, QTextDocument, QTextOption,
QTextCursor)

View File

@ -20,8 +20,8 @@
import sys
import traceback
from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QVBoxLayout,
QHBoxLayout, QPushButton)
from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
QVBoxLayout, QHBoxLayout)
import qutebrowser.utils.config as config
from qutebrowser.utils.version import version

View File

@ -1,5 +1,3 @@
"""The main window of QuteBrowser."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,7 +15,9 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
from PyQt5.QtWidgets import QVBoxLayout, QWidget
"""The main window of QuteBrowser."""
from PyQt5.QtWidgets import QWidget, QVBoxLayout
from qutebrowser.widgets.statusbar import StatusBar
from qutebrowser.widgets.browser import TabbedBrowser

View File

@ -20,10 +20,10 @@
import logging
from PyQt5.QtCore import pyqtSignal, pyqtSlot, pyqtProperty, Qt
from PyQt5.QtWidgets import (QLineEdit, QShortcut, QHBoxLayout, QWidget,
QSizePolicy, QProgressBar, QLabel, QStyle,
from PyQt5.QtWidgets import (QWidget, QLineEdit, QProgressBar, QLabel,
QHBoxLayout, QSizePolicy, QShortcut, QStyle,
QStyleOption)
from PyQt5.QtGui import QValidator, QKeySequence, QPainter
from PyQt5.QtGui import QPainter, QKeySequence, QValidator
import qutebrowser.utils.config as config
import qutebrowser.commands.keys as keys

View File

@ -1,5 +1,3 @@
"""The tab widget used for TabbedBrowser from browser.py."""
# Copyright 2014 Florian Bruhin (The Compiler) <mail@qutebrowser.org>
#
# This file is part of qutebrowser.
@ -17,8 +15,10 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
from PyQt5.QtWidgets import QTabWidget, QTabBar, QSizePolicy
"""The tab widget used for TabbedBrowser from browser.py."""
from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QTabWidget, QTabBar, QSizePolicy
import qutebrowser.utils.config as config
from qutebrowser.utils.style import Style