mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
fix geometry bugs
This commit is contained in:
parent
d17098b8ce
commit
b9db00e668
2 changed files with 4 additions and 25 deletions
|
@ -43,8 +43,7 @@ class Config(dict):
|
||||||
'saveAfterAdding': True,
|
'saveAfterAdding': True,
|
||||||
'saveAfterAddingNum': 3,
|
'saveAfterAddingNum': 3,
|
||||||
'saveOnClose': True,
|
'saveOnClose': True,
|
||||||
'mainWindowSize': QSize(450, 400),
|
'mainWindowGeom': None,
|
||||||
'mainWindowPos': QPoint(100, 100),
|
|
||||||
'easeButtonHeight': 'standard',
|
'easeButtonHeight': 'standard',
|
||||||
'suppressUpdate': False,
|
'suppressUpdate': False,
|
||||||
'suppressEstimates': False,
|
'suppressEstimates': False,
|
||||||
|
|
|
@ -47,9 +47,8 @@ class AnkiQt(QMainWindow):
|
||||||
self.help = ui.help.HelpArea(self.mainWin.helpFrame, self.config, self)
|
self.help = ui.help.HelpArea(self.mainWin.helpFrame, self.config, self)
|
||||||
self.trayIcon = ui.tray.AnkiTrayIcon( self )
|
self.trayIcon = ui.tray.AnkiTrayIcon( self )
|
||||||
self.connectMenuActions()
|
self.connectMenuActions()
|
||||||
self.resize(self.config['mainWindowSize'])
|
if self.config['mainWindowGeom']:
|
||||||
self.move(self.config['mainWindowPos'])
|
self.restoreGeometry(self.config['mainWindowGeom'])
|
||||||
self.maybeMoveWindow()
|
|
||||||
self.bodyView = ui.view.View(self, self.mainWin.mainText,
|
self.bodyView = ui.view.View(self, self.mainWin.mainText,
|
||||||
self.mainWin.mainTextFrame)
|
self.mainWin.mainTextFrame)
|
||||||
self.addView(self.bodyView)
|
self.addView(self.bodyView)
|
||||||
|
@ -78,24 +77,6 @@ class AnkiQt(QMainWindow):
|
||||||
# check for updates
|
# check for updates
|
||||||
self.setupAutoUpdate()
|
self.setupAutoUpdate()
|
||||||
|
|
||||||
def maybeMoveWindow(self):
|
|
||||||
# If the window is positioned off the screen, move it back into view
|
|
||||||
moveWin = False
|
|
||||||
if (self.pos().x() > (self.app.desktop().width() - 200) or
|
|
||||||
self.pos().x() < 0):
|
|
||||||
moveWin = True
|
|
||||||
newX = self.app.desktop().width() - self.size().width()
|
|
||||||
else:
|
|
||||||
newX = self.pos().x()
|
|
||||||
if (self.pos().y() > (self.app.desktop().height() - 200) or
|
|
||||||
self.pos().y() < 0):
|
|
||||||
moveWin = True
|
|
||||||
newY = self.app.desktop().height() - self.size().height()
|
|
||||||
else:
|
|
||||||
newY = self.pos().y()
|
|
||||||
if moveWin:
|
|
||||||
self.move( newX, newY )
|
|
||||||
|
|
||||||
# State machine
|
# State machine
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
|
@ -741,8 +722,7 @@ class AnkiQt(QMainWindow):
|
||||||
"Save config and window geometry."
|
"Save config and window geometry."
|
||||||
self.runHook('quit')
|
self.runHook('quit')
|
||||||
self.help.hide()
|
self.help.hide()
|
||||||
self.config['mainWindowPos'] = self.pos()
|
self.config['mainWindowGeom'] = self.saveGeometry()
|
||||||
self.config['mainWindowSize'] = self.size()
|
|
||||||
# save config
|
# save config
|
||||||
try:
|
try:
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
Loading…
Reference in a new issue