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 985: a00d52a70d9b
parent 984: 860ab60351f1
branch: default
[#80 state:fixed] Added Debit/Credit visibility options for the entry table.
Virgil Dupras / hsoft
6 weeks ago

Changed (Δ15.1 KB):

raw changeset »

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

cocoa/de.lproj/ViewOptions.strings (3 lines added, 0 lines removed)

cocoa/de.lproj/ViewOptions.xib (59 lines added, 2 lines removed)

cocoa/en.lproj/ViewOptions.strings (binary file changed)

cocoa/en.lproj/ViewOptions.xib (59 lines added, 2 lines removed)

cocoa/fr.lproj/ViewOptions.strings (3 lines added, 0 lines removed)

cocoa/fr.lproj/ViewOptions.xib (59 lines added, 2 lines removed)

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

core/gui/balance_sheet.py (5 lines added, 5 lines removed)

core/gui/column.py (9 lines added, 11 lines removed)

core/gui/entry_table.py (54 lines added, 31 lines removed)

core/gui/income_statement.py (5 lines added, 5 lines removed)

core/gui/schedule_table.py (3 lines added, 3 lines removed)

core/gui/transaction_table.py (3 lines added, 3 lines removed)

core/gui/view_options.py (14 lines added, 0 lines removed)

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

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

qt/controller/view_options.py (1 lines added, 0 lines removed)

qt/lang/de.ts (16 lines added, 0 lines removed)

qt/lang/fr.ts (16 lines added, 0 lines removed)

qt/ui/view_options_dialog.ui (14 lines added, 7 lines removed)

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

@@ -40,6 +40,8 @@ http://www.hardcoded.net/licenses/hs_lic
40
40
        {@"transfer", @"Transfer", 140, 80, 0, YES, [MGTextFieldCell class]},
41
41
        {@"increase", @"Increase", 80, 80, 0, YES, nil},
42
42
        {@"decrease", @"Decrease", 80, 80, 0, YES, nil},
43
        {@"debit", @"Debit", 80, 80, 0, YES, nil},
44
        {@"credit", @"Credit", 80, 80, 0, YES, nil},
43
45
        {@"balance", @"Balance", 90, 90, 0, YES, nil},
44
46
        nil
45
47
    };
@@ -54,6 +56,12 @@ http://www.hardcoded.net/licenses/hs_lic
54
56
    c = [[self tableView] tableColumnWithIdentifier:@"decrease"];
55
57
    [[c headerCell] setAlignment:NSRightTextAlignment];
56
58
    [[c dataCell] setAlignment:NSRightTextAlignment];
59
    c = [[self tableView] tableColumnWithIdentifier:@"debit"];
60
    [[c headerCell] setAlignment:NSRightTextAlignment];
61
    [[c dataCell] setAlignment:NSRightTextAlignment];
62
    c = [[self tableView] tableColumnWithIdentifier:@"credit"];
63
    [[c headerCell] setAlignment:NSRightTextAlignment];
64
    [[c dataCell] setAlignment:NSRightTextAlignment];
57
65
    c = [[self tableView] tableColumnWithIdentifier:@"balance"];
58
66
    [[c headerCell] setAlignment:NSRightTextAlignment];
59
67
    [[c dataCell] setAlignment:NSRightTextAlignment];

Up to file-list cocoa/de.lproj/ViewOptions.strings:

91
91
92
92
/* Class = "NSButtonCell"; title = "Account #"; ObjectID = "103"; */
93
93
"103.title" = "Konto #";
94
95
/* Class = "NSButtonCell"; title = "Debit/Credit"; ObjectID = "147"; */
96
"147.title" = "Debit/kredit";

Up to file-list cocoa/de.lproj/ViewOptions.xib:

478
478
								<int key="NSPeriodicInterval">25</int>
479
479
							</object>
480
480
						</object>
481
						<object class="NSButton" id="197912605">
482
							<reference key="NSNextResponder" ref="45188462"/>
483
							<int key="NSvFlags">268</int>
484
							<string key="NSFrame">{{150, 123}, {266, 18}}</string>
485
							<reference key="NSSuperview" ref="45188462"/>
486
							<bool key="NSEnabled">YES</bool>
487
							<object class="NSButtonCell" key="NSCell" id="465207099">
488
								<int key="NSCellFlags">67239424</int>
489
								<int key="NSCellFlags2">131072</int>
490
								<string key="NSContents">Debit/kredit</string>
491
								<reference key="NSSupport" ref="26"/>
492
								<reference key="NSControlView" ref="197912605"/>
493
								<int key="NSButtonFlags">1211912703</int>
494
								<int key="NSButtonFlags2">2</int>
495
								<reference key="NSNormalImage" ref="329833725"/>
496
								<reference key="NSAlternateImage" ref="141542944"/>
497
								<string key="NSAlternateContents"/>
498
								<string key="NSKeyEquivalent"/>
