Add starting size dependent upon screen res.

This commit is contained in:
alessandro90
2018-10-11 19:01:41 +02:00
parent bbe470be99
commit 66e3268a61
2 changed files with 11 additions and 3 deletions

12
main.py
View File

@@ -7,7 +7,8 @@ from pandas import read_csv
from PyQt5.QtWidgets import (QMainWindow,
QApplication,
QMessageBox,
qApp,)
qApp,
QDesktopWidget)
from PyQt5.QtGui import QPixmap
from PyQt5 import uic
from PyQt5.QtCore import QFileInfo, QSize, Qt
@@ -20,7 +21,7 @@ Ui_MainWindow, _ = uic.loadUiType(qt_creator_file)
class MyApp(QMainWindow, Ui_MainWindow):
Band = namedtuple("Band", ["lower", "upper"])
ELF = Band(3, 30)
ELF = Band(3, 30)
SLF = Band(30, 300)
ULF = Band(300, 3000)
VLF = Band(3000, 30000)
@@ -37,6 +38,7 @@ class MyApp(QMainWindow, Ui_MainWindow):
def __init__(self):
super().__init__()
self.setupUi(self)
self.set_initial_size()
self.show()
self.actionExit.triggered.connect(qApp.quit)
self.db_version = None
@@ -99,6 +101,12 @@ class MyApp(QMainWindow, Ui_MainWindow):
BandLabel(self.ehf_left, self.ehf, self.ehf_right),
]
def set_initial_size(self):
d = QDesktopWidget().availableGeometry()
w = d.width()
h = d.height()
self.setGeometry(50, 50, (3 * w) // 4, (3 * h) // 4)
def load_db(self):
names = ["name",
"inf_freq",

View File

@@ -366,7 +366,7 @@ QTabBar::tab:!selected {
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:20pt; font-weight:600; font-style:normal;">
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-size:15pt;&quot;&gt;No signal&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;No Signal&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>