Configure window size based on screen dims on windows

windows_testing_volume
wattygetlood 2021-09-16 16:33:48 -04:00 committed by Tyler Goodlet
parent 6c86db8f2c
commit 25eb6f0087
2 changed files with 17 additions and 3 deletions

View File

@ -61,7 +61,9 @@ _do_overrides()
# XXX: pretty sure none of this shit works on linux as per:
# https://bugreports.qt.io/browse/QTBUG-53022
# it seems to work on windows.. no idea wtf is up.
is_windows = False
if platform.system() == "Windows":
is_windows = True
# Proper high DPI scaling is available in Qt >= 5.6.0. This attibute
# must be set before creating the application
@ -182,6 +184,8 @@ def run_qtractor(
window.main_widget = main_widget
window.setCentralWidget(instance)
if is_windows:
window.configure_to_desktop()
# actually render to screen
window.show()

View File

@ -151,8 +151,8 @@ class MainWindow(QtGui.QMainWindow):
# XXX: for tiling wms this should scale
# with the alloted window size.
# TODO: detect for tiling and if untrue set some size?
# size = (300, 500)
size = (0, 0)
size = (300, 500)
#size = (0, 0)
title = 'piker chart (ur symbol is loading bby)'
@ -267,6 +267,16 @@ class MainWindow(QtGui.QMainWindow):
assert screen, "Wow Qt is dumb as shit and has no screen..."
return screen
def configure_to_desktop(
self,
) -> None:
# https://stackoverflow.com/a/18975846
app = QtGui.QApplication.instance()
geo = self.current_screen().geometry()
h, w = geo.height(), geo.width()
self.resize(round(w * .375), round(h * 3/8))
# singleton app per actor
_qt_win: QtGui.QMainWindow = None