499
								<int key="NSPeriodicDelay">200</int>
500
								<int key="NSPeriodicInterval">25</int>
501
							</object>
502
						</object>
481
503
						<object class="NSButton" id="256661265">
482
504
							<reference key="NSNextResponder" ref="45188462"/>
483
505
							<int key="NSvFlags">268</int>
698
720
						<object class="NSButton" id="304444806">
699
721
							<reference key="NSNextResponder" ref="45188462"/>
700
722
							<int key="NSvFlags">268</int>
701
							<string key="NSFrame">{{151, 123}, {265, 18}}</string>
723
							<string key="NSFrame">{{151, 103}, {265, 18}}</string>
702
724
							<reference key="NSSuperview" ref="45188462"/>
703
725
							<bool key="NSEnabled">YES</bool>
704
726
							<object class="NSButtonCell" key="NSCell" id="262221300">
1138
1160
					</object>
1139
1161
					<int key="connectionID">145</int>
1140
1162
				</object>
1163
				<object class="IBConnectionRecord">
1164
					<object class="IBBindingConnection" key="connection">
1165
						<string key="label">value: py.entryTableDebitCredit</string>
1166
						<reference key="source" ref="197912605"/>
1167
						<reference key="destination" ref="1001"/>
1168
						<object class="NSNibBindingConnector" key="connector">
1169
							<reference key="NSSource" ref="197912605"/>
1170
							<reference key="NSDestination" ref="1001"/>
1171
							<string key="NSLabel">value: py.entryTableDebitCredit</string>
1172
							<string key="NSBinding">value</string>
1173
							<string key="NSKeyPath">py.entryTableDebitCredit</string>
1174
							<int key="NSNibBindingConnectorVersion">2</int>
1175
						</object>
1176
					</object>
1177
					<int key="connectionID">149</int>
1178
				</object>
1141
1179
			</object>
1142
1180
			<object class="IBMutableOrderedSet" key="objectRecords">
1143
1181
				<object class="NSArray" key="orderedObjects">
1210
1248
							<reference ref="386946478"/>
1211
1249
							<reference ref="732213890"/>
1212
1250
							<reference ref="304444806"/>
1251
							<reference ref="197912605"/>
1213
1252
						</object>
1214
1253
						<reference key="parent" ref="937315869"/>
1215
1254
					</object>
1638
1677
						<reference key="object" ref="72795768"/>
1639
1678
						<reference key="parent" ref="1019717434"/>
1640
1679
					</object>
1680
					<object class="IBObjectRecord">
1681
						<int key="objectID">146</int>
1682
						<reference key="object" ref="197912605"/>
1683
						<object class="NSMutableArray" key="children">
1684
							<bool key="EncodedWithXMLCoder">YES</bool>
1685
							<reference ref="465207099"/>
1686
						</object>
1687
						<reference key="parent" ref="45188462"/>
1688
					</object>
1689
					<object class="IBObjectRecord">
1690
						<int key="objectID">147</int>
1691
						<reference key="object" ref="465207099"/>
1692
						<reference key="parent" ref="197912605"/>
1693
					</object>
1641
1694
				</object>
1642
1695
			</object>
1643
1696
			<object class="NSMutableDictionary" key="flattenedProperties">
1652
1705
					<string>103.IBPluginDependency</string>
1653
1706
					<string>11.IBPluginDependency</string>
1654
1707
					<string>12.IBPluginDependency</string>
1708
					<string>146.IBPluginDependency</string>
1709
					<string>147.IBPluginDependency</string>
1655
1710
					<string>18.IBPluginDependency</string>
1656
1711
					<string>19.IBPluginDependency</string>
1657
1712
					<string>20.IBPluginDependency</string>
1734
1789
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1735
1790
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1736
1791
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1792
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1793
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1737
1794
					<string>{{86, 398}, {434, 453}}</string>
1738
1795
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1739
1796
					<string>{{86, 398}, {434, 453}}</string>
1807
1864
				</object>
1808
1865
			</object>
1809
1866
			<nil key="sourceID"/>
1810
			<int key="maxID">145</int>
1867
			<int key="maxID">149</int>
1811
1868
		</object>
1812
1869
		<object class="IBClassDescriber" key="IBDocument.Classes">
1813
1870
			<object class="NSMutableArray" key="referencedPartialClassDescriptions">

Up to file-list cocoa/en.lproj/ViewOptions.strings:

Binary file has changed or diff was empty.

Up to file-list cocoa/en.lproj/ViewOptions.xib:

479
479
								<int key="NSPeriodicInterval">25</int>
480
480
							</object>
481
481
						</object>
482
						<object class="NSButton" id="197912605">
483
							<reference key="NSNextResponder" ref="45188462"/>
484
							<int key="NSvFlags">268</int>
485
							<string key="NSFrame">{{150, 123}, {266, 18}}</string>
486
							<reference key="NSSuperview" ref="45188462"/>
