lucaschess
lucaschess copied to clipboard
Feature request: New windows positioned relative to parent
I have 3 monitors. When playing, all new windows open on Monitor 1 regardless of where the parent is. It gets annoying having to move new windows to monitor 2 or 3 every time I start something new. If the child windows were positioned relative to the parent it would fix this annoyance without being forced to put Lucas Chess on monitor 1. Alternatively, remembering window location and size would be nice but I'd be far less annoyed by not having to move the new windows to the correct monitor. I'd do it myself but QT isn't something I'm versed in.
Thank you, Michael
You could work with these simple functions in file QtUtil.py (Code/QT/QtUtil.py) these functions set the limits.
def centraWindow(window):
"""
Centra la ventana en el escritorio
"""
screen = QtGui.QDesktopWidget().screenGeometry()
size = window.geometry()
window.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
def escondeWindow(window):
pos = window.pos()
screen = QtGui.QDesktopWidget().screenGeometry()
window.move(screen.width()*2, 0)
return pos
class EscondeWindow:
def __init__(self, window):
self.window = window
def __enter__(self):
self.pos = self.window.pos()
screen = QtGui.QDesktopWidget().screenGeometry()
self.window.move(screen.width()*2, 0)
return self
def __exit__(self, type, value, traceback):
self.window.move(self.pos)
self.window.show()
....
def tamEscritorio():
"""
Devuelve ancho,alto del escritorio
"""
screen = QtGui.QDesktopWidget().availableGeometry()
return screen.width(), screen.height()
def anchoEscritorio():
return QtGui.QDesktopWidget().availableGeometry().width()
def altoEscritorio():
return QtGui.QDesktopWidget().availableGeometry().height()
Perhaps creating a function that centralized QtGui.QDesktopWidget().availableGeometry(), could help to adapt the pogram to other sizes.
tamEscritorio = sizeDesktop anchoEscritorio = widthDesktop altoEscritorio = heightDesktop
I have one monitor and I can´t test.