From 48b0a794f196ec5f508c67c399b5dba8bd4ec960 Mon Sep 17 00:00:00 2001
From: Vincent Texier <vit@free.fr>
Date: Thu, 14 May 2015 15:07:19 +0200
Subject: [PATCH] Fix bug notify spamming

Fix bug in french translation
---
 res/i18n/ts/fr_FR.ts             |  2 +-
 src/cutecoin/core/net/network.py |  1 +
 src/cutecoin/gui/toast.py        | 41 ++++++++++++++++++--------------
 3 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/res/i18n/ts/fr_FR.ts b/res/i18n/ts/fr_FR.ts
index fe8f3740..7e33a0b0 100644
--- a/res/i18n/ts/fr_FR.ts
+++ b/res/i18n/ts/fr_FR.ts
@@ -546,7 +546,7 @@ Le processus pour rejoindre la communauté devrait être refait à zéro.</trans
     <message>
         <location filename="../../../src/cutecoin/gui/currency_tab.py" line="150"/>
         <source>&lt;b&gt;Warning : You are certified by only {0} persons, need {1}&lt;/b&gt;</source>
-        <translation>&lt;b&gt;Attention : Vous êtes certifiés par seulement {0} personnes, besoin de {2}&lt;/b&gt;</translation>
+        <translation>&lt;b&gt;Attention : Vous êtes certifiés par seulement {0} personnes, besoin de {1}&lt;/b&gt;</translation>
     </message>
 </context>
 <context>
diff --git a/src/cutecoin/core/net/network.py b/src/cutecoin/core/net/network.py
index 34f533cc..b46be630 100644
--- a/src/cutecoin/core/net/network.py
+++ b/src/cutecoin/core/net/network.py
@@ -252,6 +252,7 @@ class Network(Watcher):
             node.check_sync(self.latest_block)
         logging.debug("{0} -> {1}".format(self.latest_block, self.latest_block))
         if self._block_found < self.latest_block:
+            self._block_found = self.latest_block
             logging.debug("New block found : {0}".format(self.latest_block))
             self.new_block_mined.emit(self.latest_block)
 
diff --git a/src/cutecoin/gui/toast.py b/src/cutecoin/gui/toast.py
index ef0c8ab7..52fddab8 100644
--- a/src/cutecoin/gui/toast.py
+++ b/src/cutecoin/gui/toast.py
@@ -12,7 +12,9 @@ from ..gen_resources.toast_uic import Ui_Toast
 
 window = None   # global
 
+
 def display(title, msg):
+    logging.debug("NOTIFY DISPLAY")
     if sys.platform == "linux":
         import notify2
         import dbus
@@ -22,28 +24,30 @@ def display(title, msg):
         n = notify2.Notification(title,
                          msg)
 
-        # Not working... Empty icon at the moment.
-        icon = QPixmap(":/icons/cutecoin_logo/").toImage()
-        if icon.isNull():
-            logging.debug("Error converting logo")
-        else:
-            icon.convertToFormat(QImage.Format_ARGB32)
-            icon_bytes = icon.bits().asstring(icon.byteCount())
-            icon_struct = (
-                icon.width(),
-                icon.height(),
-                icon.bytesPerLine(),
-                icon.hasAlphaChannel(),
-                32,
-                4,
-                dbus.ByteArray(icon_bytes)
-                )
-            n.set_hint('icon_data', icon_struct)
-            n.set_timeout(5000)
+# fixme: https://bugs.python.org/issue11587
+        # # Not working... Empty icon at the moment.
+        # icon = QPixmap(":/icons/cutecoin_logo/").toImage()
+        # if icon.isNull():
+        #     logging.debug("Error converting logo")
+        # else:
+        #     icon.convertToFormat(QImage.Format_ARGB32)
+        #     icon_bytes = icon.bits().asstring(icon.byteCount())
+        #     icon_struct = (
+        #         icon.width(),
+        #         icon.height(),
+        #         icon.bytesPerLine(),
+        #         icon.hasAlphaChannel(),
+        #         32,
+        #         4,
+        #         dbus.ByteArray(icon_bytes)
+        #         )
+        #     n.set_hint('icon_data', icon_struct)
+        #     n.set_timeout(5000)
         n.show()
     else:
         _Toast(title, msg)
 
+
 class _Toast(QMainWindow, Ui_Toast):
     def __init__(self, title, msg):
         global window               # some space outside the local stack
@@ -69,6 +73,7 @@ class _Toast(QMainWindow, Ui_Toast):
         global window
         window = None               # kill pointer to window object to close it and GC
 
+
 class _ToastThread(QThread):
     def __init__(self):
         QThread.__init__(self)
-- 
GitLab