487
							<bool key="NSEnabled">YES</bool>
488
							<object class="NSButtonCell" key="NSCell" id="465207099">
489
								<int key="NSCellFlags">67239424</int>
490
								<int key="NSCellFlags2">131072</int>
491
								<string key="NSContents">Debit/Credit</string>
492
								<reference key="NSSupport" ref="26"/>
493
								<reference key="NSControlView" ref="197912605"/>
494
								<int key="NSButtonFlags">1211912703</int>
495
								<int key="NSButtonFlags2">2</int>
496
								<reference key="NSNormalImage" ref="329833725"/>
497
								<reference key="NSAlternateImage" ref="141542944"/>
498
								<string key="NSAlternateContents"/>
499
								<string key="NSKeyEquivalent"/>
500
								<int key="NSPeriodicDelay">200</int>
501
								<int key="NSPeriodicInterval">25</int>
502
							</object>
503
						</object>
482
504
						<object class="NSButton" id="256661265">
483
505
							<reference key="NSNextResponder" ref="45188462"/>
484
506
							<int key="NSvFlags">268</int>
699
721
						<object class="NSButton" id="304444806">
700
722
							<reference key="NSNextResponder" ref="45188462"/>
701
723
							<int key="NSvFlags">268</int>
702
							<string key="NSFrame">{{151, 123}, {265, 18}}</string>
724
							<string key="NSFrame">{{151, 103}, {265, 18}}</string>
703
725
							<reference key="NSSuperview" ref="45188462"/>
704
726
							<bool key="NSEnabled">YES</bool>
705
727
							<object class="NSButtonCell" key="NSCell" id="262221300">
1140
1162
					</object>
1141
1163
					<int key="connectionID">145</int>
1142
1164
				</object>
1165
				<object class="IBConnectionRecord">
1166
					<object class="IBBindingConnection" key="connection">
1167
						<string key="label">value: py.entryTableDebitCredit</string>
1168
						<reference key="source" ref="197912605"/>
1169
						<reference key="destination" ref="1001"/>
1170
						<object class="NSNibBindingConnector" key="connector">
1171
							<reference key="NSSource" ref="197912605"/>
1172
							<reference key="NSDestination" ref="1001"/>
1173
							<string key="NSLabel">value: py.entryTableDebitCredit</string>
1174
							<string key="NSBinding">value</string>
1175
							<string key="NSKeyPath">py.entryTableDebitCredit</string>
1176
							<int key="NSNibBindingConnectorVersion">2</int>
1177
						</object>
1178
					</object>
1179
					<int key="connectionID">149</int>
1180
				</object>
1143
1181
			</object>
1144
1182
			<object class="IBMutableOrderedSet" key="objectRecords">
1145
1183
				<object class="NSArray" key="orderedObjects">
1212
1250
							<reference ref="386946478"/>
1213
1251
							<reference ref="732213890"/>
1214
1252
							<reference ref="304444806"/>
1253
							<reference ref="197912605"/>
1215
1254
						</object>
1216
1255
						<reference key="parent" ref="937315869"/>
1217
1256
					</object>
1640
1679
						<reference key="object" ref="72795768"/>
1641
1680
						<reference key="parent" ref="1019717434"/>
1642
1681
					</object>
1682
					<object class="IBObjectRecord">
1683
						<int key="objectID">146</int>
1684
						<reference key="object" ref="197912605"/>
1685
						<object class="NSMutableArray" key="children">
1686
							<bool key="EncodedWithXMLCoder">YES</bool>
1687
							<reference ref="465207099"/>
1688
						</object>
1689
						<reference key="parent" ref="45188462"/>
1690
					</object>
1691
					<object class="IBObjectRecord">
1692
						<int key="objectID">147</int>
1693
						<reference key="object" ref="465207099"/>
1694
						<reference key="parent" ref="197912605"/>
1695
					</object>
1643
1696
				</object>
1644
1697
			</object>
1645
1698
			<object class="NSMutableDictionary" key="flattenedProperties">
1654
1707
					<string>103.IBPluginDependency</string>
1655
1708
					<string>11.IBPluginDependency</string>
1656
1709
					<string>12.IBPluginDependency</string>
1710
					<string>146.IBPluginDependency</string>
1711
					<string>147.IBPluginDependency</string>
1657
1712
					<string>18.IBPluginDependency</string>
1658
1713
					<string>19.IBPluginDependency</string>
1659
1714
					<string>20.IBPluginDependency</string>
1734
1789
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1735
1790
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1736
1791
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1792
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1793
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1737
1794
					<string>{{86, 398}, {434, 453}}</string>
1738
1795
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1739
1796
					<string>{{86, 398}, {434, 453}}</string>
1805
1862
				</object>
1806
1863
			</object>
1807
1864
			<nil key="sourceID"/>
1808
			<int key="maxID">145</int>
1865
			<int key="maxID">149</int>
1809
1866
		</object>
