mirror of
https://github.com/ankitects/anki.git
synced 2025-11-11 15:17:12 -05:00
convert reverse order menu item to toggle button
This commit is contained in:
parent
20f9e69b79
commit
0f3a083278
5 changed files with 53 additions and 13 deletions
|
|
@ -366,8 +366,7 @@ class EditDeck(QMainWindow):
|
||||||
SIGNAL("selectionChanged(QItemSelection,QItemSelection)"),
|
SIGNAL("selectionChanged(QItemSelection,QItemSelection)"),
|
||||||
self.updateFilterLabel)
|
self.updateFilterLabel)
|
||||||
self.dialog.tableView.setItemDelegate(StatusDelegate(self, self.model))
|
self.dialog.tableView.setItemDelegate(StatusDelegate(self, self.model))
|
||||||
if self.deck.getInt("reverseOrder"):
|
self.updateSortOrder()
|
||||||
self.dialog.actionReverseOrder.setChecked(True)
|
|
||||||
self.updateFont()
|
self.updateFont()
|
||||||
self.setupMenus()
|
self.setupMenus()
|
||||||
self.setupFilter()
|
self.setupFilter()
|
||||||
|
|
@ -422,6 +421,8 @@ class EditDeck(QMainWindow):
|
||||||
self.connect(self.dialog.sortBox, SIGNAL("activated(int)"),
|
self.connect(self.dialog.sortBox, SIGNAL("activated(int)"),
|
||||||
self.sortChanged)
|
self.sortChanged)
|
||||||
self.sortChanged(self.sortIndex, refresh=False)
|
self.sortChanged(self.sortIndex, refresh=False)
|
||||||
|
self.connect(self.dialog.sortOrder, SIGNAL("clicked()"),
|
||||||
|
self.reverseOrder)
|
||||||
|
|
||||||
def drawTags(self):
|
def drawTags(self):
|
||||||
self.dialog.tagList.view().setFixedWidth(200)
|
self.dialog.tagList.view().setFixedWidth(200)
|
||||||
|
|
@ -496,6 +497,12 @@ class EditDeck(QMainWindow):
|
||||||
self.sortIndex = 0
|
self.sortIndex = 0
|
||||||
self.dialog.sortBox.setCurrentIndex(self.sortIndex)
|
self.dialog.sortBox.setCurrentIndex(self.sortIndex)
|
||||||
|
|
||||||
|
def updateSortOrder(self):
|
||||||
|
if self.deck.getInt("reverseOrder"):
|
||||||
|
self.dialog.sortOrder.setIcon(QIcon(":/icons/view-sort-descending.png"))
|
||||||
|
else:
|
||||||
|
self.dialog.sortOrder.setIcon(QIcon(":/icons/view-sort-ascending.png"))
|
||||||
|
|
||||||
def sortChanged(self, idx, refresh=True):
|
def sortChanged(self, idx, refresh=True):
|
||||||
if idx == 0:
|
if idx == 0:
|
||||||
self.sortKey = "question"
|
self.sortKey = "question"
|
||||||
|
|
@ -684,7 +691,6 @@ class EditDeck(QMainWindow):
|
||||||
self.connect(self.dialog.actionUndo, SIGNAL("triggered()"), self.onUndo)
|
self.connect(self.dialog.actionUndo, SIGNAL("triggered()"), self.onUndo)
|
||||||
self.connect(self.dialog.actionRedo, SIGNAL("triggered()"), self.onRedo)
|
self.connect(self.dialog.actionRedo, SIGNAL("triggered()"), self.onRedo)
|
||||||
self.connect(self.dialog.actionInvertSelection, SIGNAL("triggered()"), self.invertSelection)
|
self.connect(self.dialog.actionInvertSelection, SIGNAL("triggered()"), self.invertSelection)
|
||||||
self.connect(self.dialog.actionReverseOrder, SIGNAL("triggered()"), self.reverseOrder)
|
|
||||||
self.connect(self.dialog.actionSelectFacts, SIGNAL("triggered()"), self.selectFacts)
|
self.connect(self.dialog.actionSelectFacts, SIGNAL("triggered()"), self.selectFacts)
|
||||||
self.connect(self.dialog.actionFindReplace, SIGNAL("triggered()"), self.onFindReplace)
|
self.connect(self.dialog.actionFindReplace, SIGNAL("triggered()"), self.onFindReplace)
|
||||||
# jumps
|
# jumps
|
||||||
|
|
@ -696,6 +702,7 @@ class EditDeck(QMainWindow):
|
||||||
self.connect(self.dialog.actionFact, SIGNAL("triggered()"), self.onFact)
|
self.connect(self.dialog.actionFact, SIGNAL("triggered()"), self.onFact)
|
||||||
self.connect(self.dialog.actionTags, SIGNAL("triggered()"), self.onTags)
|
self.connect(self.dialog.actionTags, SIGNAL("triggered()"), self.onTags)
|
||||||
self.connect(self.dialog.actionSort, SIGNAL("triggered()"), self.onSort)
|
self.connect(self.dialog.actionSort, SIGNAL("triggered()"), self.onSort)
|
||||||
|
self.connect(self.dialog.actionCardList, SIGNAL("triggered()"), self.onCardList)
|
||||||
# help
|
# help
|
||||||
self.connect(self.dialog.actionGuide, SIGNAL("triggered()"), self.onHelp)
|
self.connect(self.dialog.actionGuide, SIGNAL("triggered()"), self.onHelp)
|
||||||
runHook('editor.setupMenus', self)
|
runHook('editor.setupMenus', self)
|
||||||
|
|
@ -1040,6 +1047,7 @@ where id in %s""" % ids2str(sf))
|
||||||
self.model.cards.reverse()
|
self.model.cards.reverse()
|
||||||
self.model.reset()
|
self.model.reset()
|
||||||
self.focusCurrentCard()
|
self.focusCurrentCard()
|
||||||
|
self.updateSortOrder()
|
||||||
|
|
||||||
# Edit: undo/redo
|
# Edit: undo/redo
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
@ -1192,6 +1200,9 @@ where id in %s""" % ids2str(sf))
|
||||||
def onSort(self):
|
def onSort(self):
|
||||||
self.dialog.sortBox.setFocus()
|
self.dialog.sortBox.setFocus()
|
||||||
|
|
||||||
|
def onCardList(self):
|
||||||
|
self.dialog.tableView.setFocus()
|
||||||
|
|
||||||
# Help
|
# Help
|
||||||
######################################################################
|
######################################################################
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,29 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="sortOrder">
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="focusPolicy">
|
||||||
|
<enum>Qt::NoFocus</enum>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/view-sort-ascending.png</normaloff>:/icons/view-sort-ascending.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="flat">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="sortBox"/>
|
<widget class="QComboBox" name="sortBox"/>
|
||||||
</item>
|
</item>
|
||||||
|
|
@ -204,7 +227,6 @@
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionFindReplace"/>
|
<addaction name="actionFindReplace"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionReverseOrder"/>
|
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionFont"/>
|
<addaction name="actionFont"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
@ -236,6 +258,7 @@
|
||||||
<addaction name="actionTags"/>
|
<addaction name="actionTags"/>
|
||||||
<addaction name="actionSort"/>
|
<addaction name="actionSort"/>
|
||||||
<addaction name="actionFact"/>
|
<addaction name="actionFact"/>
|
||||||
|
<addaction name="actionCardList"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionFirstCard"/>
|
<addaction name="actionFirstCard"/>
|
||||||
<addaction name="actionPreviousCard"/>
|
<addaction name="actionPreviousCard"/>
|
||||||
|
|
@ -429,14 +452,6 @@
|
||||||
<string>Ctrl+End</string>
|
<string>Ctrl+End</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionReverseOrder">
|
|
||||||
<property name="checkable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Reverse &Order</string>
|
|
||||||
</property>
|
|
||||||
</action>
|
|
||||||
<action name="actionGuide">
|
<action name="actionGuide">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../icons.qrc">
|
<iconset resource="../icons.qrc">
|
||||||
|
|
@ -560,6 +575,18 @@
|
||||||
<string>Toggle Mark</string>
|
<string>Toggle Mark</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionCardList">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../icons.qrc">
|
||||||
|
<normaloff>:/icons/generate_07.png</normaloff>:/icons/generate_07.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Card List</string>
|
||||||
|
</property>
|
||||||
|
<property name="shortcut">
|
||||||
|
<string>Ctrl+L</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources>
|
<resources>
|
||||||
<include location="../icons.qrc"/>
|
<include location="../icons.qrc"/>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
|
<file>icons/generate_07.png</file>
|
||||||
|
<file>icons/view-sort-descending.png</file>
|
||||||
<file>icons/emblem-important.png</file>
|
<file>icons/emblem-important.png</file>
|
||||||
<file>icons/view-sort-ascending.png</file>
|
<file>icons/view-sort-ascending.png</file>
|
||||||
<file>icons/media-playback-start2.png</file>
|
<file>icons/media-playback-start2.png</file>
|
||||||
|
|
|
||||||
BIN
icons/generate_07.png
Normal file
BIN
icons/generate_07.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
BIN
icons/view-sort-descending.png
Normal file
BIN
icons/view-sort-descending.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in a new issue