mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Rename column label fields
This commit is contained in:
parent
b723159b3b
commit
48b70873cb
4 changed files with 13 additions and 11 deletions
|
@ -547,7 +547,9 @@ class ItemState(ABC):
|
||||||
return self._active_columns[index]
|
return self._active_columns[index]
|
||||||
|
|
||||||
def column_label(self, column: Column) -> str:
|
def column_label(self, column: Column) -> str:
|
||||||
return column.notes_label if self.is_notes_mode() else column.label
|
return (
|
||||||
|
column.notes_mode_label if self.is_notes_mode() else column.cards_mode_label
|
||||||
|
)
|
||||||
|
|
||||||
# Columns and sorting
|
# Columns and sorting
|
||||||
|
|
||||||
|
@ -1083,8 +1085,8 @@ def addon_column_fillin(key: str) -> Column:
|
||||||
"""
|
"""
|
||||||
return Column(
|
return Column(
|
||||||
key=key,
|
key=key,
|
||||||
label=tr.browsing_addon(),
|
cards_mode_label=tr.browsing_addon(),
|
||||||
notes_label=tr.browsing_addon(),
|
notes_mode_label=tr.browsing_addon(),
|
||||||
sorting=Columns.SORTING_NONE,
|
sorting=Columns.SORTING_NONE,
|
||||||
uses_cell_font=False,
|
uses_cell_font=False,
|
||||||
alignment=Columns.ALIGNMENT_CENTER,
|
alignment=Columns.ALIGNMENT_CENTER,
|
||||||
|
|
|
@ -1043,8 +1043,8 @@ message BrowserColumns {
|
||||||
}
|
}
|
||||||
message Column {
|
message Column {
|
||||||
string key = 1;
|
string key = 1;
|
||||||
string label = 2;
|
string cards_mode_label = 2;
|
||||||
string notes_label = 3;
|
string notes_mode_label = 3;
|
||||||
Sorting sorting = 4;
|
Sorting sorting = 4;
|
||||||
bool uses_cell_font = 5;
|
bool uses_cell_font = 5;
|
||||||
Alignment alignment = 6;
|
Alignment alignment = 6;
|
||||||
|
|
|
@ -9,8 +9,8 @@ impl browser_table::Column {
|
||||||
pub fn to_pb_column(self, i18n: &I18n) -> pb::browser_columns::Column {
|
pub fn to_pb_column(self, i18n: &I18n) -> pb::browser_columns::Column {
|
||||||
pb::browser_columns::Column {
|
pb::browser_columns::Column {
|
||||||
key: self.to_string(),
|
key: self.to_string(),
|
||||||
label: self.localized_label(i18n),
|
cards_mode_label: self.cards_mode_label(i18n),
|
||||||
notes_label: self.localized_notes_label(i18n),
|
notes_mode_label: self.notes_mode_label(i18n),
|
||||||
sorting: self.sorting() as i32,
|
sorting: self.sorting() as i32,
|
||||||
uses_cell_font: self.uses_cell_font(),
|
uses_cell_font: self.uses_cell_font(),
|
||||||
alignment: self.alignment() as i32,
|
alignment: self.alignment() as i32,
|
||||||
|
|
|
@ -172,7 +172,7 @@ impl Note {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Column {
|
impl Column {
|
||||||
pub fn localized_label(self, i18n: &I18n) -> String {
|
pub fn cards_mode_label(self, i18n: &I18n) -> String {
|
||||||
match self {
|
match self {
|
||||||
Self::Answer => i18n.browsing_answer(),
|
Self::Answer => i18n.browsing_answer(),
|
||||||
Self::CardMod => i18n.search_card_modified(),
|
Self::CardMod => i18n.search_card_modified(),
|
||||||
|
@ -194,14 +194,14 @@ impl Column {
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn localized_notes_label(self, i18n: &I18n) -> String {
|
pub fn notes_mode_label(self, i18n: &I18n) -> String {
|
||||||
match self {
|
match self {
|
||||||
Self::CardMod => i18n.search_card_modified(),
|
Self::CardMod => i18n.search_card_modified(),
|
||||||
Self::Cards => i18n.editing_cards(),
|
Self::Cards => i18n.editing_cards(),
|
||||||
Self::Ease => i18n.browsing_average_ease(),
|
Self::Ease => i18n.browsing_average_ease(),
|
||||||
Self::Interval => i18n.browsing_average_interval(),
|
Self::Interval => i18n.browsing_average_interval(),
|
||||||
Self::Reps => i18n.scheduling_reviews(),
|
Self::Reps => i18n.scheduling_reviews(),
|
||||||
_ => return self.localized_label(i18n),
|
_ => return self.cards_mode_label(i18n),
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
@ -240,7 +240,7 @@ impl Collection {
|
||||||
.filter(|&c| c != Column::Custom)
|
.filter(|&c| c != Column::Custom)
|
||||||
.map(|c| c.to_pb_column(&self.tr))
|
.map(|c| c.to_pb_column(&self.tr))
|
||||||
.collect();
|
.collect();
|
||||||
columns.sort_by(|c1, c2| c1.label.cmp(&c2.label));
|
columns.sort_by(|c1, c2| c1.cards_mode_label.cmp(&c2.cards_mode_label));
|
||||||
pb::BrowserColumns { columns }
|
pb::BrowserColumns { columns }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue