]> git.lizzy.rs Git - torbrowser-launcher.git/commitdiff
Center the window
authorMicah Lee <micah@micahflee.com>
Fri, 23 Mar 2018 21:50:12 +0000 (14:50 -0700)
committerMicah Lee <micah@micahflee.com>
Fri, 23 Mar 2018 21:50:12 +0000 (14:50 -0700)
torbrowser_launcher/__init__.py
torbrowser_launcher/launcher.py
torbrowser_launcher/settings.py

index 08bf381433f01d260043d785b9ed4fcaaa1b58d1..ce542a472181b49327839122218d7f4aaba566e9 100644 (file)
@@ -70,8 +70,9 @@ def main():
     common = Common(tor_browser_launcher_version)
     app = Application()
 
-    # Open the GUI
+    # Open the window
     gui = None
+
     if settings:
         # Settings mode
         gui = Settings(common, app)
@@ -79,6 +80,15 @@ def main():
         # Launcher mode
         gui = Launcher(common, app, url_list)
 
+    # Center the window
+    desktop = app.desktop()
+    window_size = gui.size()
+    gui.move(
+        (desktop.width() - window_size.width()) / 2,
+        (desktop.height() - window_size.height()) / 2
+    )
+    gui.show()
+
     # Allow ctrl-c to work
     signal.signal(signal.SIGINT, signal.SIG_DFL)
 
index cc6778d535ca2ca5b7be1124c89945e518592638..28e5f870507dbe64ec45e4e0ced26025fc544d01 100644 (file)
@@ -146,7 +146,6 @@ class Launcher(QtWidgets.QMainWindow):
             central_widget = QtWidgets.QWidget()
             central_widget.setLayout(layout)
             self.setCentralWidget(central_widget)
-            self.show()
 
             self.update()
 
index e344b1113fe88c6b72aa985c73dc9bd1135515ed..545fab505dda4c17a44d8589aa42f673b4b73953 100644 (file)
@@ -151,7 +151,6 @@ class Settings(QtWidgets.QMainWindow):
         central_widget = QtWidgets.QWidget()
         central_widget.setLayout(layout)
         self.setCentralWidget(central_widget)
-        self.show()
 
     # Install
     def install(self):