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

10
main.py
View File

@@ -7,7 +7,8 @@ from pandas import read_csv
from PyQt5.QtWidgets import (QMainWindow, from PyQt5.QtWidgets import (QMainWindow,
QApplication, QApplication,
QMessageBox, QMessageBox,
qApp,) qApp,
QDesktopWidget)
from PyQt5.QtGui import QPixmap from PyQt5.QtGui import QPixmap
from PyQt5 import uic from PyQt5 import uic
from PyQt5.QtCore import QFileInfo, QSize, Qt from PyQt5.QtCore import QFileInfo, QSize, Qt
@@ -37,6 +38,7 @@ class MyApp(QMainWindow, Ui_MainWindow):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.setupUi(self) self.setupUi(self)
self.set_initial_size()
self.show() self.show()
self.actionExit.triggered.connect(qApp.quit) self.actionExit.triggered.connect(qApp.quit)
self.db_version = None self.db_version = None
@@ -99,6 +101,12 @@ class MyApp(QMainWindow, Ui_MainWindow):
BandLabel(self.ehf_left, self.ehf, self.ehf_right), 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): def load_db(self):
names = ["name", names = ["name",
"inf_freq", "inf_freq",

View File

@@ -366,7 +366,7 @@ QTabBar::tab:!selected {
<html><head><meta name="qrichtext" content="1" /><style type="text/css"> <html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; } 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;"> </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> </property>
</widget> </widget>
</item> </item>