checkmark on flags in browser

This commit is contained in:
Damien Elmes 2018-11-12 12:10:50 +10:00
parent 8ac5cc8dff
commit 4acce5f96b
2 changed files with 26 additions and 0 deletions

View File

@ -654,6 +654,7 @@ class Browser(QMainWindow):
self.focusTo = None
self.editor.card = self.card
self.singleCard = True
self._updateFlagsMenu()
runHook("browser.rowChanged", self)
self._renderPreview(True)
@ -1561,6 +1562,19 @@ update cards set usn=?, mod=?, did=? where id in """ + scids,
self.col.setUserFlag(n, self.selectedCards())
self.model.reset()
def _updateFlagsMenu(self):
flag = self.card and self.card.userFlag()
flag = flag or 0
f = self.form
flagActions = [f.actionRed_Flag,
f.actionOrange_Flag,
f.actionGreen_Flag,
f.actionBlue_Flag]
for c, act in enumerate(flagActions):
act.setChecked(flag == c+1)
def onMark(self, mark=None):
if mark is None:
mark = not self.isMarked()

View File

@ -526,6 +526,9 @@
</property>
</action>
<action name="actionRed_Flag">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Red Flag</string>
</property>
@ -534,6 +537,9 @@
</property>
</action>
<action name="actionOrange_Flag">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Orange Flag</string>
</property>
@ -542,6 +548,9 @@
</property>
</action>
<action name="actionGreen_Flag">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Green Flag</string>
</property>
@ -550,6 +559,9 @@
</property>
</action>
<action name="actionBlue_Flag">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Blue Flag</string>
</property>