Move BrowserColumn into BrowserColumns message

This commit is contained in:
RumovZ 2021-04-08 10:16:06 +02:00
parent ee0ad6f5d6
commit 6c3c479906
3 changed files with 15 additions and 14 deletions

View File

@ -1143,7 +1143,9 @@ def _build_sort_mode(
return _pb.SortOrder(builtin=_pb.SortOrder.Builtin(kind=order, reverse=reverse))
def _column_data(column: _pb.BrowserColumn) -> Tuple[str, str, bool, bool, bool, bool]:
def _column_data(
column: _pb.BrowserColumns.Column,
) -> Tuple[str, str, bool, bool, bool, bool]:
return (
column.key,
column.label,

View File

@ -1055,16 +1055,15 @@ message FindAndReplaceIn {
}
message BrowserColumns {
repeated BrowserColumn columns = 1;
}
message BrowserColumn {
string key = 1;
string label = 2;
bool is_sortable = 3;
bool sorts_reversed = 4;
bool uses_cell_font = 5;
bool aligns_centered = 6;
message Column {
string key = 1;
string label = 2;
bool is_sortable = 3;
bool sorts_reversed = 4;
bool uses_cell_font = 5;
bool aligns_centered = 6;
}
repeated Column columns = 1;
}
message BrowserRow {

View File

@ -47,7 +47,7 @@ impl Collection {
}
fn to_pb_columns(&self, columns: &[browser_table::Column]) -> pb::BrowserColumns {
let mut columns: Vec<pb::BrowserColumn> =
let mut columns: Vec<pb::browser_columns::Column> =
columns.iter().map(|c| c.to_pb_column(&self.tr)).collect();
columns.sort_by(|c1, c2| c1.label.cmp(&c2.label));
pb::BrowserColumns { columns }
@ -55,8 +55,8 @@ impl Collection {
}
impl browser_table::Column {
fn to_pb_column(self, i18n: &I18n) -> pb::BrowserColumn {
pb::BrowserColumn {
fn to_pb_column(self, i18n: &I18n) -> pb::browser_columns::Column {
pb::browser_columns::Column {
key: self.to_string(),
label: self.localized_label(i18n),
is_sortable: self.is_sortable(),