1810
1867
		<object class="IBClassDescriber" key="IBDocument.Classes">
1811
1868
			<object class="NSMutableArray" key="referencedPartialClassDescriptions">

Up to file-list cocoa/fr.lproj/ViewOptions.strings:

91
91
92
92
/* Class = "NSButtonCell"; title = "Account #"; ObjectID = "103"; */
93
93
"103.title" = "# Compte";
94
95
/* Class = "NSButtonCell"; title = "Debit/Credit"; ObjectID = "147"; */
96
"147.title" = "Débit/Crédit";

Up to file-list cocoa/fr.lproj/ViewOptions.xib:

478
478
								<int key="NSPeriodicInterval">25</int>
479
479
							</object>
480
480
						</object>
481
						<object class="NSButton" id="197912605">
482
							<reference key="NSNextResponder" ref="45188462"/>
483
							<int key="NSvFlags">268</int>
484
							<string key="NSFrame">{{150, 123}, {266, 18}}</string>
485
							<reference key="NSSuperview" ref="45188462"/>
486
							<bool key="NSEnabled">YES</bool>
487
							<object class="NSButtonCell" key="NSCell" id="465207099">
488
								<int key="NSCellFlags">67239424</int>
489
								<int key="NSCellFlags2">131072</int>
490
								<string key="NSContents">Débit/Crédit</string>
491
								<reference key="NSSupport" ref="26"/>
492
								<reference key="NSControlView" ref="197912605"/>
493
								<int key="NSButtonFlags">1211912703</int>
494
								<int key="NSButtonFlags2">2</int>
495
								<reference key="NSNormalImage" ref="329833725"/>
496
								<reference key="NSAlternateImage" ref="141542944"/>
497
								<string key="NSAlternateContents"/>
498
								<string key="NSKeyEquivalent"/>
499
								<int key="NSPeriodicDelay">200</int>
500
								<int key="NSPeriodicInterval">25</int>
501
							</object>
502
						</object>
481
503
						<object class="NSButton" id="256661265">
482
504
							<reference key="NSNextResponder" ref="45188462"/>
483
505
							<int key="NSvFlags">268</int>
698
720
						<object class="NSButton" id="304444806">
699
721
							<reference key="NSNextResponder" ref="45188462"/>
700
722
							<int key="NSvFlags">268</int>
701
							<string key="NSFrame">{{151, 123}, {265, 18}}</string>
723
							<string key="NSFrame">{{151, 103}, {265, 18}}</string>
702
724
							<reference key="NSSuperview" ref="45188462"/>
703
725
							<bool key="NSEnabled">YES</bool>
704
726
							<object class="NSButtonCell" key="NSCell" id="262221300">
1138
1160
					</object>
1139
1161
					<int key="connectionID">145</int>
1140
1162
				</object>
1163
				<object class="IBConnectionRecord">
1164
					<object class="IBBindingConnection" key="connection">
1165
						<string key="label">value: py.entryTableDebitCredit</string>
1166
						<reference key="source" ref="197912605"/>
1167
						<reference key="destination" ref="1001"/>
1168
						<object class="NSNibBindingConnector" key="connector">
1169
							<reference key="NSSource" ref="197912605"/>
1170
							<reference key="NSDestination" ref="1001"/>
1171
							<string key="NSLabel">value: py.entryTableDebitCredit</string>
1172
							<string key="NSBinding">value</string>
1173
							<string key="NSKeyPath">py.entryTableDebitCredit</string>
1174
							<int key="NSNibBindingConnectorVersion">2</int>
1175
						</object>
1176
					</object>
1177
					<int key="connectionID">149</int>
1178
				</object>
1141
1179
			</object>
1142
1180
			<object class="IBMutableOrderedSet" key="objectRecords">
1143
1181
				<object class="NSArray" key="orderedObjects">
1210
1248
							<reference ref="386946478"/>
1211
1249
							<reference ref="732213890"/>
1212
1250
							<reference ref="304444806"/>
1251
							<reference ref="197912605"/>
1213
1252
						</object>
1214
1253
						<reference key="parent" ref="937315869"/>
1215
1254
					</object>
1638
1677
						<reference key="object" ref="72795768"/>
1639
1678
						<reference key="parent" ref="1019717434"/>
1640
1679
					</object>
1680
					<object class="IBObjectRecord">
1681
						<int key="objectID">146</int>
1682
						<reference key="object" ref="197912605"/>
1683
						<object class="NSMutableArray" key="children">
1684
							<bool key="EncodedWithXMLCoder">YES</bool>
1685
							<reference ref="465207099"/>
1686
						</object>
1687
						<reference key="parent" ref="45188462"/>
1688
					</object>
1689
					<object class="IBObjectRecord">
1690
						<int key="objectID">147</int>
1691
						<reference key="object" ref="465207099"/>
1692
						<reference key="parent" ref="197912605"/>
1693
					</object>
1641
1694
				</object>
1642
1695
			</object>
