Factor info print into func
parent
fe4a69b353
commit
5a9e985024
|
@ -38,54 +38,41 @@ main_widget = QtWidgets.QWidget()
|
||||||
window.setCentralWidget(main_widget)
|
window.setCentralWidget(main_widget)
|
||||||
window.show()
|
window.show()
|
||||||
|
|
||||||
|
# TODO: move widget through multiple displays and auto-detect the pixel
|
||||||
|
# ratio? (probably is gonna require calls to i3ipc on linux)..
|
||||||
pxr = main_widget.devicePixelRatioF()
|
pxr = main_widget.devicePixelRatioF()
|
||||||
|
|
||||||
# screen_num = app.desktop().screenNumber()
|
# TODO: how to detect list of displays from API?
|
||||||
# screen = app.screens()[screen_num]
|
# screen = app.screens()[screen_num]
|
||||||
|
|
||||||
|
|
||||||
|
def ppscreeninfo(screen: 'QScreen') -> None:
|
||||||
|
# screen_num = app.desktop().screenNumber()
|
||||||
|
name = screen.name()
|
||||||
|
size = screen.size()
|
||||||
|
geo = screen.availableGeometry()
|
||||||
|
phydpi = screen.physicalDotsPerInch()
|
||||||
|
logdpi = screen.logicalDotsPerInch()
|
||||||
|
rr = screen.refreshRate()
|
||||||
|
|
||||||
|
print(
|
||||||
|
# f'screen number: {screen_num}\n',
|
||||||
|
f'screen: {name}\n'
|
||||||
|
f' size: {size}\n'
|
||||||
|
f' geometry: {geo}\n'
|
||||||
|
f' logical dpi: {logdpi}\n'
|
||||||
|
f' devicePixelRationF(): {pxr}\n'
|
||||||
|
f' physical dpi: {phydpi}\n'
|
||||||
|
f' refresh rate: {rr}\n'
|
||||||
|
)
|
||||||
|
|
||||||
|
print('-'*50 + '\n')
|
||||||
|
|
||||||
screen = app.screenAt(main_widget.geometry().center())
|
screen = app.screenAt(main_widget.geometry().center())
|
||||||
|
ppscreeninfo(screen)
|
||||||
name = screen.name()
|
|
||||||
size = screen.size()
|
|
||||||
geo = screen.availableGeometry()
|
|
||||||
phydpi = screen.physicalDotsPerInch()
|
|
||||||
logdpi = screen.logicalDotsPerInch()
|
|
||||||
rr = screen.refreshRate()
|
|
||||||
|
|
||||||
print(
|
|
||||||
# f'screen number: {screen_num}\n',
|
|
||||||
f'screen: {name}\n'
|
|
||||||
f' size: {size}\n'
|
|
||||||
f' geometry: {geo}\n'
|
|
||||||
f' logical dpi: {logdpi}\n'
|
|
||||||
f' devicePixelRationF(): {pxr}\n'
|
|
||||||
f' physical dpi: {phydpi}\n'
|
|
||||||
f' refresh rate: {rr}\n'
|
|
||||||
)
|
|
||||||
|
|
||||||
print('-'*50 + '\n')
|
|
||||||
|
|
||||||
screen = app.primaryScreen()
|
screen = app.primaryScreen()
|
||||||
|
ppscreeninfo(screen)
|
||||||
name = screen.name()
|
|
||||||
size = screen.size()
|
|
||||||
geo = screen.availableGeometry()
|
|
||||||
phydpi = screen.physicalDotsPerInch()
|
|
||||||
logdpi = screen.logicalDotsPerInch()
|
|
||||||
rr = screen.refreshRate()
|
|
||||||
|
|
||||||
print(
|
|
||||||
# f'screen number: {screen_num}\n',
|
|
||||||
f'screen: {name}\n'
|
|
||||||
f' size: {size}\n'
|
|
||||||
f' geometry: {geo}\n'
|
|
||||||
f' logical dpi: {logdpi}\n'
|
|
||||||
f' devicePixelRationF(): {pxr}\n'
|
|
||||||
f' physical dpi: {phydpi}\n'
|
|
||||||
f' refresh rate: {rr}\n'
|
|
||||||
)
|
|
||||||
|
|
||||||
print('-'*50 + '\n')
|
|
||||||
|
|
||||||
# app-wide font
|
# app-wide font
|
||||||
font = QtGui.QFont("Hack")
|
font = QtGui.QFont("Hack")
|
||||||
|
|
Loading…
Reference in New Issue