improve layout

This commit is contained in:
Damien Elmes 2009-02-06 17:27:52 +09:00
parent f5f68a8603
commit 0977c50a0c
2 changed files with 103 additions and 116 deletions

View file

@ -41,12 +41,11 @@ class AnkiQt(QMainWindow):
self.hideWelcome = False self.hideWelcome = False
self.views = [] self.views = []
self.setLang() self.setLang()
self.setupDocumentDir()
self.setupFonts() self.setupFonts()
self.setupBackupDir() self.setupBackupDir()
self.setupMainWindow() self.setupMainWindow()
self.setupSystemHacks()
self.setupSound() self.setupSound()
self.alterShortcuts()
self.setupTray() self.setupTray()
self.connectMenuActions() self.connectMenuActions()
if self.config['mainWindowGeom']: if self.config['mainWindowGeom']:
@ -1081,11 +1080,10 @@ day = :d""", d=yesterday)
self.updateStudyStats() self.updateStudyStats()
# start reviewing button # start reviewing button
self.mainWin.buttonStack.hide() self.mainWin.buttonStack.hide()
t = " " * 5
if initial: if initial:
self.mainWin.startReviewingButton.setText(t+_("Start &Reviewing")) self.mainWin.startReviewingButton.setText(_("Start &Reviewing"))
else: else:
self.mainWin.startReviewingButton.setText(t+_("Continue &Reviewing")) self.mainWin.startReviewingButton.setText(_("Continue &Reviewing"))
self.mainWin.startReviewingButton.setFocus() self.mainWin.startReviewingButton.setFocus()
self.connect(self.mainWin.startReviewingButton, self.connect(self.mainWin.startReviewingButton,
SIGNAL("clicked()"), SIGNAL("clicked()"),
@ -1733,11 +1731,6 @@ day = :d""", d=yesterday)
def onStartHere(self): def onStartHere(self):
QDesktopServices.openUrl(QUrl(ankiqt.appHelpSite)) 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): def updateMarkAction(self):
self.mainWin.actionMarkCard.blockSignals(True) self.mainWin.actionMarkCard.blockSignals(True)
if self.currentCard.hasTag("Marked"): if self.currentCard.hasTag("Marked"):
@ -2058,6 +2051,16 @@ Consider backing up your media directory first."""))
# System specific misc # 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): def setupDocumentDir(self):
if sys.platform.startswith("win32"): if sys.platform.startswith("win32"):
s = QSettings(QSettings.UserScope, "Microsoft", "Windows") s = QSettings(QSettings.UserScope, "Microsoft", "Windows")
@ -2068,6 +2071,13 @@ Consider backing up your media directory first."""))
else: else:
self.documentDir = os.path.expanduser("~/.anki") 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 # Misc
########################################################################## ##########################################################################

View file

