Add a main function to app.py

This commit is contained in:
Florian Bruhin 2014-06-04 13:38:53 +02:00
parent 346ef4ac3d
commit 57d261ee85
3 changed files with 11 additions and 16 deletions

View File

@ -19,15 +19,9 @@
"""Entry point for qutebrowser. Simply execute qutebrowser.""" """Entry point for qutebrowser. Simply execute qutebrowser."""
from qutebrowser.app import QuteBrowser import qutebrowser.app as app
import sys import sys
def main():
"""Main entry point for qutebrowser."""
app = QuteBrowser()
return app.exec_()
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(main()) sys.exit(app.main())

View File

@ -70,14 +70,9 @@ from qutebrowser.utils.readline import ReadlineBridge
from qutebrowser.utils.debug import set_trace # pylint: disable=unused-import from qutebrowser.utils.debug import set_trace # pylint: disable=unused-import
class QuteBrowser(QApplication): class Application(QApplication):
"""Main object for qutebrowser. """Main application instance.
Can be used like this:
>>> app = QuteBrowser()
>>> sys.exit(app.exec_())
Attributes: Attributes:
mainwindow: The MainWindow QWidget. mainwindow: The MainWindow QWidget.
@ -657,3 +652,9 @@ class QuteBrowser(QApplication):
""" """
log.destroy.debug("Shutdown complete, quitting.") log.destroy.debug("Shutdown complete, quitting.")
self.quit() self.quit()
def main():
"""Main entry point for qutebrowser."""
app = Application()
return app.exec_()

View File

@ -41,7 +41,7 @@ try:
include_package_data=True, include_package_data=True,
package_data={'qutebrowser': ['html/*', 'git-commit-id']}, package_data={'qutebrowser': ['html/*', 'git-commit-id']},
entry_points={'gui_scripts': entry_points={'gui_scripts':
['qutebrowser = qutebrowser.__main__:main']}, ['qutebrowser = qutebrowser.app:main']},
test_suite='qutebrowser.test', test_suite='qutebrowser.test',
zip_safe=True, zip_safe=True,
**setupdata **setupdata