From b95d22ba863b08d7222ebe3d7a83f4bfb25f8cca Mon Sep 17 00:00:00 2001
From: Inso <insomniak.fr@gmail.com>
Date: Wed, 23 Dec 2015 08:49:57 +0100
Subject: [PATCH] Fix bug #310

---
 src/sakia/gui/community_tile.py | 6 +++++-
 src/sakia/gui/homescreen.py     | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/sakia/gui/community_tile.py b/src/sakia/gui/community_tile.py
index 419a5a15..f2a7b210 100644
--- a/src/sakia/gui/community_tile.py
+++ b/src/sakia/gui/community_tile.py
@@ -9,7 +9,7 @@ from PyQt5.QtWidgets import QFrame, QLabel, QVBoxLayout, QLayout
 from PyQt5.QtCore import QSize, pyqtSignal
 from ucoinpy.documents.block import Block
 
-from ..tools.decorators import asyncify
+from ..tools.decorators import asyncify, once_at_a_time, cancel_once_task
 from ..tools.exceptions import NoPeerAvailable
 from sakia.gui.widgets.busy import Busy
 
@@ -55,6 +55,10 @@ class CommunityTile(QFrame):
         if state != self._state:
             self.refresh()
 
+    def cancel_refresh(self):
+        cancel_once_task(self, self.refresh)
+
+    @once_at_a_time
     @asyncify
     @asyncio.coroutine
     def refresh(self):
diff --git a/src/sakia/gui/homescreen.py b/src/sakia/gui/homescreen.py
index b60ca759..3eb44ead 100644
--- a/src/sakia/gui/homescreen.py
+++ b/src/sakia/gui/homescreen.py
@@ -29,6 +29,7 @@ class FrameCommunities(QFrame):
 
     def refresh(self, app):
         for t in self.tiles:
+            t.cancel_refresh()
             t.setParent(None)
         self.tiles = []
         if app.current_account:
-- 
GitLab