From 8c8cc1ca4a2adeb59c99957f0a4506c02eee5a10 Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 23 Jun 2019 20:40:08 +0200 Subject: [PATCH] Set main and download windows initial position --- artemis.py | 4 ++++ download_window.py | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/artemis.py b/artemis.py index 0c26fff..8596948 100644 --- a/artemis.py +++ b/artemis.py @@ -59,6 +59,10 @@ class Artemis(QMainWindow, Ui_MainWindow): super().__init__() self.setupUi(self) self.set_initial_size() + qtRectangle = self.frameGeometry() + centerPoint = QDesktopWidget().availableGeometry().center() + qtRectangle.moveCenter(centerPoint) + self.move(qtRectangle.topLeft()) self.closing = False self.download_window = DownloadWindow() self.download_window.complete.connect(self.show_downloaded_signals) diff --git a/download_window.py b/download_window.py index f089ede..2ff1d19 100644 --- a/download_window.py +++ b/download_window.py @@ -1,6 +1,6 @@ from PyQt5 import uic from PyQt5.QtCore import Qt, pyqtSlot, pyqtSignal -from PyQt5.QtWidgets import QWidget +from PyQt5.QtWidgets import QWidget, QDesktopWidget from threads import DownloadThread, ThreadStatus from utilities import pop_up, resource_path from constants import Constants, Messages @@ -25,8 +25,8 @@ class DownloadWindow(QWidget, Ui_Download_window): # Qt.Window | Qt.CustomizeWindowHint | Qt.WindowTitleHint | - Qt.WindowCloseButtonHint # | - # Qt.WindowStaysOnTopHint + Qt.WindowCloseButtonHint | + Qt.WindowStaysOnTopHint ) self._no_internet_msg = pop_up(self, title=Messages.NO_CONNECTION, @@ -49,7 +49,7 @@ class DownloadWindow(QWidget, Ui_Download_window): def _downlaod_format_str(self, n, speed): """Return a well-formatted string with downloaded MB and speed.""" - return f"Downloaded MB: {n}\nSpeed: {speed} MB/s" + return f"Downloaded: {n} MB\nSpeed: {speed} MB/s" def show(self): """Extends QWidget.show. Set downloaded MB and speed to zero."""