← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mbernis/openlp/timer_cpu_load_bug into lp:openlp

 

M. Bernis has proposed merging lp:~mbernis/openlp/timer_cpu_load_bug into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~mbernis/openlp/timer_cpu_load_bug/+merge/238598

After 3 or 4 hours, the cpu was at 100%, and OpenLP freeze.
I commit a bug fix : timer of check update was use in a bad way.
-- 
https://code.launchpad.net/~mbernis/openlp/timer_cpu_load_bug/+merge/238598
Your team OpenLP Core is requested to review the proposed merge of lp:~mbernis/openlp/timer_cpu_load_bug into lp:openlp.
=== modified file 'openlp/core/__init__.py'
--- openlp/core/__init__.py	2014-09-21 19:23:40 +0000
+++ openlp/core/__init__.py	2014-10-16 16:46:52 +0000
@@ -155,6 +155,8 @@
         update_check = Settings().value('core/update check')
         if update_check:
             VersionThread(self.main_window).start()
+        else:
+            self.main_window.version_update_running = False
         self.main_window.is_display_blank()
         self.main_window.app_startup()
         return self.exec_()

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2014-09-04 21:38:39 +0000
+++ openlp/core/ui/mainwindow.py	2014-10-16 16:46:52 +0000
@@ -1294,26 +1294,31 @@
         """
         Trigger it's removal after 2.5 second
         """
-        self.timer_id = self.startTimer(2500)
+        QtCore.QTimer.singleShot(2500, self.remove_progress_bar_event);
+        
+    def remove_progress_bar_event(self):
+        """
+        Trigger event : remove progress bar
+        """
+        self.load_progress_bar.hide()
+        self.application.process_events()
 
     def timerEvent(self, event):
         """
-        Remove the Progress bar from view.
+        Wait and display the version update status
         """
-        if event.timerId() == self.timer_id:
-            self.timer_id = 0
-            self.load_progress_bar.hide()
-            self.application.process_events()
+        super(MainWindow, self).timerEvent(event)
+
         if event.timerId() == self.timer_version_id:
-            self.timer_version_id = 0
             # Has the thread passed some data to be displayed so display it and stop all waiting
             if hasattr(self, 'version_text'):
+                self.killTimer(self.timer_version_id)
                 QtGui.QMessageBox.question(self, translate('OpenLP.MainWindow', 'OpenLP Version Updated'),
                                            self.version_text)
             else:
                 # the thread has not confirmed it is running or it has not yet sent any data so lets keep waiting
-                if not hasattr(self, 'version_update_running') or self.version_update_running:
-                    self.timer_version_id = self.startTimer(1000)
+                if hasattr(self, 'version_update_running') and not self.version_update_running:
+                     self.killTimer(self.timer_version_id)
             self.application.process_events()
 
     def set_new_data_path(self, new_data_path):


Follow ups