@ -5,8 +5,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>988</width> <width>751</width>
<height>710</height> <height>502</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
@ -26,9 +26,9 @@
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>
<y>69</y> <y>63</y>
<width>988</width> <width>751</width>
<height>621</height> <height>418</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy" > <property name="sizePolicy" >
@ -381,8 +381,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>711</width> <width>474</width>
<height>57</height> <height>60</height>
</rect> </rect>
</property> </property>
</widget> </widget>
@ -397,15 +397,15 @@
</sizepolicy> </sizepolicy>
</property> </property>
<property name="currentIndex" > <property name="currentIndex" >
<number>4</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="blankPage" > <widget class="QWidget" name="blankPage" >
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>422</width> <width>474</width>
<height>300</height> <height>358</height>
</rect> </rect>
</property> </property>
</widget> </widget>
@ -439,8 +439,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>422</width> <width>456</width>
<height>300</height> <height>341</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_2" > <layout class="QVBoxLayout" name="verticalLayout_2" >
@ -477,8 +477,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>711</width> <width>474</width>
<height>564</height> <height>358</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_4" > <layout class="QVBoxLayout" name="verticalLayout_4" >
@ -511,10 +511,10 @@
</spacer> </spacer>
</item> </item>
<item> <item>
<widget class="QFrame" name="frame" > <widget class="QFrame" name="studyOptionsFrame" >
<property name="maximumSize" > <property name="maximumSize" >
<size> <size>
<width>450</width> <width>350</width>
<height>16777215</height> <height>16777215</height>
</size> </size>
</property> </property>
@ -530,8 +530,8 @@
<property name="spacing" > <property name="spacing" >
<number>0</number> <number>0</number>
</property> </property>
<property name="topMargin" > <property name="margin" >
<number>4</number> <number>10</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="optionsLabel" > <widget class="QLabel" name="optionsLabel" >
@ -579,7 +579,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QGridLayout" name="gridLayout_13" > <layout class="QGridLayout" name="studyOptionsLayout1" >
<property name="leftMargin" > <property name="leftMargin" >
<number>2</number> <number>2</number>
</property> </property>
@ -590,7 +590,7 @@
<number>0</number> <number>0</number>
</property> </property>
<property name="verticalSpacing" > <property name="verticalSpacing" >
<number>4</number> <number>6</number>
</property> </property>
<item row="1" column="0" > <item row="1" column="0" >
<widget class="QLabel" name="label_20" > <widget class="QLabel" name="label_20" >
@ -695,39 +695,6 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0" >
<layout class="QHBoxLayout" name="horizontalLayout_5" >
<property name="spacing" >
<number>6</number>
</property>
<property name="topMargin" >
<number>4</number>
</property>
<item>
<widget class="QPushButton" name="optionsButton" >
<property name="text" >
<string>More>></string>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
<property name="checked" >
<bool>false</bool>
</property>
<property name="flat" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="optionsHelpButton" >
<property name="text" >
<string>Help</string>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</item> </item>
<item> <item>
@ -736,13 +703,13 @@
<widget class="QWidget" native="1" name="optionsBox" > <widget class="QWidget" native="1" name="optionsBox" >
<layout class="QVBoxLayout" name="verticalLayout_7" > <layout class="QVBoxLayout" name="verticalLayout_7" >
<property name="spacing" > <property name="spacing" >
<number>4</number> <number>10</number>
</property> </property>
<property name="leftMargin" > <property name="leftMargin" >
<number>2</number> <number>2</number>
</property> </property>
<property name="topMargin" > <property name="topMargin" >
<number>4</number> <number>6</number>
</property> </property>
<property name="rightMargin" > <property name="rightMargin" >
<number>0</number> <number>0</number>
@ -751,14 +718,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QComboBox" name="newCardOrder" > <widget class="QComboBox" name="newCardOrder" />
<property name="minimumSize" >
<size>
<width>250</width>
<height>0</height>
</size>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QComboBox" name="newCardScheduling" > <widget class="QComboBox" name="newCardScheduling" >
@ -791,37 +751,54 @@
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="verticalSpacer" > <layout class="QGridLayout" name="studyOptionsReviewBar" >
<property name="orientation" > <property name="topMargin" >
<enum>Qt::Vertical</enum> <number>10</number>
</property> </property>
<property name="sizeType" > <property name="horizontalSpacing" >
<enum>QSizePolicy::Fixed</enum> <number>10</number>
</property> </property>
<property name="sizeHint" stdset="0" > <item row="0" column="0" >
<size> <widget class="QPushButton" name="startReviewingButton" >
<width>20</width> <property name="sizePolicy" >
<height>10</height> <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
</size> <horstretch>0</horstretch>
</property> <verstretch>0</verstretch>
</spacer> </sizepolicy>
</item> </property>
<item> <property name="text" >
<widget class="QPushButton" name="startReviewingButton" > <string>Review</string>
<property name="text" > </property>
<string>Review</string> <property name="icon" >
</property> <iconset resource="../icons.qrc" >
<property name="icon" > <normaloff>:/icons/player-time.png</normaloff>:/icons/player-time.png</iconset>
<iconset resource="../icons.qrc" > </property>
<normaloff>:/icons/player-time.png</normaloff>:/icons/player-time.png</iconset> </widget>
</property> </item>
<property name="iconSize" > <item row="0" column="1" >
<size> <widget class="QPushButton" name="optionsButton" >
<width>32</width> <property name="text" >
<height>32</height> <string>More>></string>
</size> </property>
</property> <property name="checkable" >
</widget> <bool>true</bool>
</property>
<property name="checked" >
<bool>false</bool>
</property>
<property name="flat" >
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QPushButton" name="optionsHelpButton" >
<property name="text" >
<string>Help</string>
</property>
</widget>
</item>
</layout>
</item> </item>
</layout> </layout>
</item> </item>
@ -865,8 +842,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>711</width> <width>474</width>
<height>564</height> <height>358</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_8" > <layout class="QVBoxLayout" name="verticalLayout_8" >
@ -1208,8 +1185,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>988</width> <width>751</width>
<height>23</height> <height>21</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuHelp" > <widget class="QMenu" name="menuHelp" >
@ -1354,9 +1331,9 @@
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>
<y>690</y> <y>481</y>
<width>988</width> <width>751</width>
<height>20</height> <height>21</height>
</rect> </rect>
</property> </property>
<property name="sizeGripEnabled" > <property name="sizeGripEnabled" >
@ -1370,9 +1347,9 @@
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>
<y>23</y> <y>21</y>
<width>988</width> <width>751</width>
<height>46</height> <height>42</height>
</rect> </rect>
</property> </property>
<property name="orientation" > <property name="orientation" >
@ -1965,12 +1942,12 @@
<slot>setShown(bool)</slot> <slot>setShown(bool)</slot>
<hints> <hints>
<hint type="sourcelabel" > <hint type="sourcelabel" >
<x>203</x> <x>218</x>
<y>322</y> <y>250</y>
</hint> </hint>
<hint type="destinationlabel" > <hint type="destinationlabel" >
<x>194</x> <x>222</x>
<y>364</y> <y>300</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>