3 https://github.com/micahflee/torbrowser-launcher/
5 Copyright (c) 2013-2021 Micah Lee <micah@micahflee.com>
7 Permission is hereby granted, free of charge, to any person
8 obtaining a copy of this software and associated documentation
9 files (the "Software"), to deal in the Software without
10 restriction, including without limitation the rights to use,
11 copy, modify, merge, publish, distribute, sublicense, and/or sell
12 copies of the Software, and to permit persons to whom the
13 Software is furnished to do so, subject to the following
16 The above copyright notice and this permission notice shall be
17 included in all copies or substantial portions of the Software.
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
21 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
23 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
24 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
26 OTHER DEALINGS IN THE SOFTWARE.
34 from PyQt5 import QtCore, QtWidgets
36 from .common import Common, SHARE
37 from .settings import Settings
38 from .launcher import Launcher
41 class Application(QtWidgets.QApplication):
43 Qt's QApplication class. It has been overridden to support threads.
47 self.setAttribute(QtCore.Qt.AA_X11InitThreads, True)
48 QtWidgets.QApplication.__init__(self, sys.argv)
49 self.installEventFilter(self)
54 parser = argparse.ArgumentParser()
59 help="Open Tor Browser Launcher settings",
61 parser.add_argument("url", nargs="*", help="URL to load")
62 args = parser.parse_args()
64 settings = bool(args.settings)
67 # Load the version and print the banner
68 with open(os.path.join(SHARE, "version")) as buf:
69 tor_browser_launcher_version = buf.read().strip()
71 print(_("Tor Browser Launcher"))
72 print(_("By Micah Lee, licensed under MIT"))
73 print(_("version {0}").format(tor_browser_launcher_version))
74 print("https://github.com/micahflee/torbrowser-launcher")
76 common = Common(tor_browser_launcher_version)
84 gui = Settings(common, app)
87 gui = Launcher(common, app, url_list)
90 desktop = app.desktop()
91 window_size = gui.size()
93 (desktop.width() - window_size.width()) / 2,
94 (desktop.height() - window_size.height()) / 2,
98 # Allow ctrl-c to work
99 signal.signal(signal.SIGINT, signal.SIG_DFL)
101 sys.exit(app.exec_())
104 if __name__ == "__main__":