URI: 
       t[Qt] Got rid of qt.util.Timer class and instead replaced the functionality with the more efficient QTimer. Also added disconnection from the timer on window close. - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 14363f8f2fe75382fd3b7c291fc1b14c678a51a8
   DIR parent 3184d6f369cb113432ebbc55ed3ab22ace7233e4
  HTML Author: Calin Culianu <calin.culianu@gmail.com>
       Date:   Wed, 12 Dec 2018 00:53:55 +0200
       
       t[Qt] Got rid of qt.util.Timer class and instead replaced the functionality with the more efficient QTimer. Also added disconnection from the timer on window close.
       
       (cherry picked from https://github.com/Electron-Cash/Electron-Cash/commit/19a21eb08d4c3bb665d4a3b50daf38d51b6589b3)
       
       Diffstat:
         M electrum/gui/qt/__init__.py         |       6 +++++-
         M electrum/gui/qt/main_window.py      |       7 +++----
         M electrum/gui/qt/util.py             |      13 -------------
       
       3 files changed, 8 insertions(+), 18 deletions(-)
       ---
   DIR diff --git a/electrum/gui/qt/__init__.py b/electrum/gui/qt/__init__.py
       t@@ -105,7 +105,11 @@ class ElectrumGui(PrintError):
                self.efilter = OpenFileEventFilter(self.windows)
                self.app = QElectrumApplication(sys.argv)
                self.app.installEventFilter(self.efilter)
       -        self.timer = Timer()
       +        # timer
       +        self.timer = QTimer(self.app)
       +        self.timer.setSingleShot(False)
       +        self.timer.setInterval(500)  # msec
       +
                self.nd = None
                self.network_updated_signal_obj = QNetworkUpdatedSignalObject()
                self._num_wizards_in_progress = 0
   DIR diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
       t@@ -222,7 +222,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                # update fee slider in case we missed the callback
                self.fee_slider.update()
                self.load_wallet(wallet)
       -        self.connect_slots(gui_object.timer)
       +        gui_object.timer.timeout.connect(self.timer_actions)
                self.fetch_alias()
        
            def on_history(self, b):
       t@@ -670,9 +670,6 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                    self.config.set_key('io_dir', os.path.dirname(fileName), True)
                return fileName
        
       -    def connect_slots(self, sender):
       -        sender.timer_signal.connect(self.timer_actions)
       -
            def timer_actions(self):
                # Note this runs in the GUI thread
                if self.need_update.is_set():
       t@@ -3134,6 +3131,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
                if self.qr_window:
                    self.qr_window.close()
                self.close_wallet()
       +
       +        self.gui_object.timer.timeout.disconnect(self.timer_actions)
                self.gui_object.close_window(self)
        
            def plugins_dialog(self):
   DIR diff --git a/electrum/gui/qt/util.py b/electrum/gui/qt/util.py
       t@@ -48,19 +48,6 @@ expiration_values = [
        ]
        
        
       -class Timer(QThread):
       -    stopped = False
       -    timer_signal = pyqtSignal()
       -
       -    def run(self):
       -        while not self.stopped:
       -            self.timer_signal.emit()
       -            time.sleep(0.5)
       -
       -    def stop(self):
       -        self.stopped = True
       -        self.wait()
       -
        class EnterButton(QPushButton):
            def __init__(self, text, func):
                QPushButton.__init__(self, text)