Update qt screen script to new import schema
parent
f31bd42a19
commit
d2e21f45b2
|
@ -16,11 +16,15 @@ DPI and info helper script for display metrics.
|
||||||
|
|
||||||
from pyqtgraph import (
|
from pyqtgraph import (
|
||||||
QtGui,
|
QtGui,
|
||||||
QtWidgets,
|
|
||||||
)
|
)
|
||||||
from PyQt5.QtCore import (
|
from PyQt5.QtCore import (
|
||||||
Qt,
|
Qt,
|
||||||
QCoreApplication,
|
QCoreApplication,
|
||||||
|
)
|
||||||
|
from PyQt5.QtWidgets import (
|
||||||
|
QWidget,
|
||||||
|
QMainWindow,
|
||||||
|
QApplication,
|
||||||
)
|
)
|
||||||
|
|
||||||
# Proper high DPI scaling is available in Qt >= 5.6.0. This attibute
|
# Proper high DPI scaling is available in Qt >= 5.6.0. This attibute
|
||||||
|
@ -32,9 +36,9 @@ if hasattr(Qt, 'AA_UseHighDpiPixmaps'):
|
||||||
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
|
QCoreApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
|
||||||
|
|
||||||
|
|
||||||
app = QtWidgets.QApplication([])
|
app = QApplication([])
|
||||||
window = QtWidgets.QMainWindow()
|
window = QMainWindow()
|
||||||
main_widget = QtWidgets.QWidget()
|
main_widget = QWidget()
|
||||||
window.setCentralWidget(main_widget)
|
window.setCentralWidget(main_widget)
|
||||||
window.show()
|
window.show()
|
||||||
|
|
||||||
|
@ -46,7 +50,7 @@ pxr = main_widget.devicePixelRatioF()
|
||||||
# screen = app.screens()[screen_num]
|
# screen = app.screens()[screen_num]
|
||||||
|
|
||||||
|
|
||||||
def ppscreeninfo(screen: 'QScreen') -> None:
|
def ppscreeninfo(screen: QtGui.QScreen) -> None:
|
||||||
# screen_num = app.desktop().screenNumber()
|
# screen_num = app.desktop().screenNumber()
|
||||||
name = screen.name()
|
name = screen.name()
|
||||||
size = screen.size()
|
size = screen.size()
|
||||||
|
@ -68,6 +72,7 @@ def ppscreeninfo(screen: 'QScreen') -> None:
|
||||||
|
|
||||||
print('-'*50 + '\n')
|
print('-'*50 + '\n')
|
||||||
|
|
||||||
|
|
||||||
screen = app.screenAt(main_widget.geometry().center())
|
screen = app.screenAt(main_widget.geometry().center())
|
||||||
ppscreeninfo(screen)
|
ppscreeninfo(screen)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue