Configure window size based on screen dims on windows
parent
71f9b5c000
commit
2ebdf008da
|
@ -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()
|
||||
|
|
|
@ -153,8 +153,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)'
|
||||
|
||||
|
@ -269,6 +269,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
|
||||
|
|
Loading…
Reference in New Issue