Configure window size based on screen dims on windows
							parent
							
								
									83299c3a8b
								
							
						
					
					
						commit
						ba7b01b704
					
				| 
						 | 
				
			
			@ -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()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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)'
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -163,7 +163,7 @@ class MainWindow(QtGui.QMainWindow):
 | 
			
		|||
 | 
			
		||||
        self._status_bar: QStatusBar = None
 | 
			
		||||
        self._status_label: QLabel = None
 | 
			
		||||
 | 
			
		||||
    
 | 
			
		||||
    @property
 | 
			
		||||
    def mode_label(self) -> QtGui.QLabel:
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue