Center the window

This commit is contained in:
Micah Lee 2018-03-23 14:50:12 -07:00
parent b8453e35e5
commit 7cc2611edc
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
3 changed files with 11 additions and 3 deletions

View 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)

View 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()

View 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):