Size the window to aproximately 1/3 the screen space
parent
15556e40f0
commit
c411a244f6
|
@ -165,6 +165,7 @@ class MainWindow(QtGui.QMainWindow):
|
||||||
|
|
||||||
self._status_bar: QStatusBar = None
|
self._status_bar: QStatusBar = None
|
||||||
self._status_label: QLabel = None
|
self._status_label: QLabel = None
|
||||||
|
self._size: Optional[tuple[int, int]] = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def mode_label(self) -> QtGui.QLabel:
|
def mode_label(self) -> QtGui.QLabel:
|
||||||
|
@ -271,12 +272,18 @@ class MainWindow(QtGui.QMainWindow):
|
||||||
|
|
||||||
def configure_to_desktop(
|
def configure_to_desktop(
|
||||||
self,
|
self,
|
||||||
|
size: Optional[tuple[int, int]] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
# https://stackoverflow.com/a/18975846
|
# https://stackoverflow.com/a/18975846
|
||||||
app = QtGui.QApplication.instance()
|
if not size and not self._size:
|
||||||
geo = self.current_screen().geometry()
|
app = QtGui.QApplication.instance()
|
||||||
h, w = geo.height(), geo.width()
|
geo = self.current_screen().geometry()
|
||||||
self.resize(round(w * .375), round(h * 3/8))
|
h, w = geo.height(), geo.width()
|
||||||
|
self.setMaximumSize(w, h)
|
||||||
|
# use approx 1/3 of the area of the screen by default
|
||||||
|
self._size = round(w * .666), round(h * .666)
|
||||||
|
|
||||||
|
self.resize(*size or self._size)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue