diff --git a/coverage.rc b/coverage.rc deleted file mode 100644 index 934a392069a8b008fa467e07320571612c65eb5e..0000000000000000000000000000000000000000 --- a/coverage.rc +++ /dev/null @@ -1,10 +0,0 @@ -[run] -omit = - src/cutecoin/gen_resources/* - src/cutecoin/gui/* - src/cutecoin/core/* - src/cutecoin/models/*Model* -source = src/cutecoin - -[html] -directory = doc/coverage diff --git a/data.txt b/data.txt deleted file mode 100644 index ffba9fb04cb2a416efba009cc46b14e231321c83..0000000000000000000000000000000000000000 --- a/data.txt +++ /dev/null @@ -1,25 +0,0 @@ -{ - "localAccounts": [ - { - "communities": [ - { - "currency": "beta_brousouf", - "nodes": [ - { - "port": 9101, - "server": "ucoin.twiced.fr" - } - ] - } - ], - "name": "Inso", - "pgpKeyId": "3EA42BBCAAD72714", - "wallets": [ - { - "coins": [], - "currency": "beta_brousouf" - } - ] - } - ] -} \ No newline at end of file diff --git a/gen_resources.py b/gen_resources.py index 49bac940f29a007bccb72c700df16ded969f375a..4afcfea687b1624094cdeee818dc7eb67b19b228 100644 --- a/gen_resources.py +++ b/gen_resources.py @@ -3,7 +3,8 @@ import sys, os, multiprocessing, subprocess resources = os.path.abspath(os.path.join(os.path.dirname(__file__), 'res')) -gen_resources = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src', 'cutecoin', 'gen_resources')) +gen_ui = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src', 'cutecoin', 'gen_resources')) +gen_resources = os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')) def convert_ui(args, **kwargs): subprocess.call(args, **kwargs) @@ -14,7 +15,7 @@ def build_resources(): for f in files: if f.endswith('.ui'): source = os.path.join(root, f) - dest = os.path.join(gen_resources, os.path.splitext(os.path.basename(source))[0]+'_uic.py') + dest = os.path.join(gen_ui, os.path.splitext(os.path.basename(source))[0]+'_uic.py') exe = 'pyuic5' elif f.endswith('.qrc'): source = os.path.join(root, f) diff --git a/lib/ucoinpy/documents/transaction.py b/lib/ucoinpy/documents/transaction.py index a69b4a28ee47fe961155b2b08c651a6f4c2ebd49..cd42c610e78061bd69da10052e883acbbc030c63 100644 --- a/lib/ucoinpy/documents/transaction.py +++ b/lib/ucoinpy/documents/transaction.py @@ -45,7 +45,7 @@ SIGNATURE re_inputs = re.compile("Inputs:\n") re_outputs = re.compile("Outputs:\n") re_compact_comment = re.compile("([^\n]+)\n") - re_comment = re.compile("Comment:(?:)?([^\n]*)\n") + re_comment = re.compile("Comment: ([^\n]*)\n") re_pubkey = re.compile("([1-9A-Za-z][^OIl]{42,45})\n") def __init__(self, version, currency, issuers, inputs, outputs, @@ -92,7 +92,7 @@ SIGNATURE outputs.append(output_source) n = n + 1 - comment = None + comment = "" if has_comment == 1: comment = Transaction.re_compact_comment.match(lines[n]).group(1) n = n + 1 @@ -175,9 +175,7 @@ Issuers: doc += "{0}\n".format(o.inline()) doc += "Comment: " - if self.comment: - doc += "{0}".format(self.comment) - doc += "\n" + doc += "{0}\n".format(self.comment) return doc @@ -194,19 +192,19 @@ PUBLIC_KEY:AMOUNT ... COMMENT """ - doc = "TX:{0}:{1}:{2}:{3}:{4}".format(self.version, - self.issuers.len, - self.inputs.len, - self.outputs.len, - '1' if self.Comment else '0') + doc = "TX:{0}:{1}:{2}:{3}:{4}\n".format(self.version, + len(self.issuers), + len(self.inputs), + len(self.outputs), + '1' if self.comment != "" else '0') for pubkey in self.issuers: doc += "{0}\n".format(pubkey) for i in self.inputs: doc += "{0}\n".format(i.compact()) for o in self.outputs: doc += "{0}\n".format(o.inline()) - if self.comment: - doc += "-----@@@----- {0}\n".format(self.comment) + if self.comment != "": + doc += "{0}\n".format(self.comment) for s in self.signatures: doc += "{0}\n".format(s) diff --git a/res/icons/noun_18704_cc.svg b/res/icons/noun_18704_cc.svg index 4d1f0a2e6e67ef4368d873ab03b6c274238febed..83c83b1510bb854ed99411028b56b6e52ca09aa1 100644 --- a/res/icons/noun_18704_cc.svg +++ b/res/icons/noun_18704_cc.svg @@ -42,7 +42,7 @@ inkscape:window-maximized="0" inkscape:current-layer="Layer_1" /><g id="g3" - transform="matrix(1.5988728,0,0,1.5988728,-25.131921,-21.494665)"><g + transform="matrix(1.2341921,0,0,1.2341921,-7.7559354,-7.7122004)"><g id="g5"><path d="m 58.065,32.624 h -16.13 c -2.584,0 -4.684,2.093 -4.684,4.68 v 21.95 c 0,2.585 2.1,4.682 4.684,4.682 h 0.024 v 15.551 c 0,2.586 2.034,4.682 4.554,4.682 h 6.975 c 2.515,0 4.555,-2.095 4.555,-4.682 V 63.936 h 0.023 c 2.586,0 4.685,-2.095 4.685,-4.682 v -21.95 c -0.004,-2.587 -2.1,-4.68 -4.686,-4.68 z" id="path7" diff --git a/res/icons/noun_22441_cc.svg b/res/icons/noun_22441_cc.svg index 0b34da07c78365c7c160b4f32abaf20b75f535e1..6ba11b5eadeba49dff097b96fa90a672b35c8896 100644 --- a/res/icons/noun_22441_cc.svg +++ b/res/icons/noun_22441_cc.svg @@ -42,7 +42,7 @@ inkscape:window-maximized="0" inkscape:current-layer="Layer_1" /><g id="g102" - transform="matrix(1.3395831,0,0,1.3395831,-12.529946,-9.2940339)"><g + transform="translate(4.8538692,7.2808029)"><g id="g104"><path d="M 49.946,17.395" id="path106" @@ -50,10 +50,10 @@ d="m 49.944,6.356 c -1.424,0 -2.576,-1.147 -2.576,-2.574 -0.001,-1.42 1.152,-2.578 2.576,-2.578 1.424,0 2.577,1.158 2.577,2.578 0,1.427 -1.153,2.574 -2.577,2.574 z" id="path108" inkscape:connector-curvature="0" /><polygon - points="58.23,1.164 52.212,7.39 50.004,7.39 49.998,7.39 47.791,7.39 41.771,1.164 40.751,1.602 47.114,11.026 47.067,17.411 45.201,32.946 46.95,32.946 50.001,20.032 53.053,32.946 54.801,32.946 52.935,17.411 52.887,11.026 59.251,1.602 " + points="47.791,7.39 41.771,1.164 40.751,1.602 47.114,11.026 47.067,17.411 45.201,32.946 46.95,32.946 50.001,20.032 53.053,32.946 54.801,32.946 52.935,17.411 52.887,11.026 59.251,1.602 58.23,1.164 52.212,7.39 50.004,7.39 49.998,7.39 " id="polygon110" /></g></g><g id="g112" - transform="matrix(1.3395831,0,0,1.3395831,-12.529946,-9.2940339)"><g + transform="translate(4.8538692,7.2808029)"><g id="g114"><path d="M 50.058,82.604" id="path116" @@ -61,10 +61,10 @@ d="m 50.058,93.644 c 1.421,0 2.576,1.147 2.576,2.573 0,1.42 -1.153,2.58 -2.576,2.58 -1.427,0 -2.579,-1.16 -2.579,-2.58 0,-1.426 1.152,-2.573 2.579,-2.573 z" id="path118" inkscape:connector-curvature="0" /><polygon - points="41.771,98.837 47.791,92.61 49.998,92.61 50.004,92.61 52.212,92.61 58.23,98.837 59.251,98.396 52.887,88.973 52.935,82.588 54.801,67.053 53.053,67.053 50.001,79.969 46.95,67.053 45.201,67.053 47.067,82.588 47.114,88.973 40.751,98.396 " + points="52.212,92.61 58.23,98.837 59.251,98.396 52.887,88.973 52.935,82.588 54.801,67.053 53.053,67.053 50.001,79.969 46.95,67.053 45.201,67.053 47.067,82.588 47.114,88.973 40.751,98.396 41.771,98.837 47.791,92.61 49.998,92.61 50.004,92.61 " id="polygon120" /></g></g><g id="g122" - transform="matrix(1.3395831,0,0,1.3395831,-12.529946,-9.2940339)"><g + transform="translate(4.8538692,7.2808029)"><g id="g124"><path d="M 26.906,26.984" id="path126" @@ -72,10 +72,10 @@ d="m 19.101,19.181 c -1.006,1.005 -2.634,1.009 -3.643,0 -1.005,-1.004 -1.008,-2.638 -0.002,-3.645 1.009,-1.009 2.644,-1.005 3.647,0 1.008,1.009 1.005,2.636 -0.002,3.645 z" id="path128" inkscape:connector-curvature="0" /><polygon - points="21.287,9.648 21.433,18.307 19.872,19.868 19.868,19.871 18.308,21.432 9.649,21.286 9.236,22.317 20.4,24.482 24.883,29.031 34.548,41.337 35.784,40.1 28.811,28.809 40.1,35.783 41.337,34.547 29.032,24.882 24.483,20.399 22.318,9.236 " + points="18.308,21.432 9.649,21.286 9.236,22.317 20.4,24.482 24.883,29.031 34.548,41.337 35.784,40.1 28.811,28.809 40.1,35.783 41.337,34.547 29.032,24.882 24.483,20.399 22.318,9.236 21.287,9.648 21.433,18.307 19.872,19.868 19.868,19.871 " id="polygon130" /></g></g><g id="g132" - transform="matrix(1.3395831,0,0,1.3395831,-12.529946,-9.2940339)"><g + transform="translate(4.8538692,7.2808029)"><g id="g134"><path d="M 73.095,73.017" id="path136" @@ -83,10 +83,10 @@ d="m 80.898,80.819 c 1.008,-1.005 2.636,-1.01 3.645,-0.002 1.005,1.006 1.007,2.641 0.002,3.647 -1.009,1.006 -2.643,1.003 -3.648,-0.002 -1.009,-1.006 -1.005,-2.634 10e-4,-3.643 z" id="path138" inkscape:connector-curvature="0" /><polygon - points="78.715,90.352 78.568,81.693 80.128,80.133 80.132,80.129 81.693,78.567 90.354,78.714 90.762,77.683 79.6,75.518 75.116,70.968 65.452,58.665 64.215,59.901 71.19,71.189 59.9,64.216 58.665,65.453 70.968,75.117 75.517,79.6 77.682,90.763 " + points="81.693,78.567 90.354,78.714 90.762,77.683 79.6,75.518 75.116,70.968 65.452,58.665 64.215,59.901 71.19,71.189 59.9,64.216 58.665,65.453 70.968,75.117 75.517,79.6 77.682,90.763 78.715,90.352 78.568,81.693 80.128,80.133 80.132,80.129 " id="polygon140" /></g></g><g id="g142" - transform="matrix(1.3395831,0,0,1.3395831,-12.529946,-9.2940339)"><g + transform="translate(4.8538692,7.2808029)"><g id="g144"><path d="M 17.395,50.056" id="path146" @@ -94,10 +94,10 @@ d="m 6.357,50.058 c 0,1.422 -1.148,2.575 -2.574,2.575 -1.421,10e-4 -2.579,-1.153 -2.578,-2.575 0,-1.427 1.157,-2.58 2.578,-2.58 1.426,0 2.574,1.153 2.574,2.58 z" id="path148" inkscape:connector-curvature="0" /><polygon - points="1.164,41.771 7.39,47.789 7.39,49.998 7.39,50.003 7.39,52.21 1.164,58.229 1.603,59.249 11.026,52.888 17.411,52.934 32.947,54.8 32.947,53.05 20.032,49.999 32.947,46.949 32.947,45.201 17.412,47.066 11.026,47.113 1.603,40.75 " + points="7.39,52.21 1.164,58.229 1.603,59.249 11.026,52.888 17.411,52.934 32.947,54.8 32.947,53.05 20.032,49.999 32.947,46.949 32.947,45.201 17.412,47.066 11.026,47.113 1.603,40.75 1.164,41.771 7.39,47.789 7.39,49.998 7.39,50.003 " id="polygon150" /></g></g><g id="g152" - transform="matrix(1.3395831,0,0,1.3395831,-12.529946,-9.2940339)"><g + transform="translate(4.8538692,7.2808029)"><g id="g154"><path d="M 82.604,49.945" id="path156" @@ -105,10 +105,10 @@ d="m 93.641,49.943 c 0.002,-1.423 1.149,-2.577 2.575,-2.576 1.421,-10e-4 2.581,1.152 2.581,2.576 0,1.425 -1.16,2.578 -2.581,2.578 -1.426,0 -2.573,-1.153 -2.575,-2.578 z" id="path158" inkscape:connector-curvature="0" /><polygon - points="98.837,58.229 92.611,52.21 92.611,50.003 92.611,49.998 92.611,47.79 98.837,41.771 98.398,40.75 88.974,47.113 82.587,47.066 67.052,45.201 67.052,46.949 79.968,49.999 67.052,53.05 67.052,54.8 82.587,52.934 88.974,52.888 98.398,59.249 " + points="92.611,47.79 98.837,41.771 98.398,40.75 88.974,47.113 82.587,47.066 67.052,45.201 67.052,46.949 79.968,49.999 67.052,53.05 67.052,54.8 82.587,52.934 88.974,52.888 98.398,59.249 98.837,58.229 92.611,52.21 92.611,50.003 92.611,49.998 " id="polygon160" /></g></g><g id="g162" - transform="matrix(1.3395831,0,0,1.3395831,-12.529946,-9.2940339)"><g + transform="translate(4.8538692,7.2808029)"><g id="g164"><path d="M 26.984,73.096" id="path166" @@ -116,10 +116,10 @@ d="m 19.181,80.899 c 1.005,1.007 1.01,2.636 10e-4,3.644 -1.004,1.004 -2.639,1.008 -3.646,10e-4 -1.008,-1.008 -1.005,-2.642 0,-3.647 1.009,-1.009 2.636,-1.004 3.645,0.002 z" id="path168" inkscape:connector-curvature="0" /><polygon - points="9.649,78.714 18.307,78.567 19.868,80.129 19.872,80.133 21.432,81.692 21.287,90.352 22.318,90.763 24.482,79.6 29.031,75.117 41.337,65.453 40.1,64.216 28.809,71.191 35.784,59.901 34.548,58.665 24.882,70.968 20.399,75.518 9.236,77.683 " + points="21.432,81.692 21.287,90.352 22.318,90.763 24.482,79.6 29.031,75.117 41.337,65.453 40.1,64.216 28.809,71.191 35.784,59.901 34.548,58.665 24.882,70.968 20.399,75.518 9.236,77.683 9.649,78.714 18.307,78.567 19.868,80.129 19.872,80.133 " id="polygon170" /></g></g><g id="g172" - transform="matrix(1.3395831,0,0,1.3395831,-12.529946,-9.2940339)"><g + transform="translate(4.8538692,7.2808029)"><g id="g174"><path d="M 73.017,26.905" id="path176" @@ -127,5 +127,5 @@ d="m 80.818,19.1 c -1.005,-1.005 -1.009,-2.634 0,-3.642 1.004,-1.006 2.64,-1.009 3.646,-0.002 1.007,1.009 1.003,2.644 0,3.647 -1.008,1.008 -2.636,1.004 -3.646,-0.003 z" id="path178" inkscape:connector-curvature="0" /><polygon - points="90.352,21.286 81.693,21.433 80.132,19.871 80.128,19.868 78.568,18.307 78.715,9.648 77.682,9.236 75.517,20.399 70.968,24.883 58.665,34.548 59.9,35.783 71.19,28.811 64.215,40.1 65.452,41.337 75.116,29.031 79.6,24.482 90.762,22.318 " + points="78.568,18.307 78.715,9.648 77.682,9.236 75.517,20.399 70.968,24.883 58.665,34.548 59.9,35.783 71.19,28.811 64.215,40.1 65.452,41.337 75.116,29.031 79.6,24.482 90.762,22.318 90.352,21.286 81.693,21.433 80.132,19.871 80.128,19.868 " id="polygon180" /></g></g></svg> \ No newline at end of file diff --git a/res/icons/noun_2651_cc.svg b/res/icons/noun_2651_cc.svg index 106891368df57012ce8560ff82d9a99a1614c6e0..6e903e75af3f628266cefa5448b4f3614c404078 100644 --- a/res/icons/noun_2651_cc.svg +++ b/res/icons/noun_2651_cc.svg @@ -42,7 +42,7 @@ inkscape:window-maximized="0" inkscape:current-layer="Layer_1" /><g id="g3" - transform="matrix(1.4516546,0,0,1.4516546,-17.434427,-11.678461)"><g + transform="matrix(1.1932927,0,0,1.1932927,-4.7732679,-6.796496)"><g id="g5"><path d="m 19.3,48.049 c -6.816,0 -12.362,-5.546 -12.362,-12.362 0,-6.817 5.546,-12.363 12.362,-12.363 6.816,0 12.362,5.546 12.362,12.363 0,6.816 -5.546,12.362 -12.362,12.362 z m 0,-19.725 c -4.06,0 -7.362,3.303 -7.362,7.363 0,4.06 3.303,7.362 7.362,7.362 4.059,0 7.362,-3.303 7.362,-7.362 0,-4.061 -3.303,-7.363 -7.362,-7.363 z" id="path7" diff --git a/res/icons/noun_29542_cc.svg b/res/icons/noun_29542_cc.svg index 1cac441b7eaae9cdc9d36614cb1acee642715968..e7ae2f6141294b4640a56e22ffa8243e5d28156a 100644 --- a/res/icons/noun_29542_cc.svg +++ b/res/icons/noun_29542_cc.svg @@ -41,14 +41,14 @@ inkscape:window-y="27" inkscape:window-maximized="0" inkscape:current-layer="Layer_1" /><path - d="m 110.19137,37.058657 h -6.41627 l -6.916674,4.850558 h 11.279734 c 0.53481,0 1.06389,0.06739 1.56715,0.189262 3.09988,0.722636 5.40543,3.52859 5.40543,6.87222 V 110.7576 c 2.94074,-1.72486 4.92799,-4.94088 4.92799,-8.6315 V 47.039365 c -0.001,-5.515843 -4.41181,-9.980708 -9.84736,-9.980708 z" + d="M 98.625666,40.817494 H 93.61882 l -5.39733,3.785065 h 8.801983 c 0.417331,0 0.830191,0.05259 1.222903,0.147688 2.418944,0.563899 4.218054,2.753486 4.218054,5.362641 v 48.214546 c 2.29476,-1.34597 3.84549,-3.855546 3.84549,-6.73547 V 48.6058 c -7.8e-4,-4.304211 -3.4427,-7.788306 -7.684254,-7.788306 z" id="path3" inkscape:connector-curvature="0" /><path - d="M 108.41345,46.058643 H -1.4703948 c -1.1484767,0 -2.0732801,-0.93054 -2.0732801,-2.07328 0,-1.148478 0.9262372,-2.081883 2.0732801,-2.081883 H 6.9933481 L 9.7993019,39.876081 13.699247,37.058657 H -0.22872085 c -5.49003415,0 -9.93912615,4.464865 -9.93912615,9.967803 v 1.937068 63.904632 c 0,5.5101 4.449092,9.97353 9.93912615,9.97353 H 101.37204 c 5.48716,0 9.94056,-4.46343 9.94056,-9.97353 V 48.963528 c -0.007,-1.604426 -1.30476,-2.904885 -2.89915,-2.904885 z" + d="M 97.238291,47.840508 H 11.49197 c -0.896198,0 -1.6178555,-0.726134 -1.6178555,-1.617855 0,-0.896199 0.7227765,-1.624569 1.6178555,-1.624569 h 6.604563 l 2.189587,-1.582052 3.043267,-2.198538 H 12.460892 c -4.2840709,0 -7.7558576,3.484095 -7.7558576,7.778236 v 1.511564 49.867086 c 0,4.29973 3.4717867,7.7827 7.7558576,7.7827 h 79.282734 c 4.281828,0 7.756977,-3.48297 7.756977,-7.7827 V 50.107294 c -0.0055,-1.251991 -1.018152,-2.266786 -2.262312,-2.266786 z" id="path5" inkscape:connector-curvature="0" /><g id="g7" - transform="matrix(1.4338036,0,0,1.4338036,-16.093758,-12.27996)"><path + transform="matrix(1.1188486,0,0,1.1188486,0.08083236,2.3167937)"><path d="m 49.752,26.299 c -5.534,-0.29 -10.249,3.943 -10.524,9.453 -0.036,0.745 0.016,1.472 0.137,2.177 h 19.797 c 0.062,-0.368 0.106,-0.741 0.126,-1.122 0.273,-5.515 -3.998,-10.219 -9.536,-10.508 z" id="path9" inkscape:connector-curvature="0" @@ -56,6 +56,6 @@ d="m 39.228,35.752 c 0.275,-5.509 4.991,-9.742 10.524,-9.453 5.538,0.289 9.808,4.992 9.536,10.507 -0.02,0.381 -0.064,0.754 -0.126,1.122 H 74.739 L 84.561,30.636 64.814,4.572 19.895,37.929 h 19.47 c -0.121,-0.705 -0.173,-1.432 -0.137,-2.177 z" id="path11" inkscape:connector-curvature="0" /></g><polygon - points="40.884,5.019 22.209,33.399 51.353,11.92 " + points="51.353,11.92 40.884,5.019 22.209,33.399 " id="polygon13" - transform="matrix(1.4338036,0,0,1.4338036,-16.093758,-12.27996)" /></svg> \ No newline at end of file + transform="matrix(1.1188486,0,0,1.1188486,0.08083236,2.3167937)" /></svg> \ No newline at end of file diff --git a/res/icons/noun_43022_cc.svg b/res/icons/noun_43022_cc.svg index ab23265c9ae7eed68984ceae4a25283ba44a6702..5e2abf525da3573800c7bc02438a154bb83e9d6b 100644 --- a/res/icons/noun_43022_cc.svg +++ b/res/icons/noun_43022_cc.svg @@ -37,13 +37,13 @@ showgrid="false" inkscape:zoom="2.36" inkscape:cx="50" - inkscape:cy="50" + inkscape:cy="45.162284" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="0" inkscape:current-layer="Ebene_1" /><switch id="switch3" - transform="matrix(1.5680243,0,0,1.5680243,-23.538928,-21.417237)"><foreignObject + transform="matrix(1.1737486,0,0,1.1737486,-2.5552277,0.8260633)"><foreignObject requiredExtensions="http://ns.adobe.com/AdobeIllustrator/10.0/" x="0" y="0" diff --git a/res/icons/noun_63271_cc.svg b/res/icons/noun_63271_cc.svg index 72a249ab7e91122130cc4502d78bd7aa9add26a6..6628795960b952b68819c3af5f0b4e6ba19f47be 100644 --- a/res/icons/noun_63271_cc.svg +++ b/res/icons/noun_63271_cc.svg @@ -36,20 +36,20 @@ showgrid="false" inkscape:zoom="2.36" inkscape:cx="50" - inkscape:cy="55.66586" + inkscape:cy="55.110775" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="0" inkscape:current-layer="Layer_1" /><g id="g3" - transform="matrix(1.4845545,0,0,1.4845545,-19.011756,-20.223488)"><polygon - points="95,40.361 71.584,16.947 59.878,16.945 83.293,40.361 59.876,63.777 71.584,63.777 94.998,40.361 " + transform="matrix(1.216319,0,0,1.216319,-4.5137983,-2.5214573)"><polygon + points="59.878,16.945 83.293,40.361 59.876,63.777 71.584,63.777 94.998,40.361 95,40.361 71.584,16.947 " id="polygon5" /><polygon - points="83.293,40.361 83.293,44.501 41.901,44.5 41.899,44.502 50.178,36.224 83.293,36.224 " + points="41.901,44.5 41.899,44.502 50.178,36.224 83.293,36.224 83.293,40.361 83.293,44.501 " id="polygon7" /></g><g id="g9" - transform="matrix(1.4845545,0,0,1.4845545,-19.011756,-20.223488)"><polygon - points="5,59.639 28.416,83.053 40.123,83.055 16.709,59.639 40.125,36.224 28.416,36.224 5.002,59.639 " + transform="matrix(1.216319,0,0,1.216319,-4.5137983,-2.5214573)"><polygon + points="40.123,83.055 16.709,59.639 40.125,36.224 28.416,36.224 5.002,59.639 5,59.639 28.416,83.053 " id="polygon11" /><polygon - points="16.707,59.639 16.707,55.498 58.099,55.5 58.101,55.498 49.822,63.777 16.707,63.777 " + points="58.099,55.5 58.101,55.498 49.822,63.777 16.707,63.777 16.707,59.639 16.707,55.498 " id="polygon13" /></g></svg> \ No newline at end of file diff --git a/res/ui/community_tab.ui b/res/ui/community_tab.ui index 3eb89b95a9078d65766ad9d1c7ace07e524f91b7..34d9f84ba575def889c108ca7024e7e6a52bc38f 100644 --- a/res/ui/community_tab.ui +++ b/res/ui/community_tab.ui @@ -22,6 +22,15 @@ <property name="currentIndex"> <number>0</number> </property> + <property name="iconSize"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + <property name="elideMode"> + <enum>Qt::ElideNone</enum> + </property> <widget class="QWidget" name="tab_members"> <attribute name="icon"> <iconset resource="../icons/icons.qrc"> diff --git a/res/ui/currency_tab.ui b/res/ui/currency_tab.ui index 8218af48ed277e794265950b98bfee2f45e6fd16..afc46e246ca289d292f683d46ce68a33019aef89 100644 --- a/res/ui/currency_tab.ui +++ b/res/ui/currency_tab.ui @@ -33,7 +33,7 @@ <bool>false</bool> </property> <property name="currentIndex"> - <number>0</number> + <number>1</number> </property> <widget class="QWidget" name="tab_wallets"> <attribute name="icon"> diff --git a/res/ui/mainwindow.ui b/res/ui/mainwindow.ui index 47fd6e376b57680e2e61ff9bdd0ae5c609bb5be3..8c5588e02e793605ed64f0ac1e7a1b0670b25132 100644 --- a/res/ui/mainwindow.ui +++ b/res/ui/mainwindow.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>498</width> - <height>437</height> + <width>681</width> + <height>549</height> </rect> </property> <property name="windowTitle"> @@ -23,7 +23,14 @@ </widget> </item> <item> - <widget class="QTabWidget" name="currencies_tabwidget"/> + <widget class="QTabWidget" name="currencies_tabwidget"> + <property name="iconSize"> + <size> + <width>24</width> + <height>24</height> + </size> + </property> + </widget> </item> </layout> </widget> @@ -32,7 +39,7 @@ <rect> <x>0</x> <y>0</y> - <width>498</width> + <width>681</width> <height>20</height> </rect> </property> @@ -42,12 +49,12 @@ </property> <widget class="QMenu" name="menu_change_account"> <property name="title"> - <string>Change account</string> + <string>Open account</string> </property> </widget> - <addaction name="action_configure_parameters"/> <addaction name="menu_change_account"/> <addaction name="action_add_account"/> + <addaction name="action_configure_parameters"/> <addaction name="separator"/> <addaction name="action_export"/> <addaction name="action_import"/> @@ -152,7 +159,7 @@ </action> <action name="action_configure_parameters"> <property name="text"> - <string>Configure</string> + <string>Configure account</string> </property> </action> <action name="action_import"> diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index c5e00b1acd20cc29e0b4ee22a27e507938ccb081..062a0e728e8453e69874df76f2774c69d331ccca 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -160,6 +160,17 @@ class Account(object): sent.append(t) return sent + def transactions_awaiting(self, community): + awaiting = [] + for w in self.wallets: + for t in w.transactions_awaiting(community): + # Lets remove transactions to our own wallets + pubkeys = [wallet.pubkey for wallet in self.wallets] + outputs = [o for o in t.outputs if o.pubkey not in pubkeys] + if len(outputs) > 0: + awaiting.append(t) + return awaiting + def member_of(self, community): pubkeys = community.members_pubkeys() if self.pubkey not in pubkeys: diff --git a/src/cutecoin/core/community.py b/src/cutecoin/core/community.py index 5736696ef33a83132e65d73c60795aad89896710..5f48889c33bd2cc01809a1873ecda428e075633c 100644 --- a/src/cutecoin/core/community.py +++ b/src/cutecoin/core/community.py @@ -141,7 +141,13 @@ class Community(object): e = next(e for e in peer.endpoints if type(e) is BMAEndpoint) logging.debug("Trying to connect to : " + peer.pubkey) req = request(e.conn_handler(), **req_args) - req.post(**post_args) + try: + req.post(**post_args) + except ValueError as e: + raise + except: + pass + return def jsonify_peers_list(self): data = [] diff --git a/src/cutecoin/core/person.py b/src/cutecoin/core/person.py index bb4920c3850908910e14fb2a87f93a2f892ab51d..0ebc8fc58ae5ec0c714d1c186427ea34fceaa42f 100644 --- a/src/cutecoin/core/person.py +++ b/src/cutecoin/core/person.py @@ -31,7 +31,6 @@ class Person(object): Create a person from the pubkey found in a community ''' data = community.request(bma.wot.Lookup, req_args={'search': pubkey}) - logging.debug(data) results = data['results'] timestamp = 0 diff --git a/src/cutecoin/core/wallet.py b/src/cutecoin/core/wallet.py index 3b048d9bd7cbd8a80909136ffc7b324278f27b10..a8c09bfd81146dfb0b66d63d45dd68ec6027f215 100644 --- a/src/cutecoin/core/wallet.py +++ b/src/cutecoin/core/wallet.py @@ -18,34 +18,54 @@ class Cache(): self.latest_block = 0 self.wallet = wallet self.tx_sent = [] + self.awaiting_tx = [] self.tx_received = [] def load_from_json(self, data): self.tx_received = [] self.tx_sent = [] + self.awaiting_tx = [] + data_received = data['received'] for r in data_received: self.tx_received.append(Transaction.from_signed_raw(r['raw'])) + data_sent = data['sent'] for s in data_sent: self.tx_sent.append(Transaction.from_signed_raw(s['raw'])) + + data_awaiting = data['awaiting'] + for s in data_awaiting: + self.awaiting_tx.append(Transaction.from_signed_raw(s['raw'])) + self.latest_block = data['latest_block'] def jsonify(self): data_received = [] for r in self.tx_received: data_received.append({'raw': r.signed_raw()}) + data_sent = [] for s in self.tx_sent: data_sent.append({'raw': s.signed_raw()}) + + data_awaiting = [] + for s in self.awaiting_tx: + data_awaiting.append({'raw': s.signed_raw()}) + return {'latest_block': self.latest_block, 'received': data_received, - 'sent': data_sent} + 'sent': data_sent, + 'awaiting': data_awaiting} def latest_sent(self, community): self._refresh(community) return self.tx_sent + def awaiting(self, community): + self._refresh(community) + return self.awaiting_tx + def latest_received(self, community): self._refresh(community) return self.tx_received @@ -63,13 +83,17 @@ class Cache(): signed_raw = "{0}{1}\n".format(block['raw'], block['signature']) block_doc = Block.from_signed_raw(signed_raw) for tx in block_doc.transactions: - for o in tx.outputs: - if o.pubkey == self.wallet.pubkey: - self.tx_received.append(tx) - - for i in tx.issuers: - if i == self.wallet.pubkey: - self.tx_sent.append(tx) + in_outputs = [o for o in tx.outputs if o.pubkey == self.wallet.pubkey] + if len(in_outputs) > 0: + self.tx_received.append(tx) + + in_inputs = [i for i in tx.issuers if i == self.wallet.pubkey] + if len(in_inputs) > 0: + # remove from waiting transactions list the one which were + # validated in the blockchain + self.awaiting_tx = [awaiting for awaiting in self.awaiting_tx + if awaiting.compact() != tx.compact()] + self.tx_sent.append(tx) self.latest_block = current_block['number'] @@ -138,12 +162,15 @@ class Wallet(object): elif self.available_inputs[0] < block['number']: self.available_inputs = (block['number'], sources) + logging.debug("Available inputs : {0}".format(self.available_inputs[1])) + buf_inputs = list(self.available_inputs[1]) for s in self.available_inputs[1]: value += s.amount s.index = 0 inputs.append(s) - self.available_inputs[1].remove(s) + buf_inputs.remove(s) if value >= amount: + self.available_inputs = (block['number'], buf_inputs) return inputs raise NotEnoughMoneyError(amount, value) @@ -185,11 +212,8 @@ class Wallet(object): try: community.post(bma.tx.Process, post_args={'transaction': tx.signed_raw()}) + self.cache.awaiting_tx.append(tx) except: - # If it fails, do not remove inputs from available inputs - # And raise the exception again - for i in inputs: - self.available_inputs[1].append(i) raise def sources(self, community): @@ -200,11 +224,12 @@ class Wallet(object): tx.append(InputSource.from_bma(s)) return tx - #TODO: Build a cache of latest transactions + def transactions_awaiting(self, community): + return self.cache.awaiting(community) + def transactions_sent(self, community): return self.cache.latest_sent(community) - #TODO: Build a cache of latest transactions def transactions_received(self, community): return self.cache.latest_received(community) diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index 2670dd7a165fc1161c71df94e9060b1fc1a2c9b3..035376145308476d4f58e509d3369595d96d70ff 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -5,7 +5,7 @@ Created on 1 févr. 2014 ''' from cutecoin.gen_resources.mainwindow_uic import Ui_MainWindow from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog -from PyQt5.QtCore import QSignalMapper +from PyQt5.QtCore import QSignalMapper, QModelIndex from PyQt5.QtGui import QIcon from cutecoin.gui.process_cfg_account import ProcessConfigureAccount from cutecoin.gui.transfer import TransferMoneyDialog @@ -46,6 +46,10 @@ class MainWindow(QMainWindow, Ui_MainWindow): dialog = TransferMoneyDialog(self.app.current_account) dialog.accepted.connect(self.refresh_wallets) dialog.exec_() + currency_tab = self.currencies_tabwidget.currentWidget() + currency_tab.list_transactions_sent.model().dataChanged.emit( + QModelIndex(), + QModelIndex(), ()) def open_certification_dialog(self): dialog = CertificationDialog(self.app.current_account) diff --git a/src/cutecoin/models/sent.py b/src/cutecoin/models/sent.py index 25bdb1fa020b8e1e7bbaa73bc249917450dd28ad..ca1264d1cde8ec6cea901ccfe5d08c49c38e62e0 100644 --- a/src/cutecoin/models/sent.py +++ b/src/cutecoin/models/sent.py @@ -7,6 +7,7 @@ Created on 5 févr. 2014 import logging from ..core.person import Person from PyQt5.QtCore import QAbstractListModel, Qt +from PyQt5.QtGui import QFont class SentListModel(QAbstractListModel): @@ -24,13 +25,18 @@ class SentListModel(QAbstractListModel): self.community = community def rowCount(self, parent): - return len(self.account.transactions_sent(self.community)) + return len(self.account.transactions_sent(self.community)) \ + + len(self.account.transactions_awaiting(self.community)) def data(self, index, role): - + row = index.row() if role == Qt.DisplayRole: - row = index.row() - transactions = self.account.transactions_sent(self.community) + transactions = [] + if row < len(self.account.transactions_sent(self.community)): + transactions = self.account.transactions_sent(self.community) + else: + transactions = self.account.transactions_awaiting(self.community) + row = row - len(self.account.transactions_sent(self.community)) amount = 0 outputs = [] for o in transactions[row].outputs: @@ -41,6 +47,11 @@ class SentListModel(QAbstractListModel): receiver = Person.lookup(outputs[0].pubkey, self.community) value = "{0} to {1}".format(amount, receiver.name) return value + if role == Qt.FontRole: + if row < len(self.account.transactions_sent(self.community)): + return QFont('Sans Serif', italic=False) + else: + return QFont('Sans Serif', italic=True) def flags(self, index): return Qt.ItemIsSelectable | Qt.ItemIsEnabled