Rename column label fields

This commit is contained in:
RumovZ 2021-04-10 09:14:20 +02:00
parent b723159b3b
commit 48b70873cb
4 changed files with 13 additions and 11 deletions

View File

@ -547,7 +547,9 @@ class ItemState(ABC):
return self._active_columns[index]
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
@ -1083,8 +1085,8 @@ def addon_column_fillin(key: str) -> Column:
"""
return Column(
key=key,
label=tr.browsing_addon(),
notes_label=tr.browsing_addon(),
cards_mode_label=tr.browsing_addon(),
notes_mode_label=tr.browsing_addon(),
sorting=Columns.SORTING_NONE,
uses_cell_font=False,
alignment=Columns.ALIGNMENT_CENTER,

View File

@ -1043,8 +1043,8 @@ message BrowserColumns {
}
message Column {
string key = 1;
string label = 2;
string notes_label = 3;
string cards_mode_label = 2;
string notes_mode_label = 3;
Sorting sorting = 4;
bool uses_cell_font = 5;
Alignment alignment = 6;

View File

@ -9,8 +9,8 @@ impl browser_table::Column {
pub fn to_pb_column(self, i18n: &I18n) -> pb::browser_columns::Column {
pb::browser_columns::Column {
key: self.to_string(),
label: self.localized_label(i18n),
notes_label: self.localized_notes_label(i18n),
cards_mode_label: self.cards_mode_label(i18n),
notes_mode_label: self.notes_mode_label(i18n),
sorting: self.sorting() as i32,
uses_cell_font: self.uses_cell_font(),
alignment: self.alignment() as i32,

View File

@ -172,7 +172,7 @@ impl Note {
}
impl Column {
pub fn localized_label(self, i18n: &I18n) -> String {
pub fn cards_mode_label(self, i18n: &I18n) -> String {
match self {
Self::Answer => i18n.browsing_answer(),
Self::CardMod => i18n.search_card_modified(),
@ -194,14 +194,14 @@ impl Column {
.into()
}
pub fn localized_notes_label(self, i18n: &I18n) -> String {
pub fn notes_mode_label(self, i18n: &I18n) -> String {
match self {
Self::CardMod => i18n.search_card_modified(),
Self::Cards => i18n.editing_cards(),
Self::Ease => i18n.browsing_average_ease(),
Self::Interval => i18n.browsing_average_interval(),
Self::Reps => i18n.scheduling_reviews(),
_ => return self.localized_label(i18n),
_ => return self.cards_mode_label(i18n),
}
.into()
}
@ -240,7 +240,7 @@ impl Collection {
.filter(|&c| c != Column::Custom)
.map(|c| c.to_pb_column(&self.tr))
.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 }
}