hsoft / moneyguru (http://hardcoded.net/moneyguru)

Future-aware personal finance application for Mac OS X and Windows.

Clone this repository (size: 8.3 MB): HTTPS / SSH
$ hg clone http://hg.hardcoded.net/moneyguru
commit 983: c9eecee6ea20
parent 982: 908467b66659
branch: default
e the new core column visibility toggle to show/hide enty table's balance column instead of using should_show_balance_column().
Virgil Dupras / hsoft
6 weeks ago

Changed (Δ972 bytes):

raw changeset »

cocoa/controllers/account/MGEntryTable.m (0 lines added, 9 lines removed)

cocoa/mg_cocoa.py (0 lines added, 4 lines removed)

cocoa/proxies/PyEntryTable.h (0 lines added, 1 lines removed)

core/gui/entry_table.py (2 lines added, 4 lines removed)

core/tests/gui/entry_table_test.py (2 lines added, 2 lines removed)

core/tests/main_test.py (6 lines added, 16 lines removed)

qt/controller/account/table.py (0 lines added, 7 lines removed)

Up to file-list cocoa/controllers/account/MGEntryTable.m:

@@ -218,13 +218,4 @@ http://www.hardcoded.net/licenses/hs_lic
218
218
{
219
219
    [[self py] showTransferAccount];
220
220
}
221
222
/* Callbacks for python */
223
224
- (void)refresh
225
{
226
    [columns setColumn:@"balance" visible:[[self py] shouldShowBalanceColumn]];
227
    [super refresh];
228
}
229
230
221
@end

Up to file-list cocoa/mg_cocoa.py:

@@ -506,10 +506,6 @@ class PyEntryTable(PyTableWithDate):
506
506
    def moveRows_to_(self, rows, position):
507
507
        self.py.move(list(rows), position)
508
508
509
    @signature('c@:')
510
    def shouldShowBalanceColumn(self):
511
        return self.py.should_show_balance_column()
512
    
513
509
    def showTransferAccount(self):
514
510
        self.py.show_transfer_account()
515
511
    

Up to file-list cocoa/proxies/PyEntryTable.h:

@@ -15,7 +15,6 @@ http://www.hardcoded.net/licenses/hs_lic
15
15
- (BOOL)isBalanceNegativeAtRow:(NSInteger)row;
16
16
- (BOOL)isBoldAtRow:(NSInteger)row;
17
17
- (void)moveRows:(NSArray *)rows to:(NSInteger)position;
18
- (BOOL)shouldShowBalanceColumn;
19
18
- (void)showTransferAccount;
20
19
- (void)toggleReconciled;
21
20
- (void)toggleReconciledAtRow:(NSInteger)row;

Up to file-list core/gui/entry_table.py:

@@ -79,6 +79,8 @@ class EntryTable(TransactionTableBase):
79
79
            total_increase += convert(row._increase)
80
80
            total_decrease += convert(row._decrease)
81
81
        self.footer = TotalRow(self, date_range.end, total_increase, total_decrease)
82
        balance_visible = account.is_balance_sheet_account()
83
        self.columns.set_column_visible('balance', balance_visible)
82
84
    
83
85
    def _restore_selection(self, previous_selection):
84
86
        if self.mainwindow.explicitly_selected_transactions:
@@ -133,10 +135,6 @@ class EntryTable(TransactionTableBase):
133
135
        else:
134
136
            self.selected_index = len(self) - 1
135
137
    
136
    def should_show_balance_column(self):
137
        account = self.mainwindow.shown_account
138
        return account is not None and self.mainwindow.shown_account.is_balance_sheet_account()
139
    
140
138
    def show_transfer_account(self):
141
139
        if not self.selected_entries:
142
140
            return

Up to file-list core/tests/gui/entry_table_test.py:

@@ -242,7 +242,7 @@ def test_show_transfer_account_entry_wit
242
242
    app.etable.show_transfer_account()
243
243
    app.check_current_pane(PaneType.Account, account_name='second')
244
244
    # Previously, this was based on selected_account rather than shown_account
245
    assert not app.etable.should_show_balance_column()
245
    assert not app.etable.columns.column_is_visible('balance')
246
246
247
247
@with_app(app_one_entry)
248
248
def test_show_transfer_account_then_add_entry(app):
@@ -627,7 +627,7 @@ def test_amount_of_selected_entry():
627
627
628
628
def test_should_show_balance_column():
629
629
    def check(app, expected):
630
        eq_(app.etable.should_show_balance_column(), expected)
630
        eq_(app.etable.columns.column_is_visible('balance'), expected)
631
631
    
632
632
    # When a liability account is selected, we show the balance column.
633
633
    app = app_liability_account()

Up to file-list core/tests/main_test.py:

@@ -11,11 +11,12 @@ import os.path as op
11
11
import sys
12
12
from datetime import date
13
13
14
from hsutil.testutil import eq_, assert_raises
14
from py.test import config
15
15
16
16
from hsutil import io
17
17
from hscommon.currency import EUR
18
from hsutil.testutil import Patcher, with_tmpdir
18
from hsutil.testutil import Patcher
19
from hsutil.testutil import eq_, assert_raises
19
20
20
21
from .base import TestCase, CommonSetup, ApplicationGUI, TestApp, with_app
21
22
from ..app import FIRST_WEEKDAY_PREFERENCE, AHEAD_MONTHS_PREFERENCE
@@ -101,11 +102,10 @@ def test_graph_yaxis():
101
102
    eq_(list(app.nwgraph.ytickmarks), range(0, 101, 20))
102
103
    eq_(list(app.nwgraph.ylabels), [dict(text=str(x), pos=x) for x in range(0, 101, 20)])
103
104
104
@with_tmpdir
105
def test_load_inexistant(tmppath):
105
def test_load_inexistant():
106
106
    # Raise FileFormatError when filename doesn't exist
107
107
    app = TestApp()
108
    filename = unicode(tmppath + 'does_not_exist.xml')
108
    filename = unicode(config.mktemp(u'foo').join('does_not_exist.xml'))
109
109
    assert_raises(FileFormatError, app.doc.load_from_xml, filename)
110
110
111
111
def test_load_invalid():
@@ -223,17 +223,6 @@ class OneEmptyAccountRangeOnOctober2007(
223
223
        assert not self.document.is_dirty()
224
224
    
225
225
226
class OneGroup(TestCase):
227
    def setUp(self):
228
        self.create_instances()
229
        self.add_group()
230
    
231
    def test_should_show_balance_column(self):
232
        # When a group is selected, False is returned (not None).
233
        assert not self.etable.should_show_balance_column()
234
        assert isinstance(self.etable.should_show_balance_column(), bool)
235
    
236
237
226
class ThreeAccountsAndOneEntry(TestCase, CommonSetup):
238
227
    def setUp(self):
239
228
        self.create_instances()
@@ -335,6 +324,7 @@ class OneEntryYearRange2007(TestCase):
335
324
        self.etable.save_edits()
336
325
        # Make sure that the values really made it down in the model by using a spanking new gui
337
326
        etable = EntryTable(self.etable_gui, self.aview)
327
        etable.columns.view = self.etable_gui
338
328
        etable.connect()
339
329
        etable.show()
340
330
        eq_(getattr(etable[0], column), value)

Up to file-list qt/controller/account/table.py:

@@ -93,10 +93,3 @@ class EntryTable(TableWithTransactions):
93
93
            if row.can_reconcile() and row.reconciled:
94
94
                row.toggle_reconciled()
95
95
    
96
    #--- model --> view
97
    def refresh(self):
98
        TableWithTransactions.refresh(self)
99
        balanceColumn = self.ATTR2COLUMN['balance']
100
        shouldShow = self.model.should_show_balance_column()
101
        self._headerView.setSectionHidden(balanceColumn.index, not shouldShow)
102