Big file tree reorganisation.

Closes #255.
Should make a lot more sense now ;)
This commit is contained in:
Florian Bruhin 2014-12-13 17:28:50 +01:00
parent 8ab23cff21
commit 06ec1a3885
66 changed files with 147 additions and 82 deletions

View File

@ -39,15 +39,15 @@ from PyQt5.QtCore import (pyqtSlot, qInstallMessageHandler, QTimer, QUrl,
import qutebrowser
from qutebrowser.commands import cmdutils, runners
from qutebrowser.config import style, config, websettings
from qutebrowser.network import qutescheme, proxy
from qutebrowser.browser import quickmarks, cookies, cache, adblock
from qutebrowser.widgets import mainwindow, crash
from qutebrowser.browser.network import qutescheme, proxy
from qutebrowser.mainwindow import mainwindow
from qutebrowser.misc import crashdialog, readline, ipc, earlyinit
from qutebrowser.misc import utilcmds # pylint: disable=unused-import
from qutebrowser.keyinput import modeman
from qutebrowser.utils import (log, version, message, readline, utils, qtutils,
urlutils, debug, objreg, usertypes, standarddir,
ipc, earlyinit)
from qutebrowser.utils import (log, version, message, utils, qtutils, urlutils,
debug, objreg, usertypes, standarddir)
# We import utilcmds to run the cmdutils.register decorators.
from qutebrowser.utils import utilcmds # pylint: disable=unused-import
class Application(QApplication):
@ -202,8 +202,8 @@ class Application(QApplication):
if data:
# Crashlog exists and has data in it, so something crashed
# previously.
self._crashdlg = crash.FatalCrashDialog(self._args.debug,
data)
self._crashdlg = crashdialog.FatalCrashDialog(
self._args.debug, data)
self._crashdlg.show()
else:
# There's no log file, so we can use this to display crashes to
@ -526,7 +526,7 @@ class Application(QApplication):
except TypeError:
log.destroy.exception("Error while preventing shutdown")
QApplication.closeAllWindows()
self._crashdlg = crash.ExceptionCrashDialog(
self._crashdlg = crashdialog.ExceptionCrashDialog(
self._args.debug, pages, history, exc, objects)
ret = self._crashdlg.exec_()
if ret == QDialog.Accepted: # restore
@ -630,7 +630,7 @@ class Application(QApplication):
pages = self._recover_pages()
history = objreg.get('command-history')[-5:]
objects = self.get_all_objects()
self._crashdlg = crash.ReportDialog(pages, history, objects)
self._crashdlg = crashdialog.ReportDialog(pages, history, objects)
self._crashdlg.show()
def interrupt(self, signum, _frame):

View File

@ -37,8 +37,9 @@ import pygments.formatters
from qutebrowser.commands import userscripts, cmdexc, cmdutils
from qutebrowser.config import config
from qutebrowser.browser import webelem
from qutebrowser.utils import (message, editor, usertypes, log, qtutils,
urlutils, objreg, utils)
from qutebrowser.utils import (message, usertypes, log, qtutils, urlutils,
objreg, utils)
from qutebrowser.misc import editor
class CommandDispatcher:

View File

@ -22,7 +22,8 @@
from PyQt5.QtNetwork import QNetworkCookie, QNetworkCookieJar
from PyQt5.QtCore import QStandardPaths, QDateTime
from qutebrowser.config import config, lineparser
from qutebrowser.config import config
from qutebrowser.config.parsers import line as lineparser
from qutebrowser.utils import utils, standarddir, objreg

View File

@ -36,9 +36,10 @@ from PyQt5.QtWebKitWidgets import QWebPage # pylint: disable=unused-import
from qutebrowser.config import config
from qutebrowser.commands import cmdexc, cmdutils
from qutebrowser.utils import (message, http, usertypes, log, utils, urlutils,
from qutebrowser.utils import (message, usertypes, log, utils, urlutils,
objreg, standarddir, qtutils)
from qutebrowser.network import networkmanager
from qutebrowser.browser import http
from qutebrowser.browser.network import networkmanager
ModelRole = usertypes.enum('ModelRole', ['item'], start=Qt.UserRole,

View File

@ -22,8 +22,8 @@
import os.path
from qutebrowser.utils import rfc6266
from qutebrowser.utils import log
from qutebrowser.browser import rfc6266
from PyQt5.QtNetwork import QNetworkRequest

View File

@ -31,8 +31,8 @@ else:
from qutebrowser.config import config
from qutebrowser.utils import message, log, usertypes, utils, objreg
from qutebrowser.network import qutescheme, networkreply
from qutebrowser.browser import cookies
from qutebrowser.browser.network import qutescheme, networkreply
HOSTBLOCK_ERROR_STRING = '%HOSTBLOCK%'

View File

@ -31,7 +31,7 @@ from PyQt5.QtCore import pyqtSlot, QObject
from PyQt5.QtNetwork import QNetworkReply
import qutebrowser
from qutebrowser.network import schemehandler, networkreply
from qutebrowser.browser.network import schemehandler, networkreply
from qutebrowser.utils import (version, utils, jinja, log, message, docutils,
objreg)
from qutebrowser.config import configtypes, configdata

View File

@ -31,7 +31,7 @@ from PyQt5.QtCore import pyqtSignal, QStandardPaths, QUrl, QObject
from qutebrowser.utils import message, usertypes, urlutils, standarddir
from qutebrowser.commands import cmdexc, cmdutils
from qutebrowser.config import lineparser
from qutebrowser.config.parsers import line as lineparser
class QuickmarkManager(QObject):

View File

@ -24,7 +24,7 @@ import functools
from PyQt5.QtCore import QObject
from qutebrowser.utils import debug, log, objreg
from qutebrowser.widgets import webview
from qutebrowser.browser import webview
class SignalFilter(QObject):

View File

@ -29,9 +29,10 @@ from PyQt5.QtPrintSupport import QPrintDialog
from PyQt5.QtWebKitWidgets import QWebPage
from qutebrowser.config import config
from qutebrowser.network import networkmanager
from qutebrowser.utils import (message, usertypes, log, http, jinja, qtutils,
utils, objreg)
from qutebrowser.browser import http
from qutebrowser.browser.network import networkmanager
from qutebrowser.utils import (message, usertypes, log, jinja, qtutils, utils,
objreg)
class BrowserPage(QWebPage):

View File

@ -26,7 +26,8 @@ from PyQt5.QtWebKitWidgets import QWebPage
from qutebrowser.config import config
from qutebrowser.commands import cmdexc, cmdutils
from qutebrowser.utils import message, log, utils, objreg, split
from qutebrowser.utils import message, log, utils, objreg
from qutebrowser.misc import split
def replace_variables(win_id, arglist):

View File

@ -0,0 +1,20 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# 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/>.
"""Modules related to the command completion."""

View File

@ -24,8 +24,9 @@ from PyQt5.QtCore import pyqtSlot, QObject, QTimer
from qutebrowser.config import config, configdata
from qutebrowser.commands import cmdutils, runners
from qutebrowser.utils import usertypes, log, objreg, utils
from qutebrowser.models import completion as models
from qutebrowser.models.completionfilter import CompletionFilterModel as CFM
from qutebrowser.completion.models import completion as models
from qutebrowser.completion.models.sortfilter import (
CompletionFilterModel as CFM)
class Completer(QObject):

View File

@ -28,8 +28,8 @@ from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QItemSelectionModel
from qutebrowser.commands import cmdutils
from qutebrowser.config import config, style
from qutebrowser.widgets import completiondelegate
from qutebrowser.utils import completer, usertypes, qtutils, objreg, utils
from qutebrowser.completion import completiondelegate, completer
from qutebrowser.utils import usertypes, qtutils, objreg, utils
class CompletionView(QTreeView):

View File

@ -17,4 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""The Qt widgets needed by qutebrowser."""
"""Models for the command completion."""

View File

@ -22,12 +22,12 @@
from PyQt5.QtCore import pyqtSlot, Qt
from qutebrowser.config import config, configdata
from qutebrowser.models import basecompletion
from qutebrowser.utils import log, qtutils, objreg
from qutebrowser.commands import cmdutils
from qutebrowser.completion.models import base
class SettingSectionCompletionModel(basecompletion.BaseCompletionModel):
class SettingSectionCompletionModel(base.BaseCompletionModel):
"""A CompletionModel filled with settings sections."""
@ -41,7 +41,7 @@ class SettingSectionCompletionModel(basecompletion.BaseCompletionModel):
self.new_item(cat, name, desc)
class SettingOptionCompletionModel(basecompletion.BaseCompletionModel):
class SettingOptionCompletionModel(base.BaseCompletionModel):
"""A CompletionModel filled with settings and their descriptions.
@ -94,7 +94,7 @@ class SettingOptionCompletionModel(basecompletion.BaseCompletionModel):
"value: {})".format(section, option, val))
class SettingValueCompletionModel(basecompletion.BaseCompletionModel):
class SettingValueCompletionModel(base.BaseCompletionModel):
"""A CompletionModel filled with setting values.
@ -146,7 +146,7 @@ class SettingValueCompletionModel(basecompletion.BaseCompletionModel):
"value: {})".format(section, option, value))
class CommandCompletionModel(basecompletion.BaseCompletionModel):
class CommandCompletionModel(base.BaseCompletionModel):
"""A CompletionModel filled with all commands and descriptions."""
@ -168,7 +168,7 @@ class CommandCompletionModel(basecompletion.BaseCompletionModel):
self.new_item(cat, name, desc)
class HelpCompletionModel(basecompletion.BaseCompletionModel):
class HelpCompletionModel(base.BaseCompletionModel):
"""A CompletionModel filled with help topics."""
@ -209,7 +209,7 @@ class HelpCompletionModel(basecompletion.BaseCompletionModel):
self.new_item(cat, name, desc)
class QuickmarkCompletionModel(basecompletion.BaseCompletionModel):
class QuickmarkCompletionModel(base.BaseCompletionModel):
"""A CompletionModel filled with all quickmarks."""

View File

@ -25,8 +25,8 @@ Contains:
from PyQt5.QtCore import QSortFilterProxyModel, QModelIndex
from qutebrowser.models import basecompletion as completion
from qutebrowser.utils import log, qtutils
from qutebrowser.completion.models import base as completion
class CompletionFilterModel(QSortFilterProxyModel):

View File

@ -35,8 +35,8 @@ import collections.abc
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject, QStandardPaths, QUrl
from PyQt5.QtWidgets import QMessageBox
from qutebrowser.config import (configdata, iniparsers, configtypes,
textwrapper, keyconfparser)
from qutebrowser.config import configdata, configtypes, textwrapper
from qutebrowser.config.parsers import ini, keyconf
from qutebrowser.commands import cmdexc, cmdutils
from qutebrowser.utils import message, objreg, utils, standarddir, log, qtutils
from qutebrowser.utils.usertypes import Completion
@ -144,8 +144,8 @@ def init(args):
else:
objreg.register('config', config_obj)
try:
key_config = keyconfparser.KeyConfigParser(confdir, 'keys.conf')
except keyconfparser.KeyConfigError as e:
key_config = keyconf.KeyConfigParser(confdir, 'keys.conf')
except keyconf.KeyConfigError as e:
log.init.exception(e)
errstr = "Error while reading key config:\n"
if e.lineno is not None:
@ -160,12 +160,12 @@ def init(args):
objreg.register('key-config', key_config)
datadir = standarddir.get(QStandardPaths.DataLocation, args)
state_config = iniparsers.ReadWriteConfigParser(datadir, 'state')
state_config = ini.ReadWriteConfigParser(datadir, 'state')
objreg.register('state-config', state_config)
# We need to import this here because lineparser needs config.
from qutebrowser.config import lineparser
command_history = lineparser.LineConfigParser(
datadir, 'cmd-history', ('completion', 'history-length'))
from qutebrowser.config.parsers import line
command_history = line.LineConfigParser(datadir, 'cmd-history',
('completion', 'history-length'))
objreg.register('command-history', command_history)
@ -259,7 +259,7 @@ class ConfigManager(QObject):
self._configdir = None
else:
self._configdir = configdir
parser = iniparsers.ReadConfigParser(configdir, fname)
parser = ini.ReadConfigParser(configdir, fname)
self._from_cp(parser)
self._initialized = True

View File

@ -0,0 +1,20 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# 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/>.
"""Parser for different configuration formats."""

View File

@ -17,4 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""The Qt widgets needed by qutebrowser."""
"""Widgets needed for the main window."""

View File

@ -30,11 +30,11 @@ from PyQt5.QtWidgets import QWidget, QVBoxLayout
from qutebrowser.commands import runners, cmdutils
from qutebrowser.config import config
from qutebrowser.utils import message, log, usertypes, qtutils, objreg, utils
from qutebrowser.widgets import tabbedbrowser, completion
from qutebrowser.widgets import downloads as downloadswidget
from qutebrowser.widgets.statusbar import bar
from qutebrowser.mainwindow import tabbedbrowser
from qutebrowser.mainwindow.statusbar import bar
from qutebrowser.completion import completionwidget
from qutebrowser.keyinput import modeman
from qutebrowser.browser import hints, downloads
from qutebrowser.browser import hints, downloads, downloadview
win_id_gen = itertools.count(0)
@ -87,7 +87,7 @@ class MainWindow(QWidget):
objreg.register('download-manager', download_manager, scope='window',
window=win_id)
self._downloadview = downloadswidget.DownloadView(win_id)
self._downloadview = downloadview.DownloadView(win_id)
self._vbox.addWidget(self._downloadview)
self._downloadview.show()
@ -99,7 +99,7 @@ class MainWindow(QWidget):
self.status = bar.StatusBar(win_id)
self._vbox.addWidget(self.status)
self._completion = completion.CompletionView(win_id, self)
self._completion = completionwidget.CompletionView(win_id, self)
self._commandrunner = runners.CommandRunner(win_id)

View File

@ -0,0 +1,20 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# 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/>.
"""Widgets needed for the statusbar."""

View File

@ -26,9 +26,9 @@ from PyQt5.QtWidgets import QWidget, QHBoxLayout, QStackedLayout, QSizePolicy
from qutebrowser.config import config, style
from qutebrowser.utils import usertypes, log, objreg, utils
from qutebrowser.widgets.statusbar import (command, progress, keystring,
percentage, url, prompt)
from qutebrowser.widgets.statusbar import text as textwidget
from qutebrowser.mainwindow.statusbar import (command, progress, keystring,
percentage, url, prompt)
from qutebrowser.mainwindow.statusbar import text as textwidget
PreviousWidget = usertypes.enum('PreviousWidget', ['none', 'prompt',

View File

@ -24,8 +24,8 @@ from PyQt5.QtWidgets import QSizePolicy
from qutebrowser.keyinput import modeman, modeparsers
from qutebrowser.commands import cmdexc, cmdutils
from qutebrowser.widgets import misc
from qutebrowser.models import cmdhistory
from qutebrowser.misc import cmdhistory
from qutebrowser.misc import miscwidgets as misc
from qutebrowser.utils import usertypes, log, objreg

View File

@ -19,7 +19,7 @@
"""Keychain string displayed in the statusbar."""
from qutebrowser.widgets.statusbar import textbase
from qutebrowser.mainwindow.statusbar import textbase
class KeyString(textbase.TextBase):

View File

@ -21,7 +21,7 @@
from PyQt5.QtCore import pyqtSlot
from qutebrowser.widgets.statusbar import textbase
from qutebrowser.mainwindow.statusbar import textbase
class Percentage(textbase.TextBase):

View File

@ -22,7 +22,7 @@
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtWidgets import QProgressBar, QSizePolicy
from qutebrowser.widgets import webview
from qutebrowser.browser import webview
from qutebrowser.config import style
from qutebrowser.utils import utils

View File

@ -23,9 +23,9 @@ import functools
from PyQt5.QtWidgets import QHBoxLayout, QWidget, QLineEdit
from qutebrowser.widgets import misc
from qutebrowser.widgets.statusbar import textbase, prompter
from qutebrowser.mainwindow.statusbar import textbase, prompter
from qutebrowser.utils import objreg, utils
from qutebrowser.misc import miscwidgets as misc
class PromptLineEdit(misc.MinimalLineEditMixin, QLineEdit):

View File

@ -22,7 +22,7 @@
from PyQt5.QtCore import pyqtSlot
from qutebrowser.config import config
from qutebrowser.widgets.statusbar import textbase
from qutebrowser.mainwindow.statusbar import textbase
from qutebrowser.utils import usertypes, log, objreg

View File

@ -21,8 +21,8 @@
from PyQt5.QtCore import pyqtSlot, pyqtProperty, Qt
from qutebrowser.widgets import webview
from qutebrowser.widgets.statusbar import textbase
from qutebrowser.browser import webview
from qutebrowser.mainwindow.statusbar import textbase
from qutebrowser.config import style
from qutebrowser.utils import usertypes

View File

@ -30,8 +30,8 @@ from PyQt5.QtWebKitWidgets import QWebPage
from qutebrowser.config import config
from qutebrowser.commands import cmdexc
from qutebrowser.keyinput import modeman
from qutebrowser.widgets import tabwidget, webview
from qutebrowser.browser import signalfilter, commands
from qutebrowser.mainwindow import tabwidget
from qutebrowser.browser import signalfilter, commands, webview
from qutebrowser.utils import (log, message, usertypes, utils, qtutils, objreg,
urlutils)
@ -316,7 +316,7 @@ class TabbedBrowser(tabwidget.TabWidget):
qtutils.ensure_valid(url)
log.webview.debug("Creating new tab with URL {}".format(url))
if config.get('tabs', 'tabs-are-windows') and self.count() > 0:
from qutebrowser.widgets import mainwindow
from qutebrowser.mainwindow import mainwindow
window = mainwindow.MainWindow.spawn()
tabbed_browser = objreg.get('tabbed-browser', scope='window',
window=window)

View File

@ -17,4 +17,4 @@
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Various data models."""
"""Misc. modules."""

View File

@ -29,12 +29,11 @@ from PyQt5.QtWidgets import (QTextEdit, QWidget, QVBoxLayout, QApplication,
from PyQt5.QtGui import QTextCursor
from qutebrowser.config import config
from qutebrowser.models import cmdhistory
from qutebrowser.misc import cmdhistory, miscwidgets
from qutebrowser.utils import utils, log, objreg
from qutebrowser.widgets import misc
class ConsoleLineEdit(misc.CommandLineEdit):
class ConsoleLineEdit(miscwidgets.CommandLineEdit):
"""A QLineEdit which executes entered code and provides a history.

View File

@ -32,8 +32,8 @@ from PyQt5.QtWidgets import (QDialog, QLabel, QTextEdit, QPushButton,
QVBoxLayout, QHBoxLayout, QCheckBox)
from qutebrowser.utils import version, log, utils, objreg
from qutebrowser.widgets.misc import DetailFold
from qutebrowser.network import pastebin
from qutebrowser.misc import miscwidgets
from qutebrowser.browser.network import pastebin
class _CrashDialog(QDialog):
@ -100,7 +100,7 @@ class _CrashDialog(QDialog):
info = QLabel("<i>You can edit the log below to remove sensitive "
"information.</i>", wordWrap=True)
info.hide()
self._fold = DetailFold("Show log", self)
self._fold = miscwidgets.DetailFold("Show log", self)
self._fold.toggled.connect(self._debug_log.setVisible)
self._fold.toggled.connect(info.setVisible)
if debug:

View File

@ -24,8 +24,8 @@ from PyQt5.QtWidgets import (QLineEdit, QApplication, QWidget, QHBoxLayout,
QLabel, QStyleOption, QStyle)
from PyQt5.QtGui import QValidator, QClipboard, QPainter
from qutebrowser.models import cmdhistory
from qutebrowser.utils import utils
from qutebrowser.misc import cmdhistory
class MinimalLineEditMixin:

View File

@ -27,7 +27,7 @@ from PyQt5.QtCore import QCoreApplication
from qutebrowser.utils import log, objreg, usertypes
from qutebrowser.commands import cmdutils, runners, cmdexc
from qutebrowser.config import style
from qutebrowser.widgets import console
from qutebrowser.misc import consolewidget
@cmdutils.register(scope='window', maxsplit=1)
@ -113,6 +113,6 @@ def debug_console():
try:
con_widget = objreg.get('debug-console')
except KeyError:
con_widget = console.ConsoleWidget()
con_widget = consolewidget.ConsoleWidget()
objreg.register('debug-console', con_widget)
con_widget.show()

View File

@ -23,11 +23,11 @@ import sys
import qutebrowser
try:
from qutebrowser.utils.checkpyver import check_python_version
from qutebrowser.misc.checkpyver import check_python_version
except ImportError:
try:
# python2
from .utils.checkpyver import check_python_version
from .misc.checkpyver import check_python_version
except (SystemError, ValueError):
# Import without module - SystemError on Python3, ValueError (?!?) on
# Python2
@ -38,7 +38,7 @@ except ImportError:
check_python_version()
import argparse
from qutebrowser.utils import earlyinit
from qutebrowser.misc import earlyinit
def get_argparser():