1643
1696
			<object class="NSMutableDictionary" key="flattenedProperties">
1652
1705
					<string>103.IBPluginDependency</string>
1653
1706
					<string>11.IBPluginDependency</string>
1654
1707
					<string>12.IBPluginDependency</string>
1708
					<string>146.IBPluginDependency</string>
1709
					<string>147.IBPluginDependency</string>
1655
1710
					<string>18.IBPluginDependency</string>
1656
1711
					<string>19.IBPluginDependency</string>
1657
1712
					<string>20.IBPluginDependency</string>
1734
1789
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1735
1790
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1736
1791
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1792
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1793
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1737
1794
					<string>{{86, 398}, {434, 453}}</string>
1738
1795
					<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
1739
1796
					<string>{{86, 398}, {434, 453}}</string>
1807
1864
				</object>
1808
1865
			</object>
1809
1866
			<nil key="sourceID"/>
1810
			<int key="maxID">145</int>
1867
			<int key="maxID">149</int>
1811
1868
		</object>
1812
1869
		<object class="IBClassDescriber" key="IBDocument.Classes">
1813
1870
			<object class="NSMutableArray" key="referencedPartialClassDescriptions">

Up to file-list cocoa/mg_cocoa.py:

@@ -1664,6 +1664,14 @@ class PyViewOptions(PyGUIObject):
1664
1664
    def setEntryTableReconciliationDate_(self, value):
1665
1665
        self.py.entry_table_reconciliation_date = bool(value)
1666
1666
    
1667
    @signature('i@:')
1668
    def entryTableDebitCredit(self):
1669
        return self.py.entry_table_debit_credit
1670
    
1671
    @signature('v@:i')
1672
    def setEntryTableDebitCredit_(self, value):
1673
        self.py.entry_table_debit_credit = bool(value)
1674
    
1667
1675
    
1668
1676
    @signature('i@:')
1669
1677
    def scheduleTableDescription(self):

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

@@ -18,12 +18,12 @@ class BalanceSheet(Report):
18
18
    SAVENAME = 'BalanceSheet'
19
19
    COLUMNS = [
20
20
        Column('name'),
21
        Column('account_number', optional=True, visible=False),
21
        Column('account_number', visible=False),
22
22
        Column('end'),
23
        Column('delta', optional=True, visible=False),
24
        Column('delta_perc', optional=True, visible=False),
25
        Column('start', optional=True),
26
        Column('budgeted', optional=True),
23
        Column('delta', visible=False),
24
        Column('delta_perc', visible=False),
25
        Column('start'),
26
        Column('budgeted'),
27
27
    ]
28
28
    
29
29
    def __init__(self, view, networth_view):

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

10
10
import copy
11
11
12
12
class Column(object):
13
    def __init__(self, name, optional=False, visible=True):
13
    def __init__(self, name, visible=True):
14
14
        self.name = name
15
15
        self.index = 0
16
16
        self.width = 0
17
        self.optional = optional # If not optional, a column is never restored as invisible
18
17
        self.visible = visible
19
18
    
20
19
@@ -70,21 +69,20 @@ class Columns(object):
70
69
            return
71
70
        for col in self.coldata.itervalues():
72
71
            pref_name = '{0}.Columns.{1}'.format(self.savename, col.name)
73
            coldata = self.app.get_default(pref_name)
74
            if coldata:
75
                col.index = coldata.get('index', 0)
76
                col.width = coldata.get('width', 0)
77
                if col.optional:
78
                    col.visible = coldata.get('visible', True)
72
            coldata = self.app.get_default(pref_name, fallback_value={})
73
            if 'index' in coldata:
74
                col.index = coldata['index']
75
            if 'width' in coldata:
76
                col.width = coldata['width']
77
            if 'visible' in coldata:
78
                col.visible = coldata['visible']
79
79
    
80
80
    def save_columns(self):
81
81
        if not (self.savename and self.coldata):
82
82
            return
83
83
        for col in self.coldata.itervalues():
84
84
            pref_name = '{0}.Columns.{1}'.format(self.savename, col.name)
85
            coldata = {'index': col.index, 'width': col.width}
86
            if col.optional:
87
                coldata['visible'] = col.visible
85
            coldata = {'index': col.index, 'width': col.width, 'visible': col.visible}
88
86
            self.app.set_default(pref_name, coldata)
89
87
    
90
88
    def set_column_order(self, colnames):

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

@@ -22,13 +22,15 @@ class EntryTable(TransactionTableBase):
22
22
    COLUMNS = [
23
23
        Column('status'),
24
24
        Column('date'),
25
        Column('reconciliation_date', optional=True, visible=False),
26
        Column('checkno', optional=True, visible=False),
27
        Column('description', optional=True),
28
        Column('payee', optional=True, visible=False),
25
        Column('reconciliation_date', visible=False),
26
        Column('checkno', visible=False),
27
        Column('description'),
28
        Column('payee', visible=False),
29
29
        Column('transfer'),
30
30
        Column('increase'),
31
31
        Column('decrease'),
32
        Column('debit', visible=False),
33
        Column('credit', visible=False),
32
34
        Column('balance'),
33
35
    ]
