Changeset - 4f223642ed4b
[Not reviewed]
0 5 0
Brett Smith - 4 years ago 2020-08-22 16:33:06
brettcsmith@brettcsmith.org
reports: Refactor total styles to BaseODS.
5 files changed with 17 insertions and 20 deletions:
0 comments (0 inline, 0 general)
conservancy_beancount/reports/balance_sheet.py
Show inline comments
...
 
@@ -250,8 +250,2 @@ class Report(core.BaseODS[Sequence[None], None]):
 
        )
 
        self.style_subtotline = self.border_style(core.Border.TOP, '1pt')
 
        self.style_totline = self.border_style(core.Border.TOP | core.Border.BOTTOM, '1pt')
 
        self.style_bottomline = self.merge_styles(
 
            self.style_subtotline,
 
            self.border_style(core.Border.BOTTOM, '2pt', 'double'),
 
        )
 

	
...
 
@@ -389,3 +383,3 @@ class Report(core.BaseODS[Sequence[None], None]):
 
        self.write_totals_row(
 
            "Total Liabilities", liabilities, stylename=self.style_totline,
 
            "Total Liabilities", liabilities, stylename=self.style_endtotal,
 
        )
...
 
@@ -405,3 +399,3 @@ class Report(core.BaseODS[Sequence[None], None]):
 
        self.write_totals_row(
 
            "Total Net Assets", equity_totals, stylename=self.style_subtotline,
 
            "Total Net Assets", equity_totals, stylename=self.style_total,
 
        )
...
 
@@ -430,3 +424,3 @@ class Report(core.BaseODS[Sequence[None], None]):
 
        income_totals = self.write_classifications_by_account('Income', bal_kwargs)
 
        self.write_totals_row("", income_totals, stylename=self.style_subtotline)
 
        self.write_totals_row("", income_totals, stylename=self.style_total)
 
        self.add_row()
...
 
@@ -447,3 +441,3 @@ class Report(core.BaseODS[Sequence[None], None]):
 
            income_totals, other_totals,
 
            stylename=self.style_totline,
 
            stylename=self.style_endtotal,
 
        )
...
 
@@ -489,3 +483,3 @@ class Report(core.BaseODS[Sequence[None], None]):
 
            prior_bal,
 
        ], stylename=self.style_totline, leading_rows=0)
 
        ], stylename=self.style_endtotal, leading_rows=0)
 

	
...
 
@@ -569,3 +563,3 @@ class Report(core.BaseODS[Sequence[None], None]):
 
            period_totals,
 
            stylename=self.style_totline,
 
            stylename=self.style_endtotal,
 
        )
conservancy_beancount/reports/core.py
Show inline comments
...
 
@@ -1056,2 +1056,9 @@ class BaseODS(BaseSpreadsheet[RT, ST], metaclass=abc.ABCMeta):
 

	
 
        self.style_total = self.border_style(Border.TOP, '1pt')
 
        self.style_endtotal = self.border_style(Border.TOP | Border.BOTTOM, '1pt')
 
        self.style_bottomline = self.merge_styles(
 
            self.style_total,
 
            self.border_style(Border.BOTTOM, '2pt', 'double'),
 
        )
 

	
 
    ### Properties
conservancy_beancount/reports/fund.py
Show inline comments
...
 
@@ -170,6 +170,3 @@ class ODSReport(core.BaseODS[FundPosts, None]):
 
                    total += bal
 
        self.write_balances('', totals, self.merge_styles(
 
            self.border_style(core.Border.TOP, '.75pt'),
 
            self.border_style(core.Border.BOTTOM, '1.5pt', 'double'),
 
        ))
 
        self.write_balances('', totals, self.style_bottomline)
 
        self.document.spreadsheet.childNodes.reverse()
conservancy_beancount/reports/ledger.py
Show inline comments
...
 
@@ -180,6 +180,2 @@ class LedgerODS(core.BaseODS[data.Posting, None]):
 
        super().init_styles()
 
        self.style_bottomline = self.merge_styles(
 
            self.border_style(core.Border.TOP, '1pt'),
 
            self.border_style(core.Border.BOTTOM, '2pt', 'double'),
 
        )
 
        self.amount_column = self.column_style(1.2)
tests/test_reports_spreadsheet.py
Show inline comments
...
 
@@ -307,2 +307,5 @@ def test_ods_currency_style_cache_considers_properties(ods_writer):
 
    ('style_starttext', odf.style.ParagraphProperties, 'textalign'),
 
    ('style_total', odf.style.TableCellProperties, 'bordertop'),
 
    ('style_endtotal', odf.style.TableCellProperties, 'borderbottom'),
 
    ('style_bottomline', odf.style.TableCellProperties, 'borderbottom'),
 
])
0 comments (0 inline, 0 general)