diff --git a/res/icons/connected.svg b/res/icons/connected.svg index 8e4a17174e997d1a0166da44dfac69f53719f8f8..c6a97c9c66be3ebf88117731bd8e14d55542ef8b 100644 --- a/res/icons/connected.svg +++ b/res/icons/connected.svg @@ -40,7 +40,7 @@ fx="52.325901" fy="1005.1627" r="42.926411" - gradientTransform="matrix(1.539681,0,0,1.5451884,-48.391841,-562.49866)" + gradientTransform="matrix(1.539681,0,0,1.5451884,-68.190831,-562.49866)" gradientUnits="userSpaceOnUse" /> </defs> <sodipodi:namedview @@ -51,7 +51,7 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="2.8284271" - inkscape:cx="80.436882" + inkscape:cx="18.741815" inkscape:cy="33.829638" inkscape:document-units="px" inkscape:current-layer="layer1" @@ -59,9 +59,9 @@ units="px" inkscape:snap-bbox="false" inkscape:window-width="1366" - inkscape:window-height="725" - inkscape:window-x="-7" - inkscape:window-y="17" + inkscape:window-height="709" + inkscape:window-x="-4" + inkscape:window-y="0" inkscape:window-maximized="1" /> <metadata id="metadata3341"> @@ -71,7 +71,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> @@ -81,7 +81,7 @@ id="layer1" transform="translate(0,-952.36216)"> <ellipse - style="opacity:1;fill:#17d017;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + style="opacity:1;fill:#17d017;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3346" cx="51.785713" cy="1005.5765" @@ -90,7 +90,7 @@ <ellipse style="opacity:0.65;fill:url(#radialGradient4162);fill-opacity:1;stroke:none;stroke-width:1.25129819;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path4148" - cx="32.173359" + cx="12.374369" cy="990.66699" rx="64.928177" ry="65.10495" /> diff --git a/res/icons/disconnected.svg b/res/icons/disconnected.svg index 4224156fbf5b7cd077c4a6db7a5b268e0205a55a..6647ff69d1f4db23fc7130d611543229eb42b3af 100644 --- a/res/icons/disconnected.svg +++ b/res/icons/disconnected.svg @@ -40,7 +40,7 @@ fx="52.325901" fy="1005.1627" r="42.926411" - gradientTransform="matrix(1.539681,0,0,1.5451884,-48.038287,-560.37733)" + gradientTransform="matrix(1.539681,0,0,1.5451884,-50.51316,-559.67022)" gradientUnits="userSpaceOnUse" /> </defs> <sodipodi:namedview @@ -51,7 +51,7 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="2.8284271" - inkscape:cx="80.436882" + inkscape:cx="18.741815" inkscape:cy="33.829638" inkscape:document-units="px" inkscape:current-layer="layer1" @@ -59,9 +59,9 @@ units="px" inkscape:snap-bbox="false" inkscape:window-width="1366" - inkscape:window-height="725" - inkscape:window-x="-7" - inkscape:window-y="17" + inkscape:window-height="709" + inkscape:window-x="-4" + inkscape:window-y="0" inkscape:window-maximized="1" /> <metadata id="metadata3341"> @@ -71,7 +71,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> @@ -81,7 +81,7 @@ id="layer1" transform="translate(0,-952.36216)"> <ellipse - style="opacity:1;fill:#c60002;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + style="opacity:1;fill:#c60002;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3346" cx="51.785713" cy="1005.5765" @@ -90,8 +90,8 @@ <ellipse style="opacity:0.65;fill:url(#radialGradient4162);fill-opacity:1;stroke:none;stroke-width:1.25129819;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path4148" - cx="32.526913" - cy="992.78827" + cx="30.05204" + cy="993.49536" rx="64.928177" ry="65.10495" /> </g> diff --git a/res/icons/weak_connect.svg b/res/icons/weak_connect.svg index 26e2d94c4cff206add115b6cb46efd5397e7a646..a00e5213659a9eeefa6b2157af47c737d6a01be5 100644 --- a/res/icons/weak_connect.svg +++ b/res/icons/weak_connect.svg @@ -40,7 +40,7 @@ fx="52.325901" fy="1005.1627" r="42.926411" - gradientTransform="matrix(1.539681,0,0,1.5451884,-51.220268,-564.97353)" + gradientTransform="matrix(1.539681,0,0,1.5451884,-51.927374,-565.68063)" gradientUnits="userSpaceOnUse" /> </defs> <sodipodi:namedview @@ -51,7 +51,7 @@ inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="2.8284271" - inkscape:cx="80.436882" + inkscape:cx="18.741815" inkscape:cy="33.829638" inkscape:document-units="px" inkscape:current-layer="layer1" @@ -59,9 +59,9 @@ units="px" inkscape:snap-bbox="false" inkscape:window-width="1366" - inkscape:window-height="725" - inkscape:window-x="-7" - inkscape:window-y="17" + inkscape:window-height="709" + inkscape:window-x="-4" + inkscape:window-y="0" inkscape:window-maximized="1" /> <metadata id="metadata3341"> @@ -71,7 +71,7 @@ <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - <dc:title></dc:title> + <dc:title /> </cc:Work> </rdf:RDF> </metadata> @@ -81,7 +81,7 @@ id="layer1" transform="translate(0,-952.36216)"> <ellipse - style="opacity:1;fill:#fff41c;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" + style="opacity:1;fill:#fff41c;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path3346" cx="51.785713" cy="1005.5765" @@ -90,8 +90,8 @@ <ellipse style="opacity:0.65;fill:url(#radialGradient4162);fill-opacity:1;stroke:none;stroke-width:1.25129819;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" id="path4148" - cx="29.344933" - cy="988.19208" + cx="28.637825" + cy="987.48499" rx="64.928177" ry="65.10495" /> </g> diff --git a/src/cutecoin/core/net/network.py b/src/cutecoin/core/net/network.py index 3154aa8b28b1fc979fec2e203a2bd62ec43ad877..4a85193fbd8ece7cbe1866208765bfd36be2b2c1 100644 --- a/src/cutecoin/core/net/network.py +++ b/src/cutecoin/core/net/network.py @@ -201,36 +201,32 @@ class Network(Watcher): ''' self._must_crawl = True while self.continue_crawling(): + emit_change = False nodes = self.crawling(interval=10) new_inlines = [n.endpoint.inline() for n in nodes] last_inlines = [n.endpoint.inline() for n in self.nodes] - hash_new_nodes = hash(tuple(frozenset(sorted(new_inlines)))) - hash_last_nodes = hash(tuple(frozenset(sorted(last_inlines)))) - emit_change = False - self._mutex.lock() - try: - if hash_new_nodes != hash_last_nodes: - self.nodes = nodes + hash_new_nodes = str(tuple(frozenset(sorted(new_inlines)))) + hash_last_nodes = str(tuple(frozenset(sorted(last_inlines)))) + if hash_new_nodes != hash_last_nodes: + logging.debug("Nodes changed...") + self.nodes = nodes + emit_change = True + + for node in self.nodes: + if node.last_change + 3600 < time.time() and \ + node.state in (Node.OFFLINE, Node.CORRUPTED): + try: + node.changed.disconnect() + except TypeError: + logging.debug("Error : {0} not connected".format(node.pubkey)) + self.nodes.remove(node) emit_change = True - for node in self.nodes: - if node.last_change + 3600 < time.time() and \ - node.state in (Node.OFFLINE, Node.CORRUPTED): - try: - node.changed.disconnect() - except TypeError: - logging.debug("Error : {0} not connected".format(node.pubkey)) - self.nodes.remove(node) - emit_change = True - except: - raise - finally: - self._mutex.unlock() if emit_change: self.nodes_changed.emit() - + QCoreApplication.processEvents() self.stopped_perpetual_crawling.emit() diff --git a/src/cutecoin/core/net/node.py b/src/cutecoin/core/net/node.py index 3f6cb0b696600aa8a32e40d62cbdf0441808e2de..0448609280faeb1d05f2ca81640a4bd707944922 100644 --- a/src/cutecoin/core/net/node.py +++ b/src/cutecoin/core/net/node.py @@ -275,6 +275,7 @@ class Node(QObject): except: logging.error('Error calling libc.__res_init') except RequestException as e: + logging.debug(str(e)) if self.state != Node.OFFLINE: self.state = Node.OFFLINE logging.debug("Change : new state offine") @@ -347,7 +348,7 @@ class Node(QObject): logging.debug(traversed_pubkeys) logging.debug("Traversing : next to read : {0} : {1}".format(node.pubkey, (node.pubkey not in traversed_pubkeys))) - node.peering_traversal(found_nodes, + node.peering_traversal(knew_pubkeys, found_nodes, traversed_pubkeys, interval, continue_crawling) time.sleep(interval) except RequestException as e: diff --git a/src/cutecoin/core/watching/monitor.py b/src/cutecoin/core/watching/monitor.py index 51ea8037c93f25c86e03e64757e0f997148cf626..b2181a2a8289d0ecd3fec7fc5a081e0bc73ac1f6 100644 --- a/src/cutecoin/core/watching/monitor.py +++ b/src/cutecoin/core/watching/monitor.py @@ -77,3 +77,8 @@ class Monitor(object): self.threads_pool.remove(watcher.thread()) watcher.deleteLater() watcher.thread().deleteLater() + + self.threads_pool = [] + self._blockchain_watchers = {} + self._network_watchers = {} + self._persons_watchers = {} diff --git a/src/cutecoin/gui/currency_tab.py b/src/cutecoin/gui/currency_tab.py index b0017eb6d40dd295c09bd3ede73a855a0e66ceeb..f1ab60256f06ad80454eb66017bc8bcb9fedb65f 100644 --- a/src/cutecoin/gui/currency_tab.py +++ b/src/cutecoin/gui/currency_tab.py @@ -156,13 +156,13 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): logging.debug("Refresh status") if self.community.network_quality() > 0.66: icon = '<img src=":/icons/connected" width="12" height="12"/>' - text = "Connected : Block {0}".format(self.community.network.latest_block) + text = " Block {0}".format(self.community.network.latest_block) elif self.community.network_quality() > 0.33: icon = '<img src=":/icons/weak_connect" width="12" height="12"/>' - text = "Connected (weak link) : Block {0}".format(self.community.network.latest_block) + text = " Block {0}".format(self.community.network.latest_block) else: icon = '<img src=":/icons/disconnected" width="12" height="12"/>' - text = "Disconnected : Block {0}".format(self.community.network.latest_block) + text = " Block {0}".format(self.community.network.latest_block) self.status_label.setText("{0}{1}".format(icon, text)) def refresh_wallets(self): diff --git a/src/cutecoin/gui/network_tab.py b/src/cutecoin/gui/network_tab.py index 71c7004424d42abbde63f42bd4de8783bb519ebb..2bfbda91bc032394205a16f9f3516778e2a5ddba 100644 --- a/src/cutecoin/gui/network_tab.py +++ b/src/cutecoin/gui/network_tab.py @@ -6,7 +6,7 @@ Created on 20 févr. 2015 import logging from PyQt5.QtWidgets import QWidget -from PyQt5.QtCore import Qt, QThread +from PyQt5.QtCore import Qt, QThread, pyqtSlot from ..models.network import NetworkTableModel, NetworkFilterProxyModel from ..gen_resources.network_tab_uic import Ui_NetworkTabWidget @@ -30,6 +30,7 @@ class NetworkTabWidget(QWidget, Ui_NetworkTabWidget): community.network.nodes_changed.connect(self.refresh_nodes) + @pyqtSlot() def refresh_nodes(self): logging.debug("Refresh nodes") self.table_network.model().sourceModel().modelReset.emit()