From 0977c50a0c87dd2a10eabcd7accee10594939dac Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 6 Feb 2009 17:27:52 +0900 Subject: [PATCH] improve layout --- ankiqt/ui/main.py | 30 +++++--- designer/main.ui | 189 ++++++++++++++++++++-------------------------- 2 files changed, 103 insertions(+), 116 deletions(-) diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 781eef865..33968b6c7 100644 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -41,12 +41,11 @@ class AnkiQt(QMainWindow): self.hideWelcome = False self.views = [] self.setLang() - self.setupDocumentDir() self.setupFonts() self.setupBackupDir() self.setupMainWindow() + self.setupSystemHacks() self.setupSound() - self.alterShortcuts() self.setupTray() self.connectMenuActions() if self.config['mainWindowGeom']: @@ -1081,11 +1080,10 @@ day = :d""", d=yesterday) self.updateStudyStats() # start reviewing button self.mainWin.buttonStack.hide() - t = " " * 5 if initial: - self.mainWin.startReviewingButton.setText(t+_("Start &Reviewing")) + self.mainWin.startReviewingButton.setText(_("Start &Reviewing")) else: - self.mainWin.startReviewingButton.setText(t+_("Continue &Reviewing")) + self.mainWin.startReviewingButton.setText(_("Continue &Reviewing")) self.mainWin.startReviewingButton.setFocus() self.connect(self.mainWin.startReviewingButton, SIGNAL("clicked()"), @@ -1733,11 +1731,6 @@ day = :d""", d=yesterday) def onStartHere(self): QDesktopServices.openUrl(QUrl(ankiqt.appHelpSite)) - def alterShortcuts(self): - if sys.platform.startswith("darwin"): - self.mainWin.actionAddcards.setShortcut(_("Ctrl+D")) - self.mainWin.actionClose.setShortcut("") - def updateMarkAction(self): self.mainWin.actionMarkCard.blockSignals(True) if self.currentCard.hasTag("Marked"): @@ -2058,6 +2051,16 @@ Consider backing up your media directory first.""")) # System specific misc ########################################################################## + def setupSystemHacks(self): + self.setupDocumentDir() + self.alterShortcuts() + self.changeLayoutSpacing() + + def alterShortcuts(self): + if sys.platform.startswith("darwin"): + self.mainWin.actionAddcards.setShortcut(_("Ctrl+D")) + self.mainWin.actionClose.setShortcut("") + def setupDocumentDir(self): if sys.platform.startswith("win32"): s = QSettings(QSettings.UserScope, "Microsoft", "Windows") @@ -2068,6 +2071,13 @@ Consider backing up your media directory first.""")) else: self.documentDir = os.path.expanduser("~/.anki") + def changeLayoutSpacing(self): + if sys.platform.startswith("darwin"): + self.mainWin.studyOptionsFrame.setFixedWidth(400) + self.mainWin.studyOptionsReviewBar.setContentsMargins(0, 20, 0, 0) + self.mainWin.optionsBox.layout().setSpacing(10) + self.mainWin.optionsBox.layout().setContentsMargins(4, 10, 4, 4) + # Misc ########################################################################## diff --git a/designer/main.ui b/designer/main.ui index 529136410..adade28d7 100644 --- a/designer/main.ui +++ b/designer/main.ui @@ -5,8 +5,8 @@ 0 0 - 988 - 710 + 751 + 502 @@ -26,9 +26,9 @@ 0 - 69 - 988 - 621 + 63 + 751 + 418 @@ -381,8 +381,8 @@ 0 0 - 711 - 57 + 474 + 60 @@ -397,15 +397,15 @@ - 4 + 0 0 0 - 422 - 300 + 474 + 358 @@ -439,8 +439,8 @@ 0 0 - 422 - 300 + 456 + 341 @@ -477,8 +477,8 @@ 0 0 - 711 - 564 + 474 + 358 @@ -511,10 +511,10 @@ - + - 450 + 350 16777215 @@ -530,8 +530,8 @@ 0 - - 4 + + 10 @@ -579,7 +579,7 @@ - + 2 @@ -590,7 +590,7 @@ 0 - 4 + 6 @@ -695,39 +695,6 @@ - - - - 6 - - - 4 - - - - - More>> - - - true - - - false - - - false - - - - - - - Help - - - - - @@ -736,13 +703,13 @@ - 4 + 10 2 - 4 + 6 0 @@ -751,14 +718,7 @@ 0 - - - - 250 - 0 - - - + @@ -791,37 +751,54 @@ - - - Qt::Vertical + + + 10 - - QSizePolicy::Fixed + + 10 - - - 20 - 10 - - - - - - - - Review - - - - :/icons/player-time.png:/icons/player-time.png - - - - 32 - 32 - - - + + + + + 0 + 0 + + + + Review + + + + :/icons/player-time.png:/icons/player-time.png + + + + + + + More>> + + + true + + + false + + + false + + + + + + + Help + + + + @@ -865,8 +842,8 @@ 0 0 - 711 - 564 + 474 + 358 @@ -1208,8 +1185,8 @@ 0 0 - 988 - 23 + 751 + 21 @@ -1354,9 +1331,9 @@ 0 - 690 - 988 - 20 + 481 + 751 + 21 @@ -1370,9 +1347,9 @@ 0 - 23 - 988 - 46 + 21 + 751 + 42 @@ -1965,12 +1942,12 @@ setShown(bool) - 203 - 322 + 218 + 250 - 194 - 364 + 222 + 300