[Pkg-privacy-commits] [torbrowser-launcher] 26/39: Center the window

Roger Shimizu rosh at debian.org
Tue Mar 27 15:41:53 UTC 2018


This is an automated email from the git hooks/post-receive script.

rosh pushed a commit to branch rosh/experimental
in repository torbrowser-launcher.

commit 7cc2611edcf8fc67cd022809742d6503b8ab4734
Author: Micah Lee <micah at micahflee.com>
Date:   Fri Mar 23 14:50:12 2018 -0700

    Center the window
---
 torbrowser_launcher/__init__.py | 12 +++++++++++-
 torbrowser_launcher/launcher.py |  1 -
 torbrowser_launcher/settings.py |  1 -
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/torbrowser_launcher/__init__.py b/torbrowser_launcher/__init__.py
index 08bf381..ce542a4 100644
--- a/torbrowser_launcher/__init__.py
+++ b/torbrowser_launcher/__init__.py
@@ -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)
 
diff --git a/torbrowser_launcher/launcher.py b/torbrowser_launcher/launcher.py
index cc6778d..28e5f87 100644
--- a/torbrowser_launcher/launcher.py
+++ b/torbrowser_launcher/launcher.py
@@ -146,7 +146,6 @@ class Launcher(QtWidgets.QMainWindow):
             central_widget = QtWidgets.QWidget()
             central_widget.setLayout(layout)
             self.setCentralWidget(central_widget)
-            self.show()
 
             self.update()
 
diff --git a/torbrowser_launcher/settings.py b/torbrowser_launcher/settings.py
index e344b11..545fab5 100644
--- a/torbrowser_launcher/settings.py
+++ b/torbrowser_launcher/settings.py
@@ -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):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/torbrowser-launcher.git



More information about the Pkg-privacy-commits mailing list