Merge pull request #1213 from RumovZ/new-flags
Add pink, turquoise and purple flags
This commit is contained in:
commit
578b1b0552
@ -1,7 +1,6 @@
|
||||
actions-add = Add
|
||||
actions-all-selected = All selected
|
||||
actions-any-selected = Any selected
|
||||
actions-blue-flag = Blue Flag
|
||||
actions-cancel = Cancel
|
||||
actions-choose = Choose
|
||||
actions-close = Close
|
||||
@ -11,7 +10,6 @@ actions-decks = Decks
|
||||
actions-delete = Delete
|
||||
actions-export = Export
|
||||
actions-filter = Filter
|
||||
actions-green-flag = Green Flag
|
||||
actions-help = Help
|
||||
actions-import = Import
|
||||
actions-manage = Manage...
|
||||
@ -20,10 +18,8 @@ actions-new = New
|
||||
actions-new-name = New name:
|
||||
actions-options = Options
|
||||
actions-options-for = Options for { $val }
|
||||
actions-orange-flag = Orange Flag
|
||||
actions-preview = Preview
|
||||
actions-rebuild = Rebuild
|
||||
actions-red-flag = Red Flag
|
||||
actions-rename = Rename
|
||||
actions-rename-deck = Rename Deck
|
||||
actions-rename-tag = Rename Tag
|
||||
@ -53,3 +49,10 @@ actions-add-notetype = Add Notetype
|
||||
actions-remove-notetype = Remove Notetype
|
||||
actions-update-notetype = Update Notetype
|
||||
actions-update-config = Update Config
|
||||
actions-red-flag = Red Flag
|
||||
actions-orange-flag = Orange Flag
|
||||
actions-green-flag = Green Flag
|
||||
actions-blue-flag = Blue Flag
|
||||
actions-pink-flag = Pink Flag
|
||||
actions-turquoise-flag = Turquoise Flag
|
||||
actions-purple-flag = Purple Flag
|
||||
|
@ -16,7 +16,7 @@ search-unclosed-quote = an opening double quote `"` was found, but there was no
|
||||
search-missing-key = a colon `:` was found, but there was no keyword preceding it. If you want to search for a literal `:`, prepend a backslash: `\:`.
|
||||
search-unknown-escape = the escape sequence `{ $val }` is not defined. If you want to search for a literal backslash `\`, prepend another one: `\\`.
|
||||
search-invalid-argument = `{ $term }` was given an invalid argument '`{ $argument }`'.
|
||||
search-invalid-flag = `flag:` must be followed by a valid flag number: `1` (red), `2` (orange), `3` (green), `4` (blue) or `0` (no flag).
|
||||
search-invalid-flag = `flag:` must be followed by a valid flag number: `1` (red), `2` (orange), `3` (green), `4` (blue), `5` (pink), `6` (turquoise), `7` (purple) or `0` (no flag).
|
||||
search-invalid-prop-operator = `prop:{ $val }` must be followed by one of the following comparison operators: `=`, `!=`, `<`, `>`, `<=` or `>=`.
|
||||
search-invalid-other = please check for typing mistakes.
|
||||
|
||||
|
@ -215,7 +215,7 @@ class Card:
|
||||
|
||||
def set_user_flag(self, flag: int) -> None:
|
||||
print("use col.set_user_flag_for_cards() instead")
|
||||
assert 0 <= flag <= 4
|
||||
assert 0 <= flag <= 7
|
||||
self.flags = (self.flags & ~0b111) | flag
|
||||
|
||||
# legacy
|
||||
|
@ -88,6 +88,12 @@ def backend_color_to_aqt_color(color: BrowserRow.Color.V) -> Optional[Tuple[str,
|
||||
return colors.FLAG3_BG
|
||||
if color == BrowserRow.COLOR_FLAG_BLUE:
|
||||
return colors.FLAG4_BG
|
||||
if color == BrowserRow.COLOR_FLAG_PINK:
|
||||
return colors.FLAG5_BG
|
||||
if color == BrowserRow.COLOR_FLAG_TURQUOISE:
|
||||
return colors.FLAG6_BG
|
||||
if color == BrowserRow.COLOR_FLAG_PURPLE:
|
||||
return colors.FLAG7_BG
|
||||
return None
|
||||
|
||||
|
||||
|
@ -146,13 +146,16 @@ function _showAnswer(a: string, bodyclass: string): void {
|
||||
}
|
||||
|
||||
const _flagColours = {
|
||||
1: "#ff6666",
|
||||
2: "#ff9900",
|
||||
3: "#77ff77",
|
||||
4: "#77aaff",
|
||||
1: "#e25252",
|
||||
2: "#ffb347",
|
||||
3: "#54c414",
|
||||
4: "#578cff",
|
||||
5: "#ff82ee",
|
||||
6: "#00d1b5",
|
||||
7: "#9649dd",
|
||||
};
|
||||
|
||||
function _drawFlag(flag: 0 | 1 | 2 | 3 | 4): void {
|
||||
function _drawFlag(flag: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7): void {
|
||||
const elem = document.getElementById("_flag");
|
||||
if (flag === 0) {
|
||||
elem.setAttribute("hidden", "");
|
||||
|
@ -65,4 +65,25 @@ def load_flags(col: Collection) -> List[Flag]:
|
||||
SearchNode(flag=SearchNode.FLAG_BLUE),
|
||||
"actionBlue_Flag",
|
||||
),
|
||||
Flag(
|
||||
5,
|
||||
labels["5"] if "5" in labels else tr.actions_pink_flag(),
|
||||
icon.with_color(colors.FLAG5_FG),
|
||||
SearchNode(flag=SearchNode.FLAG_PINK),
|
||||
"actionPink_Flag",
|
||||
),
|
||||
Flag(
|
||||
6,
|
||||
labels["6"] if "6" in labels else tr.actions_turquoise_flag(),
|
||||
icon.with_color(colors.FLAG6_FG),
|
||||
SearchNode(flag=SearchNode.FLAG_TURQUOISE),
|
||||
"actionTurquoise_Flag",
|
||||
),
|
||||
Flag(
|
||||
7,
|
||||
labels["7"] if "7" in labels else tr.actions_purple_flag(),
|
||||
icon.with_color(colors.FLAG7_FG),
|
||||
SearchNode(flag=SearchNode.FLAG_PURPLE),
|
||||
"actionPurple_Flag",
|
||||
),
|
||||
]
|
||||
|
@ -144,12 +144,12 @@
|
||||
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderMinimumSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderHighlightSections">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderMinimumSectionSize">
|
||||
<number>20</number>
|
||||
</attribute>
|
||||
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
@ -209,7 +209,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>750</width>
|
||||
<height>24</height>
|
||||
<height>21</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="menuEdit">
|
||||
@ -262,6 +262,9 @@
|
||||
<addaction name="actionOrange_Flag"/>
|
||||
<addaction name="actionGreen_Flag"/>
|
||||
<addaction name="actionBlue_Flag"/>
|
||||
<addaction name="actionPink_Flag"/>
|
||||
<addaction name="actionTurquoise_Flag"/>
|
||||
<addaction name="actionPurple_Flag"/>
|
||||
</widget>
|
||||
<addaction name="actionChange_Deck"/>
|
||||
<addaction name="separator"/>
|
||||
@ -622,6 +625,39 @@
|
||||
<string notr="true">Ctrl+Shift+Z</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPink_Flag">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>actions_pink_flag</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+5</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionTurquoise_Flag">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>actions_turquoise_flag</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+6</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionPurple_Flag">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>actions_purple_flag</string>
|
||||
</property>
|
||||
<property name="shortcut">
|
||||
<string notr="true">Ctrl+7</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="icons.qrc"/>
|
||||
|
@ -860,6 +860,9 @@ message SearchNode {
|
||||
FLAG_ORANGE = 3;
|
||||
FLAG_GREEN = 4;
|
||||
FLAG_BLUE = 5;
|
||||
FLAG_PINK = 6;
|
||||
FLAG_TURQUOISE = 7;
|
||||
FLAG_PURPLE = 8;
|
||||
}
|
||||
enum Rating {
|
||||
RATING_ANY = 0;
|
||||
@ -1132,6 +1135,9 @@ message BrowserRow {
|
||||
COLOR_FLAG_ORANGE = 4;
|
||||
COLOR_FLAG_GREEN = 5;
|
||||
COLOR_FLAG_BLUE = 6;
|
||||
COLOR_FLAG_PINK = 7;
|
||||
COLOR_FLAG_TURQUOISE = 8;
|
||||
COLOR_FLAG_PURPLE = 9;
|
||||
}
|
||||
repeated Cell cells = 1;
|
||||
Color color = 2;
|
||||
|
@ -70,6 +70,9 @@ impl TryFrom<pb::SearchNode> for Node {
|
||||
Flag::Orange => Node::Search(SearchNode::Flag(2)),
|
||||
Flag::Green => Node::Search(SearchNode::Flag(3)),
|
||||
Flag::Blue => Node::Search(SearchNode::Flag(4)),
|
||||
Flag::Pink => Node::Search(SearchNode::Flag(5)),
|
||||
Flag::Turquoise => Node::Search(SearchNode::Flag(6)),
|
||||
Flag::Purple => Node::Search(SearchNode::Flag(7)),
|
||||
},
|
||||
Filter::Negated(term) => Node::try_from(*term)?.negated(),
|
||||
Filter::Group(mut group) => {
|
||||
|
@ -527,6 +527,9 @@ impl RowContext {
|
||||
2 => Color::FlagOrange,
|
||||
3 => Color::FlagGreen,
|
||||
4 => Color::FlagBlue,
|
||||
5 => Color::FlagPink,
|
||||
6 => Color::FlagTurquoise,
|
||||
7 => Color::FlagPurple,
|
||||
_ => {
|
||||
if self.note.is_marked() {
|
||||
Color::Marked
|
||||
|
@ -119,11 +119,8 @@ impl Card {
|
||||
|
||||
/// True if flag changed.
|
||||
fn set_flag(&mut self, flag: u8) -> bool {
|
||||
// we currently only allow 4 flags
|
||||
assert!(flag < 5);
|
||||
|
||||
// but reserve space for 7, preserving the rest of
|
||||
// the flags (up to a byte)
|
||||
// The first 3 bits represent one of the 7 supported flags, the rest of
|
||||
// the flag byte is preserved.
|
||||
let updated_flags = (self.flags & !0b111) | flag;
|
||||
if self.flags != updated_flags {
|
||||
self.flags = updated_flags;
|
||||
@ -268,7 +265,7 @@ impl Collection {
|
||||
}
|
||||
|
||||
pub fn set_card_flag(&mut self, cards: &[CardId], flag: u32) -> Result<OpOutput<usize>> {
|
||||
if flag > 4 {
|
||||
if flag > 7 {
|
||||
return Err(AnkiError::invalid_input("invalid flag"));
|
||||
}
|
||||
let flag = flag as u8;
|
||||
|
@ -414,10 +414,10 @@ fn parse_template(s: &str) -> ParseResult<SearchNode> {
|
||||
}))
|
||||
}
|
||||
|
||||
/// flag:0-4
|
||||
/// flag:0-7
|
||||
fn parse_flag(s: &str) -> ParseResult<SearchNode> {
|
||||
if let Ok(flag) = s.parse::<u8>() {
|
||||
if flag > 4 {
|
||||
if flag > 7 {
|
||||
Err(parse_failure(s, FailKind::InvalidFlag))
|
||||
} else {
|
||||
Ok(SearchNode::Flag(flag))
|
||||
@ -999,7 +999,7 @@ mod test {
|
||||
assert_err_kind(r#""flag: ""#, InvalidFlag);
|
||||
assert_err_kind("flag:-0", InvalidFlag);
|
||||
assert_err_kind("flag:", InvalidFlag);
|
||||
assert_err_kind("flag:5", InvalidFlag);
|
||||
assert_err_kind("flag:8", InvalidFlag);
|
||||
assert_err_kind("flag:1.1", InvalidFlag);
|
||||
|
||||
for term in &["added", "edited", "rated", "resched"] {
|
||||
|
@ -17,14 +17,20 @@
|
||||
--highlight-bg: #77ccff;
|
||||
--highlight-fg: black;
|
||||
--disabled: #777;
|
||||
--flag1-fg: #c35617;
|
||||
--flag1-fg: #e25252;
|
||||
--flag2-fg: #ffb347;
|
||||
--flag3-fg: #0a0;
|
||||
--flag4-fg: #77ccff;
|
||||
--flag1-bg: #ffaaaa;
|
||||
--flag3-fg: #54c414;
|
||||
--flag4-fg: #578cff;
|
||||
--flag5-fg: #ff82ee;
|
||||
--flag6-fg: #00d1b5;
|
||||
--flag7-fg: #9649dd;
|
||||
--flag1-bg: #ff9b9b;
|
||||
--flag2-bg: #ffb347;
|
||||
--flag3-bg: #82e0aa;
|
||||
--flag4-bg: #85c1e9;
|
||||
--flag3-bg: #93e066;
|
||||
--flag4-bg: #9dbcff;
|
||||
--flag5-bg: #f5a8eb;
|
||||
--flag6-bg: #7edbd7;
|
||||
--flag7-bg: #cca3f1;
|
||||
--buried-fg: #aaaa33;
|
||||
--suspended-fg: #dd0;
|
||||
--suspended-bg: #ffffb2;
|
||||
@ -48,14 +54,20 @@
|
||||
--highlight-bg: #77ccff;
|
||||
--highlight-fg: white;
|
||||
--disabled: #777;
|
||||
--flag1-fg: #ffaaaa;
|
||||
--flag2-fg: #ffb347;
|
||||
--flag3-fg: #82e0aa;
|
||||
--flag4-fg: #85c1e9;
|
||||
--flag1-fg: #ff7b7b;
|
||||
--flag2-fg: #f5aa41;
|
||||
--flag3-fg: #86ce5d;
|
||||
--flag4-fg: #6f9dff;
|
||||
--flag5-fg: #f097e4;
|
||||
--flag6-fg: #5ccfca;
|
||||
--flag7-fg: #9f63d3;
|
||||
--flag1-bg: #aa5555;
|
||||
--flag2-bg: #aa6337;
|
||||
--flag3-bg: #33a055;
|
||||
--flag4-bg: #3581a9;
|
||||
--flag2-bg: #ac653a;
|
||||
--flag3-bg: #559238;
|
||||
--flag4-bg: #506aa3;
|
||||
--flag5-bg: #975d8f;
|
||||
--flag6-bg: #399185;
|
||||
--flag7-bg: #624b77;
|
||||
--buried-fg: #777733;
|
||||
--suspended-fg: #ffffb2;
|
||||
--suspended-bg: #aaaa33;
|
||||
|
Loading…
Reference in New Issue
Block a user