electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 7d1075d85d355c30b224caede4416a8173ca97e4
parent df135641557ac5bdc610efff848d52ad4bc951ce
Author: ecdsa <ecdsa@github>
Date:   Sat, 27 Apr 2013 19:17:36 +0200

use an Event to signal when to redraw the gui

Diffstat:
Mgui/gui_classic.py | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gui/gui_classic.py b/gui/gui_classic.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -import sys, time, datetime, re +import sys, time, datetime, re, threading from i18n import _, set_language from electrum.util import print_error, print_msg import os.path, json, ast, traceback @@ -268,7 +268,8 @@ class ElectrumWindow(QMainWindow): self.init_plugins() self.create_status_bar() - self.wallet.interface.register_callback('updated', lambda: self.emit(QtCore.SIGNAL('update_wallet'))) + self.need_update = threading.Event() + self.wallet.interface.register_callback('updated', lambda: self.need_update.set()) self.wallet.interface.register_callback('banner', lambda: self.emit(QtCore.SIGNAL('banner_signal'))) self.wallet.interface.register_callback('disconnected', lambda: self.emit(QtCore.SIGNAL('update_status'))) self.wallet.interface.register_callback('disconnecting', lambda: self.emit(QtCore.SIGNAL('update_status'))) @@ -303,7 +304,6 @@ class ElectrumWindow(QMainWindow): QShortcut(QKeySequence("Ctrl+PgUp"), self, lambda: tabs.setCurrentIndex( (tabs.currentIndex() - 1 )%tabs.count() )) QShortcut(QKeySequence("Ctrl+PgDown"), self, lambda: tabs.setCurrentIndex( (tabs.currentIndex() + 1 )%tabs.count() )) - self.connect(self, QtCore.SIGNAL('update_wallet'), self.update_wallet) self.connect(self, QtCore.SIGNAL('update_status'), self.update_status) self.connect(self, QtCore.SIGNAL('banner_signal'), lambda: self.console.showMessage(self.wallet.interface.banner) ) self.history_list.setFocus(True) @@ -406,6 +406,9 @@ class ElectrumWindow(QMainWindow): self.previous_payto_e='' def timer_actions(self): + if self.need_update.is_set(): + self.update_wallet() + self.need_update.clear() self.run_hook('timer_actions') def format_amount(self, x, is_diff=False):