34
36
    INVALIDATING_MESSAGES = TransactionTableBase.INVALIDATING_MESSAGES | set(['shown_account_changed'])
@@ -70,15 +72,15 @@ class EntryTable(TransactionTableBase):
70
72
                balance = prev_entry.balance
71
73
                rbalance = prev_entry.reconciled_balance
72
74
                self.header = PreviousBalanceRow(self, date_range.start, balance, rbalance, account)
73
        total_increase = 0
74
        total_decrease = 0
75
        total_debit = 0
76
        total_credit = 0
75
77
        for entry in self.parent_view.visible_entries:
76
78
            row = EntryTableRow(self, entry, account)
77
79
            self.append(row)
78
80
            convert = lambda a: convert_amount(a, account.currency, entry.date)
79
            total_increase += convert(row._increase)
80
            total_decrease += convert(row._decrease)
81
        self.footer = TotalRow(self, date_range.end, total_increase, total_decrease)
81
            total_debit += convert(row._debit)
82
            total_credit += convert(row._credit)
83
        self.footer = TotalRow(self, date_range.end, total_debit, total_credit)
82
84
        balance_visible = account.is_balance_sheet_account()
83
85
        self.columns.set_column_visible('balance', balance_visible)
84
86
    
@@ -291,6 +293,14 @@ class BaseEntryTableRow(RowWithDebitAndC
291
293
        return self.table.document.app.format_amount(self._decrease, blank_zero=True)
292
294
    
293
295
    @property
296
    def debit(self):
297
        return self.table.document.app.format_amount(self._debit, blank_zero=True)
298
    
299
    @property
300
    def credit(self):
301
        return self.table.document.app.format_amount(self._credit, blank_zero=True)
302
    
303
    @property
294
304
    def balance(self):
295
305
        account_currency = self.table.account.currency
296
306
        return self.table.document.app.format_amount(self._the_balance(), zero_currency=account_currency)
@@ -351,6 +361,15 @@ class EntryTableRow(RowWithDate, BaseEnt
351
361
                continue
352
362
            yield EntryTableRow(self.table, entry, self.account)
353
363
    
364
    def _set_amount_property(self, propname, stramount):
365
        try:
366
            currency = self.table.mainwindow.shown_account.currency
367
            parsed = self.table.document.app.parse_amount(stramount, default_currency=currency)
368
        except ValueError:
369
            return
370
        if parsed != getattr(self, propname):
371
            setattr(self, propname, parsed)
372
    
354
373
    def can_edit(self):
355
374
        return not self.is_budget
356
375
    
@@ -410,25 +429,19 @@ class EntryTableRow(RowWithDate, BaseEnt
410
429
    
411
430
    @BaseEntryTableRow.increase.setter
412
431
    def increase(self, value):
413
        try:
414
            currency = self.table.mainwindow.shown_account.currency
415
            increase = self.table.document.app.parse_amount(value, default_currency=currency)
416
        except ValueError:
417
            return
418
        if increase == self._increase:
419
            return
420
        self._increase = increase
432
        self._set_amount_property('_increase', value)
421
433
    
422
434
    @BaseEntryTableRow.decrease.setter
423
435
    def decrease(self, value):
424
        try:
425
            currency = self.table.mainwindow.shown_account.currency
426
            decrease = self.table.document.app.parse_amount(value, default_currency=currency)
427
        except ValueError:
428
            return
429
        if decrease == self._decrease:
430
            return
431
        self._decrease = decrease
436
        self._set_amount_property('_decrease', value)
437
    
438
    @BaseEntryTableRow.debit.setter
439
    def debit(self, value):
440
        self._set_amount_property('_debit', value)
441
    
442
    @BaseEntryTableRow.credit.setter
443
    def credit(self, value):
444
        self._set_amount_property('_credit', value)
432
445
    
433
446
    @property
434
447
    def can_edit_transfer(self):
@@ -449,15 +462,17 @@ class PreviousBalanceRow(BaseEntryTableR
449
462
    
450
463
451
464
class TotalRow(BaseEntryTableRow):
452
    def __init__(self, table, date, total_increase, total_decrease):
465
    def __init__(self, table, date, total_debit, total_credit):
453
466
        super(TotalRow, self).__init__(table)
454
467
        self._date = date
455
468
        self._description = tr('TOTAL')
456
469
        # don't touch _increase and _decrease, they trigger editing.
457
        self._increase_fmt = table.document.app.format_amount(total_increase, blank_zero=True)
458
        self._decrease_fmt = table.document.app.format_amount(total_decrease, blank_zero=True)
459
        delta = total_increase - total_decrease
470
        self._debit_fmt = table.document.app.format_amount(total_debit, blank_zero=True)
471
        self._credit_fmt = table.document.app.format_amount(total_credit, blank_zero=True)
472
        delta = total_debit - total_credit
460
473
        if delta:
474
            if self.table.account.is_credit_account():
475
                delta *= -1
461
476
            positive = delta > 0
462
477
            delta_fmt = table.document.app.format_amount(abs(delta))
463
478
            delta_fmt = ('+' if positive else '-') + delta_fmt
@@ -468,11 +483,19 @@ class TotalRow(BaseEntryTableRow):
468
483
    
469
484
    @property
470
485
    def increase(self):
471
        return self._increase_fmt
486
        return self._credit_fmt if self.table.account.is_credit_account() else self._debit_fmt
472
487
    
473
488
    @property
474
489
    def decrease(self):
475
        return self._decrease_fmt
490
        return self._debit_fmt if self.table.account.is_credit_account() else self._credit_fmt
491
    
492
    @property
493
    def debit(self):
494
        return self._debit_fmt
495
    
496
    @property
497
    def credit(self):
498
        return self._credit_fmt
476
499
    
477
500
    @property
478
501
    def balance(self):

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

@@ -13,12 +13,12 @@ class IncomeStatement(Report):
13
13
    SAVENAME = 'IncomeStatement'
14
14
    COLUMNS = [
15
15
        Column('name'),
16
        Column('account_number', optional=True, visible=False),
16
        Column('account_number', visible=False),
17
17
        Column('cash_flow'),
18
        Column('delta', optional=True, visible=False),
19
        Column('delta_perc', optional=True, visible=False),
20
        Column('last_cash_flow', optional=True),
21
        Column('budgeted', optional=True),
18
        Column('delta', visible=False),
19
        Column('delta_perc', visible=False),
20
        Column('last_cash_flow'),
21
        Column('budgeted'),
22
22
    ]
23
23
    
24
24
    def __init__(self, view, profit_view):

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

@@ -21,9 +21,9 @@ class ScheduleTable(GUITable, ViewChild)
21
21
        Column('stop_date'),
22
22
        Column('repeat_type'),
23
23
        Column('interval'),
24
        Column('checkno', optional=True, visible=False),
25
        Column('description', optional=True),
26
        Column('payee', optional=True, visible=False),
24
        Column('checkno', visible=False),
25
        Column('description'),
26
        Column('payee', visible=False),
27
27
        Column('from'),
28
28
        Column('to'),
29
29
        Column('amount'),

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

@@ -22,9 +22,9 @@ class TransactionTable(TransactionTableB
22
22
    COLUMNS = [
23
23
        Column('status'),
24
24
        Column('date'),
25
        Column('checkno', optional=True, visible=False),
26
        Column('description', optional=True),
27
        Column('payee', optional=True, visible=False),
25
        Column('checkno', visible=False),
26
        Column('description'),
27
        Column('payee', visible=False),
28
28
        Column('from'),
29
29
        Column('to'),
30
30
        Column('amount'),

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

@@ -51,3 +51,17 @@ class ViewOptions(DocumentGUIObject):
51
51
    schedule_table_description = column_prop('scview', 'sctable', 'description')
52
52
    schedule_table_payee = column_prop('scview', 'sctable', 'payee')
53
53
    schedule_table_checkno = column_prop('scview', 'sctable', 'checkno')
54
    
55
    @property
56
    def entry_table_debit_credit(self):
57
        columns = self.mainwindow.aview.etable.columns
58
        return columns.column_is_visible('credit') and columns.column_is_visible('debit')
59
    
60
    @entry_table_debit_credit.setter
61
    def entry_table_debit_credit(self, value):
62
        columns = self.mainwindow.aview.etable.columns
63
        columns.set_column_visible('increase', not value)
64
        columns.set_column_visible('decrease', not value)
65
        columns.set_column_visible('debit', value)
66
        columns.set_column_visible('credit', value)
67
    

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

@@ -201,6 +201,29 @@ def test_change_transfer(app):
201
201
    app.etable.save_edits()
202
202
203
203
@with_app(app_one_entry)
204
def test_debit_credit_columns(app):
205
    # when enabling the credit/debit columns option, increase/decrease columns are replaced with
206
    # credit/debit columns
207
    app.vopts.entry_table_debit_credit = True
208
    assert app.etable.columns.column_is_visible('debit')
209
    assert app.etable.columns.column_is_visible('credit')
210
    assert not app.etable.columns.column_is_visible('increase')
211
    assert not app.etable.columns.column_is_visible('decrease')
212
    eq_(app.etable[0].credit, '42.00')
213
    eq_(app.etable[0].debit, '')
214
    # credit/debit in total row works too
215
    eq_(app.etable.footer.credit, '42.00')
216
217
@with_app(app_one_entry)
218
def test_debit_credit_columns_edit(app):
219
    # editing a debit/credit columns work
220
    app.vopts.entry_table_debit_credit = True
221
    app.etable[0].debit = '43'
222
    app.etable.save_edits()
223
    app.vopts.entry_table_debit_credit = False
224
    eq_(app.etable[0].increase, '43.00')
225
226
@with_app(app_one_entry)
204
227
def test_delete_when_entry_selected(app):
205
228
    # Before deleting an entry, make sure the entry table is not in edition mode.
206
229
    app.etable.delete()

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

@@ -44,6 +44,8 @@ class EntryTable(TableWithTransactions):
44
44
        Column('transfer', tr('Transfer'), 120, editor=ACCOUNT_EDIT),
45
45
        Column('increase', tr('Increase'), 95, alignment=Qt.AlignRight),
46
46
        Column('decrease', tr('Decrease'), 95, alignment=Qt.AlignRight),
47
        Column('debit', tr('Debit'), 95, alignment=Qt.AlignRight),
48
        Column('credit', tr('Credit'), 95, alignment=Qt.AlignRight),
47
49
        Column('balance', tr('Balance'), 110, alignment=Qt.AlignRight),
48
50
    ]
49
51
    

Up to file-list qt/controller/view_options.py:

@@ -41,6 +41,7 @@ class ViewOptionsDialog(QDialog, Ui_View
41
41
        'accPayeeCheckBox': 'entry_table_payee',
42
42
        'accChecknoCheckBox': 'entry_table_checkno',
43
43
        'accReconciliationDateCheckBox': 'entry_table_reconciliation_date',
44
        'accDebitCreditCheckBox': 'entry_table_debit_credit',
44
45
        'schDescriptionCheckBox': 'schedule_table_description',
45
46
        'schPayeeCheckBox': 'schedule_table_payee',
46
47
        'schChecknoCheckBox': 'schedule_table_checkno',

Up to file-list qt/lang/de.ts:

645
645
        <source>To</source>
646
646
        <translation>nach</translation>
647
647
    </message>
648
    <message>
649
        <source>Memo</source>
650
        <translation>Memo</translation>
651
    </message>
652
    <message>
653
        <source>Debit</source>
654
        <translation>Debit</translation>
655
    </message>
656
    <message>
657
        <source>Credit</source>
658
        <translation>Kredit</translation>
659
    </message>
648
660
</context>
649
661
<context>
650
662
    <name>AccountPanel</name>
1583
1595
        <translation>Wertstellungsdatum</translation>
1584
1596
    </message>
1585
1597
    <message>
1598
        <source>Debit/Credit</source>
1599
        <translation>Debit/Kredit</translation>
1600
    </message>
1601
    <message>
1586
1602
        <location filename="view_options_dialog.ui" line="223"/>
1587
1603
        <source>Schedules</source>
1588
1604
        <translation>Wiederholung</translation>

Up to file-list qt/lang/fr.ts:

648
648
        <source>To</source>
649
649
        <translation>Cp. débités</translation>
650
650
    </message>
651
    <message>
652
        <source>Memo</source>
653
        <translation>Mémo</translation>
654
    </message>
655
    <message>
656
        <source>Debit</source>
657
        <translation>Débit</translation>
658
    </message>
659
    <message>
660
        <source>Credit</source>
661
        <translation>Crédit</translation>
662
    </message>
651
663
</context>
652
664
<context>
653
665
    <name>AccountPanel</name>
1590
1602
        <source>Reconciliation Date</source>
1591
1603
        <translation>Date réconciliation</translation>
1592
1604
    </message>
1605
		<message>
1606
        <source>Debit/Credit</source>
1607
        <translation>Débit/Crédit</translation>
1608
    </message>
1593
1609
    <message>
1594
1610
        <location filename="view_options_dialog.ui" line="223"/>
1595
1611
        <source>Schedules</source>

Up to file-list qt/ui/view_options_dialog.ui:

201
201
       </widget>
202
202
      </item>
203
203
      <item row="1" column="0">
204
       <widget class="QCheckBox" name="accReconciliationDateCheckBox">
205
        <property name="text">
206
         <string>Reconciliation Date</string>
207
        </property>
208
       </widget>
209
      </item>
210
      <item row="1" column="1">
211
       <widget class="QCheckBox" name="accDebitCreditCheckBox">
212
        <property name="text">
213
         <string>Debit/Credit</string>
214
        </property>
215
       </widget>
216
      </item>
217
      <item row="1" column="2">
204
218
       <widget class="QCheckBox" name="accGraphCheckBox">
205
219
        <property name="text">
206
220
         <string>Graph</string>
207
221
        </property>
208
222
       </widget>
209
223
      </item>
210
      <item row="0" column="3">
211
       <widget class="QCheckBox" name="accReconciliationDateCheckBox">
212
        <property name="text">
213
         <string>Reconciliation Date</string>
214
        </property>
215
       </widget>
216
      </item>
217
224
     </layout>
218
225
    </widget>
219
226
   </item>